composer.phar 1.8MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968659696597065971659726597365974659756597665977659786597965980659816598265983659846598565986659876598865989659906599165992659936599465995659966599765998659996600066001660026600366004660056600666007660086600966010660116601266013660146601566016660176601866019660206602166022660236602466025660266602766028660296603066031660326603366034660356603666037660386603966040660416604266043660446604566046660476604866049660506605166052660536605466055660566605766058660596606066061660626606366064660656606666067660686606966070660716607266073660746607566076660776607866079660806608166082660836608466085660866608766088660896609066091660926609366094660956609666097660986609966100661016610266103661046610566106661076610866109661106611166112661136611466115661166611766118661196612066121661226612366124661256612666127661286612966130661316613266133661346613566136661376613866139661406614166142661436614466145661466614766148661496615066151661526615366154661556615666157661586615966160661616616266163661646616566166661676616866169661706617166172661736617466175661766617766178661796618066181661826618366184661856618666187661886618966190661916619266193661946619566196661976619866199662006620166202662036620466205662066620766208662096621066211662126621366214662156621666217662186621966220662216622266223662246622566226662276622866229662306623166232662336623466235662366623766238662396624066241662426624366244662456624666247662486624966250662516625266253662546625566256662576625866259662606626166262662636626466265662666626766268662696627066271662726627366274662756627666277662786627966280662816628266283662846628566286662876628866289662906629166292662936629466295662966629766298662996630066301663026630366304663056630666307663086630966310663116631266313663146631566316663176631866319663206632166322663236632466325663266632766328663296633066331663326633366334663356633666337663386633966340663416634266343663446634566346663476634866349663506635166352663536635466355663566635766358663596636066361663626636366364663656636666367663686636966370663716637266373663746637566376663776637866379663806638166382663836638466385663866638766388663896639066391663926639366394663956639666397663986639966400664016640266403664046640566406664076640866409664106641166412664136641466415664166641766418664196642066421664226642366424664256642666427664286642966430664316643266433664346643566436664376643866439664406644166442664436644466445664466644766448664496645066451664526645366454664556645666457664586645966460664616646266463664646646566466664676646866469664706647166472664736647466475664766647766478664796648066481664826648366484664856648666487664886648966490664916649266493664946649566496664976649866499665006650166502665036650466505665066650766508665096651066511665126651366514665156651666517665186651966520665216652266523665246652566526665276652866529665306653166532665336653466535665366653766538665396654066541665426654366544665456654666547665486654966550665516655266553665546655566556665576655866559665606656166562665636656466565665666656766568665696657066571665726657366574665756657666577665786657966580665816658266583665846658566586665876658866589665906659166592665936659466595665966659766598665996660066601666026660366604666056660666607666086660966610666116661266613666146661566616666176661866619666206662166622666236662466625666266662766628666296663066631666326663366634666356663666637666386663966640666416664266643666446664566646666476664866649666506665166652666536665466655666566665766658666596666066661666626666366664666656666666667666686666966670666716667266673666746667566676666776667866679666806668166682666836668466685666866668766688666896669066691666926669366694666956669666697666986669966700667016670266703667046670566706667076670866709667106671166712667136671466715667166671766718667196672066721667226672366724667256672666727667286672966730667316673266733667346673566736667376673866739667406674166742667436674466745667466674766748667496675066751667526675366754667556675666757667586675966760667616676266763667646676566766667676676866769667706677166772667736677466775667766677766778667796678066781667826678366784667856678666787667886678966790667916679266793667946679566796667976679866799668006680166802668036680466805668066680766808668096681066811668126681366814668156681666817668186681966820668216682266823668246682566826668276682866829668306683166832668336683466835668366683766838668396684066841668426684366844668456684666847668486684966850668516685266853668546685566856668576685866859668606686166862668636686466865668666686766868668696687066871668726687366874668756687666877668786687966880668816688266883668846688566886668876688866889668906689166892668936689466895668966689766898668996690066901669026690366904669056690666907669086690966910669116691266913669146691566916669176691866919669206692166922669236692466925669266692766928669296693066931669326693366934669356693666937669386693966940669416694266943669446694566946669476694866949669506695166952669536695466955669566695766958669596696066961669626696366964669656696666967669686696966970669716697266973669746697566976669776697866979669806698166982669836698466985669866698766988669896699066991669926699366994669956699666997669986699967000670016700267003670046700567006670076700867009670106701167012670136701467015670166701767018670196702067021670226702367024670256702667027670286702967030670316703267033670346703567036670376703867039670406704167042670436704467045670466704767048670496705067051670526705367054670556705667057670586705967060670616706267063670646706567066670676706867069670706707167072670736707467075670766707767078670796708067081670826708367084670856708667087670886708967090670916709267093670946709567096670976709867099671006710167102671036710467105671066710767108671096711067111671126711367114671156711667117671186711967120671216712267123671246712567126671276712867129671306713167132671336713467135671366713767138671396714067141671426714367144671456714667147671486714967150671516715267153671546715567156671576715867159671606716167162671636716467165671666716767168671696717067171671726717367174671756717667177671786717967180671816718267183671846718567186671876718867189671906719167192671936719467195671966719767198671996720067201672026720367204672056720667207672086720967210672116721267213672146721567216672176721867219672206722167222672236722467225672266722767228672296723067231672326723367234672356723667237672386723967240672416724267243672446724567246672476724867249672506725167252672536725467255672566725767258672596726067261672626726367264672656726667267672686726967270672716727267273672746727567276672776727867279672806728167282672836728467285672866728767288672896729067291672926729367294672956729667297672986729967300673016730267303673046730567306673076730867309673106731167312673136731467315673166731767318673196732067321673226732367324673256732667327673286732967330673316733267333673346733567336673376733867339673406734167342673436734467345673466734767348673496735067351673526735367354673556735667357673586735967360673616736267363673646736567366673676736867369673706737167372673736737467375673766737767378673796738067381673826738367384673856738667387673886738967390673916739267393673946739567396673976739867399674006740167402674036740467405674066740767408674096741067411674126741367414674156741667417674186741967420674216742267423674246742567426674276742867429674306743167432674336743467435674366743767438674396744067441674426744367444674456744667447674486744967450674516745267453674546745567456674576745867459674606746167462674636746467465674666746767468674696747067471674726747367474674756747667477674786747967480674816748267483674846748567486674876748867489674906749167492674936749467495674966749767498674996750067501675026750367504675056750667507675086750967510675116751267513675146751567516675176751867519675206752167522675236752467525675266752767528675296753067531675326753367534675356753667537675386753967540675416754267543675446754567546675476754867549675506755167552675536755467555675566755767558675596756067561675626756367564675656756667567675686756967570675716757267573675746757567576675776757867579675806758167582675836758467585675866758767588675896759067591675926759367594675956759667597675986759967600676016760267603676046760567606676076760867609676106761167612676136761467615676166761767618676196762067621676226762367624676256762667627676286762967630676316763267633676346763567636676376763867639676406764167642676436764467645676466764767648676496765067651676526765367654676556765667657676586765967660676616766267663676646766567666676676766867669676706767167672676736767467675676766767767678676796768067681676826768367684676856768667687676886768967690676916769267693676946769567696676976769867699677006770167702677036770467705677066770767708677096771067711677126771367714677156771667717677186771967720677216772267723677246772567726677276772867729677306773167732677336773467735677366773767738677396774067741677426774367744677456774667747677486774967750677516775267753677546775567756677576775867759677606776167762677636776467765677666776767768677696777067771677726777367774677756777667777677786777967780677816778267783677846778567786677876778867789677906779167792677936779467795677966779767798677996780067801678026780367804678056780667807678086780967810678116781267813678146781567816678176781867819678206782167822678236782467825678266782767828678296783067831678326783367834678356783667837678386783967840678416784267843678446784567846678476784867849678506785167852678536785467855678566785767858678596786067861678626786367864678656786667867678686786967870678716787267873678746787567876678776787867879678806788167882678836788467885678866788767888678896789067891678926789367894678956789667897678986789967900679016790267903679046790567906679076790867909679106791167912679136791467915679166791767918679196792067921679226792367924679256792667927679286792967930679316793267933679346793567936679376793867939679406794167942679436794467945679466794767948679496795067951679526795367954679556795667957679586795967960679616796267963679646796567966679676796867969679706797167972679736797467975679766797767978679796798067981679826798367984679856798667987679886798967990679916799267993679946799567996679976799867999680006800168002680036800468005680066800768008680096801068011680126801368014680156801668017680186801968020680216802268023680246802568026680276802868029680306803168032680336803468035680366803768038680396804068041680426804368044680456804668047680486804968050680516805268053680546805568056680576805868059680606806168062680636806468065680666806768068680696807068071680726807368074680756807668077680786807968080680816808268083680846808568086680876808868089680906809168092680936809468095680966809768098680996810068101681026810368104681056810668107681086810968110681116811268113681146811568116681176811868119681206812168122681236812468125681266812768128681296813068131681326813368134681356813668137681386813968140681416814268143681446814568146681476814868149681506815168152681536815468155681566815768158681596816068161681626816368164681656816668167681686816968170681716817268173681746817568176681776817868179681806818168182681836818468185681866818768188681896819068191681926819368194681956819668197681986819968200682016820268203682046820568206682076820868209682106821168212682136821468215682166821768218682196822068221682226822368224682256822668227682286822968230682316823268233682346823568236682376823868239682406824168242682436824468245682466824768248682496825068251682526825368254682556825668257682586825968260682616826268263682646826568266682676826868269682706827168272682736827468275682766827768278682796828068281682826828368284682856828668287682886828968290682916829268293682946829568296682976829868299683006830168302683036830468305683066830768308683096831068311683126831368314683156831668317683186831968320683216832268323683246832568326683276832868329683306833168332683336833468335683366833768338683396834068341683426834368344683456834668347683486834968350683516835268353683546835568356683576835868359683606836168362683636836468365683666836768368683696837068371683726837368374683756837668377683786837968380683816838268383683846838568386683876838868389683906839168392683936839468395683966839768398683996840068401684026840368404684056840668407684086840968410684116841268413684146841568416684176841868419684206842168422684236842468425684266842768428684296843068431684326843368434684356843668437684386843968440684416844268443684446844568446684476844868449684506845168452684536845468455684566845768458684596846068461684626846368464684656846668467684686846968470684716847268473684746847568476684776847868479684806848168482684836848468485684866848768488684896849068491684926849368494684956849668497684986849968500685016850268503685046850568506685076850868509685106851168512685136851468515685166851768518685196852068521685226852368524685256852668527685286852968530685316853268533685346853568536685376853868539685406854168542685436854468545685466854768548685496855068551685526855368554685556855668557685586855968560685616856268563685646856568566685676856868569685706857168572685736857468575685766857768578685796858068581685826858368584685856858668587685886858968590685916859268593685946859568596685976859868599686006860168602686036860468605686066860768608686096861068611686126861368614686156861668617686186861968620686216862268623686246862568626686276862868629686306863168632686336863468635686366863768638686396864068641686426864368644686456864668647686486864968650686516865268653686546865568656686576865868659686606866168662686636866468665686666866768668686696867068671686726867368674686756867668677686786867968680686816868268683686846868568686686876868868689686906869168692686936869468695686966869768698686996870068701687026870368704687056870668707687086870968710687116871268713687146871568716687176871868719687206872168722687236872468725687266872768728687296873068731687326873368734687356873668737687386873968740687416874268743687446874568746687476874868749687506875168752687536875468755687566875768758687596876068761687626876368764687656876668767687686876968770687716877268773687746877568776687776877868779687806878168782687836878468785687866878768788687896879068791687926879368794687956879668797687986879968800688016880268803688046880568806688076880868809688106881168812688136881468815688166881768818688196882068821688226882368824688256882668827688286882968830688316883268833688346883568836688376883868839688406884168842688436884468845688466884768848688496885068851688526885368854688556885668857688586885968860688616886268863688646886568866688676886868869688706887168872688736887468875688766887768878688796888068881688826888368884688856888668887688886888968890688916889268893688946889568896688976889868899689006890168902689036890468905689066890768908689096891068911689126891368914689156891668917689186891968920689216892268923689246892568926689276892868929689306893168932689336893468935689366893768938689396894068941689426894368944689456894668947689486894968950689516895268953689546895568956689576895868959689606896168962689636896468965689666896768968689696897068971689726897368974689756897668977689786897968980689816898268983689846898568986689876898868989689906899168992689936899468995689966899768998689996900069001690026900369004690056900669007690086900969010690116901269013690146901569016690176901869019690206902169022690236902469025690266902769028690296903069031690326903369034690356903669037690386903969040690416904269043690446904569046690476904869049690506905169052690536905469055690566905769058690596906069061690626906369064690656906669067690686906969070690716907269073690746907569076690776907869079690806908169082690836908469085690866908769088690896909069091690926909369094690956909669097690986909969100691016910269103691046910569106691076910869109691106911169112691136911469115691166911769118691196912069121691226912369124691256912669127691286912969130691316913269133691346913569136691376913869139691406914169142691436914469145691466914769148691496915069151691526915369154691556915669157691586915969160691616916269163691646916569166691676916869169691706917169172691736917469175691766917769178691796918069181691826918369184691856918669187691886918969190691916919269193691946919569196691976919869199692006920169202692036920469205692066920769208692096921069211692126921369214692156921669217692186921969220692216922269223692246922569226692276922869229692306923169232692336923469235692366923769238692396924069241692426924369244692456924669247692486924969250692516925269253692546925569256692576925869259692606926169262692636926469265692666926769268692696927069271692726927369274692756927669277692786927969280692816928269283692846928569286692876928869289692906929169292692936929469295692966929769298692996930069301693026930369304693056930669307693086930969310693116931269313693146931569316693176931869319693206932169322693236932469325693266932769328693296933069331693326933369334693356933669337693386933969340693416934269343693446934569346693476934869349693506935169352693536935469355693566935769358693596936069361693626936369364693656936669367693686936969370693716937269373693746937569376693776937869379693806938169382693836938469385693866938769388693896939069391693926939369394693956939669397693986939969400694016940269403694046940569406694076940869409694106941169412694136941469415694166941769418694196942069421694226942369424694256942669427694286942969430694316943269433694346943569436694376943869439694406944169442694436944469445694466944769448694496945069451694526945369454694556945669457694586945969460694616946269463694646946569466694676946869469694706947169472694736947469475694766947769478694796948069481694826948369484694856948669487694886948969490694916949269493694946949569496694976949869499695006950169502695036950469505695066950769508695096951069511695126951369514695156951669517695186951969520695216952269523695246952569526695276952869529695306953169532695336953469535695366953769538695396954069541695426954369544695456954669547695486954969550695516955269553695546955569556695576955869559695606956169562695636956469565695666956769568695696957069571695726957369574695756957669577695786957969580695816958269583695846958569586695876958869589695906959169592695936959469595695966959769598695996960069601696026960369604696056960669607696086960969610696116961269613696146961569616696176961869619696206962169622696236962469625696266962769628696296963069631696326963369634696356963669637696386963969640696416964269643696446964569646696476964869649696506965169652696536965469655696566965769658696596966069661696626966369664696656966669667696686966969670696716967269673696746967569676696776967869679696806968169682696836968469685696866968769688696896969069691696926969369694696956969669697696986969969700697016970269703697046970569706697076970869709697106971169712697136971469715697166971769718697196972069721697226972369724697256972669727697286972969730697316973269733697346973569736697376973869739697406974169742697436974469745697466974769748697496975069751697526975369754697556975669757697586975969760697616976269763697646976569766697676976869769697706977169772697736977469775697766977769778697796978069781697826978369784697856978669787697886978969790697916979269793697946979569796697976979869799698006980169802698036980469805698066980769808698096981069811698126981369814698156981669817698186981969820698216982269823698246982569826698276982869829698306983169832698336983469835698366983769838698396984069841698426984369844698456984669847698486984969850698516985269853698546985569856698576985869859698606986169862698636986469865698666986769868698696987069871698726987369874698756987669877698786987969880698816988269883698846988569886698876988869889698906989169892698936989469895698966989769898698996990069901699026990369904699056990669907699086990969910699116991269913699146991569916699176991869919699206992169922699236992469925699266992769928699296993069931699326993369934699356993669937699386993969940699416994269943699446994569946699476994869949699506995169952699536995469955699566995769958699596996069961699626996369964699656996669967699686996969970699716997269973699746997569976699776997869979699806998169982699836998469985699866998769988699896999069991699926999369994699956999669997699986999970000700017000270003700047000570006700077000870009700107001170012700137001470015700167001770018700197002070021700227002370024700257002670027700287002970030700317003270033700347003570036700377003870039700407004170042700437004470045700467004770048700497005070051700527005370054700557005670057700587005970060700617006270063700647006570066700677006870069700707007170072700737007470075700767007770078700797008070081700827008370084700857008670087700887008970090700917009270093700947009570096700977009870099701007010170102701037010470105701067010770108701097011070111701127011370114701157011670117701187011970120701217012270123701247012570126701277012870129701307013170132701337013470135701367013770138701397014070141701427014370144701457014670147701487014970150701517015270153701547015570156701577015870159701607016170162701637016470165701667016770168701697017070171701727017370174701757017670177701787017970180701817018270183701847018570186701877018870189701907019170192701937019470195701967019770198701997020070201702027020370204702057020670207702087020970210702117021270213702147021570216702177021870219702207022170222702237022470225702267022770228702297023070231702327023370234702357023670237702387023970240702417024270243702447024570246702477024870249702507025170252702537025470255702567025770258702597026070261702627026370264702657026670267702687026970270702717027270273702747027570276702777027870279702807028170282702837028470285702867028770288702897029070291702927029370294702957029670297702987029970300703017030270303703047030570306703077030870309703107031170312703137031470315703167031770318703197032070321703227032370324703257032670327703287032970330703317033270333703347033570336703377033870339703407034170342703437034470345703467034770348703497035070351703527035370354703557035670357703587035970360703617036270363703647036570366703677036870369703707037170372703737037470375703767037770378703797038070381703827038370384703857038670387703887038970390703917039270393703947039570396703977039870399704007040170402704037040470405704067040770408704097041070411704127041370414704157041670417704187041970420704217042270423704247042570426704277042870429704307043170432704337043470435704367043770438704397044070441704427044370444704457044670447704487044970450704517045270453704547045570456704577045870459704607046170462704637046470465704667046770468704697047070471704727047370474704757047670477704787047970480704817048270483704847048570486704877048870489704907049170492704937049470495704967049770498704997050070501705027050370504705057050670507705087050970510705117051270513705147051570516705177051870519705207052170522705237052470525705267052770528705297053070531705327053370534705357053670537705387053970540705417054270543705447054570546705477054870549705507055170552705537055470555705567055770558705597056070561705627056370564705657056670567705687056970570705717057270573705747057570576705777057870579705807058170582705837058470585705867058770588705897059070591705927059370594705957059670597705987059970600706017060270603706047060570606706077060870609706107061170612706137061470615706167061770618706197062070621706227062370624706257062670627706287062970630706317063270633706347063570636706377063870639706407064170642706437064470645706467064770648706497065070651706527065370654706557065670657706587065970660706617066270663706647066570666706677066870669706707067170672706737067470675706767067770678706797068070681706827068370684706857068670687706887068970690706917069270693706947069570696706977069870699707007070170702707037070470705707067070770708707097071070711707127071370714707157071670717707187071970720707217072270723707247072570726707277072870729707307073170732707337073470735707367073770738707397074070741707427074370744707457074670747707487074970750707517075270753707547075570756707577075870759707607076170762707637076470765707667076770768707697077070771707727077370774707757077670777707787077970780707817078270783707847078570786707877078870789707907079170792707937079470795707967079770798707997080070801708027080370804708057080670807708087080970810708117081270813708147081570816708177081870819708207082170822708237082470825708267082770828708297083070831708327083370834708357083670837708387083970840708417084270843708447084570846708477084870849708507085170852708537085470855708567085770858708597086070861708627086370864708657086670867708687086970870708717087270873708747087570876708777087870879708807088170882708837088470885708867088770888708897089070891708927089370894708957089670897708987089970900709017090270903709047090570906709077090870909709107091170912709137091470915709167091770918709197092070921709227092370924709257092670927709287092970930709317093270933709347093570936709377093870939709407094170942709437094470945709467094770948709497095070951709527095370954709557095670957709587095970960709617096270963709647096570966709677096870969709707097170972709737097470975709767097770978709797098070981709827098370984709857098670987709887098970990709917099270993709947099570996709977099870999710007100171002710037100471005710067100771008710097101071011710127101371014710157101671017710187101971020710217102271023710247102571026710277102871029710307103171032710337103471035710367103771038710397104071041710427104371044710457104671047710487104971050710517105271053710547105571056710577105871059710607106171062710637106471065710667106771068710697107071071710727107371074710757107671077710787107971080710817108271083710847108571086710877108871089710907109171092710937109471095710967109771098710997110071101711027110371104711057110671107711087110971110711117111271113711147111571116711177111871119711207112171122711237112471125711267112771128711297113071131711327113371134711357113671137711387113971140711417114271143711447114571146711477114871149711507115171152711537115471155711567115771158711597116071161711627116371164711657116671167711687116971170711717117271173711747117571176711777117871179711807118171182711837118471185711867118771188711897119071191711927119371194711957119671197711987119971200712017120271203712047120571206712077120871209712107121171212712137121471215712167121771218712197122071221712227122371224712257122671227712287122971230712317123271233712347123571236712377123871239712407124171242712437124471245712467124771248712497125071251712527125371254712557125671257712587125971260712617126271263712647126571266712677126871269712707127171272712737127471275712767127771278712797128071281712827128371284712857128671287712887128971290712917129271293712947129571296712977129871299713007130171302713037130471305713067130771308713097131071311713127131371314713157131671317713187131971320713217132271323713247132571326713277132871329713307133171332713337133471335713367133771338713397134071341713427134371344713457134671347713487134971350713517135271353713547135571356713577135871359713607136171362713637136471365713667136771368713697137071371713727137371374713757137671377713787137971380713817138271383713847138571386713877138871389713907139171392713937139471395713967139771398713997140071401714027140371404714057140671407714087140971410714117141271413714147141571416714177141871419714207142171422714237142471425714267142771428714297143071431714327143371434714357143671437714387143971440714417144271443714447144571446714477144871449714507145171452714537145471455714567145771458714597146071461714627146371464714657146671467714687146971470714717147271473714747147571476714777147871479714807148171482714837148471485714867148771488714897149071491714927149371494714957149671497714987149971500715017150271503715047150571506715077150871509715107151171512715137151471515715167151771518715197152071521715227152371524715257152671527715287152971530715317153271533715347153571536715377153871539715407154171542715437154471545715467154771548715497155071551715527155371554715557155671557715587155971560715617156271563715647156571566715677156871569715707157171572715737157471575715767157771578715797158071581715827158371584715857158671587715887158971590715917159271593715947159571596715977159871599716007160171602716037160471605716067160771608716097161071611716127161371614716157161671617716187161971620716217162271623716247162571626716277162871629716307163171632716337163471635716367163771638716397164071641716427164371644716457164671647716487164971650716517165271653716547165571656716577165871659716607166171662716637166471665716667166771668716697167071671716727167371674716757167671677716787167971680716817168271683716847168571686716877168871689716907169171692716937169471695716967169771698716997170071701717027170371704717057170671707717087170971710717117171271713717147171571716717177171871719717207172171722717237172471725717267172771728717297173071731717327173371734717357173671737717387173971740717417174271743717447174571746717477174871749717507175171752717537175471755717567175771758717597176071761717627176371764717657176671767717687176971770717717177271773717747177571776717777177871779717807178171782717837178471785717867178771788717897179071791717927179371794717957179671797717987179971800718017180271803718047180571806718077180871809718107181171812718137181471815718167181771818718197182071821718227182371824718257182671827718287182971830718317183271833718347183571836718377183871839718407184171842718437184471845718467184771848718497185071851718527185371854718557185671857718587185971860718617186271863718647186571866718677186871869718707187171872718737187471875718767187771878718797188071881718827188371884718857188671887718887188971890718917189271893718947189571896718977189871899719007190171902719037190471905719067190771908719097191071911719127191371914719157191671917719187191971920719217192271923719247192571926719277192871929719307193171932719337193471935719367193771938719397194071941719427194371944719457194671947719487194971950719517195271953719547195571956719577195871959719607196171962719637196471965719667196771968719697197071971719727197371974719757197671977719787197971980719817198271983719847198571986719877198871989719907199171992719937199471995719967199771998719997200072001720027200372004720057200672007720087200972010720117201272013720147201572016720177201872019720207202172022720237202472025720267202772028720297203072031720327203372034720357203672037720387203972040720417204272043720447204572046720477204872049720507205172052720537205472055720567205772058720597206072061720627206372064720657206672067720687206972070720717207272073720747207572076720777207872079720807208172082720837208472085720867208772088720897209072091720927209372094720957209672097720987209972100721017210272103721047210572106721077210872109721107211172112721137211472115721167211772118721197212072121721227212372124721257212672127721287212972130721317213272133721347213572136721377213872139721407214172142721437214472145721467214772148721497215072151721527215372154721557215672157721587215972160721617216272163721647216572166721677216872169721707217172172721737217472175721767217772178721797218072181721827218372184721857218672187721887218972190721917219272193721947219572196721977219872199722007220172202722037220472205722067220772208722097221072211722127221372214722157221672217722187221972220722217222272223722247222572226722277222872229722307223172232722337223472235722367223772238722397224072241722427224372244722457224672247722487224972250722517225272253722547225572256722577225872259722607226172262722637226472265722667226772268722697227072271722727227372274722757227672277722787227972280722817228272283722847228572286722877228872289722907229172292722937229472295722967229772298722997230072301723027230372304723057230672307723087230972310723117231272313723147231572316723177231872319723207232172322723237232472325723267232772328723297233072331723327233372334723357233672337723387233972340723417234272343723447234572346723477234872349723507235172352723537235472355723567235772358723597236072361723627236372364723657236672367723687236972370723717237272373723747237572376723777237872379723807238172382723837238472385723867238772388723897239072391723927239372394723957239672397723987239972400724017240272403724047240572406724077240872409724107241172412724137241472415724167241772418724197242072421724227242372424724257242672427724287242972430724317243272433724347243572436724377243872439724407244172442724437244472445724467244772448724497245072451724527245372454724557245672457724587245972460724617246272463724647246572466724677246872469724707247172472724737247472475724767247772478724797248072481724827248372484724857248672487724887248972490724917249272493724947249572496724977249872499725007250172502725037250472505725067250772508725097251072511725127251372514725157251672517725187251972520725217252272523725247252572526725277252872529725307253172532725337253472535725367253772538725397254072541725427254372544725457254672547725487254972550725517255272553725547255572556725577255872559725607256172562725637256472565725667256772568725697257072571725727257372574725757257672577725787257972580725817258272583725847258572586725877258872589725907259172592725937259472595725967259772598725997260072601726027260372604726057260672607726087260972610726117261272613726147261572616726177261872619726207262172622726237262472625726267262772628726297263072631726327263372634726357263672637726387263972640726417264272643726447264572646726477264872649726507265172652726537265472655726567265772658726597266072661726627266372664726657266672667726687266972670726717267272673726747267572676726777267872679726807268172682726837268472685726867268772688726897269072691726927269372694726957269672697726987269972700727017270272703727047270572706727077270872709727107271172712727137271472715727167271772718727197272072721727227272372724727257272672727727287272972730727317273272733727347273572736727377273872739727407274172742727437274472745727467274772748727497275072751727527275372754727557275672757727587275972760727617276272763727647276572766727677276872769727707277172772727737277472775727767277772778727797278072781727827278372784727857278672787727887278972790727917279272793727947279572796727977279872799728007280172802728037280472805728067280772808728097281072811728127281372814728157281672817728187281972820728217282272823728247282572826728277282872829728307283172832728337283472835728367283772838728397284072841728427284372844728457284672847728487284972850728517285272853728547285572856728577285872859728607286172862728637286472865728667286772868728697287072871728727287372874728757287672877728787287972880728817288272883728847288572886728877288872889728907289172892728937289472895728967289772898728997290072901729027290372904729057290672907729087290972910729117291272913729147291572916729177291872919729207292172922729237292472925729267292772928729297293072931729327293372934729357293672937729387293972940729417294272943729447294572946729477294872949729507295172952729537295472955729567295772958729597296072961729627296372964729657296672967729687296972970729717297272973729747297572976729777297872979729807298172982729837298472985729867298772988729897299072991729927299372994729957299672997729987299973000730017300273003730047300573006730077300873009730107301173012730137301473015730167301773018730197302073021730227302373024730257302673027730287302973030730317303273033730347303573036730377303873039730407304173042730437304473045730467304773048730497305073051730527305373054730557305673057730587305973060730617306273063730647306573066730677306873069730707307173072730737307473075730767307773078730797308073081730827308373084730857308673087730887308973090730917309273093730947309573096730977309873099731007310173102731037310473105731067310773108731097311073111731127311373114731157311673117731187311973120731217312273123731247312573126731277312873129731307313173132731337313473135731367313773138731397314073141731427314373144731457314673147731487314973150731517315273153731547315573156731577315873159731607316173162731637316473165731667316773168731697317073171731727317373174731757317673177731787317973180731817318273183731847318573186731877318873189731907319173192731937319473195731967319773198731997320073201732027320373204732057320673207732087320973210732117321273213732147321573216732177321873219732207322173222732237322473225732267322773228732297323073231732327323373234732357323673237732387323973240732417324273243732447324573246732477324873249732507325173252732537325473255732567325773258732597326073261732627326373264732657326673267732687326973270732717327273273732747327573276732777327873279732807328173282732837328473285732867328773288732897329073291732927329373294732957329673297732987329973300733017330273303733047330573306733077330873309733107331173312733137331473315733167331773318733197332073321733227332373324733257332673327733287332973330733317333273333733347333573336733377333873339733407334173342733437334473345733467334773348733497335073351733527335373354733557335673357733587335973360733617336273363733647336573366733677336873369733707337173372733737337473375733767337773378733797338073381733827338373384733857338673387733887338973390733917339273393733947339573396733977339873399734007340173402734037340473405734067340773408734097341073411734127341373414734157341673417734187341973420734217342273423734247342573426734277342873429734307343173432734337343473435734367343773438734397344073441734427344373444734457344673447734487344973450734517345273453734547345573456734577345873459734607346173462734637346473465734667346773468734697347073471734727347373474734757347673477734787347973480734817348273483734847348573486734877348873489734907349173492734937349473495734967349773498734997350073501735027350373504735057350673507735087350973510735117351273513735147351573516735177351873519735207352173522735237352473525735267352773528735297353073531735327353373534735357353673537735387353973540735417354273543735447354573546735477354873549735507355173552735537355473555735567355773558735597356073561735627356373564735657356673567735687356973570735717357273573735747357573576735777357873579735807358173582735837358473585735867358773588735897359073591735927359373594735957359673597735987359973600736017360273603736047360573606736077360873609736107361173612736137361473615736167361773618736197362073621736227362373624736257362673627736287362973630736317363273633736347363573636736377363873639736407364173642736437364473645736467364773648736497365073651736527365373654736557365673657736587365973660736617366273663736647366573666736677366873669736707367173672736737367473675736767367773678736797368073681736827368373684736857368673687736887368973690736917369273693736947369573696736977369873699737007370173702737037370473705737067370773708737097371073711737127371373714737157371673717737187371973720737217372273723737247372573726737277372873729737307373173732737337373473735737367373773738737397374073741737427374373744737457374673747737487374973750737517375273753737547375573756737577375873759737607376173762737637376473765737667376773768737697377073771737727377373774737757377673777737787377973780737817378273783737847378573786737877378873789737907379173792737937379473795737967379773798737997380073801738027380373804738057380673807738087380973810738117381273813738147381573816738177381873819738207382173822738237382473825738267382773828738297383073831738327383373834738357383673837738387383973840738417384273843738447384573846738477384873849738507385173852738537385473855738567385773858738597386073861738627386373864738657386673867738687386973870738717387273873738747387573876738777387873879738807388173882738837388473885738867388773888738897389073891738927389373894738957389673897738987389973900739017390273903739047390573906739077390873909739107391173912739137391473915739167391773918739197392073921739227392373924739257392673927739287392973930739317393273933739347393573936739377393873939739407394173942739437394473945739467394773948739497395073951739527395373954739557395673957739587395973960739617396273963739647396573966739677396873969739707397173972739737397473975739767397773978739797398073981739827398373984739857398673987739887398973990739917399273993739947399573996739977399873999740007400174002740037400474005740067400774008740097401074011740127401374014740157401674017740187401974020740217402274023740247402574026740277402874029740307403174032740337403474035740367403774038740397404074041740427404374044740457404674047740487404974050740517405274053740547405574056740577405874059740607406174062740637406474065740667406774068740697407074071740727407374074740757407674077740787407974080740817408274083740847408574086740877408874089740907409174092740937409474095740967409774098740997410074101741027410374104741057410674107741087410974110741117411274113741147411574116741177411874119741207412174122741237412474125741267412774128741297413074131741327413374134741357413674137741387413974140741417414274143741447414574146741477414874149741507415174152741537415474155741567415774158741597416074161741627416374164741657416674167741687416974170741717417274173741747417574176741777417874179741807418174182741837418474185741867418774188741897419074191741927419374194741957419674197741987419974200742017420274203742047420574206742077420874209742107421174212742137421474215742167421774218742197422074221742227422374224742257422674227742287422974230742317423274233742347423574236742377423874239742407424174242742437424474245742467424774248742497425074251742527425374254742557425674257742587425974260742617426274263742647426574266742677426874269742707427174272742737427474275742767427774278742797428074281742827428374284742857428674287742887428974290742917429274293742947429574296742977429874299743007430174302743037430474305743067430774308743097431074311743127431374314743157431674317743187431974320743217432274323743247432574326743277432874329743307433174332743337433474335743367433774338743397434074341743427434374344743457434674347743487434974350743517435274353743547435574356743577435874359743607436174362743637436474365743667436774368743697437074371743727437374374743757437674377743787437974380743817438274383743847438574386743877438874389743907439174392743937439474395743967439774398743997440074401744027440374404744057440674407744087440974410744117441274413744147441574416744177441874419744207442174422744237442474425744267442774428744297443074431744327443374434744357443674437744387443974440744417444274443744447444574446744477444874449744507445174452744537445474455744567445774458744597446074461744627446374464744657446674467744687446974470744717447274473744747447574476744777447874479744807448174482744837448474485744867448774488744897449074491744927449374494744957449674497744987449974500745017450274503745047450574506745077450874509745107451174512745137451474515745167451774518745197452074521745227452374524745257452674527745287452974530745317453274533745347453574536745377453874539745407454174542745437454474545745467454774548745497455074551745527455374554745557455674557745587455974560745617456274563745647456574566745677456874569745707457174572745737457474575745767457774578745797458074581745827458374584745857458674587745887458974590745917459274593745947459574596745977459874599746007460174602746037460474605746067460774608746097461074611746127461374614746157461674617746187461974620746217462274623746247462574626746277462874629746307463174632746337463474635746367463774638746397464074641746427464374644746457464674647746487464974650746517465274653746547465574656746577465874659746607466174662746637466474665746667466774668746697467074671746727467374674746757467674677746787467974680746817468274683746847468574686746877468874689746907469174692746937469474695746967469774698746997470074701747027470374704747057470674707747087470974710747117471274713747147471574716747177471874719747207472174722747237472474725747267472774728747297473074731747327473374734747357473674737747387473974740747417474274743747447474574746747477474874749747507475174752747537475474755747567475774758747597476074761747627476374764747657476674767747687476974770747717477274773747747477574776747777477874779747807478174782747837478474785747867478774788747897479074791747927479374794747957479674797747987479974800748017480274803748047480574806748077480874809748107481174812748137481474815748167481774818748197482074821748227482374824748257482674827748287482974830748317483274833748347483574836748377483874839748407484174842748437484474845748467484774848748497485074851748527485374854748557485674857748587485974860748617486274863748647486574866748677486874869748707487174872748737487474875748767487774878748797488074881748827488374884748857488674887748887488974890748917489274893748947489574896748977489874899749007490174902749037490474905749067490774908749097491074911749127491374914749157491674917749187491974920749217492274923749247492574926749277492874929749307493174932749337493474935749367493774938749397494074941749427494374944749457494674947749487494974950749517495274953749547495574956749577495874959749607496174962749637496474965749667496774968749697497074971749727497374974749757497674977749787497974980749817498274983749847498574986749877498874989749907499174992749937499474995749967499774998749997500075001750027500375004750057500675007750087500975010750117501275013750147501575016750177501875019750207502175022750237502475025750267502775028750297503075031750327503375034750357503675037750387503975040750417504275043750447504575046750477504875049750507505175052750537505475055750567505775058750597506075061750627506375064750657506675067750687506975070750717507275073750747507575076750777507875079750807508175082750837508475085750867508775088750897509075091750927509375094750957509675097750987509975100751017510275103751047510575106751077510875109751107511175112751137511475115751167511775118751197512075121751227512375124751257512675127751287512975130751317513275133751347513575136751377513875139751407514175142751437514475145751467514775148751497515075151751527515375154751557515675157751587515975160751617516275163751647516575166751677516875169751707517175172751737517475175751767517775178751797518075181751827518375184751857518675187751887518975190751917519275193751947519575196751977519875199752007520175202752037520475205752067520775208752097521075211752127521375214752157521675217752187521975220752217522275223752247522575226752277522875229752307523175232752337523475235752367523775238752397524075241752427524375244752457524675247752487524975250752517525275253752547525575256752577525875259752607526175262752637526475265752667526775268752697527075271752727527375274752757527675277752787527975280752817528275283752847528575286752877528875289752907529175292752937529475295752967529775298752997530075301753027530375304753057530675307753087530975310753117531275313753147531575316753177531875319753207532175322753237532475325753267532775328753297533075331753327533375334753357533675337753387533975340753417534275343753447534575346753477534875349753507535175352753537535475355753567535775358753597536075361753627536375364753657536675367753687536975370753717537275373753747537575376753777537875379753807538175382753837538475385753867538775388753897539075391753927539375394753957539675397753987539975400754017540275403754047540575406754077540875409754107541175412754137541475415754167541775418754197542075421754227542375424754257542675427754287542975430754317543275433754347543575436754377543875439754407544175442754437544475445754467544775448754497545075451754527545375454754557545675457754587545975460754617546275463754647546575466754677546875469754707547175472754737547475475754767547775478754797548075481754827548375484754857548675487754887548975490754917549275493754947549575496754977549875499755007550175502755037550475505755067550775508755097551075511755127551375514755157551675517755187551975520755217552275523755247552575526755277552875529755307553175532755337553475535755367553775538755397554075541755427554375544755457554675547755487554975550755517555275553755547555575556755577555875559755607556175562755637556475565755667556775568755697557075571755727557375574755757557675577755787557975580755817558275583755847558575586755877558875589755907559175592755937559475595755967559775598755997560075601756027560375604756057560675607756087560975610756117561275613756147561575616756177561875619756207562175622756237562475625756267562775628756297563075631756327563375634756357563675637756387563975640756417564275643756447564575646756477564875649756507565175652756537565475655756567565775658756597566075661756627566375664756657566675667756687566975670756717567275673756747567575676756777567875679756807568175682756837568475685756867568775688756897569075691756927569375694756957569675697756987569975700757017570275703757047570575706757077570875709757107571175712757137571475715757167571775718757197572075721757227572375724757257572675727757287572975730757317573275733757347573575736757377573875739757407574175742757437574475745757467574775748757497575075751757527575375754757557575675757757587575975760757617576275763757647576575766757677576875769757707577175772757737577475775757767577775778757797578075781757827578375784757857578675787757887578975790757917579275793757947579575796757977579875799758007580175802758037580475805758067580775808758097581075811758127581375814758157581675817758187581975820758217582275823758247582575826758277582875829758307583175832758337583475835758367583775838758397584075841758427584375844758457584675847758487584975850758517585275853758547585575856758577585875859758607586175862758637586475865758667586775868758697587075871758727587375874758757587675877758787587975880758817588275883758847588575886758877588875889758907589175892758937589475895758967589775898758997590075901759027590375904759057590675907759087590975910759117591275913759147591575916759177591875919759207592175922759237592475925759267592775928759297593075931759327593375934759357593675937759387593975940759417594275943759447594575946759477594875949759507595175952759537595475955759567595775958759597596075961759627596375964759657596675967759687596975970759717597275973759747597575976759777597875979759807598175982759837598475985759867598775988759897599075991759927599375994759957599675997759987599976000760017600276003760047600576006760077600876009760107601176012760137601476015760167601776018760197602076021760227602376024760257602676027760287602976030760317603276033760347603576036760377603876039760407604176042760437604476045760467604776048760497605076051760527605376054760557605676057760587605976060760617606276063760647606576066760677606876069760707607176072760737607476075760767607776078760797608076081760827608376084760857608676087760887608976090760917609276093760947609576096760977609876099761007610176102761037610476105761067610776108761097611076111761127611376114761157611676117761187611976120761217612276123761247612576126761277612876129761307613176132761337613476135761367613776138761397614076141761427614376144761457614676147761487614976150761517615276153761547615576156761577615876159761607616176162761637616476165761667616776168761697617076171761727617376174761757617676177761787617976180761817618276183761847618576186761877618876189761907619176192761937619476195761967619776198761997620076201762027620376204762057620676207762087620976210762117621276213762147621576216762177621876219762207622176222762237622476225762267622776228762297623076231762327623376234762357623676237762387623976240762417624276243762447624576246762477624876249762507625176252762537625476255762567625776258762597626076261762627626376264762657626676267762687626976270762717627276273762747627576276762777627876279762807628176282762837628476285762867628776288762897629076291762927629376294762957629676297762987629976300763017630276303763047630576306763077630876309763107631176312763137631476315763167631776318763197632076321763227632376324763257632676327763287632976330763317633276333763347633576336763377633876339763407634176342763437634476345763467634776348763497635076351763527635376354763557635676357763587635976360763617636276363763647636576366763677636876369763707637176372763737637476375763767637776378763797638076381763827638376384763857638676387763887638976390763917639276393763947639576396763977639876399764007640176402764037640476405764067640776408764097641076411764127641376414764157641676417764187641976420764217642276423764247642576426764277642876429764307643176432764337643476435764367643776438764397644076441764427644376444764457644676447764487644976450764517645276453764547645576456764577645876459764607646176462764637646476465764667646776468764697647076471764727647376474764757647676477764787647976480764817648276483764847648576486764877648876489764907649176492764937649476495764967649776498764997650076501765027650376504765057650676507765087650976510765117651276513765147651576516765177651876519765207652176522765237652476525765267652776528765297653076531765327653376534765357653676537765387653976540765417654276543765447654576546765477654876549765507655176552765537655476555765567655776558765597656076561765627656376564765657656676567765687656976570765717657276573765747657576576765777657876579765807658176582765837658476585765867658776588765897659076591765927659376594765957659676597765987659976600766017660276603766047660576606766077660876609766107661176612766137661476615766167661776618766197662076621766227662376624766257662676627766287662976630766317663276633766347663576636766377663876639766407664176642766437664476645766467664776648766497665076651766527665376654766557665676657766587665976660766617666276663766647666576666766677666876669766707667176672766737667476675766767667776678766797668076681766827668376684766857668676687766887668976690766917669276693766947669576696766977669876699767007670176702767037670476705767067670776708767097671076711767127671376714767157671676717767187671976720767217672276723767247672576726767277672876729767307673176732767337673476735767367673776738767397674076741767427674376744767457674676747767487674976750767517675276753767547675576756767577675876759767607676176762767637676476765767667676776768767697677076771767727677376774767757677676777767787677976780767817678276783767847678576786767877678876789767907679176792767937679476795767967679776798767997680076801768027680376804768057680676807768087680976810768117681276813768147681576816768177681876819768207682176822768237682476825768267682776828768297683076831768327683376834768357683676837768387683976840768417684276843768447684576846768477684876849768507685176852768537685476855768567685776858768597686076861768627686376864768657686676867768687686976870768717687276873768747687576876768777687876879768807688176882768837688476885768867688776888768897689076891768927689376894768957689676897768987689976900769017690276903769047690576906769077690876909769107691176912769137691476915769167691776918769197692076921769227692376924769257692676927769287692976930769317693276933769347693576936769377693876939769407694176942769437694476945769467694776948769497695076951769527695376954769557695676957769587695976960769617696276963769647696576966769677696876969769707697176972769737697476975769767697776978769797698076981769827698376984769857698676987769887698976990769917699276993769947699576996769977699876999770007700177002770037700477005770067700777008770097701077011770127701377014770157701677017770187701977020770217702277023770247702577026770277702877029770307703177032770337703477035770367703777038770397704077041770427704377044770457704677047770487704977050770517705277053770547705577056770577705877059770607706177062770637706477065770667706777068770697707077071770727707377074770757707677077770787707977080770817708277083770847708577086770877708877089770907709177092770937709477095770967709777098770997710077101771027710377104771057710677107771087710977110771117711277113771147711577116771177711877119771207712177122771237712477125771267712777128771297713077131771327713377134771357713677137771387713977140771417714277143771447714577146771477714877149771507715177152771537715477155771567715777158771597716077161771627716377164771657716677167771687716977170771717717277173771747717577176771777717877179771807718177182771837718477185771867718777188771897719077191771927719377194771957719677197771987719977200772017720277203772047720577206772077720877209772107721177212772137721477215772167721777218772197722077221772227722377224772257722677227772287722977230772317723277233772347723577236772377723877239772407724177242772437724477245772467724777248772497725077251772527725377254772557725677257772587725977260772617726277263772647726577266772677726877269772707727177272772737727477275772767727777278772797728077281772827728377284772857728677287772887728977290772917729277293772947729577296772977729877299773007730177302773037730477305773067730777308773097731077311773127731377314773157731677317773187731977320773217732277323773247732577326773277732877329773307733177332773337733477335773367733777338773397734077341773427734377344773457734677347773487734977350773517735277353773547735577356773577735877359773607736177362773637736477365773667736777368773697737077371773727737377374773757737677377773787737977380773817738277383773847738577386773877738877389773907739177392773937739477395773967739777398773997740077401774027740377404774057740677407774087740977410774117741277413774147741577416774177741877419774207742177422774237742477425774267742777428774297743077431774327743377434774357743677437774387743977440774417744277443774447744577446774477744877449774507745177452774537745477455774567745777458774597746077461774627746377464774657746677467774687746977470774717747277473774747747577476774777747877479774807748177482774837748477485774867748777488774897749077491774927749377494774957749677497774987749977500775017750277503775047750577506775077750877509775107751177512775137751477515775167751777518775197752077521775227752377524775257752677527775287752977530775317753277533775347753577536775377753877539775407754177542775437754477545775467754777548775497755077551775527755377554775557755677557775587755977560775617756277563775647756577566775677756877569775707757177572775737757477575775767757777578775797758077581775827758377584775857758677587775887758977590775917759277593775947759577596775977759877599776007760177602776037760477605776067760777608776097761077611776127761377614776157761677617776187761977620776217762277623776247762577626776277762877629776307763177632776337763477635776367763777638776397764077641776427764377644776457764677647776487764977650776517765277653776547765577656776577765877659776607766177662776637766477665776667766777668776697767077671776727767377674776757767677677776787767977680776817768277683776847768577686776877768877689776907769177692776937769477695776967769777698776997770077701777027770377704777057770677707777087770977710777117771277713777147771577716777177771877719777207772177722777237772477725777267772777728777297773077731777327773377734777357773677737777387773977740777417774277743777447774577746777477774877749777507775177752777537775477755777567775777758777597776077761777627776377764777657776677767777687776977770777717777277773777747777577776777777777877779777807778177782777837778477785777867778777788777897779077791777927779377794777957779677797777987779977800778017780277803778047780577806778077780877809778107781177812778137781477815778167781777818778197782077821778227782377824778257782677827778287782977830778317783277833778347783577836778377783877839778407784177842778437784477845778467784777848778497785077851778527785377854778557785677857778587785977860778617786277863778647786577866778677786877869778707787177872778737787477875778767787777878778797788077881778827788377884778857788677887778887788977890778917789277893778947789577896778977789877899779007790177902779037790477905779067790777908779097791077911779127791377914779157791677917779187791977920779217792277923779247792577926779277792877929779307793177932779337793477935779367793777938779397794077941779427794377944779457794677947779487794977950779517795277953779547795577956779577795877959779607796177962779637796477965779667796777968779697797077971779727797377974779757797677977779787797977980779817798277983779847798577986779877798877989779907799177992779937799477995779967799777998779997800078001780027800378004780057800678007780087800978010780117801278013780147801578016780177801878019780207802178022780237802478025780267802778028780297803078031780327803378034780357803678037780387803978040780417804278043780447804578046780477804878049780507805178052780537805478055780567805778058780597806078061780627806378064780657806678067780687806978070780717807278073780747807578076780777807878079780807808178082780837808478085780867808778088780897809078091780927809378094780957809678097780987809978100781017810278103781047810578106781077810878109781107811178112781137811478115781167811778118781197812078121781227812378124781257812678127781287812978130781317813278133781347813578136781377813878139781407814178142781437814478145781467814778148781497815078151781527815378154781557815678157781587815978160781617816278163781647816578166781677816878169781707817178172781737817478175781767817778178781797818078181781827818378184781857818678187781887818978190781917819278193781947819578196781977819878199782007820178202782037820478205782067820778208782097821078211782127821378214782157821678217782187821978220782217822278223782247822578226782277822878229782307823178232782337823478235782367823778238782397824078241782427824378244782457824678247782487824978250782517825278253782547825578256782577825878259782607826178262782637826478265782667826778268782697827078271782727827378274782757827678277782787827978280782817828278283782847828578286782877828878289782907829178292782937829478295782967829778298782997830078301783027830378304783057830678307783087830978310783117831278313783147831578316783177831878319783207832178322783237832478325783267832778328783297833078331783327833378334783357833678337783387833978340783417834278343783447834578346783477834878349783507835178352783537835478355783567835778358783597836078361783627836378364783657836678367783687836978370783717837278373783747837578376783777837878379783807838178382783837838478385783867838778388783897839078391783927839378394783957839678397783987839978400784017840278403784047840578406784077840878409784107841178412784137841478415784167841778418784197842078421784227842378424784257842678427784287842978430784317843278433784347843578436784377843878439784407844178442784437844478445784467844778448784497845078451784527845378454784557845678457784587845978460784617846278463784647846578466784677846878469784707847178472784737847478475784767847778478784797848078481784827848378484784857848678487784887848978490784917849278493784947849578496784977849878499785007850178502785037850478505785067850778508785097851078511785127851378514785157851678517785187851978520785217852278523785247852578526785277852878529785307853178532785337853478535785367853778538785397854078541785427854378544785457854678547785487854978550785517855278553785547855578556785577855878559785607856178562785637856478565785667856778568785697857078571785727857378574785757857678577785787857978580785817858278583785847858578586785877858878589785907859178592785937859478595785967859778598785997860078601786027860378604786057860678607786087860978610786117861278613786147861578616786177861878619786207862178622786237862478625786267862778628786297863078631786327863378634786357863678637786387863978640786417864278643786447864578646786477864878649786507865178652786537865478655786567865778658786597866078661786627866378664786657866678667786687866978670786717867278673786747867578676786777867878679786807868178682786837868478685786867868778688786897869078691786927869378694786957869678697786987869978700787017870278703787047870578706787077870878709787107871178712787137871478715787167871778718787197872078721787227872378724787257872678727787287872978730787317873278733787347873578736787377873878739787407874178742787437874478745787467874778748787497875078751787527875378754787557875678757787587875978760787617876278763787647876578766787677876878769787707877178772787737877478775787767877778778787797878078781787827878378784787857878678787787887878978790787917879278793787947879578796787977879878799788007880178802788037880478805788067880778808788097881078811788127881378814788157881678817788187881978820788217882278823788247882578826788277882878829788307883178832788337883478835788367883778838788397884078841788427884378844788457884678847788487884978850788517885278853788547885578856788577885878859788607886178862788637886478865788667886778868788697887078871788727887378874788757887678877788787887978880788817888278883788847888578886788877888878889788907889178892788937889478895788967889778898788997890078901789027890378904789057890678907789087890978910789117891278913789147891578916789177891878919789207892178922789237892478925789267892778928789297893078931789327893378934789357893678937789387893978940789417894278943789447894578946789477894878949789507895178952789537895478955789567895778958789597896078961789627896378964789657896678967789687896978970789717897278973789747897578976789777897878979789807898178982789837898478985789867898778988789897899078991789927899378994789957899678997789987899979000790017900279003790047900579006790077900879009790107901179012790137901479015790167901779018790197902079021790227902379024790257902679027790287902979030790317903279033790347903579036790377903879039790407904179042790437904479045790467904779048790497905079051790527905379054790557905679057790587905979060790617906279063790647906579066790677906879069790707907179072790737907479075790767907779078790797908079081790827908379084790857908679087790887908979090790917909279093790947909579096790977909879099791007910179102791037910479105791067910779108791097911079111791127911379114791157911679117791187911979120791217912279123791247912579126791277912879129791307913179132791337913479135791367913779138791397914079141791427914379144791457914679147791487914979150791517915279153791547915579156791577915879159791607916179162791637916479165791667916779168791697917079171791727917379174791757917679177791787917979180791817918279183791847918579186791877918879189791907919179192791937919479195791967919779198791997920079201792027920379204792057920679207792087920979210792117921279213792147921579216792177921879219792207922179222792237922479225792267922779228792297923079231792327923379234792357923679237792387923979240792417924279243792447924579246792477924879249792507925179252792537925479255792567925779258792597926079261792627926379264792657926679267792687926979270792717927279273792747927579276792777927879279792807928179282792837928479285792867928779288792897929079291792927929379294792957929679297792987929979300793017930279303793047930579306793077930879309793107931179312793137931479315793167931779318793197932079321793227932379324793257932679327793287932979330793317933279333793347933579336793377933879339793407934179342793437934479345793467934779348793497935079351793527935379354793557935679357793587935979360793617936279363793647936579366793677936879369793707937179372793737937479375793767937779378793797938079381793827938379384793857938679387793887938979390793917939279393793947939579396793977939879399794007940179402794037940479405794067940779408794097941079411794127941379414794157941679417794187941979420794217942279423794247942579426794277942879429794307943179432794337943479435794367943779438794397944079441794427944379444794457944679447794487944979450794517945279453794547945579456794577945879459794607946179462794637946479465794667946779468794697947079471794727947379474794757947679477794787947979480794817948279483794847948579486794877948879489794907949179492794937949479495794967949779498794997950079501795027950379504795057950679507795087950979510795117951279513795147951579516795177951879519795207952179522795237952479525795267952779528795297953079531795327953379534795357953679537795387953979540795417954279543795447954579546795477954879549795507955179552795537955479555795567955779558795597956079561795627956379564795657956679567795687956979570795717957279573795747957579576795777957879579795807958179582795837958479585795867958779588795897959079591795927959379594795957959679597795987959979600796017960279603796047960579606796077960879609796107961179612796137961479615796167961779618796197962079621796227962379624796257962679627796287962979630796317963279633796347963579636796377963879639796407964179642796437964479645796467964779648796497965079651796527965379654796557965679657796587965979660796617966279663796647966579666796677966879669796707967179672796737967479675796767967779678796797968079681796827968379684796857968679687796887968979690796917969279693796947969579696796977969879699797007970179702797037970479705797067970779708797097971079711797127971379714797157971679717797187971979720797217972279723797247972579726797277972879729797307973179732797337973479735797367973779738797397974079741797427974379744797457974679747797487974979750797517975279753797547975579756797577975879759797607976179762797637976479765797667976779768797697977079771797727977379774797757977679777797787977979780797817978279783797847978579786797877978879789797907979179792797937979479795797967979779798797997980079801798027980379804798057980679807798087980979810798117981279813798147981579816798177981879819798207982179822798237982479825798267982779828798297983079831798327983379834798357983679837798387983979840798417984279843798447984579846798477984879849798507985179852798537985479855798567985779858798597986079861798627986379864798657986679867798687986979870798717987279873798747987579876798777987879879798807988179882798837988479885798867988779888798897989079891798927989379894798957989679897798987989979900799017990279903799047990579906799077990879909799107991179912799137991479915799167991779918799197992079921799227992379924799257992679927799287992979930799317993279933799347993579936799377993879939799407994179942799437994479945799467994779948799497995079951799527995379954799557995679957799587995979960799617996279963799647996579966799677996879969799707997179972799737997479975799767997779978799797998079981799827998379984799857998679987799887998979990799917999279993799947999579996799977999879999800008000180002800038000480005800068000780008800098001080011800128001380014800158001680017800188001980020800218002280023800248002580026800278002880029800308003180032800338003480035800368003780038800398004080041800428004380044800458004680047800488004980050800518005280053800548005580056800578005880059800608006180062800638006480065800668006780068800698007080071800728007380074800758007680077800788007980080800818008280083800848008580086800878008880089800908009180092800938009480095800968009780098800998010080101801028010380104801058010680107801088010980110801118011280113801148011580116801178011880119801208012180122801238012480125801268012780128801298013080131801328013380134801358013680137801388013980140801418014280143801448014580146801478014880149801508015180152801538015480155801568015780158801598016080161801628016380164801658016680167801688016980170801718017280173801748017580176801778017880179801808018180182801838018480185801868018780188801898019080191801928019380194801958019680197801988019980200802018020280203802048020580206802078020880209802108021180212802138021480215802168021780218802198022080221802228022380224802258022680227802288022980230802318023280233802348023580236802378023880239802408024180242802438024480245802468024780248802498025080251802528025380254802558025680257802588025980260802618026280263802648026580266802678026880269802708027180272802738027480275802768027780278802798028080281802828028380284802858028680287802888028980290802918029280293802948029580296802978029880299803008030180302803038030480305803068030780308803098031080311803128031380314803158031680317803188031980320803218032280323803248032580326803278032880329803308033180332803338033480335803368033780338803398034080341803428034380344803458034680347803488034980350803518035280353803548035580356803578035880359803608036180362803638036480365803668036780368803698037080371803728037380374803758037680377803788037980380803818038280383803848038580386803878038880389803908039180392803938039480395803968039780398803998040080401804028040380404804058040680407804088040980410804118041280413804148041580416804178041880419804208042180422804238042480425804268042780428804298043080431804328043380434804358043680437804388043980440804418044280443804448044580446804478044880449804508045180452804538045480455804568045780458804598046080461804628046380464804658046680467804688046980470804718047280473804748047580476804778047880479804808048180482804838048480485804868048780488804898049080491804928049380494804958049680497804988049980500805018050280503805048050580506805078050880509805108051180512805138051480515805168051780518805198052080521805228052380524805258052680527805288052980530805318053280533805348053580536805378053880539805408054180542805438054480545805468054780548805498055080551805528055380554805558055680557805588055980560805618056280563805648056580566805678056880569805708057180572805738057480575805768057780578805798058080581805828058380584805858058680587805888058980590805918059280593805948059580596805978059880599806008060180602806038060480605806068060780608806098061080611806128061380614806158061680617806188061980620806218062280623806248062580626806278062880629806308063180632806338063480635806368063780638806398064080641806428064380644806458064680647806488064980650806518065280653806548065580656806578065880659806608066180662806638066480665806668066780668806698067080671806728067380674806758067680677806788067980680806818068280683806848068580686806878068880689806908069180692806938069480695806968069780698806998070080701807028070380704807058070680707807088070980710807118071280713807148071580716807178071880719807208072180722807238072480725807268072780728807298073080731807328073380734807358073680737807388073980740807418074280743807448074580746807478074880749807508075180752807538075480755807568075780758807598076080761807628076380764807658076680767807688076980770807718077280773807748077580776807778077880779807808078180782807838078480785807868078780788807898079080791807928079380794807958079680797807988079980800808018080280803808048080580806808078080880809808108081180812808138081480815808168081780818808198082080821808228082380824808258082680827808288082980830808318083280833808348083580836808378083880839808408084180842808438084480845808468084780848808498085080851808528085380854808558085680857808588085980860808618086280863808648086580866808678086880869808708087180872808738087480875808768087780878808798088080881808828088380884808858088680887808888088980890808918089280893808948089580896808978089880899809008090180902809038090480905809068090780908809098091080911809128091380914809158091680917809188091980920809218092280923809248092580926809278092880929809308093180932809338093480935809368093780938809398094080941809428094380944809458094680947809488094980950809518095280953809548095580956809578095880959809608096180962809638096480965809668096780968809698097080971809728097380974809758097680977809788097980980809818098280983809848098580986809878098880989809908099180992809938099480995809968099780998809998100081001810028100381004810058100681007810088100981010810118101281013810148101581016810178101881019810208102181022810238102481025810268102781028810298103081031810328103381034810358103681037810388103981040810418104281043810448104581046810478104881049810508105181052810538105481055810568105781058810598106081061810628106381064810658106681067810688106981070810718107281073810748107581076810778107881079810808108181082810838108481085810868108781088810898109081091810928109381094810958109681097810988109981100811018110281103811048110581106811078110881109811108111181112811138111481115811168111781118811198112081121811228112381124811258112681127811288112981130811318113281133811348113581136811378113881139811408114181142811438114481145811468114781148811498115081151811528115381154811558115681157811588115981160811618116281163811648116581166811678116881169811708117181172811738117481175811768117781178811798118081181811828118381184811858118681187811888118981190811918119281193811948119581196811978119881199812008120181202812038120481205812068120781208812098121081211812128121381214812158121681217812188121981220812218122281223812248122581226812278122881229812308123181232812338123481235812368123781238812398124081241812428124381244812458124681247812488124981250812518125281253812548125581256812578125881259812608126181262812638126481265812668126781268812698127081271812728127381274812758127681277812788127981280812818128281283812848128581286812878128881289812908129181292812938129481295812968129781298812998130081301813028130381304813058130681307813088130981310813118131281313813148131581316813178131881319813208132181322813238132481325813268132781328813298133081331813328133381334813358133681337813388133981340813418134281343813448134581346813478134881349813508135181352813538135481355813568135781358813598136081361813628136381364813658136681367813688136981370813718137281373813748137581376813778137881379813808138181382813838138481385813868138781388813898139081391813928139381394813958139681397813988139981400814018140281403814048140581406814078140881409814108141181412814138141481415814168141781418814198142081421814228142381424814258142681427814288142981430814318143281433814348143581436814378143881439814408144181442814438144481445814468144781448814498145081451814528145381454814558145681457814588145981460814618146281463814648146581466814678146881469814708147181472814738147481475814768147781478814798148081481814828148381484814858148681487814888148981490814918149281493814948149581496814978149881499815008150181502815038150481505815068150781508815098151081511815128151381514815158151681517815188151981520815218152281523815248152581526815278152881529815308153181532815338153481535815368153781538815398154081541815428154381544815458154681547815488154981550815518155281553815548155581556815578155881559815608156181562815638156481565815668156781568815698157081571815728157381574815758157681577815788157981580815818158281583815848158581586815878158881589815908159181592815938159481595815968159781598815998160081601816028160381604816058160681607816088160981610816118161281613816148161581616816178161881619816208162181622816238162481625816268162781628816298163081631816328163381634816358163681637816388163981640816418164281643816448164581646816478164881649816508165181652816538165481655816568165781658816598166081661816628166381664816658166681667816688166981670816718167281673816748167581676816778167881679816808168181682816838168481685816868168781688816898169081691816928169381694816958169681697816988169981700817018170281703817048170581706817078170881709817108171181712817138171481715817168171781718817198172081721817228172381724817258172681727817288172981730817318173281733817348173581736817378173881739817408174181742817438174481745817468174781748817498175081751817528175381754817558175681757817588175981760817618176281763817648176581766817678176881769817708177181772817738177481775817768177781778817798178081781817828178381784817858178681787817888178981790817918179281793817948179581796817978179881799818008180181802818038180481805818068180781808818098181081811818128181381814818158181681817818188181981820818218182281823818248182581826818278182881829818308183181832818338183481835818368183781838818398184081841818428184381844818458184681847818488184981850818518185281853818548185581856818578185881859818608186181862818638186481865818668186781868818698187081871818728187381874818758187681877818788187981880818818188281883818848188581886818878188881889818908189181892818938189481895818968189781898818998190081901819028190381904819058190681907819088190981910819118191281913819148191581916819178191881919819208192181922819238192481925819268192781928819298193081931819328193381934819358193681937819388193981940819418194281943819448194581946819478194881949819508195181952819538195481955819568195781958819598196081961819628196381964819658196681967819688196981970819718197281973819748197581976819778197881979819808198181982819838198481985819868198781988819898199081991819928199381994819958199681997819988199982000820018200282003820048200582006820078200882009820108201182012820138201482015820168201782018820198202082021820228202382024820258202682027820288202982030820318203282033820348203582036820378203882039820408204182042820438204482045820468204782048820498205082051820528205382054820558205682057820588205982060820618206282063820648206582066820678206882069820708207182072820738207482075820768207782078820798208082081820828208382084820858208682087820888208982090820918209282093820948209582096820978209882099821008210182102821038210482105821068210782108821098211082111821128211382114821158211682117821188211982120821218212282123821248212582126821278212882129821308213182132821338213482135821368213782138821398214082141821428214382144821458214682147821488214982150821518215282153821548215582156821578215882159821608216182162821638216482165821668216782168821698217082171821728217382174821758217682177821788217982180821818218282183821848218582186821878218882189821908219182192821938219482195821968219782198821998220082201822028220382204822058220682207822088220982210822118221282213822148221582216822178221882219822208222182222822238222482225822268222782228822298223082231822328223382234822358223682237822388223982240822418224282243822448224582246822478224882249822508225182252822538225482255822568225782258822598226082261822628226382264822658226682267822688226982270822718227282273822748227582276822778227882279822808228182282822838228482285822868228782288822898229082291822928229382294822958229682297822988229982300823018230282303823048230582306823078230882309823108231182312823138231482315823168231782318823198232082321823228232382324823258232682327823288232982330823318233282333823348233582336823378233882339823408234182342823438234482345823468234782348823498235082351823528235382354823558235682357823588235982360823618236282363823648236582366823678236882369823708237182372823738237482375823768237782378823798238082381823828238382384823858238682387823888238982390823918239282393823948239582396823978239882399824008240182402824038240482405824068240782408824098241082411824128241382414824158241682417824188241982420824218242282423824248242582426824278242882429824308243182432824338243482435824368243782438824398244082441824428244382444824458244682447824488244982450824518245282453824548245582456824578245882459824608246182462824638246482465824668246782468824698247082471824728247382474824758247682477824788247982480824818248282483824848248582486824878248882489824908249182492824938249482495824968249782498824998250082501825028250382504825058250682507825088250982510825118251282513825148251582516825178251882519825208252182522825238252482525825268252782528825298253082531825328253382534825358253682537825388253982540825418254282543825448254582546825478254882549825508255182552825538255482555825568255782558825598256082561825628256382564825658256682567825688256982570825718257282573825748257582576825778257882579825808258182582825838258482585825868258782588825898259082591825928259382594825958259682597825988259982600826018260282603826048260582606826078260882609826108261182612826138261482615826168261782618826198262082621826228262382624826258262682627826288262982630826318263282633826348263582636826378263882639826408264182642826438264482645826468264782648826498265082651826528265382654826558265682657826588265982660826618266282663826648266582666826678266882669826708267182672826738267482675826768267782678826798268082681826828268382684826858268682687826888268982690826918269282693826948269582696826978269882699827008270182702827038270482705827068270782708827098271082711827128271382714827158271682717827188271982720827218272282723827248272582726827278272882729827308273182732827338273482735827368273782738827398274082741827428274382744827458274682747827488274982750827518275282753827548275582756827578275882759827608276182762827638276482765827668276782768827698277082771827728277382774827758277682777827788277982780827818278282783827848278582786827878278882789827908279182792827938279482795827968279782798827998280082801828028280382804828058280682807828088280982810828118281282813828148281582816828178281882819828208282182822828238282482825828268282782828828298283082831828328283382834828358283682837828388283982840828418284282843828448284582846828478284882849828508285182852828538285482855828568285782858828598286082861828628286382864828658286682867828688286982870828718287282873828748287582876828778287882879828808288182882828838288482885828868288782888828898289082891828928289382894828958289682897828988289982900829018290282903829048290582906829078290882909829108291182912829138291482915829168291782918829198292082921829228292382924829258292682927829288292982930829318293282933829348293582936829378293882939829408294182942829438294482945829468294782948829498295082951829528295382954829558295682957829588295982960829618296282963829648296582966829678296882969829708297182972829738297482975829768297782978829798298082981829828298382984829858298682987829888298982990829918299282993829948299582996829978299882999830008300183002830038300483005830068300783008830098301083011830128301383014830158301683017830188301983020830218302283023830248302583026830278302883029830308303183032830338303483035830368303783038830398304083041830428304383044830458304683047830488304983050830518305283053830548305583056830578305883059830608306183062830638306483065830668306783068830698307083071830728307383074830758307683077830788307983080830818308283083830848308583086830878308883089830908309183092830938309483095830968309783098830998310083101831028310383104831058310683107831088310983110831118311283113831148311583116831178311883119831208312183122831238312483125831268312783128831298313083131831328313383134831358313683137831388313983140831418314283143831448314583146831478314883149831508315183152831538315483155831568315783158831598316083161831628316383164831658316683167831688316983170831718317283173831748317583176831778317883179831808318183182831838318483185831868318783188831898319083191831928319383194831958319683197831988319983200832018320283203832048320583206832078320883209832108321183212832138321483215832168321783218832198322083221832228322383224832258322683227832288322983230832318323283233832348323583236832378323883239832408324183242832438324483245832468324783248832498325083251832528325383254832558325683257832588325983260832618326283263832648326583266832678326883269832708327183272832738327483275832768327783278832798328083281832828328383284832858328683287832888328983290832918329283293832948329583296832978329883299833008330183302833038330483305833068330783308833098331083311833128331383314833158331683317833188331983320833218332283323833248332583326833278332883329833308333183332833338333483335833368333783338833398334083341833428334383344833458334683347833488334983350833518335283353833548335583356833578335883359833608336183362833638336483365833668336783368833698337083371833728337383374833758337683377833788337983380833818338283383833848338583386833878338883389833908339183392833938339483395833968339783398833998340083401834028340383404834058340683407834088340983410834118341283413834148341583416834178341883419834208342183422834238342483425834268342783428834298343083431834328343383434834358343683437834388343983440834418344283443834448344583446834478344883449834508345183452834538345483455834568345783458834598346083461834628346383464834658346683467834688346983470834718347283473834748347583476834778347883479834808348183482834838348483485834868348783488834898349083491834928349383494834958349683497834988349983500835018350283503835048350583506835078350883509835108351183512835138351483515835168351783518835198352083521835228352383524835258352683527835288352983530835318353283533835348353583536835378353883539835408354183542835438354483545835468354783548835498355083551835528355383554835558355683557835588355983560835618356283563835648356583566835678356883569835708357183572835738357483575835768357783578835798358083581835828358383584835858358683587835888358983590835918359283593835948359583596835978359883599836008360183602836038360483605836068360783608836098361083611836128361383614836158361683617836188361983620836218362283623836248362583626836278362883629836308363183632836338363483635836368363783638836398364083641836428364383644836458364683647836488364983650836518365283653836548365583656836578365883659836608366183662836638366483665836668366783668836698367083671836728367383674836758367683677836788367983680836818368283683836848368583686836878368883689836908369183692836938369483695836968369783698836998370083701837028370383704837058370683707837088370983710837118371283713837148371583716837178371883719837208372183722837238372483725837268372783728837298373083731837328373383734837358373683737837388373983740837418374283743837448374583746837478374883749837508375183752837538375483755837568375783758837598376083761837628376383764837658376683767837688376983770837718377283773837748377583776837778377883779837808378183782837838378483785837868378783788837898379083791837928379383794837958379683797837988379983800838018380283803838048380583806838078380883809838108381183812838138381483815838168381783818838198382083821838228382383824838258382683827838288382983830838318383283833838348383583836838378383883839838408384183842838438384483845838468384783848838498385083851838528385383854838558385683857838588385983860838618386283863838648386583866838678386883869838708387183872838738387483875838768387783878838798388083881838828388383884838858388683887838888388983890838918389283893838948389583896838978389883899839008390183902839038390483905839068390783908839098391083911839128391383914839158391683917839188391983920839218392283923839248392583926839278392883929839308393183932839338393483935839368393783938839398394083941839428394383944839458394683947839488394983950839518395283953839548395583956839578395883959839608396183962839638396483965839668396783968839698397083971839728397383974839758397683977839788397983980839818398283983839848398583986839878398883989839908399183992839938399483995839968399783998839998400084001840028400384004840058400684007840088400984010840118401284013840148401584016840178401884019840208402184022840238402484025840268402784028840298403084031840328403384034840358403684037840388403984040840418404284043840448404584046840478404884049840508405184052840538405484055840568405784058840598406084061840628406384064840658406684067840688406984070840718407284073840748407584076840778407884079840808408184082840838408484085840868408784088840898409084091840928409384094840958409684097840988409984100841018410284103841048410584106841078410884109841108411184112841138411484115841168411784118841198412084121841228412384124841258412684127841288412984130841318413284133841348413584136841378413884139841408414184142841438414484145841468414784148841498415084151841528415384154841558415684157841588415984160841618416284163841648416584166841678416884169841708417184172841738417484175841768417784178841798418084181841828418384184841858418684187841888418984190841918419284193841948419584196841978419884199842008420184202842038420484205842068420784208842098421084211842128421384214842158421684217842188421984220842218422284223842248422584226842278422884229842308423184232842338423484235842368423784238842398424084241842428424384244842458424684247842488424984250842518425284253842548425584256842578425884259842608426184262842638426484265842668426784268842698427084271842728427384274842758427684277842788427984280842818428284283842848428584286842878428884289842908429184292842938429484295842968429784298842998430084301843028430384304843058430684307843088430984310843118431284313843148431584316843178431884319843208432184322843238432484325843268432784328843298433084331843328433384334843358433684337843388433984340843418434284343843448434584346843478434884349843508435184352843538435484355843568435784358843598436084361843628436384364843658436684367843688436984370843718437284373843748437584376843778437884379843808438184382843838438484385843868438784388843898439084391843928439384394843958439684397843988439984400844018440284403844048440584406844078440884409844108441184412844138441484415844168441784418844198442084421844228442384424844258442684427844288442984430844318443284433844348443584436844378443884439844408444184442844438444484445844468444784448844498445084451844528445384454844558445684457844588445984460844618446284463844648446584466844678446884469844708447184472844738447484475844768447784478844798448084481844828448384484844858448684487844888448984490844918449284493844948449584496844978449884499845008450184502845038450484505845068450784508845098451084511845128451384514845158451684517845188451984520845218452284523845248452584526845278452884529845308453184532845338453484535845368453784538845398454084541845428454384544845458454684547845488454984550845518455284553845548455584556845578455884559845608456184562845638456484565845668456784568845698457084571845728457384574845758457684577845788457984580845818458284583845848458584586845878458884589845908459184592845938459484595845968459784598845998460084601846028460384604846058460684607846088460984610846118461284613846148461584616846178461884619846208462184622846238462484625846268462784628846298463084631846328463384634846358463684637846388463984640846418464284643846448464584646846478464884649846508465184652846538465484655846568465784658846598466084661846628466384664846658466684667846688466984670846718467284673846748467584676846778467884679846808468184682846838468484685846868468784688846898469084691846928469384694846958469684697846988469984700847018470284703847048470584706847078470884709847108471184712847138471484715847168471784718847198472084721847228472384724847258472684727847288472984730847318473284733847348473584736847378473884739847408474184742847438474484745847468474784748847498475084751847528475384754847558475684757847588475984760847618476284763847648476584766847678476884769847708477184772847738477484775847768477784778847798478084781847828478384784847858478684787847888478984790847918479284793847948479584796847978479884799848008480184802848038480484805848068480784808848098481084811848128481384814848158481684817848188481984820848218482284823848248482584826848278482884829848308483184832848338483484835848368483784838848398484084841848428484384844848458484684847848488484984850848518485284853848548485584856848578485884859848608486184862848638486484865848668486784868848698487084871848728487384874848758487684877848788487984880848818488284883848848488584886848878488884889848908489184892848938489484895848968489784898848998490084901849028490384904849058490684907849088490984910849118491284913849148491584916849178491884919849208492184922849238492484925849268492784928849298493084931849328493384934849358493684937849388493984940849418494284943849448494584946849478494884949849508495184952849538495484955849568495784958849598496084961849628496384964849658496684967849688496984970849718497284973849748497584976849778497884979849808498184982849838498484985849868498784988849898499084991849928499384994849958499684997849988499985000850018500285003850048500585006850078500885009850108501185012850138501485015850168501785018850198502085021850228502385024850258502685027850288502985030850318503285033850348503585036850378503885039850408504185042850438504485045850468504785048850498505085051850528505385054850558505685057850588505985060850618506285063850648506585066850678506885069850708507185072850738507485075850768507785078850798508085081850828508385084850858508685087850888508985090850918509285093850948509585096850978509885099851008510185102851038510485105851068510785108851098511085111851128511385114851158511685117851188511985120851218512285123851248512585126851278512885129851308513185132851338513485135851368513785138851398514085141851428514385144851458514685147851488514985150851518515285153851548515585156851578515885159851608516185162851638516485165851668516785168851698517085171851728517385174851758517685177851788517985180851818518285183851848518585186851878518885189851908519185192851938519485195851968519785198851998520085201852028520385204852058520685207852088520985210852118521285213852148521585216852178521885219852208522185222852238522485225852268522785228852298523085231852328523385234852358523685237852388523985240852418524285243852448524585246852478524885249852508525185252852538525485255852568525785258852598526085261852628526385264852658526685267852688526985270852718527285273852748527585276852778527885279852808528185282852838528485285852868528785288852898529085291852928529385294852958529685297852988529985300853018530285303853048530585306853078530885309853108531185312853138531485315853168531785318853198532085321853228532385324853258532685327853288532985330853318533285333853348533585336853378533885339853408534185342853438534485345853468534785348853498535085351853528535385354853558535685357853588535985360853618536285363853648536585366853678536885369853708537185372853738537485375853768537785378853798538085381853828538385384853858538685387853888538985390853918539285393853948539585396853978539885399854008540185402854038540485405854068540785408854098541085411854128541385414854158541685417854188541985420854218542285423854248542585426854278542885429854308543185432854338543485435854368543785438854398544085441854428544385444854458544685447854488544985450854518545285453854548545585456854578545885459854608546185462854638546485465854668546785468854698547085471854728547385474854758547685477854788547985480854818548285483854848548585486854878548885489854908549185492854938549485495854968549785498854998550085501855028550385504855058550685507855088550985510855118551285513855148551585516855178551885519855208552185522855238552485525855268552785528855298553085531855328553385534855358553685537855388553985540855418554285543855448554585546855478554885549855508555185552855538555485555855568555785558855598556085561855628556385564855658556685567855688556985570855718557285573855748557585576855778557885579855808558185582855838558485585855868558785588855898559085591855928559385594855958559685597855988559985600856018560285603856048560585606856078560885609856108561185612856138561485615856168561785618856198562085621856228562385624856258562685627856288562985630856318563285633856348563585636856378563885639856408564185642856438564485645856468564785648856498565085651856528565385654856558565685657856588565985660856618566285663856648566585666856678566885669856708567185672856738567485675856768567785678856798568085681856828568385684856858568685687856888568985690856918569285693856948569585696856978569885699857008570185702857038570485705857068570785708857098571085711857128571385714857158571685717857188571985720857218572285723857248572585726857278572885729857308573185732857338573485735857368573785738857398574085741857428574385744857458574685747857488574985750857518575285753857548575585756857578575885759857608576185762857638576485765857668576785768857698577085771857728577385774857758577685777857788577985780857818578285783857848578585786857878578885789857908579185792857938579485795857968579785798857998580085801858028580385804858058580685807858088580985810858118581285813858148581585816858178581885819858208582185822858238582485825858268582785828858298583085831858328583385834858358583685837858388583985840858418584285843858448584585846858478584885849858508585185852858538585485855858568585785858858598586085861858628586385864858658586685867858688586985870858718587285873858748587585876858778587885879858808588185882858838588485885858868588785888858898589085891858928589385894858958589685897858988589985900859018590285903859048590585906859078590885909859108591185912859138591485915859168591785918859198592085921859228592385924859258592685927859288592985930859318593285933859348593585936859378593885939859408594185942859438594485945859468594785948859498595085951859528595385954859558595685957859588595985960859618596285963859648596585966859678596885969859708597185972859738597485975859768597785978859798598085981859828598385984859858598685987859888598985990859918599285993859948599585996859978599885999860008600186002860038600486005860068600786008860098601086011860128601386014860158601686017860188601986020860218602286023860248602586026860278602886029860308603186032860338603486035860368603786038860398604086041860428604386044860458604686047860488604986050860518605286053860548605586056860578605886059860608606186062860638606486065860668606786068860698607086071860728607386074860758607686077860788607986080860818608286083860848608586086860878608886089860908609186092860938609486095860968609786098860998610086101861028610386104861058610686107861088610986110861118611286113861148611586116861178611886119861208612186122861238612486125861268612786128861298613086131861328613386134861358613686137861388613986140861418614286143861448614586146861478614886149861508615186152861538615486155861568615786158861598616086161861628616386164861658616686167861688616986170861718617286173861748617586176861778617886179861808618186182861838618486185861868618786188861898619086191861928619386194861958619686197861988619986200862018620286203862048620586206862078620886209862108621186212862138621486215862168621786218862198622086221862228622386224862258622686227862288622986230862318623286233862348623586236862378623886239862408624186242862438624486245862468624786248862498625086251862528625386254862558625686257862588625986260862618626286263862648626586266862678626886269862708627186272862738627486275862768627786278862798628086281862828628386284862858628686287862888628986290862918629286293862948629586296862978629886299863008630186302863038630486305863068630786308863098631086311863128631386314863158631686317863188631986320863218632286323863248632586326863278632886329863308633186332863338633486335863368633786338863398634086341863428634386344863458634686347863488634986350863518635286353863548635586356863578635886359863608636186362863638636486365863668636786368863698637086371863728637386374863758637686377863788637986380863818638286383863848638586386863878638886389863908639186392863938639486395863968639786398863998640086401864028640386404864058640686407864088640986410864118641286413864148641586416864178641886419864208642186422864238642486425864268642786428864298643086431864328643386434864358643686437864388643986440864418644286443864448644586446864478644886449864508645186452864538645486455864568645786458864598646086461864628646386464864658646686467864688646986470864718647286473864748647586476864778647886479864808648186482864838648486485864868648786488864898649086491864928649386494864958649686497864988649986500865018650286503865048650586506865078650886509865108651186512865138651486515865168651786518865198652086521865228652386524865258652686527865288652986530865318653286533865348653586536865378653886539865408654186542865438654486545865468654786548865498655086551865528655386554865558655686557865588655986560865618656286563865648656586566865678656886569865708657186572865738657486575865768657786578865798658086581865828658386584865858658686587865888658986590865918659286593865948659586596865978659886599866008660186602866038660486605866068660786608866098661086611866128661386614866158661686617866188661986620866218662286623866248662586626866278662886629866308663186632866338663486635866368663786638866398664086641866428664386644866458664686647866488664986650866518665286653866548665586656866578665886659866608666186662866638666486665866668666786668866698667086671866728667386674866758667686677866788667986680866818668286683866848668586686866878668886689866908669186692866938669486695866968669786698866998670086701867028670386704867058670686707867088670986710867118671286713867148671586716867178671886719867208672186722867238672486725867268672786728867298673086731867328673386734867358673686737867388673986740867418674286743867448674586746867478674886749867508675186752867538675486755867568675786758867598676086761867628676386764867658676686767867688676986770867718677286773867748677586776867778677886779867808678186782867838678486785867868678786788867898679086791867928679386794867958679686797867988679986800868018680286803868048680586806868078680886809868108681186812868138681486815868168681786818868198682086821868228682386824868258682686827868288682986830868318683286833868348683586836868378683886839868408684186842868438684486845868468684786848868498685086851868528685386854868558685686857868588685986860868618686286863868648686586866868678686886869868708687186872868738687486875868768687786878868798688086881868828688386884868858688686887868888688986890868918689286893868948689586896868978689886899869008690186902869038690486905869068690786908869098691086911869128691386914869158691686917869188691986920869218692286923869248692586926869278692886929869308693186932869338693486935869368693786938869398694086941869428694386944869458694686947869488694986950869518695286953869548695586956869578695886959869608696186962869638696486965869668696786968869698697086971869728697386974869758697686977869788697986980869818698286983869848698586986869878698886989869908699186992869938699486995869968699786998869998700087001870028700387004870058700687007870088700987010870118701287013870148701587016870178701887019870208702187022870238702487025870268702787028870298703087031870328703387034870358703687037870388703987040870418704287043870448704587046870478704887049870508705187052870538705487055870568705787058870598706087061870628706387064870658706687067870688706987070870718707287073870748707587076870778707887079870808708187082870838708487085870868708787088870898709087091870928709387094870958709687097870988709987100871018710287103871048710587106871078710887109871108711187112871138711487115871168711787118871198712087121871228712387124871258712687127871288712987130871318713287133871348713587136871378713887139871408714187142871438714487145871468714787148871498715087151871528715387154871558715687157871588715987160871618716287163871648716587166871678716887169871708717187172871738717487175871768717787178871798718087181871828718387184871858718687187871888718987190871918719287193871948719587196871978719887199872008720187202872038720487205872068720787208872098721087211872128721387214872158721687217872188721987220872218722287223872248722587226872278722887229872308723187232
  1. #!/usr/bin/env php
  2. <?php
  3. /*
  4. * This file is part of Composer.
  5. *
  6. * (c) Nils Adermann <naderman@naderman.de>
  7. * Jordi Boggiano <j.boggiano@seld.be>
  8. *
  9. * For the full copyright and license information, please view
  10. * the license that is located at the bottom of this file.
  11. */
  12. // Avoid APC causing random fatal errors per https://github.com/composer/composer/issues/264
  13. if (extension_loaded('apc') && ini_get('apc.enable_cli') && ini_get('apc.cache_by_default')) {
  14. if (version_compare(phpversion('apc'), '3.0.12', '>=')) {
  15. ini_set('apc.cache_by_default', 0);
  16. } else {
  17. fwrite(STDERR, 'Warning: APC <= 3.0.12 may cause fatal errors when running composer commands.'.PHP_EOL);
  18. fwrite(STDERR, 'Update APC, or set apc.enable_cli or apc.cache_by_default to 0 in your php.ini.'.PHP_EOL);
  19. }
  20. }
  21. Phar::mapPhar('composer.phar');
  22. require 'phar://composer.phar/bin/composer';
  23. __HALT_COMPILER(); ?>
  24. ù‘��ë������ ���composer.phar����+���src/Composer/Autoload/AutoloadGenerator.phpþa��›+ìZþa��tG�”¶������+���src/Composer/Autoload/ClassMapGenerator.php‹��›+ìZ‹��Mè�Ķ���������src/Composer/Cache.phpt��›+ìZt���&#¶������%���src/Composer/Command/AboutCommand.phpË��›+ìZË��º¡Ãh¶������'���src/Composer/Command/ArchiveCommand.phpL��›+ìZL��… ;V¶������$���src/Composer/Command/BaseCommand.phpÉ ��›+ìZÉ ��—P!£¶������.���src/Composer/Command/BaseDependencyCommand.phpÕ��›+ìZÕ��8UŽ—¶������1���src/Composer/Command/CheckPlatformReqsCommand.php‚ ��›+ìZ‚ ��ˆD†¶������*���src/Composer/Command/ClearCacheCommand.php]��›+ìZ]��‚ß´¶������&���src/Composer/Command/ConfigCommand.php‡H��›+ìZ‡H��Ä×Ö¶������-���src/Composer/Command/CreateProjectCommand.php;6��›+ìZ;6��ü€y¶������'���src/Composer/Command/DependsCommand.php·��›+ìZ·��o±¹ú¶������(���src/Composer/Command/DiagnoseCommand.phpÕG��›+ìZÕG��ðõü ¶������,���src/Composer/Command/DumpAutoloadCommand.php
  25. ��›+ìZ
  26. ��'K¬ž¶������$���src/Composer/Command/ExecCommand.phpi��›+ìZi��Eþ€¶������&���src/Composer/Command/GlobalCommand.phpü��›+ìZü��ÝH�\¶������$���src/Composer/Command/HomeCommand.phpÃ��›+ìZÃ��¯àyB¶������$���src/Composer/Command/InitCommand.php•K��›+ìZ•K��ÇòÒi¶������'���src/Composer/Command/InstallCommand.phpý��›+ìZý��0ö:‰¶������(���src/Composer/Command/LicensesCommand.php&��›+ìZ&��Óvƒ¶������(���src/Composer/Command/OutdatedCommand.php°
  27. ��›+ìZ°
  28. ��7àzk¶������)���src/Composer/Command/ProhibitsCommand.phpË��›+ìZË��g�ð¶������&���src/Composer/Command/RemoveCommand.php›��›+ìZ›��>Sþ˜¶������'���src/Composer/Command/RequireCommand.phpÖ ��›+ìZÖ ��B÷õE¶������)���src/Composer/Command/RunScriptCommand.phpÈ��›+ìZÈ��dŸ@¶������+���src/Composer/Command/ScriptAliasCommand.phpo��›+ìZo�� 5Þl¶������&���src/Composer/Command/SearchCommand.phpã��›+ìZã��ñ ¼w¶������*���src/Composer/Command/SelfUpdateCommand.phpÈ2��›+ìZÈ2��+}”¶������$���src/Composer/Command/ShowCommand.phplg��›+ìZlg��‘f¤¶������&���src/Composer/Command/StatusCommand.phpS��›+ìZS��‚õ¤X¶������(���src/Composer/Command/SuggestsCommand.php¨ ��›+ìZ¨ ��¼Ñc¶������&���src/Composer/Command/UpdateCommand.php¯#��›+ìZ¯#��—ú�T¶������(���src/Composer/Command/ValidateCommand.php#��›+ìZ#��‰��~¶���������src/Composer/Composer.phpù ��›+ìZù ��.ÌfK¶���������src/Composer/Config.phpÅ"��›+ìZÅ"��FÅ�¡¶������-���src/Composer/Config/ConfigSourceInterface.php��›+ìZ��³ [/¶������(���src/Composer/Config/JsonConfigSource.php!��›+ìZ!��¾S N¶������$���src/Composer/Console/Application.php§3��›+ìZ§3��‰D;q¶������,���src/Composer/Console/HtmlOutputFormatter.php3��›+ìZ3��Ú�Eu¶������-���src/Composer/DependencyResolver/Decisions.phpQ��›+ìZQ��?˜¬$¶������1���src/Composer/DependencyResolver/DefaultPolicy.php��›+ìZ��õÝv¶������/���src/Composer/DependencyResolver/GenericRule.php·��›+ìZ·��Ì~¯³¶������>���src/Composer/DependencyResolver/Operation/InstallOperation.phpC��›+ìZC��´\õ*¶������I���src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php÷��›+ìZ÷��ïÎà÷¶������K���src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.phpý��›+ìZý��3#†¶������@���src/Composer/DependencyResolver/Operation/OperationInterface.phpÓ���›+ìZÓ���Ùâ&ä¶������=���src/Composer/DependencyResolver/Operation/SolverOperation.php¹��›+ìZ¹��&¢e
  29. ¶������@���src/Composer/DependencyResolver/Operation/UninstallOperation.phpI��›+ìZI��FûÂɶ������=���src/Composer/DependencyResolver/Operation/UpdateOperation.phph��›+ìZh��öSÕ]¶������3���src/Composer/DependencyResolver/PolicyInterface.php­��›+ìZ­��Ÿ‹R¶������(���src/Composer/DependencyResolver/Pool.php°"��›+ìZ°"�� Ž%¶������+���src/Composer/DependencyResolver/Problem.php¥��›+ìZ¥��@ˆ<4¶������+���src/Composer/DependencyResolver/Request.phpƒ��›+ìZƒ��åVP„¶������(���src/Composer/DependencyResolver/Rule.php¶��›+ìZ¶��Ú{��¶������1���src/Composer/DependencyResolver/Rule2Literals.php§��›+ìZ§��~Ð'ò¶������+���src/Composer/DependencyResolver/RuleSet.phpª
  30. ��›+ìZª
  31. ��_΂¶������4���src/Composer/DependencyResolver/RuleSetGenerator.phpL��›+ìZL��¡³`¶������3���src/Composer/DependencyResolver/RuleSetIterator.php��›+ìZ��›Cü$¶������2���src/Composer/DependencyResolver/RuleWatchChain.phpi��›+ìZi��hïš,¶������2���src/Composer/DependencyResolver/RuleWatchGraph.phpá��›+ìZá��‰rôv¶������1���src/Composer/DependencyResolver/RuleWatchNode.phpé��›+ìZé��hØÑ´¶������*���src/Composer/DependencyResolver/Solver.phpŸ8��›+ìZŸ8��pöb¶������6���src/Composer/DependencyResolver/SolverBugException.php˜��›+ìZ˜��"qN¶������;���src/Composer/DependencyResolver/SolverProblemsException.phpô��›+ìZô��×|Ŧ¶������/���src/Composer/DependencyResolver/Transaction.phpÙ��›+ìZÙ��5ÖHÀ¶������-���src/Composer/Downloader/ArchiveDownloader.php³ ��›+ìZ³ ��ÖðÞŸ¶������1���src/Composer/Downloader/ChangeReportInterface.phpÌ���›+ìZÌ���¯à¨¿¶������+���src/Composer/Downloader/DownloadManager.php`��›+ìZ`��†ë�¾¶������/���src/Composer/Downloader/DownloaderInterface.phpÊ��›+ìZÊ��gs!l¶������3���src/Composer/Downloader/DvcsDownloaderInterface.phpÑ���›+ìZÑ���&Áœ¿¶������*���src/Composer/Downloader/FileDownloader.php���›+ìZ���1‚ã¶������/���src/Composer/Downloader/FilesystemException.php
  32. ��›+ìZ
  33. ��.-‹¶������,���src/Composer/Downloader/FossilDownloader.php‚ ��›+ìZ‚ ��Ü�Ii¶������)���src/Composer/Downloader/GitDownloader.phpq4��›+ìZq4��ZÎÇ׶������*���src/Composer/Downloader/GzipDownloader.phpó��›+ìZó��}Úo¶������(���src/Composer/Downloader/HgDownloader.phpj ��›+ìZj ��­ð±¶������*���src/Composer/Downloader/PathDownloader.phpK��›+ìZK��9•&c¶������0���src/Composer/Downloader/PearPackageExtractor.phpu��›+ìZu��z„‡¶������.���src/Composer/Downloader/PerforceDownloader.php§��›+ìZ§��⃨¶������*���src/Composer/Downloader/PharDownloader.phpå���›+ìZå���ÞÉç¶������)���src/Composer/Downloader/RarDownloader.phpž��›+ìZž��6 3U¶������)���src/Composer/Downloader/SvnDownloader.phpG��›+ìZG��M#j¶������)���src/Composer/Downloader/TarDownloader.phpã���›+ìZã���Í’X?¶������.���src/Composer/Downloader/TransportException.php=��›+ìZ=��ZÎÈÞ¶������9���src/Composer/Downloader/VcsCapableDownloaderInterface.phpÔ���›+ìZÔ���`§ôö¶������)���src/Composer/Downloader/VcsDownloader.php"��›+ìZ"��œŸp¶������(���src/Composer/Downloader/XzDownloader.php§��›+ìZ§��W$;á¶������)���src/Composer/Downloader/ZipDownloader.php˜��›+ìZ˜��›@ü¶������&���src/Composer/EventDispatcher/Event.php ��›+ìZ ��±™jï¶������0���src/Composer/EventDispatcher/EventDispatcher.php 2��›+ìZ 2��GKþl¶������9���src/Composer/EventDispatcher/EventSubscriberInterface.php©���›+ìZ©���h·0¶������9���src/Composer/EventDispatcher/ScriptExecutionException.phpv���›+ìZv���wZ8S¶������)���src/Composer/Exception/NoSslException.phpf���›+ìZf���ËíM�¶���������src/Composer/Factory.phpU=��›+ìZU=��%êÿí¶���������src/Composer/IO/BaseIO.phpŒ��›+ìZŒ��(‚l‘¶���������src/Composer/IO/BufferIO.php*��›+ìZ*��¢®hT¶���������src/Composer/IO/ConsoleIO.phpÛ��›+ìZÛ��M¶ã¶���������src/Composer/IO/IOInterface.phpì��›+ìZì���Õ�¶���������src/Composer/IO/NullIO.phpÀ��›+ìZÀ��F`sʶ���������src/Composer/Installer.php™���›+ìZ™���j¦õÙ¶������*���src/Composer/Installer/BinaryInstaller.phpÛ��›+ìZÛ��<x> ¶������2���src/Composer/Installer/BinaryPresenceInterface.phpË���›+ìZË���À5š¨¶������.���src/Composer/Installer/InstallationManager.php-��›+ìZ-��¾}Œ7¶������)���src/Composer/Installer/InstallerEvent.php��›+ìZ��lÔzi¶������*���src/Composer/Installer/InstallerEvents.phpÞ���›+ìZÞ���ìŸ@G¶������-���src/Composer/Installer/InstallerInterface.phpã��›+ìZã��^ƒ“ʶ������+���src/Composer/Installer/LibraryInstaller.php%��›+ìZ%�� »�̶������/���src/Composer/Installer/MetapackageInstaller.phpœ��›+ìZœ��ÆÅ!¶������(���src/Composer/Installer/NoopInstaller.php+��›+ìZ+��À·M}¶������'���src/Composer/Installer/PackageEvent.phpe��›+ìZe��;° ¶������(���src/Composer/Installer/PackageEvents.php¸��›+ìZ¸��dbØs¶������.���src/Composer/Installer/PearBinaryInstaller.phpø ��›+ìZø ��*ë•k¶������(���src/Composer/Installer/PearInstaller.php¢��›+ìZ¢��È‚¶Ñ¶������*���src/Composer/Installer/PluginInstaller.phpŸ��›+ìZŸ��<tú,¶������+���src/Composer/Installer/ProjectInstaller.php��›+ìZ��*0@P¶������4���src/Composer/Installer/SuggestedPackagesReporter.php��›+ìZ��+±]Ķ���������src/Composer/Json/JsonFile.phpï��›+ìZï��_( ¶������#���src/Composer/Json/JsonFormatter.php��›+ìZ��Ðqu¶������%���src/Composer/Json/JsonManipulator.php°2��›+ìZ°2��Žèζ������-���src/Composer/Json/JsonValidationException.php\��›+ìZ\��.Xóܶ������%���src/Composer/Package/AliasPackage.php��›+ìZ��¹—~š¶������7���src/Composer/Package/Archiver/ArchivableFilesFilter.php ��›+ìZ ��yY+¦¶������7���src/Composer/Package/Archiver/ArchivableFilesFinder.phpÞ��›+ìZÞ�� ²²¹¶������0���src/Composer/Package/Archiver/ArchiveManager.php° ��›+ìZ° ��gþÒ)¶������3���src/Composer/Package/Archiver/ArchiverInterface.php��›+ìZ��ñ´> ¶������3���src/Composer/Package/Archiver/BaseExcludeFilter.php–��›+ìZ–��y¶=ƶ������7���src/Composer/Package/Archiver/ComposerExcludeFilter.php��›+ìZ��‹SZ0¶������2���src/Composer/Package/Archiver/GitExcludeFilter.phpq��›+ìZq��5¾i&¶������1���src/Composer/Package/Archiver/HgExcludeFilter.php ��›+ìZ �� •¦S¶������.���src/Composer/Package/Archiver/PharArchiver.php>��›+ìZ>�� 5‰í¶������-���src/Composer/Package/Archiver/ZipArchiver.php¼��›+ìZ¼��‘XÝë¶������$���src/Composer/Package/BasePackage.php& ��›+ìZ& ��'ݶ������(���src/Composer/Package/CompletePackage.phpü��›+ìZü��þM˶¶������1���src/Composer/Package/CompletePackageInterface.phpõ��›+ìZõ��¦Ê�ò¶������+���src/Composer/Package/Dumper/ArrayDumper.phpë ��›+ìZë ��Ó8WE¶���������src/Composer/Package/Link.phpˆ��›+ìZˆ��å¶Y«¶������7���src/Composer/Package/LinkConstraint/EmptyConstraint.php‚��›+ìZ‚��é~‹¶������?���src/Composer/Package/LinkConstraint/LinkConstraintInterface.phpd��›+ìZd��¤ôLn¶������7���src/Composer/Package/LinkConstraint/MultiConstraint.php‚��›+ìZ‚��ób`ý¶������:���src/Composer/Package/LinkConstraint/SpecificConstraint.phpi��›+ìZi��Þ”š%¶������9���src/Composer/Package/LinkConstraint/VersionConstraint.phpX��›+ìZX��}`y¶������+���src/Composer/Package/Loader/ArrayLoader.php��›+ìZ��n~œ›¶������7���src/Composer/Package/Loader/InvalidPackageException.phpE��›+ìZE��xb¾¶������*���src/Composer/Package/Loader/JsonLoader.phpù��›+ìZù��!~ˆ{¶������/���src/Composer/Package/Loader/LoaderInterface.php²���›+ìZ²���¦}úζ������1���src/Composer/Package/Loader/RootPackageLoader.php$��›+ìZ$��Ârü°¶������5���src/Composer/Package/Loader/ValidatingArrayLoader.phpÃ6��›+ìZÃ6��*ñS¶���������src/Composer/Package/Locker.php¥!��›+ìZ¥!��ÐPyD¶������ ���src/Composer/Package/Package.phpÉ��›+ìZÉ��cÃ�h¶������)���src/Composer/Package/PackageInterface.php ��›+ìZ ��ûÇ^ƶ������)���src/Composer/Package/RootAliasPackage.php ��›+ìZ �� _€ø¶������$���src/Composer/Package/RootPackage.php��›+ìZ��ŽÎ_¶������-���src/Composer/Package/RootPackageInterface.php¹��›+ìZ¹��"maV¶������/���src/Composer/Package/Version/VersionGuesser.phpÏ��›+ìZÏ��ÌÂ߶������.���src/Composer/Package/Version/VersionParser.phpo��›+ìZo��m€;¶������0���src/Composer/Package/Version/VersionSelector.phpK ��›+ìZK ��²<ȶ������-���src/Composer/Plugin/Capability/Capability.phpW���›+ìZW���æ_¨1¶������2���src/Composer/Plugin/Capability/CommandProvider.php—���›+ìZ—���ûOâ>¶���������src/Composer/Plugin/Capable.php���›+ìZ���Æq+¶������$���src/Composer/Plugin/CommandEvent.phpâ��›+ìZâ��³ÆÇW¶������$���src/Composer/Plugin/PluginEvents.phpÂ���›+ìZÂ���^Íþ¶������'���src/Composer/Plugin/PluginInterface.phpô���›+ìZô���)'*ض������%���src/Composer/Plugin/PluginManager.php$��›+ìZ$��ëŽ"»¶������,���src/Composer/Plugin/PreFileDownloadEvent.php`��›+ìZ`���9-ζ������4���src/Composer/Question/StrictConfirmationQuestion.php��›+ìZ��'.³è¶������+���src/Composer/Repository/ArrayRepository.php��›+ìZ��éÌt�¶������.���src/Composer/Repository/ArtifactRepository.php» ��›+ìZ» ��ˆÝ÷<¶������*���src/Composer/Repository/BaseRepository.phpv ��›+ìZv ��„ÜL¶������.���src/Composer/Repository/ComposerRepository.php‡T��›+ìZ‡T��Ç“×{¶������/���src/Composer/Repository/CompositeRepository.php;��›+ìZ;��¤¯S¶������;���src/Composer/Repository/ConfigurableRepositoryInterface.php…���›+ìZ…���±Ÿ_¶������0���src/Composer/Repository/FilesystemRepository.php$��›+ìZ$��¾Ãá…¶������4���src/Composer/Repository/InstalledArrayRepository.php£���›+ìZ£���/ö~>¶������9���src/Composer/Repository/InstalledFilesystemRepository.php£���›+ìZ£���V
  34. •_¶������8���src/Composer/Repository/InstalledRepositoryInterface.php‡���›+ìZ‡���£9p¶������6���src/Composer/Repository/InvalidRepositoryException.phpn���›+ìZn���à“똶������-���src/Composer/Repository/PackageRepository.phpj��›+ìZj��¥ôò̶������*���src/Composer/Repository/PathRepository.php~
  35. ��›+ìZ~
  36. ��ˆÑ½¶������2���src/Composer/Repository/Pear/BaseChannelReader.phpI��›+ìZI��c6³¶������,���src/Composer/Repository/Pear/ChannelInfo.phpÄ��›+ìZÄ��:T*ɶ������.���src/Composer/Repository/Pear/ChannelReader.phpí��›+ìZí��?ÈYT¶������4���src/Composer/Repository/Pear/ChannelRest10Reader.php® ��›+ìZ® ��™ÖÛú¶������4���src/Composer/Repository/Pear/ChannelRest11Reader.php& ��›+ìZ& ��òUb¶������5���src/Composer/Repository/Pear/DependencyConstraint.phpq��›+ìZq��9=¶������/���src/Composer/Repository/Pear/DependencyInfo.phpq��›+ìZq��fºTò¶������8���src/Composer/Repository/Pear/PackageDependencyParser.php…��›+ìZ…��÷$Li¶������,���src/Composer/Repository/Pear/PackageInfo.php°��›+ìZ°��Ÿ ¸ ¶������,���src/Composer/Repository/Pear/ReleaseInfo.php’��›+ìZ’��o“ŠÃ¶������*���src/Composer/Repository/PearRepository.phpª��›+ìZª��)Ÿƒ}¶������.���src/Composer/Repository/PlatformRepository.php��›+ìZ��fVÉ¢¶������-���src/Composer/Repository/RepositoryFactory.php2��›+ìZ2��t>¶������/���src/Composer/Repository/RepositoryInterface.phpÛ��›+ìZÛ��’âÁ¶������-���src/Composer/Repository/RepositoryManager.php,
  37. ��›+ìZ,
  38. ��¾…\•¶������7���src/Composer/Repository/RepositorySecurityException.phpo���›+ìZo���pÕ«ª¶������/���src/Composer/Repository/Vcs/BitbucketDriver.phpô��›+ìZô��x¤ü¶������,���src/Composer/Repository/Vcs/FossilDriver.php¦��›+ìZ¦��ébîd¶������2���src/Composer/Repository/Vcs/GitBitbucketDriver.phpê��›+ìZê��ÃŽ»¶������)���src/Composer/Repository/Vcs/GitDriver.php¼��›+ìZ¼��Š©Ðê¶������,���src/Composer/Repository/Vcs/GitHubDriver.php¡+��›+ìZ¡+��ýYû
  39. ¶������,���src/Composer/Repository/Vcs/GitLabDriver.phpÍ#��›+ìZÍ#��ßNìʶ������1���src/Composer/Repository/Vcs/HgBitbucketDriver.phpä��›+ìZä��i›üà¶������(���src/Composer/Repository/Vcs/HgDriver.phpe��›+ìZe��O!O¶������.���src/Composer/Repository/Vcs/PerforceDriver.php' ��›+ìZ' ��ÙóH¶������)���src/Composer/Repository/Vcs/SvnDriver.phpˆ��›+ìZˆ��ß‚†¶������)���src/Composer/Repository/Vcs/VcsDriver.phpæ
  40. ��›+ìZæ
  41. ��eׯ-¶������2���src/Composer/Repository/Vcs/VcsDriverInterface.php÷��›+ìZ÷��ÇX[‰¶������)���src/Composer/Repository/VcsRepository.php´��›+ìZ´��ªÖG¶������3���src/Composer/Repository/WritableArrayRepository.php��›+ìZ��¾G*¶������7���src/Composer/Repository/WritableRepositoryInterface.php‰��›+ìZ‰��‘/sï¶������$���src/Composer/Script/CommandEvent.phpW���›+ìZW���£VZt¶���������src/Composer/Script/Event.phpµ��›+ìZµ��lt¦M¶������$���src/Composer/Script/PackageEvent.phpœ���›+ìZœ���§ÿÉ ¶������$���src/Composer/Script/ScriptEvents.phpP��›+ìZP��‡�¶¶������ ���src/Composer/SelfUpdate/Keys.php���›+ìZ��� îÊN¶������$���src/Composer/SelfUpdate/Versions.phpì��›+ìZì��͵‘ƒ¶������ ���src/Composer/Util/AuthHelper.phpË��›+ìZË��>zx–¶���������src/Composer/Util/Bitbucket.php%��›+ìZ%��n=gÓ¶������$���src/Composer/Util/ComposerMirror.php±��›+ìZ±��­½øض������%���src/Composer/Util/ConfigValidator.phpP��›+ìZP��ñË{'¶������"���src/Composer/Util/ErrorHandler.php‡��›+ìZ‡��He"¶������ ���src/Composer/Util/Filesystem.phpl/��›+ìZl/��Î33t¶���������src/Composer/Util/Git.php!&��›+ìZ!&��lsý׶���������src/Composer/Util/GitHub.phpÏ
  42. ��›+ìZÏ
  43. ��ÁØ\å¶���������src/Composer/Util/GitLab.php™ ��›+ìZ™ ��BLF¶���������src/Composer/Util/IniHelper.php]��›+ìZ]��®äéä¶������$���src/Composer/Util/NoProxyPattern.php¾��›+ìZ¾��Z+°m¶���������src/Composer/Util/Perforce.php‚1��›+ìZ‚1��,œbx¶���������src/Composer/Util/Platform.phpü��›+ìZü��s­fç¶������%���src/Composer/Util/ProcessExecutor.phpÚ ��›+ìZÚ ��£ÒÙ¶������&���src/Composer/Util/RemoteFilesystem.phpÊd��›+ìZÊd��pͶ���������src/Composer/Util/Silencer.phpé��›+ìZé��“Vjf¶������!���src/Composer/Util/SpdxLicense.php��›+ìZ��¾7
  44. ñ¶������*���src/Composer/Util/StreamContextFactory.php��›+ìZ��ËH*v¶���������src/Composer/Util/Svn.php&��›+ìZ&��œg¤¶���������src/Composer/Util/TlsHelper.phpp
  45. ��›+ìZp
  46. ��¤eÞæ¶���������src/Composer/Util/Url.phpÀ��›+ìZÀ��lqh¶���������src/Composer/XdebugHandler.php“��›+ìZ“��ÕWÖ>¶���������src/bootstrap.php¹��›+ìZ¹��I}œ¶������%���src/Composer/Autoload/ClassLoader.phpl4��›+ìZl4��’ø[÷¶������#���res/composer-repository-schema.jsonð��›+ìZð���GÐà¶���������res/composer-schema.json±•��›+ìZ±•��•ÑlͶ������6���vendor/composer/spdx-licenses/res/spdx-exceptions.json}��›+ìZ}��/Yž¶������4���vendor/composer/spdx-licenses/res/spdx-licenses.jsonàŒ��›+ìZàŒ��£O¶������*���vendor/seld/cli-prompt/res/hiddeninput.exe�$��›+ìZ�$��•�¥v¶������&���vendor/symfony/console/Application.php‚W��›+ìZ‚W��âPáz¶������*���vendor/symfony/console/Command/Command.phpò"��›+ìZò"��dX<ζ������.���vendor/symfony/console/Command/HelpCommand.phpØ��›+ìZØ��$Y«¶������.���vendor/symfony/console/Command/ListCommand.phpZ��›+ìZZ��É£ ¶������(���vendor/symfony/console/ConsoleEvents.phpé���›+ìZé���RÛÔe¶������<���vendor/symfony/console/Descriptor/ApplicationDescription.phpÐ��›+ìZÐ��™Ž5°¶������0���vendor/symfony/console/Descriptor/Descriptor.phpŽ��›+ìZŽ��éð8Ÿ¶������9���vendor/symfony/console/Descriptor/DescriptorInterface.phpü���›+ìZü���±Qµ¶������4���vendor/symfony/console/Descriptor/JsonDescriptor.phpá ��›+ìZá ��‡ àƶ������8���vendor/symfony/console/Descriptor/MarkdownDescriptor.php¹��›+ìZ¹��kŸ.a¶������4���vendor/symfony/console/Descriptor/TextDescriptor.php²��›+ìZ²���­ùâ¶������3���vendor/symfony/console/Descriptor/XmlDescriptor.php��›+ìZ��
  47. ]…ζ������4���vendor/symfony/console/Event/ConsoleCommandEvent.php°��›+ìZ°��!�ȶ������-���vendor/symfony/console/Event/ConsoleEvent.phpÅ��›+ìZÅ��ÒxÛ\¶������6���vendor/symfony/console/Event/ConsoleExceptionEvent.php��›+ìZ��á2é¶������6���vendor/symfony/console/Event/ConsoleTerminateEvent.phpz��›+ìZz��³,îL¶������=���vendor/symfony/console/Exception/CommandNotFoundException.phpÔ��›+ìZÔ��È÷ L¶������7���vendor/symfony/console/Exception/ExceptionInterface.phpf���›+ìZf���¡ABª¶������=���vendor/symfony/console/Exception/InvalidArgumentException.php¦���›+ìZ¦���Ö̽Z¶������;���vendor/symfony/console/Exception/InvalidOptionException.php¦���›+ìZ¦���Ë×H¶������3���vendor/symfony/console/Exception/LogicException.php’���›+ìZ’���ÍO\e¶������5���vendor/symfony/console/Exception/RuntimeException.php–���›+ìZ–���Ùí,6¶������4���vendor/symfony/console/Formatter/OutputFormatter.php2��›+ìZ2��RÌYh¶������=���vendor/symfony/console/Formatter/OutputFormatterInterface.phpŒ��›+ìZŒ��òññÀ¶������9���vendor/symfony/console/Formatter/OutputFormatterStyle.phpJ��›+ìZJ��ÏDSȶ������B���vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php„��›+ìZ„��÷½G¶������>���vendor/symfony/console/Formatter/OutputFormatterStyleStack.php>��›+ìZ>��[†¿–¶������6���vendor/symfony/console/Helper/DebugFormatterHelper.phpx��›+ìZx��N©Ø¼¶������2���vendor/symfony/console/Helper/DescriptorHelper.phpw��›+ìZw��ÅHð.¶������.���vendor/symfony/console/Helper/DialogHelper.phpú��›+ìZú�� "8m¶������1���vendor/symfony/console/Helper/FormatterHelper.phpc��›+ìZc��“ý«N¶������(���vendor/symfony/console/Helper/Helper.php¨��›+ìZ¨��œoû3¶������1���vendor/symfony/console/Helper/HelperInterface.phpå���›+ìZå���Š ¶������+���vendor/symfony/console/Helper/HelperSet.phpÉ��›+ìZÉ��?ã 2¶������2���vendor/symfony/console/Helper/InputAwareHelper.phpc��›+ìZc��ñø�|¶������/���vendor/symfony/console/Helper/ProcessHelper.phpÑ ��›+ìZÑ ��@±ã�¶������-���vendor/symfony/console/Helper/ProgressBar.phpk%��›+ìZk%��H]„ȶ������0���vendor/symfony/console/Helper/ProgressHelper.php\��›+ìZ\��èK+¶������3���vendor/symfony/console/Helper/ProgressIndicator.phpK��›+ìZK��íÍ°¶������0���vendor/symfony/console/Helper/QuestionHelper.php†��›+ìZ†��ΰù'¶������7���vendor/symfony/console/Helper/SymfonyQuestionHelper.phpl
  48. ��›+ìZl
  49. ��÷ÞL¶������'���vendor/symfony/console/Helper/Table.phpª*��›+ìZª*��í8ïM¶������+���vendor/symfony/console/Helper/TableCell.php€��›+ìZ€��Ìî*Û¶������-���vendor/symfony/console/Helper/TableHelper.php ��›+ìZ ��ƒu®¹¶������0���vendor/symfony/console/Helper/TableSeparator.phpÊ���›+ìZÊ���az¶������,���vendor/symfony/console/Helper/TableStyle.php
  50. ��›+ìZ
  51. ��PÞµ¦¶������*���vendor/symfony/console/Input/ArgvInput.php™��›+ìZ™��,»Bô¶������+���vendor/symfony/console/Input/ArrayInput.php" ��›+ìZ" ��uô™X¶������&���vendor/symfony/console/Input/Input.php¢ ��›+ìZ¢ ��”‡B"¶������.���vendor/symfony/console/Input/InputArgument.php��›+ìZ��&<¦¯¶������4���vendor/symfony/console/Input/InputAwareInterface.phpš���›+ìZš���‡jTŸ¶������0���vendor/symfony/console/Input/InputDefinition.phpŠ��›+ìZŠ��œäf²¶������/���vendor/symfony/console/Input/InputInterface.php¡��›+ìZ¡��,t^>¶������,���vendor/symfony/console/Input/InputOption.php ��›+ìZ ��ùýN4¶������,���vendor/symfony/console/Input/StringInput.php–��›+ìZ–��cì\(¶���������vendor/symfony/console/LICENSE)��›+ìZ)��NUN½¶������/���vendor/symfony/console/Logger/ConsoleLogger.php. ��›+ìZ. ��¤Œ…ζ������0���vendor/symfony/console/Output/BufferedOutput.php_��›+ìZ_��‹ >P¶������/���vendor/symfony/console/Output/ConsoleOutput.php°��›+ìZ°��]k~o¶������8���vendor/symfony/console/Output/ConsoleOutputInterface.phpà���›+ìZà���‡†Æʶ������,���vendor/symfony/console/Output/NullOutput.phpÏ��›+ìZÏ��®˜‹Z¶������(���vendor/symfony/console/Output/Output.php˜ ��›+ìZ˜ ��pf\¶������1���vendor/symfony/console/Output/OutputInterface.php��›+ìZ���ì&¶������.���vendor/symfony/console/Output/StreamOutput.php!��›+ìZ!��¼Øé¶������2���vendor/symfony/console/Question/ChoiceQuestion.phpw
  52. ��›+ìZw
  53. ��2t¶������8���vendor/symfony/console/Question/ConfirmationQuestion.phpç��›+ìZç�� ­òf¶������,���vendor/symfony/console/Question/Question.phpË ��›+ìZË ��ÒqµR¶������ ���vendor/symfony/console/Shell.phpå��›+ìZå��•šxS¶������,���vendor/symfony/console/Style/OutputStyle.php\��›+ìZ\��wפ¶������/���vendor/symfony/console/Style/StyleInterface.phpÏ��›+ìZÏ��&nÅѶ������-���vendor/symfony/console/Style/SymfonyStyle.php¶��›+ìZ¶��ª×ì¶������3���vendor/symfony/console/Tester/ApplicationTester.phpÏ��›+ìZÏ��sž9i¶������/���vendor/symfony/console/Tester/CommandTester.phpª��›+ìZª��µ.âr¶������(���vendor/symfony/debug/BufferingLogger.phpt��›+ìZt��=�hܶ���������vendor/symfony/debug/Debug.php ��›+ìZ ��ŠåÐî¶������)���vendor/symfony/debug/DebugClassLoader.php¡��›+ìZ¡��tÅÍT¶������%���vendor/symfony/debug/ErrorHandler.phpÊG��›+ìZÊG��ƒÐÁȶ������9���vendor/symfony/debug/Exception/ClassNotFoundException.php„��›+ìZ„��n�¡…¶������8���vendor/symfony/debug/Exception/ContextErrorException.php˜��›+ìZ˜��-
  54. d2¶������1���vendor/symfony/debug/Exception/DummyException.php��›+ìZ��®+Ãê¶������6���vendor/symfony/debug/Exception/FatalErrorException.phpï��›+ìZï��æ fz¶������6���vendor/symfony/debug/Exception/FatalThrowableError.phpW��›+ìZW��?àèK¶������3���vendor/symfony/debug/Exception/FlattenException.php²��›+ìZ²��HòѶ������7���vendor/symfony/debug/Exception/OutOfMemoryException.php~���›+ìZ~���ë¨oâ¶������=���vendor/symfony/debug/Exception/UndefinedFunctionException.phpˆ��›+ìZˆ��¢G‚n¶������;���vendor/symfony/debug/Exception/UndefinedMethodException.php†��›+ìZ†��¨LÚ:¶������)���vendor/symfony/debug/ExceptionHandler.php!3��›+ìZ!3�� Ïq ¶������I���vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php7��›+ìZ7��Ñj/=¶������E���vendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.php��›+ìZ��ĹBV¶������M���vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.phpu��›+ìZu��éj¶������K���vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.phpN��›+ìZN��Ço-ç¶���������vendor/symfony/debug/LICENSE)��›+ìZ)��NUN½¶������:���vendor/symfony/filesystem/Exception/ExceptionInterface.phpi���›+ìZi���$ ÿ›¶������=���vendor/symfony/filesystem/Exception/FileNotFoundException.php¼��›+ìZ¼��pí\¶¶������3���vendor/symfony/filesystem/Exception/IOException.php‡��›+ìZ‡��€ü#Ѷ������<���vendor/symfony/filesystem/Exception/IOExceptionInterface.php¦���›+ìZ¦���jÙwM¶������(���vendor/symfony/filesystem/Filesystem.phpû2��›+ìZû2��Œÿ¯�¶������!���vendor/symfony/filesystem/LICENSE)��›+ìZ)��NUN½¶������)���vendor/symfony/filesystem/LockHandler.php¢��›+ìZ¢��D‘;i¶������1���vendor/symfony/finder/Adapter/AbstractAdapter.php\ ��›+ìZ\ ��hˆB¶������5���vendor/symfony/finder/Adapter/AbstractFindAdapter.php‹��›+ìZ‹��…Ôж������2���vendor/symfony/finder/Adapter/AdapterInterface.php›��›+ìZ›��Mþ¶������0���vendor/symfony/finder/Adapter/BsdFindAdapter.php2��›+ìZ2��+Eì¶������0���vendor/symfony/finder/Adapter/GnuFindAdapter.php��›+ìZ��è„JL¶������,���vendor/symfony/finder/Adapter/PhpAdapter.phpô��›+ìZô��Þdè;¶������/���vendor/symfony/finder/Comparator/Comparator.phpŒ��›+ìZŒ��wþT¶������3���vendor/symfony/finder/Comparator/DateComparator.php#��›+ìZ#��°ζ������5���vendor/symfony/finder/Comparator/NumberComparator.php|��›+ìZ|��ITÇͶ������9���vendor/symfony/finder/Exception/AccessDeniedException.php„���›+ìZ„���½¾sœ¶������;���vendor/symfony/finder/Exception/AdapterFailureException.php¬��›+ìZ¬��wR¶������6���vendor/symfony/finder/Exception/ExceptionInterface.php„���›+ìZ„���Gz-¶������A���vendor/symfony/finder/Exception/OperationNotPermitedException.php)��›+ìZ)��x§e¶������@���vendor/symfony/finder/Exception/ShellCommandFailureException.phpº��›+ìZº��˜þ˜¶������/���vendor/symfony/finder/Expression/Expression.php��›+ìZ��i¥:Ŷ������)���vendor/symfony/finder/Expression/Glob.phpf��›+ìZf��DÞcj¶������*���vendor/symfony/finder/Expression/Regex.php��›+ìZ��ü(Ã϶������3���vendor/symfony/finder/Expression/ValueInterface.phpÍ��›+ìZÍ��\p4†¶������ ���vendor/symfony/finder/Finder.php].��›+ìZ].��dìÇ¿¶���������vendor/symfony/finder/Glob.phpK��›+ìZK��já±n¶������7���vendor/symfony/finder/Iterator/CustomFilterIterator.php[��›+ìZ[��­åW¶������:���vendor/symfony/finder/Iterator/DateRangeFilterIterator.phpx��›+ìZx��ôP¶������;���vendor/symfony/finder/Iterator/DepthRangeFilterIterator.phpî��›+ìZî��üÍ�q¶������A���vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.phpí��›+ìZí��nõH¶������4���vendor/symfony/finder/Iterator/FilePathsIterator.php ��›+ìZ ��^ÁkF¶������9���vendor/symfony/finder/Iterator/FileTypeFilterIterator.phpZ��›+ìZZ��(&ø¶������<���vendor/symfony/finder/Iterator/FilecontentFilterIterator.php5��›+ìZ5��ší¶������9���vendor/symfony/finder/Iterator/FilenameFilterIterator.phpr��›+ìZr��tu¶������1���vendor/symfony/finder/Iterator/FilterIterator.phpÃ��›+ìZÃ��š+µÞ¶������=���vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php-��›+ìZ-��ºÎÒ_¶������5���vendor/symfony/finder/Iterator/PathFilterIterator.phpÏ��›+ìZÏ��ºªÇ¶������=���vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php ��›+ìZ �� ÿ¶������:���vendor/symfony/finder/Iterator/SizeRangeFilterIterator.phpe��›+ìZe��Ÿ’áé¶������3���vendor/symfony/finder/Iterator/SortableIterator.php*��›+ìZ*��€õ´^¶���������vendor/symfony/finder/LICENSE)��›+ìZ)��NUN½¶������'���vendor/symfony/finder/Shell/Command.php? ��›+ìZ? ��¨lÊ϶������%���vendor/symfony/finder/Shell/Shell.phpp��›+ìZp��QT�¶������%���vendor/symfony/finder/SplFileInfo.phpý��›+ìZý��`ØÓ¶������(���vendor/symfony/polyfill-mbstring/LICENSE)��›+ìZ)��±íж������-���vendor/symfony/polyfill-mbstring/Mbstring.phpôB��›+ìZôB��Ì1ù¶������@���vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php2A��›+ìZ2A��½=¨¶������@���vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php¡A��›+ìZ¡A��Ú Í¶������.���vendor/symfony/polyfill-mbstring/bootstrap.phpË��›+ìZË��ó<Ë¢¶������7���vendor/symfony/process/Exception/ExceptionInterface.phpf���›+ìZf���]ö>T¶������=���vendor/symfony/process/Exception/InvalidArgumentException.php¨���›+ìZ¨���ÐÀ+_¶������3���vendor/symfony/process/Exception/LogicException.php”���›+ìZ”��� ³ãñ¶������;���vendor/symfony/process/Exception/ProcessFailedException.phpx��›+ìZx��¨Ìzy¶������=���vendor/symfony/process/Exception/ProcessTimedOutException.php��›+ìZ��﫶������5���vendor/symfony/process/Exception/RuntimeException.php˜���›+ìZ˜���¢Ø:¶������+���vendor/symfony/process/ExecutableFinder.php™��›+ìZ™��|O¿é¶���������vendor/symfony/process/LICENSE)��›+ìZ)��NUN½¶������.���vendor/symfony/process/PhpExecutableFinder.phpÅ��›+ìZÅ��Ñ�€¶������%���vendor/symfony/process/PhpProcess.phpú��›+ìZú��¯“Õ�¶������.���vendor/symfony/process/Pipes/AbstractPipes.phpX��›+ìZX�� ª¶������/���vendor/symfony/process/Pipes/PipesInterface.phpD��›+ìZD��vØ������*���vendor/symfony/process/Pipes/UnixPipes.phpÝ��›+ìZÝ��Þ˜°x¶������-���vendor/symfony/process/Pipes/WindowsPipes.php‰ ��›+ìZ‰ ��À"¢¶������"���vendor/symfony/process/Process.php£R��›+ìZ£R��ÁÜÕ(¶������)���vendor/symfony/process/ProcessBuilder.phpß
  55. ��›+ìZß
  56. ��^ƒ8¶������'���vendor/symfony/process/ProcessUtils.phpK��›+ìZK��2ÁÞg¶���������vendor/seld/jsonlint/LICENSE"��›+ìZ"��aƒsy¶������@���vendor/seld/jsonlint/src/Seld/JsonLint/DuplicateKeyException.php*��›+ìZ*��•pñ¶������5���vendor/seld/jsonlint/src/Seld/JsonLint/JsonParser.php/2��›+ìZ/2��­ß˜ö¶������0���vendor/seld/jsonlint/src/Seld/JsonLint/Lexer.php��›+ìZ��%ÿ3N¶������;���vendor/seld/jsonlint/src/Seld/JsonLint/ParsingException.php��›+ìZ��‰²ñ¶������4���vendor/seld/jsonlint/src/Seld/JsonLint/Undefined.php>���›+ìZ>���ÿqŸŸ¶���������vendor/seld/cli-prompt/LICENSE"��›+ìZ"��ˆñ?e¶������&���vendor/seld/cli-prompt/res/example.php'��›+ìZ'��I£¶������(���vendor/seld/cli-prompt/src/CliPrompt.phpC��›+ìZC��Ð}�p¶������(���vendor/justinrainbow/json-schema/LICENSE ��›+ìZ ��ºç©¶������.���vendor/justinrainbow/json-schema/demo/demo.phpñ��›+ìZñ��fC¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php¡ ��›+ìZ¡ ��†wÌl¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.php) ��›+ìZ) ��#©¶������J���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php§ ��›+ìZ§ ��›Vض������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php¼��›+ìZ¼��ÿ Qœ¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.php]��›+ìZ]��VŽU<¶������G���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.phpã ��›+ìZã ��á0;¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.php…��›+ìZ…��“TœÚ¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.phpš
  57. ��›+ìZš
  58. ��z&¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.phpÃ��›+ìZÃ��©Å¼x¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.php0 ��›+ìZ0 ��×j´˜¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.php��›+ìZ��¥wš‡¶������X���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.phpa��›+ìZa�� qö������Y���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.phpp��›+ìZp��rë¶������\���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php‰��›+ìZ‰��“µ+j¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.php&��›+ìZ&��4˜©T¶������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.php,"��›+ìZ,"��ulÙ·¶������F���vendor/justinrainbow/json-schema/src/JsonSchema/Entity/JsonPointer.phpè��›+ìZè��{N–¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ExceptionInterface.phpI���›+ìZI���%|°¶������V���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidArgumentException.php•���›+ìZ•���‹àG¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidConfigException.phpl���›+ìZl���A!L׶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaException.phpl���›+ìZl���è2÷þ¶������]���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaMediaTypeException.phpu���›+ìZu���=hç¶������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSourceUriException.phpw���›+ìZw���N-ò[¶������S���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.phpÞ��›+ìZÞ��\¸
  59. ¶������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ResourceNotFoundException.phpo���›+ìZo���píÛù¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/RuntimeException.php…���›+ìZ…���%…—¶������^���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UnresolvableJsonPointerException.php€���›+ìZ€���u-#1¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UriResolverException.phpj���›+ìZj���å>�¶������Q���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ValidationException.phpf���›+ìZf���¬¤„þ¶������K���vendor/justinrainbow/json-schema/src/JsonSchema/Iterator/ObjectIterator.phpþ��›+ìZþ��M�„õ¶������;���vendor/justinrainbow/json-schema/src/JsonSchema/Rfc3339.php ��›+ìZ ��f4÷³¶������A���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorage.phpœ ��›+ìZœ ��åfO¶������J���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorageInterface.php��›+ìZ��oŠ+}¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/AbstractRetriever.phpá���›+ìZá���[þA�¶������G���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/Curl.php¥��›+ìZ¥��Ô§Lb¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/FileGetContents.php%��›+ìZ%��5" ¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/PredefinedArray.php,��›+ìZ,��1•5þ¶������X���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php®���›+ìZ®���ÿ‹Áå¶������C���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriResolver.php ��›+ìZ ��£Ÿ)à¶������D���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriRetriever.php&��›+ìZ&��¼î‚¢¶������H���vendor/justinrainbow/json-schema/src/JsonSchema/UriResolverInterface.phpƒ���›+ìZƒ���J€¶������I���vendor/justinrainbow/json-schema/src/JsonSchema/UriRetrieverInterface.php…���›+ìZ…���íæe¶������=���vendor/justinrainbow/json-schema/src/JsonSchema/Validator.phpx��›+ìZx��eÃþ¶������%���vendor/composer/spdx-licenses/LICENSE��›+ìZ��Bhí¶������2���vendor/composer/spdx-licenses/src/SpdxLicenses.phpH��›+ìZH��͉T¶���������vendor/composer/semver/LICENSE��›+ìZ��Bhí¶������)���vendor/composer/semver/src/Comparator.php��›+ìZ��wlƒï¶������<���vendor/composer/semver/src/Constraint/AbstractConstraint.php×��›+ìZ×��õî>Ž¶������4���vendor/composer/semver/src/Constraint/Constraint.phpª ��›+ìZª ��ÇO7²¶������=���vendor/composer/semver/src/Constraint/ConstraintInterface.phpß���›+ìZß���0C,‡¶������9���vendor/composer/semver/src/Constraint/EmptyConstraint.phpé��›+ìZé��!-Ø™¶������9���vendor/composer/semver/src/Constraint/MultiConstraint.php1��›+ìZ1��í xU¶������%���vendor/composer/semver/src/Semver.phpv��›+ìZv��‹×È›¶������,���vendor/composer/semver/src/VersionParser.php¿*��›+ìZ¿*��)mƶ������!���vendor/composer/ca-bundle/LICENSE��›+ìZ��*!^`¶������*���vendor/composer/ca-bundle/src/CaBundle.php��›+ìZ��Ê ~Ķ���������vendor/psr/log/LICENSE=��›+ìZ=��p±ŽO¶������)���vendor/psr/log/Psr/Log/AbstractLogger.php;��›+ìZ;��ñ>3[¶������3���vendor/psr/log/Psr/Log/InvalidArgumentException.php`���›+ìZ`��� ˆX1¶������#���vendor/psr/log/Psr/Log/LogLevel.phpû���›+ìZû���jðñ8¶������/���vendor/psr/log/Psr/Log/LoggerAwareInterface.php|���›+ìZ|���$£ˆ¶������+���vendor/psr/log/Psr/Log/LoggerAwareTrait.php§���›+ìZ§���T½úB¶������*���vendor/psr/log/Psr/Log/LoggerInterface.phpÆ��›+ìZÆ��»sg¶������&���vendor/psr/log/Psr/Log/LoggerTrait.phpi��›+ìZi��35§Þ¶������%���vendor/psr/log/Psr/Log/NullLogger.phpž���›+ìZž���Çö������3���vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.phpü ��›+ìZü ��iq0ض���������vendor/autoload.php‚���›+ìZ‚���ù�+ˆ¶������'���vendor/composer/autoload_namespaces.phpd���›+ìZd���Z¡¦H¶������!���vendor/composer/autoload_psr4.php˜��›+ìZ˜��ž{¢¶������%���vendor/composer/autoload_classmap.phpd���›+ìZd���Z¡¦H¶������"���vendor/composer/autoload_files.phpÃ���›+ìZÃ���ÒÂür¶������!���vendor/composer/autoload_real.phpI��›+ìZI��”'*©¶������#���vendor/composer/autoload_static.php¬ ��›+ìZ¬ ��_® ¶���������vendor/composer/ClassLoader.php���›+ìZ���‚Aãd¶������(���vendor/composer/ca-bundle/res/cacert.pemJ�›+ìZJ�9îPL¶������ ���bin/composer8��›+ìZ8��8¶���������LICENSE.��›+ìZ.�� Õ¶������<?php
  60. namespace Composer\Autoload;
  61. use Composer\Config;
  62. use Composer\EventDispatcher\EventDispatcher;
  63. use Composer\Installer\InstallationManager;
  64. use Composer\IO\IOInterface;
  65. use Composer\Package\AliasPackage;
  66. use Composer\Package\PackageInterface;
  67. use Composer\Repository\InstalledRepositoryInterface;
  68. use Composer\Util\Filesystem;
  69. use Composer\Script\ScriptEvents;
  70. class AutoloadGenerator
  71. {
  72. private $eventDispatcher;
  73. private $io;
  74. private $devMode = false;
  75. private $classMapAuthoritative = false;
  76. private $apcu = false;
  77. private $runScripts = false;
  78. public function __construct(EventDispatcher $eventDispatcher, IOInterface $io = null)
  79. {
  80. $this->eventDispatcher = $eventDispatcher;
  81. $this->io = $io;
  82. }
  83. public function setDevMode($devMode = true)
  84. {
  85. $this->devMode = (bool) $devMode;
  86. }
  87. public function setClassMapAuthoritative($classMapAuthoritative)
  88. {
  89. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  90. }
  91. public function setApcu($apcu)
  92. {
  93. $this->apcu = (bool) $apcu;
  94. }
  95. public function setRunScripts($runScripts = true)
  96. {
  97. $this->runScripts = (bool) $runScripts;
  98. }
  99. public function dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '')
  100. {
  101. if ($this->classMapAuthoritative) {
  102. $scanPsr0Packages = true;
  103. }
  104. if ($this->runScripts) {
  105. $this->eventDispatcher->dispatchScript(ScriptEvents::PRE_AUTOLOAD_DUMP, $this->devMode, array(), array(
  106. 'optimize' => (bool) $scanPsr0Packages,
  107. ));
  108. }
  109. $filesystem = new Filesystem();
  110. $filesystem->ensureDirectoryExists($config->get('vendor-dir'));
  111. $basePath = $filesystem->normalizePath(realpath(realpath(getcwd())));
  112. $vendorPath = $filesystem->normalizePath(realpath(realpath($config->get('vendor-dir'))));
  113. $useGlobalIncludePath = (bool) $config->get('use-include-path');
  114. $prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
  115. $targetDir = $vendorPath.'/'.$targetDir;
  116. $filesystem->ensureDirectoryExists($targetDir);
  117. $vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
  118. $vendorPathCode52 = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathCode);
  119. $vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
  120. $appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
  121. $appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
  122. $namespacesFile = <<<EOF
  123. <?php
  124. // autoload_namespaces.php @generated by Composer
  125. \$vendorDir = $vendorPathCode52;
  126. \$baseDir = $appBaseDirCode;
  127. return array(
  128. EOF;
  129. $psr4File = <<<EOF
  130. <?php
  131. // autoload_psr4.php @generated by Composer
  132. \$vendorDir = $vendorPathCode52;
  133. \$baseDir = $appBaseDirCode;
  134. return array(
  135. EOF;
  136. $packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getCanonicalPackages());
  137. $autoloads = $this->parseAutoloads($packageMap, $mainPackage);
  138. foreach ($autoloads['psr-0'] as $namespace => $paths) {
  139. $exportedPaths = array();
  140. foreach ($paths as $path) {
  141. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  142. }
  143. $exportedPrefix = var_export($namespace, true);
  144. $namespacesFile .= " $exportedPrefix => ";
  145. $namespacesFile .= "array(".implode(', ', $exportedPaths)."),\n";
  146. }
  147. $namespacesFile .= ");\n";
  148. foreach ($autoloads['psr-4'] as $namespace => $paths) {
  149. $exportedPaths = array();
  150. foreach ($paths as $path) {
  151. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  152. }
  153. $exportedPrefix = var_export($namespace, true);
  154. $psr4File .= " $exportedPrefix => ";
  155. $psr4File .= "array(".implode(', ', $exportedPaths)."),\n";
  156. }
  157. $psr4File .= ");\n";
  158. $classmapFile = <<<EOF
  159. <?php
  160. // autoload_classmap.php @generated by Composer
  161. \$vendorDir = $vendorPathCode52;
  162. \$baseDir = $appBaseDirCode;
  163. return array(
  164. EOF;
  165. $targetDirLoader = null;
  166. $mainAutoload = $mainPackage->getAutoload();
  167. if ($mainPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
  168. $levels = substr_count($filesystem->normalizePath($mainPackage->getTargetDir()), '/') + 1;
  169. $prefixes = implode(', ', array_map(function ($prefix) {
  170. return var_export($prefix, true);
  171. }, array_keys($mainAutoload['psr-0'])));
  172. $baseDirFromTargetDirCode = $filesystem->findShortestPathCode($targetDir, $basePath, true);
  173. $targetDirLoader = <<<EOF
  174. public static function autoload(\$class)
  175. {
  176. \$dir = $baseDirFromTargetDirCode . '/';
  177. \$prefixes = array($prefixes);
  178. foreach (\$prefixes as \$prefix) {
  179. if (0 !== strpos(\$class, \$prefix)) {
  180. continue;
  181. }
  182. \$path = \$dir . implode('/', array_slice(explode('\\\\', \$class), $levels)).'.php';
  183. if (!\$path = stream_resolve_include_path(\$path)) {
  184. return false;
  185. }
  186. require \$path;
  187. return true;
  188. }
  189. }
  190. EOF;
  191. }
  192. $blacklist = null;
  193. if (!empty($autoloads['exclude-from-classmap'])) {
  194. $blacklist = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  195. }
  196. $classMap = array();
  197. if ($scanPsr0Packages) {
  198. $namespacesToScan = array();
  199. foreach (array('psr-0', 'psr-4') as $psrType) {
  200. foreach ($autoloads[$psrType] as $namespace => $paths) {
  201. $namespacesToScan[$namespace][] = array('paths' => $paths, 'type' => $psrType);
  202. }
  203. }
  204. krsort($namespacesToScan);
  205. foreach ($namespacesToScan as $namespace => $groups) {
  206. foreach ($groups as $group) {
  207. foreach ($group['paths'] as $dir) {
  208. $dir = $filesystem->normalizePath($filesystem->isAbsolutePath($dir) ? $dir : $basePath.'/'.$dir);
  209. if (!is_dir($dir)) {
  210. continue;
  211. }
  212. $namespaceFilter = $namespace === '' ? null : $namespace;
  213. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, $namespaceFilter, $classMap);
  214. }
  215. }
  216. }
  217. }
  218. foreach ($autoloads['classmap'] as $dir) {
  219. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, null, $classMap);
  220. }
  221. ksort($classMap);
  222. foreach ($classMap as $class => $code) {
  223. $classmapFile .= ' '.var_export($class, true).' => '.$code;
  224. }
  225. $classmapFile .= ");\n";
  226. if (!$suffix) {
  227. if (!$config->get('autoloader-suffix') && is_readable($vendorPath.'/autoload.php')) {
  228. $content = file_get_contents($vendorPath.'/autoload.php');
  229. if (preg_match('{ComposerAutoloaderInit([^:\s]+)::}', $content, $match)) {
  230. $suffix = $match[1];
  231. }
  232. }
  233. if (!$suffix) {
  234. $suffix = $config->get('autoloader-suffix') ?: md5(uniqid('', true));
  235. }
  236. }
  237. file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile);
  238. file_put_contents($targetDir.'/autoload_psr4.php', $psr4File);
  239. file_put_contents($targetDir.'/autoload_classmap.php', $classmapFile);
  240. $includePathFilePath = $targetDir.'/include_paths.php';
  241. if ($includePathFileContents = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  242. file_put_contents($includePathFilePath, $includePathFileContents);
  243. } elseif (file_exists($includePathFilePath)) {
  244. unlink($includePathFilePath);
  245. }
  246. $includeFilesFilePath = $targetDir.'/autoload_files.php';
  247. if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  248. file_put_contents($includeFilesFilePath, $includeFilesFileContents);
  249. } elseif (file_exists($includeFilesFilePath)) {
  250. unlink($includeFilesFilePath);
  251. }
  252. file_put_contents($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath, $staticPhpVersion));
  253. file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
  254. file_put_contents($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion));
  255. $this->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
  256. $this->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
  257. if ($this->runScripts) {
  258. $this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode, array(), array(
  259. 'optimize' => (bool) $scanPsr0Packages,
  260. ));
  261. }
  262. }
  263. private function addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist = null, $namespaceFilter = null, array $classMap = array())
  264. {
  265. foreach ($this->generateClassMap($dir, $blacklist, $namespaceFilter) as $class => $path) {
  266. $pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";
  267. if (!isset($classMap[$class])) {
  268. $classMap[$class] = $pathCode;
  269. } elseif ($this->io && $classMap[$class] !== $pathCode && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($classMap[$class].' '.$path, '\\', '/'))) {
  270. $this->io->writeError(
  271. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  272. ' was found in both "'.str_replace(array('$vendorDir . \'', "',\n"), array($vendorPath, ''), $classMap[$class]).'" and "'.$path.'", the first will be used.</warning>'
  273. );
  274. }
  275. }
  276. return $classMap;
  277. }
  278. private function generateClassMap($dir, $blacklist = null, $namespaceFilter = null, $showAmbiguousWarning = true)
  279. {
  280. return ClassMapGenerator::createMap($dir, $blacklist, $showAmbiguousWarning ? $this->io : null, $namespaceFilter);
  281. }
  282. public function buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages)
  283. {
  284. $packageMap = array(array($mainPackage, ''));
  285. foreach ($packages as $package) {
  286. if ($package instanceof AliasPackage) {
  287. continue;
  288. }
  289. $this->validatePackage($package);
  290. $packageMap[] = array(
  291. $package,
  292. $installationManager->getInstallPath($package),
  293. );
  294. }
  295. return $packageMap;
  296. }
  297. protected function validatePackage(PackageInterface $package)
  298. {
  299. $autoload = $package->getAutoload();
  300. if (!empty($autoload['psr-4']) && null !== $package->getTargetDir()) {
  301. $name = $package->getName();
  302. $package->getTargetDir();
  303. throw new \InvalidArgumentException("PSR-4 autoloading is incompatible with the target-dir property, remove the target-dir in package '$name'.");
  304. }
  305. if (!empty($autoload['psr-4'])) {
  306. foreach ($autoload['psr-4'] as $namespace => $dirs) {
  307. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  308. throw new \InvalidArgumentException("psr-4 namespaces must end with a namespace separator, '$namespace' does not, use '$namespace\\'.");
  309. }
  310. }
  311. }
  312. }
  313. public function parseAutoloads(array $packageMap, PackageInterface $mainPackage)
  314. {
  315. $mainPackageMap = array_shift($packageMap);
  316. $sortedPackageMap = $this->sortPackageMap($packageMap);
  317. $sortedPackageMap[] = $mainPackageMap;
  318. array_unshift($packageMap, $mainPackageMap);
  319. $psr0 = $this->parseAutoloadsType($packageMap, 'psr-0', $mainPackage);
  320. $psr4 = $this->parseAutoloadsType($packageMap, 'psr-4', $mainPackage);
  321. $classmap = $this->parseAutoloadsType(array_reverse($sortedPackageMap), 'classmap', $mainPackage);
  322. $files = $this->parseAutoloadsType($sortedPackageMap, 'files', $mainPackage);
  323. $exclude = $this->parseAutoloadsType($sortedPackageMap, 'exclude-from-classmap', $mainPackage);
  324. krsort($psr0);
  325. krsort($psr4);
  326. return array(
  327. 'psr-0' => $psr0,
  328. 'psr-4' => $psr4,
  329. 'classmap' => $classmap,
  330. 'files' => $files,
  331. 'exclude-from-classmap' => $exclude,
  332. );
  333. }
  334. public function createLoader(array $autoloads)
  335. {
  336. $loader = new ClassLoader();
  337. if (isset($autoloads['psr-0'])) {
  338. foreach ($autoloads['psr-0'] as $namespace => $path) {
  339. $loader->add($namespace, $path);
  340. }
  341. }
  342. if (isset($autoloads['psr-4'])) {
  343. foreach ($autoloads['psr-4'] as $namespace => $path) {
  344. $loader->addPsr4($namespace, $path);
  345. }
  346. }
  347. if (isset($autoloads['classmap'])) {
  348. $blacklist = null;
  349. if (!empty($autoloads['exclude-from-classmap'])) {
  350. $blacklist = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  351. }
  352. foreach ($autoloads['classmap'] as $dir) {
  353. try {
  354. $loader->addClassMap($this->generateClassMap($dir, $blacklist, null, false));
  355. } catch (\RuntimeException $e) {
  356. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  357. }
  358. }
  359. }
  360. return $loader;
  361. }
  362. protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  363. {
  364. $includePaths = array();
  365. foreach ($packageMap as $item) {
  366. list($package, $installPath) = $item;
  367. if (null !== $package->getTargetDir() && strlen($package->getTargetDir()) > 0) {
  368. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  369. }
  370. foreach ($package->getIncludePaths() as $includePath) {
  371. $includePath = trim($includePath, '/');
  372. $includePaths[] = empty($installPath) ? $includePath : $installPath.'/'.$includePath;
  373. }
  374. }
  375. if (!$includePaths) {
  376. return;
  377. }
  378. $includePathsCode = '';
  379. foreach ($includePaths as $path) {
  380. $includePathsCode .= " " . $this->getPathCode($filesystem, $basePath, $vendorPath, $path) . ",\n";
  381. }
  382. return <<<EOF
  383. <?php
  384. // include_paths.php @generated by Composer
  385. \$vendorDir = $vendorPathCode;
  386. \$baseDir = $appBaseDirCode;
  387. return array(
  388. $includePathsCode);
  389. EOF;
  390. }
  391. protected function getIncludeFilesFile(array $files, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  392. {
  393. $filesCode = '';
  394. foreach ($files as $fileIdentifier => $functionFile) {
  395. $filesCode .= ' ' . var_export($fileIdentifier, true) . ' => '
  396. . $this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile) . ",\n";
  397. }
  398. if (!$filesCode) {
  399. return false;
  400. }
  401. return <<<EOF
  402. <?php
  403. // autoload_files.php @generated by Composer
  404. \$vendorDir = $vendorPathCode;
  405. \$baseDir = $appBaseDirCode;
  406. return array(
  407. $filesCode);
  408. EOF;
  409. }
  410. protected function getPathCode(Filesystem $filesystem, $basePath, $vendorPath, $path)
  411. {
  412. if (!$filesystem->isAbsolutePath($path)) {
  413. $path = $basePath . '/' . $path;
  414. }
  415. $path = $filesystem->normalizePath($path);
  416. $baseDir = '';
  417. if (strpos($path.'/', $vendorPath.'/') === 0) {
  418. $path = substr($path, strlen($vendorPath));
  419. $baseDir = '$vendorDir';
  420. if ($path !== false) {
  421. $baseDir .= " . ";
  422. }
  423. } else {
  424. $path = $filesystem->normalizePath($filesystem->findShortestPath($basePath, $path, true));
  425. if (!$filesystem->isAbsolutePath($path)) {
  426. $baseDir = '$baseDir . ';
  427. $path = '/' . $path;
  428. }
  429. }
  430. if (preg_match('/\.phar.+$/', $path)) {
  431. $baseDir = "'phar://' . " . $baseDir;
  432. }
  433. return $baseDir . (($path !== false) ? var_export($path, true) : "");
  434. }
  435. protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix)
  436. {
  437. $lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode) - 1];
  438. if ("'" === $lastChar || '"' === $lastChar) {
  439. $vendorPathToTargetDirCode = substr($vendorPathToTargetDirCode, 0, -1).'/autoload_real.php'.$lastChar;
  440. } else {
  441. $vendorPathToTargetDirCode .= " . '/autoload_real.php'";
  442. }
  443. return <<<AUTOLOAD
  444. <?php
  445. // autoload.php @generated by Composer
  446. require_once $vendorPathToTargetDirCode;
  447. return ComposerAutoloaderInit$suffix::getLoader();
  448. AUTOLOAD;
  449. }
  450. protected function getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $useIncludeFiles, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion = 70000)
  451. {
  452. $file = <<<HEADER
  453. <?php
  454. // autoload_real.php @generated by Composer
  455. class ComposerAutoloaderInit$suffix
  456. {
  457. private static \$loader;
  458. public static function loadClassLoader(\$class)
  459. {
  460. if ('Composer\\Autoload\\ClassLoader' === \$class) {
  461. require __DIR__ . '/ClassLoader.php';
  462. }
  463. }
  464. public static function getLoader()
  465. {
  466. if (null !== self::\$loader) {
  467. return self::\$loader;
  468. }
  469. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true, $prependAutoloader);
  470. self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader();
  471. spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
  472. HEADER;
  473. if ($useIncludePath) {
  474. $file .= <<<'INCLUDE_PATH'
  475. $includePaths = require __DIR__ . '/include_paths.php';
  476. $includePaths[] = get_include_path();
  477. set_include_path(implode(PATH_SEPARATOR, $includePaths));
  478. INCLUDE_PATH;
  479. }
  480. $file .= <<<STATIC_INIT
  481. \$useStaticLoader = PHP_VERSION_ID >= $staticPhpVersion && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  482. if (\$useStaticLoader) {
  483. require_once __DIR__ . '/autoload_static.php';
  484. call_user_func(\Composer\Autoload\ComposerStaticInit$suffix::getInitializer(\$loader));
  485. } else {
  486. STATIC_INIT;
  487. if (!$this->classMapAuthoritative) {
  488. $file .= <<<'PSR04'
  489. $map = require __DIR__ . '/autoload_namespaces.php';
  490. foreach ($map as $namespace => $path) {
  491. $loader->set($namespace, $path);
  492. }
  493. $map = require __DIR__ . '/autoload_psr4.php';
  494. foreach ($map as $namespace => $path) {
  495. $loader->setPsr4($namespace, $path);
  496. }
  497. PSR04;
  498. }
  499. if ($useClassMap) {
  500. $file .= <<<'CLASSMAP'
  501. $classMap = require __DIR__ . '/autoload_classmap.php';
  502. if ($classMap) {
  503. $loader->addClassMap($classMap);
  504. }
  505. CLASSMAP;
  506. }
  507. $file .= " }\n\n";
  508. if ($this->classMapAuthoritative) {
  509. $file .= <<<'CLASSMAPAUTHORITATIVE'
  510. $loader->setClassMapAuthoritative(true);
  511. CLASSMAPAUTHORITATIVE;
  512. }
  513. if ($this->apcu) {
  514. $apcuPrefix = substr(base64_encode(md5(uniqid('', true), true)), 0, -3);
  515. $file .= <<<APCU
  516. \$loader->setApcuPrefix('$apcuPrefix');
  517. APCU;
  518. }
  519. if ($useGlobalIncludePath) {
  520. $file .= <<<'INCLUDEPATH'
  521. $loader->setUseIncludePath(true);
  522. INCLUDEPATH;
  523. }
  524. if ($targetDirLoader) {
  525. $file .= <<<REGISTER_TARGET_DIR_AUTOLOAD
  526. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'autoload'), true, true);
  527. REGISTER_TARGET_DIR_AUTOLOAD;
  528. }
  529. $file .= <<<REGISTER_LOADER
  530. \$loader->register($prependAutoloader);
  531. REGISTER_LOADER;
  532. if ($useIncludeFiles) {
  533. $file .= <<<INCLUDE_FILES
  534. if (\$useStaticLoader) {
  535. \$includeFiles = Composer\Autoload\ComposerStaticInit$suffix::\$files;
  536. } else {
  537. \$includeFiles = require __DIR__ . '/autoload_files.php';
  538. }
  539. foreach (\$includeFiles as \$fileIdentifier => \$file) {
  540. composerRequire$suffix(\$fileIdentifier, \$file);
  541. }
  542. INCLUDE_FILES;
  543. }
  544. $file .= <<<METHOD_FOOTER
  545. return \$loader;
  546. }
  547. METHOD_FOOTER;
  548. $file .= $targetDirLoader;
  549. if ($useIncludeFiles) {
  550. return $file . <<<FOOTER
  551. }
  552. function composerRequire$suffix(\$fileIdentifier, \$file)
  553. {
  554. if (empty(\$GLOBALS['__composer_autoload_files'][\$fileIdentifier])) {
  555. require \$file;
  556. \$GLOBALS['__composer_autoload_files'][\$fileIdentifier] = true;
  557. }
  558. }
  559. FOOTER;
  560. }
  561. return $file . <<<FOOTER
  562. }
  563. FOOTER;
  564. }
  565. protected function getStaticFile($suffix, $targetDir, $vendorPath, $basePath, &$staticPhpVersion)
  566. {
  567. $staticPhpVersion = 50600;
  568. $file = <<<HEADER
  569. <?php
  570. // autoload_static.php @generated by Composer
  571. namespace Composer\Autoload;
  572. class ComposerStaticInit$suffix
  573. {
  574. HEADER;
  575. $loader = new ClassLoader();
  576. $map = require $targetDir . '/autoload_namespaces.php';
  577. foreach ($map as $namespace => $path) {
  578. $loader->set($namespace, $path);
  579. }
  580. $map = require $targetDir . '/autoload_psr4.php';
  581. foreach ($map as $namespace => $path) {
  582. $loader->setPsr4($namespace, $path);
  583. }
  584. $classMap = require $targetDir . '/autoload_classmap.php';
  585. if ($classMap) {
  586. $loader->addClassMap($classMap);
  587. }
  588. $filesystem = new Filesystem();
  589. $vendorPathCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  590. $appBaseDirCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  591. $absoluteVendorPathCode = ' => ' . substr(var_export(rtrim($vendorDir, '\\/') . '/', true), 0, -1);
  592. $absoluteAppBaseDirCode = ' => ' . substr(var_export(rtrim($baseDir, '\\/') . '/', true), 0, -1);
  593. $initializer = '';
  594. $prefix = "\0Composer\Autoload\ClassLoader\0";
  595. $prefixLen = strlen($prefix);
  596. if (file_exists($targetDir . '/autoload_files.php')) {
  597. $maps = array('files' => require $targetDir . '/autoload_files.php');
  598. } else {
  599. $maps = array();
  600. }
  601. foreach ((array) $loader as $prop => $value) {
  602. if ($value && 0 === strpos($prop, $prefix)) {
  603. $maps[substr($prop, $prefixLen)] = $value;
  604. }
  605. }
  606. foreach ($maps as $prop => $value) {
  607. if (count($value) > 32767) {
  608. $staticPhpVersion = 70000;
  609. }
  610. $value = var_export($value, true);
  611. $value = str_replace($absoluteVendorPathCode, $vendorPathCode, $value);
  612. $value = str_replace($absoluteAppBaseDirCode, $appBaseDirCode, $value);
  613. $value = ltrim(preg_replace('/^ */m', ' $0$0', $value));
  614. $file .= sprintf(" public static $%s = %s;\n\n", $prop, $value);
  615. if ('files' !== $prop) {
  616. $initializer .= " \$loader->$prop = ComposerStaticInit$suffix::\$$prop;\n";
  617. }
  618. }
  619. return $file . <<<INITIALIZER
  620. public static function getInitializer(ClassLoader \$loader)
  621. {
  622. return \Closure::bind(function () use (\$loader) {
  623. $initializer
  624. }, null, ClassLoader::class);
  625. }
  626. }
  627. INITIALIZER;
  628. }
  629. protected function parseAutoloadsType(array $packageMap, $type, PackageInterface $mainPackage)
  630. {
  631. $autoloads = array();
  632. foreach ($packageMap as $item) {
  633. list($package, $installPath) = $item;
  634. $autoload = $package->getAutoload();
  635. if ($this->devMode && $package === $mainPackage) {
  636. $autoload = array_merge_recursive($autoload, $package->getDevAutoload());
  637. }
  638. if (!isset($autoload[$type]) || !is_array($autoload[$type])) {
  639. continue;
  640. }
  641. if (null !== $package->getTargetDir() && $package !== $mainPackage) {
  642. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  643. }
  644. foreach ($autoload[$type] as $namespace => $paths) {
  645. foreach ((array) $paths as $path) {
  646. if (($type === 'files' || $type === 'classmap' || $type === 'exclude-from-classmap') && $package->getTargetDir() && !is_readable($installPath.'/'.$path)) {
  647. if ($package === $mainPackage) {
  648. $targetDir = str_replace('\\<dirsep\\>', '[\\\\/]', preg_quote(str_replace(array('/', '\\'), '<dirsep>', $package->getTargetDir())));
  649. $path = ltrim(preg_replace('{^'.$targetDir.'}', '', ltrim($path, '\\/')), '\\/');
  650. } else {
  651. $path = $package->getTargetDir() . '/' . $path;
  652. }
  653. }
  654. if ($type === 'exclude-from-classmap') {
  655. $path = preg_replace('{/+}', '/', preg_quote(trim(strtr($path, '\\', '/'), '/')));
  656. $path = str_replace('\\*\\*', '.+?', $path);
  657. $path = str_replace('\\*', '[^/]+?', $path);
  658. $updir = null;
  659. $path = preg_replace_callback(
  660. '{^((?:(?:\\\\\\.){1,2}+/)+)}',
  661. function ($matches) use (&$updir) {
  662. if (isset($matches[1])) {
  663. $updir = str_replace('\\.', '.', $matches[1]);
  664. }
  665. return '';
  666. },
  667. $path
  668. );
  669. if (empty($installPath)) {
  670. $installPath = strtr(getcwd(), '\\', '/');
  671. }
  672. $resolvedPath = realpath($installPath . '/' . $updir);
  673. $autoloads[] = preg_quote(strtr($resolvedPath, '\\', '/')) . '/' . $path;
  674. continue;
  675. }
  676. $relativePath = empty($installPath) ? (empty($path) ? '.' : $path) : $installPath.'/'.$path;
  677. if ($type === 'files') {
  678. $autoloads[$this->getFileIdentifier($package, $path)] = $relativePath;
  679. continue;
  680. } elseif ($type === 'classmap') {
  681. $autoloads[] = $relativePath;
  682. continue;
  683. }
  684. $autoloads[$namespace][] = $relativePath;
  685. }
  686. }
  687. }
  688. return $autoloads;
  689. }
  690. protected function getFileIdentifier(PackageInterface $package, $path)
  691. {
  692. return md5($package->getName() . ':' . $path);
  693. }
  694. protected function sortPackageMap(array $packageMap)
  695. {
  696. $packages = array();
  697. $paths = array();
  698. $usageList = array();
  699. foreach ($packageMap as $item) {
  700. list($package, $path) = $item;
  701. $name = $package->getName();
  702. $packages[$name] = $package;
  703. $paths[$name] = $path;
  704. foreach (array_merge($package->getRequires(), $package->getDevRequires()) as $link) {
  705. $target = $link->getTarget();
  706. $usageList[$target][] = $name;
  707. }
  708. }
  709. $computing = array();
  710. $computed = array();
  711. $computeImportance = function ($name) use (&$computeImportance, &$computing, &$computed, $usageList) {
  712. if (isset($computed[$name])) {
  713. return $computed[$name];
  714. }
  715. if (isset($computing[$name])) {
  716. return 0;
  717. }
  718. $computing[$name] = true;
  719. $weight = 0;
  720. if (isset($usageList[$name])) {
  721. foreach ($usageList[$name] as $user) {
  722. $weight -= 1 - $computeImportance($user);
  723. }
  724. }
  725. unset($computing[$name]);
  726. $computed[$name] = $weight;
  727. return $weight;
  728. };
  729. $weightList = array();
  730. foreach ($packages as $name => $package) {
  731. $weight = $computeImportance($name);
  732. $weightList[$name] = $weight;
  733. }
  734. $stable_sort = function (&$array) {
  735. static $transform, $restore;
  736. $i = 0;
  737. if (!$transform) {
  738. $transform = function (&$v, $k) use (&$i) {
  739. $v = array($v, ++$i, $k, $v);
  740. };
  741. $restore = function (&$v, $k) {
  742. $v = $v[3];
  743. };
  744. }
  745. array_walk($array, $transform);
  746. asort($array);
  747. array_walk($array, $restore);
  748. };
  749. $stable_sort($weightList);
  750. $sortedPackageMap = array();
  751. foreach (array_keys($weightList) as $name) {
  752. $sortedPackageMap[] = array($packages[$name], $paths[$name]);
  753. }
  754. return $sortedPackageMap;
  755. }
  756. protected function safeCopy($source, $target)
  757. {
  758. $source = fopen($source, 'r');
  759. $target = fopen($target, 'w+');
  760. stream_copy_to_stream($source, $target);
  761. fclose($source);
  762. fclose($target);
  763. }
  764. }
  765. <?php
  766. namespace Composer\Autoload;
  767. use Symfony\Component\Finder\Finder;
  768. use Composer\IO\IOInterface;
  769. use Composer\Util\Filesystem;
  770. class ClassMapGenerator
  771. {
  772. public static function dump($dirs, $file)
  773. {
  774. $maps = array();
  775. foreach ($dirs as $dir) {
  776. $maps = array_merge($maps, static::createMap($dir));
  777. }
  778. file_put_contents($file, sprintf('<?php return %s;', var_export($maps, true)));
  779. }
  780. public static function createMap($path, $blacklist = null, IOInterface $io = null, $namespace = null)
  781. {
  782. if (is_string($path)) {
  783. if (is_file($path)) {
  784. $path = array(new \SplFileInfo($path));
  785. } elseif (is_dir($path)) {
  786. $path = Finder::create()->files()->followLinks()->name('/\.(php|inc|hh)$/')->in($path);
  787. } else {
  788. throw new \RuntimeException(
  789. 'Could not scan for classes inside "'.$path.
  790. '" which does not appear to be a file nor a folder'
  791. );
  792. }
  793. }
  794. $map = array();
  795. $filesystem = new Filesystem();
  796. $cwd = realpath(getcwd());
  797. foreach ($path as $file) {
  798. $filePath = $file->getPathname();
  799. if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), array('php', 'inc', 'hh'))) {
  800. continue;
  801. }
  802. if (!$filesystem->isAbsolutePath($filePath)) {
  803. $filePath = $cwd . '/' . $filePath;
  804. $filePath = $filesystem->normalizePath($filePath);
  805. } else {
  806. $filePath = preg_replace('{[\\\\/]{2,}}', '/', $filePath);
  807. }
  808. if ($blacklist && preg_match($blacklist, strtr(realpath($filePath), '\\', '/'))) {
  809. continue;
  810. }
  811. if ($blacklist && preg_match($blacklist, strtr($filePath, '\\', '/'))) {
  812. continue;
  813. }
  814. $classes = self::findClasses($filePath);
  815. foreach ($classes as $class) {
  816. if (null !== $namespace && 0 !== strpos($class, $namespace)) {
  817. continue;
  818. }
  819. if (!isset($map[$class])) {
  820. $map[$class] = $filePath;
  821. } elseif ($io && $map[$class] !== $filePath && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($map[$class].' '.$filePath, '\\', '/'))) {
  822. $io->writeError(
  823. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  824. ' was found in both "'.$map[$class].'" and "'.$filePath.'", the first will be used.</warning>'
  825. );
  826. }
  827. }
  828. }
  829. return $map;
  830. }
  831. private static function findClasses($path)
  832. {
  833. $extraTypes = PHP_VERSION_ID < 50400 ? '' : '|trait';
  834. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>=')) {
  835. $extraTypes .= '|enum';
  836. }
  837. $contents = @php_strip_whitespace($path);
  838. if (!$contents) {
  839. if (!file_exists($path)) {
  840. $message = 'File at "%s" does not exist, check your classmap definitions';
  841. } elseif (!is_readable($path)) {
  842. $message = 'File at "%s" is not readable, check its permissions';
  843. } elseif ('' === trim(file_get_contents($path))) {
  844. return array();
  845. } else {
  846. $message = 'File at "%s" could not be parsed as PHP, it may be binary or corrupted';
  847. }
  848. $error = error_get_last();
  849. if (isset($error['message'])) {
  850. $message .= PHP_EOL . 'The following message may be helpful:' . PHP_EOL . $error['message'];
  851. }
  852. throw new \RuntimeException(sprintf($message, $path));
  853. }
  854. if (!preg_match('{\b(?:class|interface'.$extraTypes.')\s}i', $contents)) {
  855. return array();
  856. }
  857. $contents = preg_replace('{<<<\s*(\'?)(\w+)\\1(?:\r\n|\n|\r)(?:.*?)(?:\r\n|\n|\r)\\2(?=\r\n|\n|\r|;)}s', 'null', $contents);
  858. $contents = preg_replace('{"[^"\\\\]*+(\\\\.[^"\\\\]*+)*+"|\'[^\'\\\\]*+(\\\\.[^\'\\\\]*+)*+\'}s', 'null', $contents);
  859. if (substr($contents, 0, 2) !== '<?') {
  860. $contents = preg_replace('{^.+?<\?}s', '<?', $contents, 1, $replacements);
  861. if ($replacements === 0) {
  862. return array();
  863. }
  864. }
  865. $contents = preg_replace('{\?>.+<\?}s', '?><?', $contents);
  866. $pos = strrpos($contents, '?>');
  867. if (false !== $pos && false === strpos(substr($contents, $pos), '<?')) {
  868. $contents = substr($contents, 0, $pos);
  869. }
  870. if (preg_match('{(<\?)(?!(php|hh))}i', $contents)) {
  871. $contents = preg_replace('{//.* | /\*(?:[^*]++|\*(?!/))*\*/}x', '', $contents);
  872. }
  873. preg_match_all('{
  874. (?:
  875. \b(?<![\$:>])(?P<type>class|interface'.$extraTypes.') \s++ (?P<name>[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+)
  876. | \b(?<![\$:>])(?P<ns>namespace) (?P<nsname>\s++[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\s*+\\\\\s*+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)*+)? \s*+ [\{;]
  877. )
  878. }ix', $contents, $matches);
  879. $classes = array();
  880. $namespace = '';
  881. for ($i = 0, $len = count($matches['type']); $i < $len; $i++) {
  882. if (!empty($matches['ns'][$i])) {
  883. $namespace = str_replace(array(' ', "\t", "\r", "\n"), '', $matches['nsname'][$i]) . '\\';
  884. } else {
  885. $name = $matches['name'][$i];
  886. if ($name === 'extends' || $name === 'implements') {
  887. continue;
  888. }
  889. if ($name[0] === ':') {
  890. $name = 'xhp'.substr(str_replace(array('-', ':'), array('_', '__'), $name), 1);
  891. } elseif ($matches['type'][$i] === 'enum') {
  892. $name = rtrim($name, ':');
  893. }
  894. $classes[] = ltrim($namespace . $name, '\\');
  895. }
  896. }
  897. return $classes;
  898. }
  899. }
  900. <?php
  901. namespace Composer;
  902. use Composer\IO\IOInterface;
  903. use Composer\Util\Filesystem;
  904. use Composer\Util\Silencer;
  905. use Symfony\Component\Finder\Finder;
  906. class Cache
  907. {
  908. private static $cacheCollected = false;
  909. private $io;
  910. private $root;
  911. private $enabled = true;
  912. private $whitelist;
  913. private $filesystem;
  914. public function __construct(IOInterface $io, $cacheDir, $whitelist = 'a-z0-9.', Filesystem $filesystem = null)
  915. {
  916. $this->io = $io;
  917. $this->root = rtrim($cacheDir, '/\\') . '/';
  918. $this->whitelist = $whitelist;
  919. $this->filesystem = $filesystem ?: new Filesystem();
  920. if (preg_match('{(^|[\\\\/])(\$null|NUL|/dev/null)([\\\\/]|$)}', $cacheDir)) {
  921. $this->enabled = false;
  922. return;
  923. }
  924. if (
  925. (!is_dir($this->root) && !Silencer::call('mkdir', $this->root, 0777, true))
  926. || !is_writable($this->root)
  927. ) {
  928. $this->io->writeError('<warning>Cannot create cache directory ' . $this->root . ', or directory is not writable. Proceeding without cache</warning>');
  929. $this->enabled = false;
  930. }
  931. }
  932. public function isEnabled()
  933. {
  934. return $this->enabled;
  935. }
  936. public function getRoot()
  937. {
  938. return $this->root;
  939. }
  940. public function read($file)
  941. {
  942. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  943. if ($this->enabled && file_exists($this->root . $file)) {
  944. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  945. return file_get_contents($this->root . $file);
  946. }
  947. return false;
  948. }
  949. public function write($file, $contents)
  950. {
  951. if ($this->enabled) {
  952. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  953. $this->io->writeError('Writing '.$this->root . $file.' into cache', true, IOInterface::DEBUG);
  954. try {
  955. return file_put_contents($this->root . $file, $contents);
  956. } catch (\ErrorException $e) {
  957. $this->io->writeError('<warning>Failed to write into cache: '.$e->getMessage().'</warning>', true, IOInterface::DEBUG);
  958. if (preg_match('{^file_put_contents\(\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) {
  959. unlink($this->root . $file);
  960. $message = sprintf(
  961. '<warning>Writing %1$s into cache failed after %2$u of %3$u bytes written, only %4$u bytes of free space available</warning>',
  962. $this->root . $file,
  963. $m[1],
  964. $m[2],
  965. @disk_free_space($this->root . dirname($file))
  966. );
  967. $this->io->writeError($message);
  968. return false;
  969. }
  970. throw $e;
  971. }
  972. }
  973. return false;
  974. }
  975. public function copyFrom($file, $source)
  976. {
  977. if ($this->enabled) {
  978. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  979. $this->filesystem->ensureDirectoryExists(dirname($this->root . $file));
  980. if (!file_exists($source)) {
  981. $this->io->writeError('<error>'.$source.' does not exist, can not write into cache</error>');
  982. } elseif ($this->io->isDebug()) {
  983. $this->io->writeError('Writing '.$this->root . $file.' into cache from '.$source);
  984. }
  985. return copy($source, $this->root . $file);
  986. }
  987. return false;
  988. }
  989. public function copyTo($file, $target)
  990. {
  991. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  992. if ($this->enabled && file_exists($this->root . $file)) {
  993. try {
  994. touch($this->root . $file, filemtime($this->root . $file), time());
  995. } catch (\ErrorException $e) {
  996. Silencer::call('touch', $this->root . $file);
  997. }
  998. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  999. return copy($this->root . $file, $target);
  1000. }
  1001. return false;
  1002. }
  1003. public function gcIsNecessary()
  1004. {
  1005. return (!self::$cacheCollected && !mt_rand(0, 50));
  1006. }
  1007. public function remove($file)
  1008. {
  1009. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1010. if ($this->enabled && file_exists($this->root . $file)) {
  1011. return $this->filesystem->unlink($this->root . $file);
  1012. }
  1013. return false;
  1014. }
  1015. public function clear()
  1016. {
  1017. if ($this->enabled) {
  1018. return $this->filesystem->removeDirectory($this->root);
  1019. }
  1020. return false;
  1021. }
  1022. public function gc($ttl, $maxSize)
  1023. {
  1024. if ($this->enabled) {
  1025. $expire = new \DateTime();
  1026. $expire->modify('-'.$ttl.' seconds');
  1027. $finder = $this->getFinder()->date('until '.$expire->format('Y-m-d H:i:s'));
  1028. foreach ($finder as $file) {
  1029. $this->filesystem->unlink($file->getPathname());
  1030. }
  1031. $totalSize = $this->filesystem->size($this->root);
  1032. if ($totalSize > $maxSize) {
  1033. $iterator = $this->getFinder()->sortByAccessedTime()->getIterator();
  1034. while ($totalSize > $maxSize && $iterator->valid()) {
  1035. $filepath = $iterator->current()->getPathname();
  1036. $totalSize -= $this->filesystem->size($filepath);
  1037. $this->filesystem->unlink($filepath);
  1038. $iterator->next();
  1039. }
  1040. }
  1041. self::$cacheCollected = true;
  1042. return true;
  1043. }
  1044. return false;
  1045. }
  1046. public function sha1($file)
  1047. {
  1048. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1049. if ($this->enabled && file_exists($this->root . $file)) {
  1050. return sha1_file($this->root . $file);
  1051. }
  1052. return false;
  1053. }
  1054. public function sha256($file)
  1055. {
  1056. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1057. if ($this->enabled && file_exists($this->root . $file)) {
  1058. return hash_file('sha256', $this->root . $file);
  1059. }
  1060. return false;
  1061. }
  1062. protected function getFinder()
  1063. {
  1064. return Finder::create()->in($this->root)->files();
  1065. }
  1066. }
  1067. <?php
  1068. namespace Composer\Command;
  1069. use Symfony\Component\Console\Input\InputInterface;
  1070. use Symfony\Component\Console\Output\OutputInterface;
  1071. class AboutCommand extends BaseCommand
  1072. {
  1073. protected function configure()
  1074. {
  1075. $this
  1076. ->setName('about')
  1077. ->setDescription('Shows the short information about Composer.')
  1078. ->setHelp(<<<EOT
  1079. <info>php composer.phar about</info>
  1080. EOT
  1081. )
  1082. ;
  1083. }
  1084. protected function execute(InputInterface $input, OutputInterface $output)
  1085. {
  1086. $this->getIO()->write(<<<EOT
  1087. <info>Composer - Package Management for PHP</info>
  1088. <comment>Composer is a dependency manager tracking local dependencies of your projects and libraries.
  1089. See https://getcomposer.org/ for more information.</comment>
  1090. EOT
  1091. );
  1092. }
  1093. }
  1094. <?php
  1095. namespace Composer\Command;
  1096. use Composer\Factory;
  1097. use Composer\IO\IOInterface;
  1098. use Composer\Config;
  1099. use Composer\Composer;
  1100. use Composer\Repository\CompositeRepository;
  1101. use Composer\Repository\RepositoryFactory;
  1102. use Composer\Script\ScriptEvents;
  1103. use Composer\Plugin\CommandEvent;
  1104. use Composer\Plugin\PluginEvents;
  1105. use Composer\Util\Filesystem;
  1106. use Symfony\Component\Console\Input\InputArgument;
  1107. use Symfony\Component\Console\Input\InputInterface;
  1108. use Symfony\Component\Console\Input\InputOption;
  1109. use Symfony\Component\Console\Output\OutputInterface;
  1110. class ArchiveCommand extends BaseCommand
  1111. {
  1112. protected function configure()
  1113. {
  1114. $this
  1115. ->setName('archive')
  1116. ->setDescription('Creates an archive of this composer package.')
  1117. ->setDefinition(array(
  1118. new InputArgument('package', InputArgument::OPTIONAL, 'The package to archive instead of the current project'),
  1119. new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'),
  1120. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the resulting archive: tar or zip'),
  1121. new InputOption('dir', null, InputOption::VALUE_REQUIRED, 'Write the archive to this directory'),
  1122. new InputOption('file', null, InputOption::VALUE_REQUIRED, 'Write the archive with the given file name.'
  1123. .' Note that the format will be appended.'),
  1124. new InputOption('ignore-filters', false, InputOption::VALUE_NONE, 'Ignore filters when saving package'),
  1125. ))
  1126. ->setHelp(<<<EOT
  1127. The <info>archive</info> command creates an archive of the specified format
  1128. containing the files and directories of the Composer project or the specified
  1129. package in the specified version and writes it to the specified directory.
  1130. <info>php composer.phar archive [--format=zip] [--dir=/foo] [package [version]]</info>
  1131. EOT
  1132. )
  1133. ;
  1134. }
  1135. protected function execute(InputInterface $input, OutputInterface $output)
  1136. {
  1137. $config = Factory::createConfig();
  1138. $composer = $this->getComposer(false);
  1139. if ($composer) {
  1140. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'archive', $input, $output);
  1141. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  1142. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_ARCHIVE_CMD);
  1143. }
  1144. if (null === $input->getOption('format')) {
  1145. $input->setOption('format', $config->get('archive-format'));
  1146. }
  1147. if (null === $input->getOption('dir')) {
  1148. $input->setOption('dir', $config->get('archive-dir'));
  1149. }
  1150. $returnCode = $this->archive(
  1151. $this->getIO(),
  1152. $config,
  1153. $input->getArgument('package'),
  1154. $input->getArgument('version'),
  1155. $input->getOption('format'),
  1156. $input->getOption('dir'),
  1157. $input->getOption('file'),
  1158. $input->getOption('ignore-filters'),
  1159. $composer
  1160. );
  1161. if (0 === $returnCode && $composer) {
  1162. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ARCHIVE_CMD);
  1163. }
  1164. return $returnCode;
  1165. }
  1166. protected function archive(IOInterface $io, Config $config, $packageName = null, $version = null, $format = 'tar', $dest = '.', $fileName = null, $ignoreFilters = false, Composer $composer = null)
  1167. {
  1168. if ($composer) {
  1169. $archiveManager = $composer->getArchiveManager();
  1170. } else {
  1171. $factory = new Factory;
  1172. $downloadManager = $factory->createDownloadManager($io, $config);
  1173. $archiveManager = $factory->createArchiveManager($config, $downloadManager);
  1174. }
  1175. if ($packageName) {
  1176. $package = $this->selectPackage($io, $packageName, $version);
  1177. if (!$package) {
  1178. return 1;
  1179. }
  1180. } else {
  1181. $package = $this->getComposer()->getPackage();
  1182. }
  1183. $io->writeError('<info>Creating the archive into "'.$dest.'".</info>');
  1184. $packagePath = $archiveManager->archive($package, $format, $dest, $fileName, $ignoreFilters);
  1185. $fs = new Filesystem;
  1186. $shortPath = $fs->findShortestPath(getcwd(), $packagePath, true);
  1187. $io->writeError('Created: ', false);
  1188. $io->write(strlen($shortPath) < strlen($packagePath) ? $shortPath : $packagePath);
  1189. return 0;
  1190. }
  1191. protected function selectPackage(IOInterface $io, $packageName, $version = null)
  1192. {
  1193. $io->writeError('<info>Searching for the specified package.</info>');
  1194. if ($composer = $this->getComposer(false)) {
  1195. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  1196. $repo = new CompositeRepository(array_merge(array($localRepo), $composer->getRepositoryManager()->getRepositories()));
  1197. } else {
  1198. $defaultRepos = RepositoryFactory::defaultRepos($this->getIO());
  1199. $io->writeError('No composer.json found in the current directory, searching packages from ' . implode(', ', array_keys($defaultRepos)));
  1200. $repo = new CompositeRepository($defaultRepos);
  1201. }
  1202. $packages = $repo->findPackages($packageName, $version);
  1203. if (count($packages) > 1) {
  1204. $package = reset($packages);
  1205. $io->writeError('<info>Found multiple matches, selected '.$package->getPrettyString().'.</info>');
  1206. $io->writeError('Alternatives were '.implode(', ', array_map(function ($p) {
  1207. return $p->getPrettyString();
  1208. }, $packages)).'.');
  1209. $io->writeError('<comment>Please use a more specific constraint to pick a different package.</comment>');
  1210. } elseif ($packages) {
  1211. $package = reset($packages);
  1212. $io->writeError('<info>Found an exact match '.$package->getPrettyString().'.</info>');
  1213. } else {
  1214. $io->writeError('<error>Could not find a package matching '.$packageName.'.</error>');
  1215. return false;
  1216. }
  1217. return $package;
  1218. }
  1219. }
  1220. <?php
  1221. namespace Composer\Command;
  1222. use Composer\Composer;
  1223. use Composer\Config;
  1224. use Composer\Console\Application;
  1225. use Composer\IO\IOInterface;
  1226. use Composer\IO\NullIO;
  1227. use Symfony\Component\Console\Input\InputInterface;
  1228. use Symfony\Component\Console\Output\OutputInterface;
  1229. use Symfony\Component\Console\Command\Command;
  1230. abstract class BaseCommand extends Command
  1231. {
  1232. private $composer;
  1233. private $io;
  1234. public function getComposer($required = true, $disablePlugins = null)
  1235. {
  1236. if (null === $this->composer) {
  1237. $application = $this->getApplication();
  1238. if ($application instanceof Application) {
  1239. $this->composer = $application->getComposer($required, $disablePlugins);
  1240. } elseif ($required) {
  1241. throw new \RuntimeException(
  1242. 'Could not create a Composer\Composer instance, you must inject '.
  1243. 'one if this command is not used with a Composer\Console\Application instance'
  1244. );
  1245. }
  1246. }
  1247. return $this->composer;
  1248. }
  1249. public function setComposer(Composer $composer)
  1250. {
  1251. $this->composer = $composer;
  1252. }
  1253. public function resetComposer()
  1254. {
  1255. $this->composer = null;
  1256. $this->getApplication()->resetComposer();
  1257. }
  1258. public function isProxyCommand()
  1259. {
  1260. return false;
  1261. }
  1262. public function getIO()
  1263. {
  1264. if (null === $this->io) {
  1265. $application = $this->getApplication();
  1266. if ($application instanceof Application) {
  1267. $this->io = $application->getIO();
  1268. } else {
  1269. $this->io = new NullIO();
  1270. }
  1271. }
  1272. return $this->io;
  1273. }
  1274. public function setIO(IOInterface $io)
  1275. {
  1276. $this->io = $io;
  1277. }
  1278. protected function initialize(InputInterface $input, OutputInterface $output)
  1279. {
  1280. if (true === $input->hasParameterOption(array('--no-ansi')) && $input->hasOption('no-progress')) {
  1281. $input->setOption('no-progress', true);
  1282. }
  1283. parent::initialize($input, $output);
  1284. }
  1285. protected function getPreferredInstallOptions(Config $config, InputInterface $input, $keepVcsRequiresPreferSource = false)
  1286. {
  1287. $preferSource = false;
  1288. $preferDist = false;
  1289. switch ($config->get('preferred-install')) {
  1290. case 'source':
  1291. $preferSource = true;
  1292. break;
  1293. case 'dist':
  1294. $preferDist = true;
  1295. break;
  1296. case 'auto':
  1297. default:
  1298. break;
  1299. }
  1300. if ($input->getOption('prefer-source') || $input->getOption('prefer-dist') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'))) {
  1301. $preferSource = $input->getOption('prefer-source') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'));
  1302. $preferDist = $input->getOption('prefer-dist');
  1303. }
  1304. return array($preferSource, $preferDist);
  1305. }
  1306. }
  1307. <?php
  1308. namespace Composer\Command;
  1309. use Composer\DependencyResolver\Pool;
  1310. use Composer\Package\Link;
  1311. use Composer\Package\PackageInterface;
  1312. use Composer\Repository\ArrayRepository;
  1313. use Composer\Repository\CompositeRepository;
  1314. use Composer\Repository\PlatformRepository;
  1315. use Composer\Repository\RepositoryFactory;
  1316. use Composer\Plugin\CommandEvent;
  1317. use Composer\Plugin\PluginEvents;
  1318. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  1319. use Composer\Package\Version\VersionParser;
  1320. use Symfony\Component\Console\Helper\Table;
  1321. use Symfony\Component\Console\Input\InputArgument;
  1322. use Symfony\Component\Console\Input\InputInterface;
  1323. use Symfony\Component\Console\Input\InputOption;
  1324. use Symfony\Component\Console\Output\OutputInterface;
  1325. class BaseDependencyCommand extends BaseCommand
  1326. {
  1327. const ARGUMENT_PACKAGE = 'package';
  1328. const ARGUMENT_CONSTRAINT = 'constraint';
  1329. const OPTION_RECURSIVE = 'recursive';
  1330. const OPTION_TREE = 'tree';
  1331. protected $colors;
  1332. protected function configure()
  1333. {
  1334. $this->setDefinition(array(
  1335. new InputArgument(self::ARGUMENT_PACKAGE, InputArgument::REQUIRED, 'Package to inspect'),
  1336. new InputArgument(self::ARGUMENT_CONSTRAINT, InputArgument::OPTIONAL, 'Optional version constraint', '*'),
  1337. new InputOption(self::OPTION_RECURSIVE, 'r', InputOption::VALUE_NONE, 'Recursively resolves up to the root package'),
  1338. new InputOption(self::OPTION_TREE, 't', InputOption::VALUE_NONE, 'Prints the results as a nested tree'),
  1339. ));
  1340. }
  1341. protected function doExecute(InputInterface $input, OutputInterface $output, $inverted = false)
  1342. {
  1343. $composer = $this->getComposer();
  1344. $commandEvent = new CommandEvent(PluginEvents::COMMAND, $this->getName(), $input, $output);
  1345. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  1346. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  1347. $repository = new CompositeRepository(array(
  1348. new ArrayRepository(array($composer->getPackage())),
  1349. $composer->getRepositoryManager()->getLocalRepository(),
  1350. new PlatformRepository(array(), $platformOverrides),
  1351. ));
  1352. $pool = new Pool();
  1353. $pool->addRepository($repository);
  1354. list($needle, $textConstraint) = array_pad(
  1355. explode(':', $input->getArgument(self::ARGUMENT_PACKAGE)),
  1356. 2,
  1357. $input->getArgument(self::ARGUMENT_CONSTRAINT)
  1358. );
  1359. $packages = $pool->whatProvides(strtolower($needle));
  1360. if (empty($packages)) {
  1361. throw new \InvalidArgumentException(sprintf('Could not find package "%s" in your project', $needle));
  1362. }
  1363. if (!$repository->findPackage($needle, $textConstraint)) {
  1364. $defaultRepos = new CompositeRepository(RepositoryFactory::defaultRepos($this->getIO()));
  1365. if ($match = $defaultRepos->findPackage($needle, $textConstraint)) {
  1366. $repository->addRepository(new ArrayRepository(array(clone $match)));
  1367. }
  1368. }
  1369. $needles = array($needle);
  1370. if ($inverted) {
  1371. foreach ($packages as $package) {
  1372. $needles = array_merge($needles, array_map(function (Link $link) {
  1373. return $link->getTarget();
  1374. }, $package->getReplaces()));
  1375. }
  1376. }
  1377. if ('*' !== $textConstraint) {
  1378. $versionParser = new VersionParser();
  1379. $constraint = $versionParser->parseConstraints($textConstraint);
  1380. } else {
  1381. $constraint = null;
  1382. }
  1383. $renderTree = $input->getOption(self::OPTION_TREE);
  1384. $recursive = $renderTree || $input->getOption(self::OPTION_RECURSIVE);
  1385. $results = $repository->getDependents($needles, $constraint, $inverted, $recursive);
  1386. if (empty($results)) {
  1387. $extra = (null !== $constraint) ? sprintf(' in versions %smatching %s', $inverted ? 'not ' : '', $textConstraint) : '';
  1388. $this->getIO()->writeError(sprintf('<info>There is no installed package depending on "%s"%s</info>',
  1389. $needle, $extra));
  1390. } elseif ($renderTree) {
  1391. $this->initStyles($output);
  1392. $root = $packages[0];
  1393. $this->getIO()->write(sprintf('<info>%s</info> %s %s', $root->getPrettyName(), $root->getPrettyVersion(), $root->getDescription()));
  1394. $this->printTree($results);
  1395. } else {
  1396. $this->printTable($output, $results);
  1397. }
  1398. return 0;
  1399. }
  1400. protected function printTable(OutputInterface $output, $results)
  1401. {
  1402. $table = array();
  1403. $doubles = array();
  1404. do {
  1405. $queue = array();
  1406. $rows = array();
  1407. foreach ($results as $result) {
  1408. list($package, $link, $children) = $result;
  1409. $unique = (string) $link;
  1410. if (isset($doubles[$unique])) {
  1411. continue;
  1412. }
  1413. $doubles[$unique] = true;
  1414. $version = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '-' : $package->getPrettyVersion();
  1415. $rows[] = array($package->getPrettyName(), $version, $link->getDescription(), sprintf('%s (%s)', $link->getTarget(), $link->getPrettyConstraint()));
  1416. if ($children) {
  1417. $queue = array_merge($queue, $children);
  1418. }
  1419. }
  1420. $results = $queue;
  1421. $table = array_merge($rows, $table);
  1422. } while (!empty($results));
  1423. $renderer = new Table($output);
  1424. $renderer->setStyle('compact');
  1425. $renderer->getStyle()->setVerticalBorderChar('');
  1426. $renderer->getStyle()->setCellRowContentFormat('%s ');
  1427. $renderer->setRows($table)->render();
  1428. }
  1429. protected function initStyles(OutputInterface $output)
  1430. {
  1431. $this->colors = array(
  1432. 'green',
  1433. 'yellow',
  1434. 'cyan',
  1435. 'magenta',
  1436. 'blue',
  1437. );
  1438. foreach ($this->colors as $color) {
  1439. $style = new OutputFormatterStyle($color);
  1440. $output->getFormatter()->setStyle($color, $style);
  1441. }
  1442. }
  1443. protected function printTree($results, $prefix = '', $level = 1)
  1444. {
  1445. $count = count($results);
  1446. $idx = 0;
  1447. foreach ($results as $result) {
  1448. list($package, $link, $children) = $result;
  1449. $color = $this->colors[$level % count($this->colors)];
  1450. $prevColor = $this->colors[($level - 1) % count($this->colors)];
  1451. $isLast = (++$idx == $count);
  1452. $versionText = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '' : $package->getPrettyVersion();
  1453. $packageText = rtrim(sprintf('<%s>%s</%1$s> %s', $color, $package->getPrettyName(), $versionText));
  1454. $linkText = sprintf('%s <%s>%s</%2$s> %s', $link->getDescription(), $prevColor, $link->getTarget(), $link->getPrettyConstraint());
  1455. $circularWarn = $children === false ? '(circular dependency aborted here)' : '';
  1456. $this->writeTreeLine(rtrim(sprintf("%s%s%s (%s) %s", $prefix, $isLast ? '└──' : '├──', $packageText, $linkText, $circularWarn)));
  1457. if ($children) {
  1458. $this->printTree($children, $prefix . ($isLast ? ' ' : '│ '), $level + 1);
  1459. }
  1460. }
  1461. }
  1462. private function writeTreeLine($line)
  1463. {
  1464. $io = $this->getIO();
  1465. if (!$io->isDecorated()) {
  1466. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  1467. }
  1468. $io->write($line);
  1469. }
  1470. }
  1471. <?php
  1472. namespace Composer\Command;
  1473. use Composer\Package\Link;
  1474. use Composer\Package\PackageInterface;
  1475. use Composer\Semver\Constraint\Constraint;
  1476. use Symfony\Component\Console\Helper\Table;
  1477. use Symfony\Component\Console\Input\InputInterface;
  1478. use Symfony\Component\Console\Output\OutputInterface;
  1479. use Composer\Repository\PlatformRepository;
  1480. class CheckPlatformReqsCommand extends BaseCommand
  1481. {
  1482. protected function configure()
  1483. {
  1484. $this->setName('check-platform-reqs')
  1485. ->setDescription('Check that platform requirements are satisfied.')
  1486. ->setHelp(<<<EOT
  1487. Checks that your PHP and extensions versions match the platform requirements of the installed packages.
  1488. <info>php composer.phar check-platform-reqs</info>
  1489. EOT
  1490. );
  1491. }
  1492. protected function execute(InputInterface $input, OutputInterface $output)
  1493. {
  1494. $composer = $this->getComposer();
  1495. $repos = $composer->getRepositoryManager()->getLocalRepository();
  1496. $allPackages = array_merge(array($composer->getPackage()), $repos->getPackages());
  1497. $requires = $composer->getPackage()->getDevRequires();
  1498. foreach ($requires as $require => $link) {
  1499. $requires[$require] = array($link);
  1500. }
  1501. foreach ($allPackages as $package) {
  1502. foreach ($package->getRequires() as $require => $link) {
  1503. $requires[$require][] = $link;
  1504. }
  1505. }
  1506. ksort($requires);
  1507. $platformRepo = new PlatformRepository(array(), array());
  1508. $currentPlatformPackages = $platformRepo->getPackages();
  1509. $currentPlatformPackageMap = array();
  1510. foreach ($currentPlatformPackages as $currentPlatformPackage) {
  1511. $currentPlatformPackageMap[$currentPlatformPackage->getName()] = $currentPlatformPackage;
  1512. }
  1513. $results = array();
  1514. $exitCode = 0;
  1515. foreach ($requires as $require => $links) {
  1516. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $require)) {
  1517. if (isset($currentPlatformPackageMap[$require])) {
  1518. $pass = true;
  1519. $version = $currentPlatformPackageMap[$require]->getVersion();
  1520. foreach ($links as $link) {
  1521. if (!$link->getConstraint()->matches(new Constraint('=', $version))) {
  1522. $results[] = array(
  1523. $currentPlatformPackageMap[$require]->getPrettyName(),
  1524. $currentPlatformPackageMap[$require]->getPrettyVersion(),
  1525. $link,
  1526. '<error>failed</error>',
  1527. );
  1528. $pass = false;
  1529. $exitCode = max($exitCode, 1);
  1530. }
  1531. }
  1532. if ($pass) {
  1533. $results[] = array(
  1534. $currentPlatformPackageMap[$require]->getPrettyName(),
  1535. $currentPlatformPackageMap[$require]->getPrettyVersion(),
  1536. null,
  1537. '<info>success</info>',
  1538. );
  1539. }
  1540. } else {
  1541. $results[] = array(
  1542. $require,
  1543. 'n/a',
  1544. $links[0],
  1545. '<error>missing</error>',
  1546. );
  1547. $exitCode = max($exitCode, 2);
  1548. }
  1549. }
  1550. }
  1551. $this->printTable($output, $results);
  1552. return $exitCode;
  1553. }
  1554. protected function printTable(OutputInterface $output, $results)
  1555. {
  1556. $table = array();
  1557. $rows = array();
  1558. foreach ($results as $result) {
  1559. list($platformPackage, $version, $link, $status) = $result;
  1560. $rows[] = array(
  1561. $platformPackage,
  1562. $version,
  1563. $link ? sprintf('%s %s %s (%s)', $link->getSource(), $link->getDescription(), $link->getTarget(), $link->getPrettyConstraint()) : '',
  1564. $status,
  1565. );
  1566. }
  1567. $table = array_merge($rows, $table);
  1568. $renderer = new Table($output);
  1569. $renderer->setStyle('compact');
  1570. $renderer->getStyle()->setVerticalBorderChar('');
  1571. $renderer->getStyle()->setCellRowContentFormat('%s ');
  1572. $renderer->setRows($table)->render();
  1573. }
  1574. }
  1575. <?php
  1576. namespace Composer\Command;
  1577. use Composer\Cache;
  1578. use Composer\Factory;
  1579. use Symfony\Component\Console\Input\InputInterface;
  1580. use Symfony\Component\Console\Output\OutputInterface;
  1581. class ClearCacheCommand extends BaseCommand
  1582. {
  1583. protected function configure()
  1584. {
  1585. $this
  1586. ->setName('clear-cache')
  1587. ->setAliases(array('clearcache'))
  1588. ->setDescription('Clears composer\'s internal package cache.')
  1589. ->setHelp(<<<EOT
  1590. The <info>clear-cache</info> deletes all cached packages from composer's
  1591. cache directory.
  1592. EOT
  1593. )
  1594. ;
  1595. }
  1596. protected function execute(InputInterface $input, OutputInterface $output)
  1597. {
  1598. $config = Factory::createConfig();
  1599. $io = $this->getIO();
  1600. $cachePaths = array(
  1601. 'cache-vcs-dir' => $config->get('cache-vcs-dir'),
  1602. 'cache-repo-dir' => $config->get('cache-repo-dir'),
  1603. 'cache-files-dir' => $config->get('cache-files-dir'),
  1604. 'cache-dir' => $config->get('cache-dir'),
  1605. );
  1606. foreach ($cachePaths as $key => $cachePath) {
  1607. $cachePath = realpath($cachePath);
  1608. if (!$cachePath) {
  1609. $io->writeError("<info>Cache directory does not exist ($key): $cachePath</info>");
  1610. continue;
  1611. }
  1612. $cache = new Cache($io, $cachePath);
  1613. if (!$cache->isEnabled()) {
  1614. $io->writeError("<info>Cache is not enabled ($key): $cachePath</info>");
  1615. continue;
  1616. }
  1617. $io->writeError("<info>Clearing cache ($key): $cachePath</info>");
  1618. $cache->clear();
  1619. }
  1620. $io->writeError('<info>All caches cleared.</info>');
  1621. }
  1622. }
  1623. <?php
  1624. namespace Composer\Command;
  1625. use Composer\Util\Platform;
  1626. use Composer\Util\Silencer;
  1627. use Symfony\Component\Console\Input\InputInterface;
  1628. use Symfony\Component\Console\Input\InputArgument;
  1629. use Symfony\Component\Console\Input\InputOption;
  1630. use Symfony\Component\Console\Output\OutputInterface;
  1631. use Composer\Config;
  1632. use Composer\Config\JsonConfigSource;
  1633. use Composer\Factory;
  1634. use Composer\Json\JsonFile;
  1635. use Composer\Semver\VersionParser;
  1636. use Composer\Package\BasePackage;
  1637. class ConfigCommand extends BaseCommand
  1638. {
  1639. protected $config;
  1640. protected $configFile;
  1641. protected $configSource;
  1642. protected $authConfigFile;
  1643. protected $authConfigSource;
  1644. protected function configure()
  1645. {
  1646. $this
  1647. ->setName('config')
  1648. ->setDescription('Sets config options.')
  1649. ->setDefinition(array(
  1650. new InputOption('global', 'g', InputOption::VALUE_NONE, 'Apply command to the global config file'),
  1651. new InputOption('editor', 'e', InputOption::VALUE_NONE, 'Open editor'),
  1652. new InputOption('auth', 'a', InputOption::VALUE_NONE, 'Affect auth config file (only used for --editor)'),
  1653. new InputOption('unset', null, InputOption::VALUE_NONE, 'Unset the given setting-key'),
  1654. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List configuration settings'),
  1655. new InputOption('file', 'f', InputOption::VALUE_REQUIRED, 'If you want to choose a different composer.json or config.json'),
  1656. new InputOption('absolute', null, InputOption::VALUE_NONE, 'Returns absolute paths when fetching *-dir config values instead of relative'),
  1657. new InputArgument('setting-key', null, 'Setting key'),
  1658. new InputArgument('setting-value', InputArgument::IS_ARRAY, 'Setting value'),
  1659. ))
  1660. ->setHelp(<<<EOT
  1661. This command allows you to edit composer config settings and repositories
  1662. in either the local composer.json file or the global config.json file.
  1663. Additionally it lets you edit most properties in the local composer.json.
  1664. To set a config setting:
  1665. <comment>%command.full_name% bin-dir bin/</comment>
  1666. To read a config setting:
  1667. <comment>%command.full_name% bin-dir</comment>
  1668. Outputs: <info>bin</info>
  1669. To edit the global config.json file:
  1670. <comment>%command.full_name% --global</comment>
  1671. To add a repository:
  1672. <comment>%command.full_name% repositories.foo vcs https://bar.com</comment>
  1673. To remove a repository (repo is a short alias for repositories):
  1674. <comment>%command.full_name% --unset repo.foo</comment>
  1675. To disable packagist:
  1676. <comment>%command.full_name% repo.packagist false</comment>
  1677. You can alter repositories in the global config.json file by passing in the
  1678. <info>--global</info> option.
  1679. To edit the file in an external editor:
  1680. <comment>%command.full_name% --editor</comment>
  1681. To choose your editor you can set the "EDITOR" env variable.
  1682. To get a list of configuration values in the file:
  1683. <comment>%command.full_name% --list</comment>
  1684. You can always pass more than one option. As an example, if you want to edit the
  1685. global config.json file.
  1686. <comment>%command.full_name% --editor --global</comment>
  1687. EOT
  1688. )
  1689. ;
  1690. }
  1691. protected function initialize(InputInterface $input, OutputInterface $output)
  1692. {
  1693. parent::initialize($input, $output);
  1694. if ($input->getOption('global') && null !== $input->getOption('file')) {
  1695. throw new \RuntimeException('--file and --global can not be combined');
  1696. }
  1697. $io = $this->getIO();
  1698. $this->config = Factory::createConfig($io);
  1699. $configFile = $input->getOption('global')
  1700. ? ($this->config->get('home') . '/config.json')
  1701. : ($input->getOption('file') ?: Factory::getComposerFile());
  1702. if (
  1703. ($configFile === 'composer.json' || $configFile === './composer.json')
  1704. && !file_exists($configFile)
  1705. && realpath(getcwd()) === realpath($this->config->get('home'))
  1706. ) {
  1707. file_put_contents($configFile, "{\n}\n");
  1708. }
  1709. $this->configFile = new JsonFile($configFile, null, $io);
  1710. $this->configSource = new JsonConfigSource($this->configFile);
  1711. $authConfigFile = $input->getOption('global')
  1712. ? ($this->config->get('home') . '/auth.json')
  1713. : dirname(realpath($configFile)) . '/auth.json';
  1714. $this->authConfigFile = new JsonFile($authConfigFile, null, $io);
  1715. $this->authConfigSource = new JsonConfigSource($this->authConfigFile, true);
  1716. if ($input->getOption('global') && !$this->configFile->exists()) {
  1717. touch($this->configFile->getPath());
  1718. $this->configFile->write(array('config' => new \ArrayObject));
  1719. Silencer::call('chmod', $this->configFile->getPath(), 0600);
  1720. }
  1721. if ($input->getOption('global') && !$this->authConfigFile->exists()) {
  1722. touch($this->authConfigFile->getPath());
  1723. $this->authConfigFile->write(array('bitbucket-oauth' => new \ArrayObject, 'github-oauth' => new \ArrayObject, 'gitlab-oauth' => new \ArrayObject, 'gitlab-token' => new \ArrayObject, 'http-basic' => new \ArrayObject));
  1724. Silencer::call('chmod', $this->authConfigFile->getPath(), 0600);
  1725. }
  1726. if (!$this->configFile->exists()) {
  1727. throw new \RuntimeException(sprintf('File "%s" cannot be found in the current directory', $configFile));
  1728. }
  1729. }
  1730. protected function execute(InputInterface $input, OutputInterface $output)
  1731. {
  1732. if ($input->getOption('editor')) {
  1733. $editor = escapeshellcmd(getenv('EDITOR'));
  1734. if (!$editor) {
  1735. if (Platform::isWindows()) {
  1736. $editor = 'notepad';
  1737. } else {
  1738. foreach (array('editor', 'vim', 'vi', 'nano', 'pico', 'ed') as $candidate) {
  1739. if (exec('which '.$candidate)) {
  1740. $editor = $candidate;
  1741. break;
  1742. }
  1743. }
  1744. }
  1745. }
  1746. $file = $input->getOption('auth') ? $this->authConfigFile->getPath() : $this->configFile->getPath();
  1747. system($editor . ' ' . $file . (Platform::isWindows() ? '' : ' > `tty`'));
  1748. return 0;
  1749. }
  1750. if (!$input->getOption('global')) {
  1751. $this->config->merge($this->configFile->read());
  1752. $this->config->merge(array('config' => $this->authConfigFile->exists() ? $this->authConfigFile->read() : array()));
  1753. }
  1754. if ($input->getOption('list')) {
  1755. $this->listConfiguration($this->config->all(), $this->config->raw(), $output);
  1756. return 0;
  1757. }
  1758. $settingKey = $input->getArgument('setting-key');
  1759. if (!$settingKey) {
  1760. return 0;
  1761. }
  1762. if (array() !== $input->getArgument('setting-value') && $input->getOption('unset')) {
  1763. throw new \RuntimeException('You can not combine a setting value with --unset');
  1764. }
  1765. if (array() === $input->getArgument('setting-value') && !$input->getOption('unset')) {
  1766. $properties = array('name', 'type', 'description', 'homepage', 'version', 'minimum-stability', 'prefer-stable', 'keywords', 'license', 'extra');
  1767. $rawData = $this->configFile->read();
  1768. $data = $this->config->all();
  1769. if (preg_match('/^repos?(?:itories)?(?:\.(.+))?/', $settingKey, $matches)) {
  1770. if (!isset($matches[1]) || $matches[1] === '') {
  1771. $value = isset($data['repositories']) ? $data['repositories'] : array();
  1772. } else {
  1773. if (!isset($data['repositories'][$matches[1]])) {
  1774. throw new \InvalidArgumentException('There is no '.$matches[1].' repository defined');
  1775. }
  1776. $value = $data['repositories'][$matches[1]];
  1777. }
  1778. } elseif (strpos($settingKey, '.')) {
  1779. $bits = explode('.', $settingKey);
  1780. if ($bits[0] === 'extra') {
  1781. $data = $rawData;
  1782. } else {
  1783. $data = $data['config'];
  1784. }
  1785. $match = false;
  1786. foreach ($bits as $bit) {
  1787. $key = isset($key) ? $key.'.'.$bit : $bit;
  1788. $match = false;
  1789. if (isset($data[$key])) {
  1790. $match = true;
  1791. $data = $data[$key];
  1792. unset($key);
  1793. }
  1794. }
  1795. if (!$match) {
  1796. throw new \RuntimeException($settingKey.' is not defined.');
  1797. }
  1798. $value = $data;
  1799. } elseif (isset($data['config'][$settingKey])) {
  1800. $value = $this->config->get($settingKey, $input->getOption('absolute') ? 0 : Config::RELATIVE_PATHS);
  1801. } elseif (in_array($settingKey, $properties, true) && isset($rawData[$settingKey])) {
  1802. $value = $rawData[$settingKey];
  1803. } else {
  1804. throw new \RuntimeException($settingKey.' is not defined');
  1805. }
  1806. if (is_array($value)) {
  1807. $value = json_encode($value);
  1808. }
  1809. $this->getIO()->write($value);
  1810. return 0;
  1811. }
  1812. $values = $input->getArgument('setting-value');
  1813. $booleanValidator = function ($val) {
  1814. return in_array($val, array('true', 'false', '1', '0'), true);
  1815. };
  1816. $booleanNormalizer = function ($val) {
  1817. return $val !== 'false' && (bool) $val;
  1818. };
  1819. $uniqueConfigValues = array(
  1820. 'process-timeout' => array('is_numeric', 'intval'),
  1821. 'use-include-path' => array($booleanValidator, $booleanNormalizer),
  1822. 'preferred-install' => array(
  1823. function ($val) {
  1824. return in_array($val, array('auto', 'source', 'dist'), true);
  1825. },
  1826. function ($val) {
  1827. return $val;
  1828. },
  1829. ),
  1830. 'store-auths' => array(
  1831. function ($val) {
  1832. return in_array($val, array('true', 'false', 'prompt'), true);
  1833. },
  1834. function ($val) {
  1835. if ('prompt' === $val) {
  1836. return 'prompt';
  1837. }
  1838. return $val !== 'false' && (bool) $val;
  1839. },
  1840. ),
  1841. 'notify-on-install' => array($booleanValidator, $booleanNormalizer),
  1842. 'vendor-dir' => array('is_string', function ($val) {
  1843. return $val;
  1844. }),
  1845. 'bin-dir' => array('is_string', function ($val) {
  1846. return $val;
  1847. }),
  1848. 'archive-dir' => array('is_string', function ($val) {
  1849. return $val;
  1850. }),
  1851. 'archive-format' => array('is_string', function ($val) {
  1852. return $val;
  1853. }),
  1854. 'data-dir' => array('is_string', function ($val) {
  1855. return $val;
  1856. }),
  1857. 'cache-dir' => array('is_string', function ($val) {
  1858. return $val;
  1859. }),
  1860. 'cache-files-dir' => array('is_string', function ($val) {
  1861. return $val;
  1862. }),
  1863. 'cache-repo-dir' => array('is_string', function ($val) {
  1864. return $val;
  1865. }),
  1866. 'cache-vcs-dir' => array('is_string', function ($val) {
  1867. return $val;
  1868. }),
  1869. 'cache-ttl' => array('is_numeric', 'intval'),
  1870. 'cache-files-ttl' => array('is_numeric', 'intval'),
  1871. 'cache-files-maxsize' => array(
  1872. function ($val) {
  1873. return preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $val) > 0;
  1874. },
  1875. function ($val) {
  1876. return $val;
  1877. },
  1878. ),
  1879. 'bin-compat' => array(
  1880. function ($val) {
  1881. return in_array($val, array('auto', 'full'));
  1882. },
  1883. function ($val) {
  1884. return $val;
  1885. },
  1886. ),
  1887. 'discard-changes' => array(
  1888. function ($val) {
  1889. return in_array($val, array('stash', 'true', 'false', '1', '0'), true);
  1890. },
  1891. function ($val) {
  1892. if ('stash' === $val) {
  1893. return 'stash';
  1894. }
  1895. return $val !== 'false' && (bool) $val;
  1896. },
  1897. ),
  1898. 'autoloader-suffix' => array('is_string', function ($val) {
  1899. return $val === 'null' ? null : $val;
  1900. }),
  1901. 'sort-packages' => array($booleanValidator, $booleanNormalizer),
  1902. 'optimize-autoloader' => array($booleanValidator, $booleanNormalizer),
  1903. 'classmap-authoritative' => array($booleanValidator, $booleanNormalizer),
  1904. 'apcu-autoloader' => array($booleanValidator, $booleanNormalizer),
  1905. 'prepend-autoloader' => array($booleanValidator, $booleanNormalizer),
  1906. 'disable-tls' => array($booleanValidator, $booleanNormalizer),
  1907. 'secure-http' => array($booleanValidator, $booleanNormalizer),
  1908. 'cafile' => array(
  1909. function ($val) {
  1910. return file_exists($val) && is_readable($val);
  1911. },
  1912. function ($val) {
  1913. return $val === 'null' ? null : $val;
  1914. },
  1915. ),
  1916. 'capath' => array(
  1917. function ($val) {
  1918. return is_dir($val) && is_readable($val);
  1919. },
  1920. function ($val) {
  1921. return $val === 'null' ? null : $val;
  1922. },
  1923. ),
  1924. 'github-expose-hostname' => array($booleanValidator, $booleanNormalizer),
  1925. 'htaccess-protect' => array($booleanValidator, $booleanNormalizer),
  1926. );
  1927. $multiConfigValues = array(
  1928. 'github-protocols' => array(
  1929. function ($vals) {
  1930. if (!is_array($vals)) {
  1931. return 'array expected';
  1932. }
  1933. foreach ($vals as $val) {
  1934. if (!in_array($val, array('git', 'https', 'ssh'))) {
  1935. return 'valid protocols include: git, https, ssh';
  1936. }
  1937. }
  1938. return true;
  1939. },
  1940. function ($vals) {
  1941. return $vals;
  1942. },
  1943. ),
  1944. 'github-domains' => array(
  1945. function ($vals) {
  1946. if (!is_array($vals)) {
  1947. return 'array expected';
  1948. }
  1949. return true;
  1950. },
  1951. function ($vals) {
  1952. return $vals;
  1953. },
  1954. ),
  1955. 'gitlab-domains' => array(
  1956. function ($vals) {
  1957. if (!is_array($vals)) {
  1958. return 'array expected';
  1959. }
  1960. return true;
  1961. },
  1962. function ($vals) {
  1963. return $vals;
  1964. },
  1965. ),
  1966. );
  1967. if ($input->getOption('unset') && (isset($uniqueConfigValues[$settingKey]) || isset($multiConfigValues[$settingKey]))) {
  1968. return $this->configSource->removeConfigSetting($settingKey);
  1969. }
  1970. if (isset($uniqueConfigValues[$settingKey])) {
  1971. return $this->handleSingleValue($settingKey, $uniqueConfigValues[$settingKey], $values, 'addConfigSetting');
  1972. }
  1973. if (isset($multiConfigValues[$settingKey])) {
  1974. return $this->handleMultiValue($settingKey, $multiConfigValues[$settingKey], $values, 'addConfigSetting');
  1975. }
  1976. $uniqueProps = array(
  1977. 'name' => array('is_string', function ($val) {
  1978. return $val;
  1979. }),
  1980. 'type' => array('is_string', function ($val) {
  1981. return $val;
  1982. }),
  1983. 'description' => array('is_string', function ($val) {
  1984. return $val;
  1985. }),
  1986. 'homepage' => array('is_string', function ($val) {
  1987. return $val;
  1988. }),
  1989. 'version' => array('is_string', function ($val) {
  1990. return $val;
  1991. }),
  1992. 'minimum-stability' => array(
  1993. function ($val) {
  1994. return isset(BasePackage::$stabilities[VersionParser::normalizeStability($val)]);
  1995. },
  1996. function ($val) {
  1997. return VersionParser::normalizeStability($val);
  1998. },
  1999. ),
  2000. 'prefer-stable' => array($booleanValidator, $booleanNormalizer),
  2001. );
  2002. $multiProps = array(
  2003. 'keywords' => array(
  2004. function ($vals) {
  2005. if (!is_array($vals)) {
  2006. return 'array expected';
  2007. }
  2008. return true;
  2009. },
  2010. function ($vals) {
  2011. return $vals;
  2012. },
  2013. ),
  2014. 'license' => array(
  2015. function ($vals) {
  2016. if (!is_array($vals)) {
  2017. return 'array expected';
  2018. }
  2019. return true;
  2020. },
  2021. function ($vals) {
  2022. return $vals;
  2023. },
  2024. ),
  2025. );
  2026. if ($input->getOption('global') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]) || substr($settingKey, 0, 6) === 'extra.')) {
  2027. throw new \InvalidArgumentException('The '.$settingKey.' property can not be set in the global config.json file. Use `composer global config` to apply changes to the global composer.json');
  2028. }
  2029. if ($input->getOption('unset') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]))) {
  2030. return $this->configSource->removeProperty($settingKey);
  2031. }
  2032. if (isset($uniqueProps[$settingKey])) {
  2033. return $this->handleSingleValue($settingKey, $uniqueProps[$settingKey], $values, 'addProperty');
  2034. }
  2035. if (isset($multiProps[$settingKey])) {
  2036. return $this->handleMultiValue($settingKey, $multiProps[$settingKey], $values, 'addProperty');
  2037. }
  2038. if (preg_match('/^repos?(?:itories)?\.(.+)/', $settingKey, $matches)) {
  2039. if ($input->getOption('unset')) {
  2040. return $this->configSource->removeRepository($matches[1]);
  2041. }
  2042. if (2 === count($values)) {
  2043. return $this->configSource->addRepository($matches[1], array(
  2044. 'type' => $values[0],
  2045. 'url' => $values[1],
  2046. ));
  2047. }
  2048. if (1 === count($values)) {
  2049. $value = strtolower($values[0]);
  2050. if (true === $booleanValidator($value)) {
  2051. if (false === $booleanNormalizer($value)) {
  2052. return $this->configSource->addRepository($matches[1], false);
  2053. }
  2054. } else {
  2055. $value = JsonFile::parseJson($values[0]);
  2056. return $this->configSource->addRepository($matches[1], $value);
  2057. }
  2058. }
  2059. throw new \RuntimeException('You must pass the type and a url. Example: php composer.phar config repositories.foo vcs https://bar.com');
  2060. }
  2061. if (preg_match('/^extra\.(.+)/', $settingKey, $matches)) {
  2062. if ($input->getOption('unset')) {
  2063. return $this->configSource->removeProperty($settingKey);
  2064. }
  2065. return $this->configSource->addProperty($settingKey, $values[0]);
  2066. }
  2067. if (preg_match('/^platform\.(.+)/', $settingKey, $matches)) {
  2068. if ($input->getOption('unset')) {
  2069. return $this->configSource->removeConfigSetting($settingKey);
  2070. }
  2071. return $this->configSource->addConfigSetting($settingKey, $values[0]);
  2072. }
  2073. if ($settingKey === 'platform' && $input->getOption('unset')) {
  2074. return $this->configSource->removeConfigSetting($settingKey);
  2075. }
  2076. if (preg_match('/^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic)\.(.+)/', $settingKey, $matches)) {
  2077. if ($input->getOption('unset')) {
  2078. $this->authConfigSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2079. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2080. return;
  2081. }
  2082. if ($matches[1] === 'bitbucket-oauth') {
  2083. if (2 !== count($values)) {
  2084. throw new \RuntimeException('Expected two arguments (consumer-key, consumer-secret), got '.count($values));
  2085. }
  2086. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2087. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('consumer-key' => $values[0], 'consumer-secret' => $values[1]));
  2088. } elseif (in_array($matches[1], array('github-oauth', 'gitlab-oauth', 'gitlab-token'), true)) {
  2089. if (1 !== count($values)) {
  2090. throw new \RuntimeException('Too many arguments, expected only one token');
  2091. }
  2092. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2093. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], $values[0]);
  2094. } elseif ($matches[1] === 'http-basic') {
  2095. if (2 !== count($values)) {
  2096. throw new \RuntimeException('Expected two arguments (username, password), got '.count($values));
  2097. }
  2098. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2099. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('username' => $values[0], 'password' => $values[1]));
  2100. }
  2101. return;
  2102. }
  2103. throw new \InvalidArgumentException('Setting '.$settingKey.' does not exist or is not supported by this command');
  2104. }
  2105. protected function handleSingleValue($key, array $callbacks, array $values, $method)
  2106. {
  2107. list($validator, $normalizer) = $callbacks;
  2108. if (1 !== count($values)) {
  2109. throw new \RuntimeException('You can only pass one value. Example: php composer.phar config process-timeout 300');
  2110. }
  2111. if (true !== $validation = $validator($values[0])) {
  2112. throw new \RuntimeException(sprintf(
  2113. '"%s" is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2114. $values[0]
  2115. ));
  2116. }
  2117. return call_user_func(array($this->configSource, $method), $key, $normalizer($values[0]));
  2118. }
  2119. protected function handleMultiValue($key, array $callbacks, array $values, $method)
  2120. {
  2121. list($validator, $normalizer) = $callbacks;
  2122. if (true !== $validation = $validator($values)) {
  2123. throw new \RuntimeException(sprintf(
  2124. '%s is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2125. json_encode($values)
  2126. ));
  2127. }
  2128. return call_user_func(array($this->configSource, $method), $key, $normalizer($values));
  2129. }
  2130. protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, $k = null)
  2131. {
  2132. $origK = $k;
  2133. $io = $this->getIO();
  2134. foreach ($contents as $key => $value) {
  2135. if ($k === null && !in_array($key, array('config', 'repositories'))) {
  2136. continue;
  2137. }
  2138. $rawVal = isset($rawContents[$key]) ? $rawContents[$key] : null;
  2139. if (is_array($value) && (!is_numeric(key($value)) || ($key === 'repositories' && null === $k))) {
  2140. $k .= preg_replace('{^config\.}', '', $key . '.');
  2141. $this->listConfiguration($value, $rawVal, $output, $k);
  2142. $k = $origK;
  2143. continue;
  2144. }
  2145. if (is_array($value)) {
  2146. $value = array_map(function ($val) {
  2147. return is_array($val) ? json_encode($val) : $val;
  2148. }, $value);
  2149. $value = '['.implode(', ', $value).']';
  2150. }
  2151. if (is_bool($value)) {
  2152. $value = var_export($value, true);
  2153. }
  2154. if (is_string($rawVal) && $rawVal != $value) {
  2155. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $rawVal . ' (' . $value . ')</info>');
  2156. } else {
  2157. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $value . '</info>');
  2158. }
  2159. }
  2160. }
  2161. }
  2162. <?php
  2163. namespace Composer\Command;
  2164. use Composer\Config;
  2165. use Composer\Factory;
  2166. use Composer\Installer;
  2167. use Composer\Installer\ProjectInstaller;
  2168. use Composer\Installer\InstallationManager;
  2169. use Composer\Installer\SuggestedPackagesReporter;
  2170. use Composer\IO\IOInterface;
  2171. use Composer\Package\BasePackage;
  2172. use Composer\DependencyResolver\Pool;
  2173. use Composer\DependencyResolver\Operation\InstallOperation;
  2174. use Composer\Package\Version\VersionSelector;
  2175. use Composer\Package\AliasPackage;
  2176. use Composer\Repository\RepositoryFactory;
  2177. use Composer\Repository\CompositeRepository;
  2178. use Composer\Repository\PlatformRepository;
  2179. use Composer\Repository\InstalledFilesystemRepository;
  2180. use Composer\Script\ScriptEvents;
  2181. use Composer\Util\Silencer;
  2182. use Symfony\Component\Console\Input\InputArgument;
  2183. use Symfony\Component\Console\Input\InputInterface;
  2184. use Symfony\Component\Console\Input\InputOption;
  2185. use Symfony\Component\Console\Output\OutputInterface;
  2186. use Symfony\Component\Finder\Finder;
  2187. use Composer\Json\JsonFile;
  2188. use Composer\Config\JsonConfigSource;
  2189. use Composer\Util\Filesystem;
  2190. use Composer\Package\Version\VersionParser;
  2191. class CreateProjectCommand extends BaseCommand
  2192. {
  2193. protected $suggestedPackagesReporter;
  2194. protected function configure()
  2195. {
  2196. $this
  2197. ->setName('create-project')
  2198. ->setDescription('Creates new project from a package into given directory.')
  2199. ->setDefinition(array(
  2200. new InputArgument('package', InputArgument::OPTIONAL, 'Package name to be installed'),
  2201. new InputArgument('directory', InputArgument::OPTIONAL, 'Directory where the files should be created'),
  2202. new InputArgument('version', InputArgument::OPTIONAL, 'Version, will default to latest'),
  2203. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum-stability allowed (unless a version is specified).'),
  2204. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  2205. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  2206. new InputOption('repository', null, InputOption::VALUE_REQUIRED, 'Pick a different repository (as url or json config) to look for the package.'),
  2207. new InputOption('repository-url', null, InputOption::VALUE_REQUIRED, 'DEPRECATED: Use --repository instead.'),
  2208. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  2209. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  2210. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  2211. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Whether to prevent execution of all defined scripts in the root package.'),
  2212. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  2213. new InputOption('no-secure-http', null, InputOption::VALUE_NONE, 'Disable the secure-http config option temporarily while installing the root package. Use at your own risk. Using this flag is a bad idea.'),
  2214. new InputOption('keep-vcs', null, InputOption::VALUE_NONE, 'Whether to prevent deleting the vcs folder.'),
  2215. new InputOption('remove-vcs', null, InputOption::VALUE_NONE, 'Whether to force deletion of the vcs folder without prompting.'),
  2216. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Whether to skip installation of the package dependencies.'),
  2217. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  2218. ))
  2219. ->setHelp(<<<EOT
  2220. The <info>create-project</info> command creates a new project from a given
  2221. package into a new directory. If executed without params and in a directory
  2222. with a composer.json file it installs the packages for the current project.
  2223. You can use this command to bootstrap new projects or setup a clean
  2224. version-controlled installation for developers of your project.
  2225. <info>php composer.phar create-project vendor/project target-directory [version]</info>
  2226. You can also specify the version with the package name using = or : as separator.
  2227. <info>php composer.phar create-project vendor/project:version target-directory</info>
  2228. To install unstable packages, either specify the version you want, or use the
  2229. --stability=dev (where dev can be one of RC, beta, alpha or dev).
  2230. To setup a developer workable version you should create the project using the source
  2231. controlled code by appending the <info>'--prefer-source'</info> flag.
  2232. To install a package from another repository than the default one you
  2233. can pass the <info>'--repository=https://myrepository.org'</info> flag.
  2234. EOT
  2235. )
  2236. ;
  2237. }
  2238. protected function execute(InputInterface $input, OutputInterface $output)
  2239. {
  2240. $config = Factory::createConfig();
  2241. $io = $this->getIO();
  2242. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input, true);
  2243. if ($input->getOption('dev')) {
  2244. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  2245. }
  2246. if ($input->getOption('no-custom-installers')) {
  2247. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  2248. $input->setOption('no-plugins', true);
  2249. }
  2250. return $this->installProject(
  2251. $io,
  2252. $config,
  2253. $input,
  2254. $input->getArgument('package'),
  2255. $input->getArgument('directory'),
  2256. $input->getArgument('version'),
  2257. $input->getOption('stability'),
  2258. $preferSource,
  2259. $preferDist,
  2260. !$input->getOption('no-dev'),
  2261. $input->getOption('repository') ?: $input->getOption('repository-url'),
  2262. $input->getOption('no-plugins'),
  2263. $input->getOption('no-scripts'),
  2264. $input->getOption('keep-vcs'),
  2265. $input->getOption('no-progress'),
  2266. $input->getOption('no-install'),
  2267. $input->getOption('ignore-platform-reqs'),
  2268. !$input->getOption('no-secure-http'),
  2269. $input->getOption('remove-vcs')
  2270. );
  2271. }
  2272. public function installProject(IOInterface $io, Config $config, InputInterface $input, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repository = null, $disablePlugins = false, $noScripts = false, $keepVcs = false, $noProgress = false, $noInstall = false, $ignorePlatformReqs = false, $secureHttp = true, $removeVcs = false)
  2273. {
  2274. $oldCwd = getcwd();
  2275. $io->loadConfiguration($config);
  2276. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($io);
  2277. if ($packageName !== null) {
  2278. $installedFromVcs = $this->installRootPackage($io, $config, $packageName, $directory, $packageVersion, $stability, $preferSource, $preferDist, $installDevPackages, $repository, $disablePlugins, $noScripts, $keepVcs, $noProgress, $ignorePlatformReqs, $secureHttp);
  2279. } else {
  2280. $installedFromVcs = false;
  2281. }
  2282. $composer = Factory::create($io, null, $disablePlugins);
  2283. $composer->getDownloadManager()->setOutputProgress(!$noProgress);
  2284. $fs = new Filesystem();
  2285. if ($noScripts === false) {
  2286. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ROOT_PACKAGE_INSTALL, $installDevPackages);
  2287. }
  2288. $config = $composer->getConfig();
  2289. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  2290. if ($noInstall === false) {
  2291. $installer = Installer::create($io, $composer);
  2292. $installer->setPreferSource($preferSource)
  2293. ->setPreferDist($preferDist)
  2294. ->setDevMode($installDevPackages)
  2295. ->setRunScripts(!$noScripts)
  2296. ->setIgnorePlatformRequirements($ignorePlatformReqs)
  2297. ->setSuggestedPackagesReporter($this->suggestedPackagesReporter)
  2298. ->setOptimizeAutoloader($config->get('optimize-autoloader'));
  2299. if ($disablePlugins) {
  2300. $installer->disablePlugins();
  2301. }
  2302. $status = $installer->run();
  2303. if (0 !== $status) {
  2304. return $status;
  2305. }
  2306. }
  2307. $hasVcs = $installedFromVcs;
  2308. if (
  2309. !$keepVcs
  2310. && $installedFromVcs
  2311. && (
  2312. $removeVcs
  2313. || !$io->isInteractive()
  2314. || $io->askConfirmation('<info>Do you want to remove the existing VCS (.git, .svn..) history?</info> [<comment>Y,n</comment>]? ', true)
  2315. )
  2316. ) {
  2317. $finder = new Finder();
  2318. $finder->depth(0)->directories()->in(getcwd())->ignoreVCS(false)->ignoreDotFiles(false);
  2319. foreach (array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg', '.fslckout', '_FOSSIL_') as $vcsName) {
  2320. $finder->name($vcsName);
  2321. }
  2322. try {
  2323. $dirs = iterator_to_array($finder);
  2324. unset($finder);
  2325. foreach ($dirs as $dir) {
  2326. if (!$fs->removeDirectory($dir)) {
  2327. throw new \RuntimeException('Could not remove '.$dir);
  2328. }
  2329. }
  2330. } catch (\Exception $e) {
  2331. $io->writeError('<error>An error occurred while removing the VCS metadata: '.$e->getMessage().'</error>');
  2332. }
  2333. $hasVcs = false;
  2334. }
  2335. if (!$hasVcs) {
  2336. $package = $composer->getPackage();
  2337. $configSource = new JsonConfigSource(new JsonFile('composer.json'));
  2338. foreach (BasePackage::$supportedLinkTypes as $type => $meta) {
  2339. foreach ($package->{'get'.$meta['method']}() as $link) {
  2340. if ($link->getPrettyConstraint() === 'self.version') {
  2341. $configSource->addLink($type, $link->getTarget(), $package->getPrettyVersion());
  2342. }
  2343. }
  2344. }
  2345. }
  2346. if ($noScripts === false) {
  2347. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_CREATE_PROJECT_CMD, $installDevPackages);
  2348. }
  2349. chdir($oldCwd);
  2350. $vendorComposerDir = $config->get('vendor-dir').'/composer';
  2351. if (is_dir($vendorComposerDir) && $fs->isDirEmpty($vendorComposerDir)) {
  2352. Silencer::call('rmdir', $vendorComposerDir);
  2353. $vendorDir = $config->get('vendor-dir');
  2354. if (is_dir($vendorDir) && $fs->isDirEmpty($vendorDir)) {
  2355. Silencer::call('rmdir', $vendorDir);
  2356. }
  2357. }
  2358. return 0;
  2359. }
  2360. protected function installRootPackage(IOInterface $io, Config $config, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repository = null, $disablePlugins = false, $noScripts = false, $keepVcs = false, $noProgress = false, $ignorePlatformReqs = false, $secureHttp = true)
  2361. {
  2362. if (!$secureHttp) {
  2363. $config->merge(array('config' => array('secure-http' => false)));
  2364. }
  2365. if (null === $repository) {
  2366. $sourceRepo = new CompositeRepository(RepositoryFactory::defaultRepos($io, $config));
  2367. } else {
  2368. $sourceRepo = RepositoryFactory::fromString($io, $config, $repository, true);
  2369. }
  2370. $parser = new VersionParser();
  2371. $requirements = $parser->parseNameVersionPairs(array($packageName));
  2372. $name = strtolower($requirements[0]['name']);
  2373. if (!$packageVersion && isset($requirements[0]['version'])) {
  2374. $packageVersion = $requirements[0]['version'];
  2375. }
  2376. if (null === $stability) {
  2377. if (preg_match('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) {
  2378. $stability = $match[1];
  2379. } else {
  2380. $stability = VersionParser::parseStability($packageVersion);
  2381. }
  2382. }
  2383. $stability = VersionParser::normalizeStability($stability);
  2384. if (!isset(BasePackage::$stabilities[$stability])) {
  2385. throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities)));
  2386. }
  2387. $pool = new Pool($stability);
  2388. $pool->addRepository($sourceRepo);
  2389. $phpVersion = null;
  2390. $prettyPhpVersion = null;
  2391. if (!$ignorePlatformReqs) {
  2392. $platformOverrides = $config->get('platform') ?: array();
  2393. $platform = new PlatformRepository(array(), $platformOverrides);
  2394. $phpPackage = $platform->findPackage('php', '*');
  2395. $phpVersion = $phpPackage->getVersion();
  2396. $prettyPhpVersion = $phpPackage->getPrettyVersion();
  2397. }
  2398. $versionSelector = new VersionSelector($pool);
  2399. $package = $versionSelector->findBestCandidate($name, $packageVersion, $phpVersion, $stability);
  2400. if (!$package) {
  2401. $errorMessage = "Could not find package $name with " . ($packageVersion ? "version $packageVersion" : "stability $stability");
  2402. if ($phpVersion && $versionSelector->findBestCandidate($name, $packageVersion, null, $stability)) {
  2403. throw new \InvalidArgumentException($errorMessage .' in a version installable using your PHP version '.$prettyPhpVersion.'.');
  2404. }
  2405. throw new \InvalidArgumentException($errorMessage .'.');
  2406. }
  2407. if (null === $directory) {
  2408. $parts = explode("/", $name, 2);
  2409. $directory = getcwd() . DIRECTORY_SEPARATOR . array_pop($parts);
  2410. }
  2411. if (function_exists('pcntl_async_signals')) {
  2412. @mkdir($directory, 0777, true);
  2413. if ($realDir = realpath($directory)) {
  2414. pcntl_async_signals(true);
  2415. pcntl_signal(SIGINT, function () use ($realDir) {
  2416. $fs = new Filesystem();
  2417. $fs->removeDirectory($realDir);
  2418. exit(130);
  2419. });
  2420. }
  2421. }
  2422. $io->writeError('<info>Installing ' . $package->getName() . ' (' . $package->getFullPrettyVersion(false) . ')</info>');
  2423. if ($disablePlugins) {
  2424. $io->writeError('<info>Plugins have been disabled.</info>');
  2425. }
  2426. if ($package instanceof AliasPackage) {
  2427. $package = $package->getAliasOf();
  2428. }
  2429. if (0 === strpos($package->getPrettyVersion(), 'dev-') && in_array($package->getSourceType(), array('git', 'hg'))) {
  2430. $package->setSourceReference(substr($package->getPrettyVersion(), 4));
  2431. }
  2432. $dm = $this->createDownloadManager($io, $config);
  2433. $dm->setPreferSource($preferSource)
  2434. ->setPreferDist($preferDist)
  2435. ->setOutputProgress(!$noProgress);
  2436. $projectInstaller = new ProjectInstaller($directory, $dm);
  2437. $im = $this->createInstallationManager();
  2438. $im->addInstaller($projectInstaller);
  2439. $im->install(new InstalledFilesystemRepository(new JsonFile('php://memory')), new InstallOperation($package));
  2440. $im->notifyInstalls($io);
  2441. $this->suggestedPackagesReporter->addSuggestionsFromPackage($package);
  2442. $installedFromVcs = 'source' === $package->getInstallationSource();
  2443. $io->writeError('<info>Created project in ' . $directory . '</info>');
  2444. chdir($directory);
  2445. $_SERVER['COMPOSER_ROOT_VERSION'] = $package->getPrettyVersion();
  2446. putenv('COMPOSER_ROOT_VERSION='.$_SERVER['COMPOSER_ROOT_VERSION']);
  2447. return $installedFromVcs;
  2448. }
  2449. protected function createDownloadManager(IOInterface $io, Config $config)
  2450. {
  2451. $factory = new Factory();
  2452. return $factory->createDownloadManager($io, $config);
  2453. }
  2454. protected function createInstallationManager()
  2455. {
  2456. return new InstallationManager();
  2457. }
  2458. }
  2459. <?php
  2460. namespace Composer\Command;
  2461. use Symfony\Component\Console\Input\InputInterface;
  2462. use Symfony\Component\Console\Output\OutputInterface;
  2463. class DependsCommand extends BaseDependencyCommand
  2464. {
  2465. protected function configure()
  2466. {
  2467. parent::configure();
  2468. $this
  2469. ->setName('depends')
  2470. ->setAliases(array('why'))
  2471. ->setDescription('Shows which packages cause the given package to be installed.')
  2472. ->setHelp(<<<EOT
  2473. Displays detailed information about where a package is referenced.
  2474. <info>php composer.phar depends composer/composer</info>
  2475. EOT
  2476. )
  2477. ;
  2478. }
  2479. protected function execute(InputInterface $input, OutputInterface $output)
  2480. {
  2481. return parent::doExecute($input, $output, false);
  2482. }
  2483. }
  2484. <?php
  2485. namespace Composer\Command;
  2486. use Composer\Composer;
  2487. use Composer\Factory;
  2488. use Composer\Config;
  2489. use Composer\Downloader\TransportException;
  2490. use Composer\Plugin\CommandEvent;
  2491. use Composer\Plugin\PluginEvents;
  2492. use Composer\Util\ConfigValidator;
  2493. use Composer\Util\IniHelper;
  2494. use Composer\Util\ProcessExecutor;
  2495. use Composer\Util\RemoteFilesystem;
  2496. use Composer\Util\StreamContextFactory;
  2497. use Composer\SelfUpdate\Keys;
  2498. use Composer\SelfUpdate\Versions;
  2499. use Composer\IO\NullIO;
  2500. use Symfony\Component\Console\Input\InputInterface;
  2501. use Symfony\Component\Console\Output\OutputInterface;
  2502. class DiagnoseCommand extends BaseCommand
  2503. {
  2504. protected $rfs;
  2505. protected $process;
  2506. protected $exitCode = 0;
  2507. protected function configure()
  2508. {
  2509. $this
  2510. ->setName('diagnose')
  2511. ->setDescription('Diagnoses the system to identify common errors.')
  2512. ->setHelp(<<<EOT
  2513. The <info>diagnose</info> command checks common errors to help debugging problems.
  2514. The process exit code will be 1 in case of warnings and 2 for errors.
  2515. EOT
  2516. )
  2517. ;
  2518. }
  2519. protected function execute(InputInterface $input, OutputInterface $output)
  2520. {
  2521. $composer = $this->getComposer(false);
  2522. $io = $this->getIO();
  2523. if ($composer) {
  2524. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'diagnose', $input, $output);
  2525. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  2526. $io->write('Checking composer.json: ', false);
  2527. $this->outputResult($this->checkComposerSchema());
  2528. }
  2529. if ($composer) {
  2530. $config = $composer->getConfig();
  2531. } else {
  2532. $config = Factory::createConfig();
  2533. }
  2534. $config->merge(array('config' => array('secure-http' => false)));
  2535. $config->prohibitUrlByConfig('http://packagist.org', new NullIO);
  2536. $this->rfs = Factory::createRemoteFilesystem($io, $config);
  2537. $this->process = new ProcessExecutor($io);
  2538. $io->write('Checking platform settings: ', false);
  2539. $this->outputResult($this->checkPlatform());
  2540. $io->write('Checking git settings: ', false);
  2541. $this->outputResult($this->checkGit());
  2542. $io->write('Checking http connectivity to packagist: ', false);
  2543. $this->outputResult($this->checkHttp('http', $config));
  2544. $io->write('Checking https connectivity to packagist: ', false);
  2545. $this->outputResult($this->checkHttp('https', $config));
  2546. $opts = stream_context_get_options(StreamContextFactory::getContext('http://example.org'));
  2547. if (!empty($opts['http']['proxy'])) {
  2548. $io->write('Checking HTTP proxy: ', false);
  2549. $this->outputResult($this->checkHttpProxy());
  2550. $io->write('Checking HTTP proxy support for request_fulluri: ', false);
  2551. $this->outputResult($this->checkHttpProxyFullUriRequestParam());
  2552. $io->write('Checking HTTPS proxy support for request_fulluri: ', false);
  2553. $this->outputResult($this->checkHttpsProxyFullUriRequestParam());
  2554. }
  2555. if ($oauth = $config->get('github-oauth')) {
  2556. foreach ($oauth as $domain => $token) {
  2557. $io->write('Checking '.$domain.' oauth access: ', false);
  2558. $this->outputResult($this->checkGithubOauth($domain, $token));
  2559. }
  2560. } else {
  2561. $io->write('Checking github.com rate limit: ', false);
  2562. try {
  2563. $rate = $this->getGithubRateLimit('github.com');
  2564. $this->outputResult(true);
  2565. if (10 > $rate['remaining']) {
  2566. $io->write('<warning>WARNING</warning>');
  2567. $io->write(sprintf(
  2568. '<comment>Github has a rate limit on their API. '
  2569. . 'You currently have <options=bold>%u</options=bold> '
  2570. . 'out of <options=bold>%u</options=bold> requests left.' . PHP_EOL
  2571. . 'See https://developer.github.com/v3/#rate-limiting and also' . PHP_EOL
  2572. . ' https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens</comment>',
  2573. $rate['remaining'],
  2574. $rate['limit']
  2575. ));
  2576. }
  2577. } catch (\Exception $e) {
  2578. if ($e instanceof TransportException && $e->getCode() === 401) {
  2579. $this->outputResult('<comment>The oauth token for github.com seems invalid, run "composer config --global --unset github-oauth.github.com" to remove it</comment>');
  2580. } else {
  2581. $this->outputResult($e);
  2582. }
  2583. }
  2584. }
  2585. $io->write('Checking disk free space: ', false);
  2586. $this->outputResult($this->checkDiskSpace($config));
  2587. if ('phar:' === substr(__FILE__, 0, 5)) {
  2588. $io->write('Checking pubkeys: ', false);
  2589. $this->outputResult($this->checkPubKeys($config));
  2590. $io->write('Checking composer version: ', false);
  2591. $this->outputResult($this->checkVersion($config));
  2592. }
  2593. $io->write(sprintf('Composer version: <comment>%s</comment>', Composer::VERSION));
  2594. $io->write(sprintf('PHP version: <comment>%s</comment>', PHP_VERSION));
  2595. if (defined('PHP_BINARY')) {
  2596. $io->write(sprintf('PHP binary path: <comment>%s</comment>', PHP_BINARY));
  2597. }
  2598. return $this->exitCode;
  2599. }
  2600. private function checkComposerSchema()
  2601. {
  2602. $validator = new ConfigValidator($this->getIO());
  2603. list($errors, , $warnings) = $validator->validate(Factory::getComposerFile());
  2604. if ($errors || $warnings) {
  2605. $messages = array(
  2606. 'error' => $errors,
  2607. 'warning' => $warnings,
  2608. );
  2609. $output = '';
  2610. foreach ($messages as $style => $msgs) {
  2611. foreach ($msgs as $msg) {
  2612. $output .= '<' . $style . '>' . $msg . '</' . $style . '>' . PHP_EOL;
  2613. }
  2614. }
  2615. return rtrim($output);
  2616. }
  2617. return true;
  2618. }
  2619. private function checkGit()
  2620. {
  2621. $this->process->execute('git config color.ui', $output);
  2622. if (strtolower(trim($output)) === 'always') {
  2623. return '<comment>Your git color.ui setting is set to always, this is known to create issues. Use "git config --global color.ui true" to set it correctly.</comment>';
  2624. }
  2625. return true;
  2626. }
  2627. private function checkHttp($proto, Config $config)
  2628. {
  2629. $disableTls = false;
  2630. $result = array();
  2631. if ($proto === 'https' && $config->get('disable-tls') === true) {
  2632. $disableTls = true;
  2633. $result[] = '<warning>Composer is configured to disable SSL/TLS protection. This will leave remote HTTPS requests vulnerable to Man-In-The-Middle attacks.</warning>';
  2634. }
  2635. if ($proto === 'https' && !extension_loaded('openssl') && !$disableTls) {
  2636. $result[] = '<error>Composer is configured to use SSL/TLS protection but the openssl extension is not available.</error>';
  2637. }
  2638. try {
  2639. $this->rfs->getContents('packagist.org', $proto . '://packagist.org/packages.json', false);
  2640. } catch (TransportException $e) {
  2641. if (false !== strpos($e->getMessage(), 'cafile')) {
  2642. $result[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
  2643. $result[] = '<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>';
  2644. $result[] = '<error>You can alternatively disable this error, at your own risk, by enabling the \'disable-tls\' option.</error>';
  2645. } else {
  2646. array_unshift($result, '[' . get_class($e) . '] ' . $e->getMessage());
  2647. }
  2648. }
  2649. if (count($result) > 0) {
  2650. return $result;
  2651. }
  2652. return true;
  2653. }
  2654. private function checkHttpProxy()
  2655. {
  2656. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  2657. try {
  2658. $json = json_decode($this->rfs->getContents('packagist.org', $protocol . '://packagist.org/packages.json', false), true);
  2659. $hash = reset($json['provider-includes']);
  2660. $hash = $hash['sha256'];
  2661. $path = str_replace('%hash%', $hash, key($json['provider-includes']));
  2662. $provider = $this->rfs->getContents('packagist.org', $protocol . '://packagist.org/'.$path, false);
  2663. if (hash('sha256', $provider) !== $hash) {
  2664. return 'It seems that your proxy is modifying http traffic on the fly';
  2665. }
  2666. } catch (\Exception $e) {
  2667. return $e;
  2668. }
  2669. return true;
  2670. }
  2671. private function checkHttpProxyFullUriRequestParam()
  2672. {
  2673. $url = 'http://packagist.org/packages.json';
  2674. try {
  2675. $this->rfs->getContents('packagist.org', $url, false);
  2676. } catch (TransportException $e) {
  2677. try {
  2678. $this->rfs->getContents('packagist.org', $url, false, array('http' => array('request_fulluri' => false)));
  2679. } catch (TransportException $e) {
  2680. return 'Unable to assess the situation, maybe packagist.org is down ('.$e->getMessage().')';
  2681. }
  2682. return 'It seems there is a problem with your proxy server, try setting the "HTTP_PROXY_REQUEST_FULLURI" and "HTTPS_PROXY_REQUEST_FULLURI" environment variables to "false"';
  2683. }
  2684. return true;
  2685. }
  2686. private function checkHttpsProxyFullUriRequestParam()
  2687. {
  2688. if (!extension_loaded('openssl')) {
  2689. return 'You need the openssl extension installed for this check';
  2690. }
  2691. $url = 'https://api.github.com/repos/Seldaek/jsonlint/zipball/1.0.0';
  2692. try {
  2693. $this->rfs->getContents('github.com', $url, false);
  2694. } catch (TransportException $e) {
  2695. try {
  2696. $this->rfs->getContents('github.com', $url, false, array('http' => array('request_fulluri' => false)));
  2697. } catch (TransportException $e) {
  2698. return 'Unable to assess the situation, maybe github is down ('.$e->getMessage().')';
  2699. }
  2700. return 'It seems there is a problem with your proxy server, try setting the "HTTPS_PROXY_REQUEST_FULLURI" environment variable to "false"';
  2701. }
  2702. return true;
  2703. }
  2704. private function checkGithubOauth($domain, $token)
  2705. {
  2706. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  2707. try {
  2708. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/' : 'https://'.$domain.'/api/v3/';
  2709. return $this->rfs->getContents($domain, $url, false, array(
  2710. 'retry-auth-failure' => false,
  2711. )) ? true : 'Unexpected error';
  2712. } catch (\Exception $e) {
  2713. if ($e instanceof TransportException && $e->getCode() === 401) {
  2714. return '<comment>The oauth token for '.$domain.' seems invalid, run "composer config --global --unset github-oauth.'.$domain.'" to remove it</comment>';
  2715. }
  2716. return $e;
  2717. }
  2718. }
  2719. private function getGithubRateLimit($domain, $token = null)
  2720. {
  2721. if ($token) {
  2722. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  2723. }
  2724. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/rate_limit' : 'https://'.$domain.'/api/rate_limit';
  2725. $json = $this->rfs->getContents($domain, $url, false, array('retry-auth-failure' => false));
  2726. $data = json_decode($json, true);
  2727. return $data['resources']['core'];
  2728. }
  2729. private function checkDiskSpace($config)
  2730. {
  2731. $minSpaceFree = 1024 * 1024;
  2732. if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  2733. || (($df = @disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  2734. ) {
  2735. return '<error>The disk hosting '.$dir.' is full</error>';
  2736. }
  2737. return true;
  2738. }
  2739. private function checkPubKeys($config)
  2740. {
  2741. $home = $config->get('home');
  2742. $errors = array();
  2743. $io = $this->getIO();
  2744. if (file_exists($home.'/keys.tags.pub') && file_exists($home.'/keys.dev.pub')) {
  2745. $io->write('');
  2746. }
  2747. if (file_exists($home.'/keys.tags.pub')) {
  2748. $io->write('Tags Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.tags.pub'));
  2749. } else {
  2750. $errors[] = '<error>Missing pubkey for tags verification</error>';
  2751. }
  2752. if (file_exists($home.'/keys.dev.pub')) {
  2753. $io->write('Dev Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.dev.pub'));
  2754. } else {
  2755. $errors[] = '<error>Missing pubkey for dev verification</error>';
  2756. }
  2757. if ($errors) {
  2758. $errors[] = '<error>Run composer self-update --update-keys to set them up</error>';
  2759. }
  2760. return $errors ?: true;
  2761. }
  2762. private function checkVersion($config)
  2763. {
  2764. $versionsUtil = new Versions($config, $this->rfs);
  2765. $latest = $versionsUtil->getLatest();
  2766. if (Composer::VERSION !== $latest['version'] && Composer::VERSION !== '@package_version@') {
  2767. return '<comment>You are not running the latest '.$versionsUtil->getChannel().' version, run `composer self-update` to update ('.Composer::VERSION.' => '.$latest['version'].')</comment>';
  2768. }
  2769. return true;
  2770. }
  2771. private function outputResult($result)
  2772. {
  2773. $io = $this->getIO();
  2774. if (true === $result) {
  2775. $io->write('<info>OK</info>');
  2776. return;
  2777. }
  2778. $hadError = false;
  2779. if ($result instanceof \Exception) {
  2780. $result = '<error>['.get_class($result).'] '.$result->getMessage().'</error>';
  2781. }
  2782. if (!$result) {
  2783. $hadError = true;
  2784. } else {
  2785. if (!is_array($result)) {
  2786. $result = array($result);
  2787. }
  2788. foreach ($result as $message) {
  2789. if (false !== strpos($message, '<error>')) {
  2790. $hadError = true;
  2791. }
  2792. }
  2793. }
  2794. if ($hadError) {
  2795. $io->write('<error>FAIL</error>');
  2796. $this->exitCode = 2;
  2797. } else {
  2798. $io->write('<warning>WARNING</warning>');
  2799. $this->exitCode = 1;
  2800. }
  2801. if ($result) {
  2802. foreach ($result as $message) {
  2803. $io->write($message);
  2804. }
  2805. }
  2806. }
  2807. private function checkPlatform()
  2808. {
  2809. $output = '';
  2810. $out = function ($msg, $style) use (&$output) {
  2811. $output .= '<'.$style.'>'.$msg.'</'.$style.'>'.PHP_EOL;
  2812. };
  2813. $errors = array();
  2814. $warnings = array();
  2815. $displayIniMessage = false;
  2816. $iniMessage = PHP_EOL.PHP_EOL.IniHelper::getMessage();
  2817. $iniMessage .= PHP_EOL.'If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.';
  2818. if (!function_exists('json_decode')) {
  2819. $errors['json'] = true;
  2820. }
  2821. if (!extension_loaded('Phar')) {
  2822. $errors['phar'] = true;
  2823. }
  2824. if (!extension_loaded('filter')) {
  2825. $errors['filter'] = true;
  2826. }
  2827. if (!extension_loaded('hash')) {
  2828. $errors['hash'] = true;
  2829. }
  2830. if (!extension_loaded('iconv') && !extension_loaded('mbstring')) {
  2831. $errors['iconv_mbstring'] = true;
  2832. }
  2833. if (!ini_get('allow_url_fopen')) {
  2834. $errors['allow_url_fopen'] = true;
  2835. }
  2836. if (extension_loaded('ionCube Loader') && ioncube_loader_iversion() < 40009) {
  2837. $errors['ioncube'] = ioncube_loader_version();
  2838. }
  2839. if (PHP_VERSION_ID < 50302) {
  2840. $errors['php'] = PHP_VERSION;
  2841. }
  2842. if (!isset($errors['php']) && PHP_VERSION_ID < 50304) {
  2843. $warnings['php'] = PHP_VERSION;
  2844. }
  2845. if (!extension_loaded('openssl')) {
  2846. $errors['openssl'] = true;
  2847. }
  2848. if (extension_loaded('openssl') && OPENSSL_VERSION_NUMBER < 0x1000100f) {
  2849. $warnings['openssl_version'] = true;
  2850. }
  2851. if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && ini_get('apc.enable_cli')) {
  2852. $warnings['apc_cli'] = true;
  2853. }
  2854. if (!extension_loaded('zlib')) {
  2855. $warnings['zlib'] = true;
  2856. }
  2857. ob_start();
  2858. phpinfo(INFO_GENERAL);
  2859. $phpinfo = ob_get_clean();
  2860. if (preg_match('{Configure Command(?: *</td><td class="v">| *=> *)(.*?)(?:</td>|$)}m', $phpinfo, $match)) {
  2861. $configure = $match[1];
  2862. if (false !== strpos($configure, '--enable-sigchild')) {
  2863. $warnings['sigchild'] = true;
  2864. }
  2865. if (false !== strpos($configure, '--with-curlwrappers')) {
  2866. $warnings['curlwrappers'] = true;
  2867. }
  2868. }
  2869. if (ini_get('xdebug.profiler_enabled')) {
  2870. $warnings['xdebug_profile'] = true;
  2871. } elseif (extension_loaded('xdebug')) {
  2872. $warnings['xdebug_loaded'] = true;
  2873. }
  2874. if (!empty($errors)) {
  2875. foreach ($errors as $error => $current) {
  2876. switch ($error) {
  2877. case 'json':
  2878. $text = PHP_EOL."The json extension is missing.".PHP_EOL;
  2879. $text .= "Install it or recompile php without --disable-json";
  2880. break;
  2881. case 'phar':
  2882. $text = PHP_EOL."The phar extension is missing.".PHP_EOL;
  2883. $text .= "Install it or recompile php without --disable-phar";
  2884. break;
  2885. case 'filter':
  2886. $text = PHP_EOL."The filter extension is missing.".PHP_EOL;
  2887. $text .= "Install it or recompile php without --disable-filter";
  2888. break;
  2889. case 'hash':
  2890. $text = PHP_EOL."The hash extension is missing.".PHP_EOL;
  2891. $text .= "Install it or recompile php without --disable-hash";
  2892. break;
  2893. case 'iconv_mbstring':
  2894. $text = PHP_EOL."The iconv OR mbstring extension is required and both are missing.".PHP_EOL;
  2895. $text .= "Install either of them or recompile php without --disable-iconv";
  2896. break;
  2897. case 'unicode':
  2898. $text = PHP_EOL."The detect_unicode setting must be disabled.".PHP_EOL;
  2899. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  2900. $text .= " detect_unicode = Off";
  2901. $displayIniMessage = true;
  2902. break;
  2903. case 'suhosin':
  2904. $text = PHP_EOL."The suhosin.executor.include.whitelist setting is incorrect.".PHP_EOL;
  2905. $text .= "Add the following to the end of your `php.ini` or suhosin.ini (Example path [for Debian]: /etc/php5/cli/conf.d/suhosin.ini):".PHP_EOL;
  2906. $text .= " suhosin.executor.include.whitelist = phar ".$current;
  2907. $displayIniMessage = true;
  2908. break;
  2909. case 'php':
  2910. $text = PHP_EOL."Your PHP ({$current}) is too old, you must upgrade to PHP 5.3.2 or higher.";
  2911. break;
  2912. case 'allow_url_fopen':
  2913. $text = PHP_EOL."The allow_url_fopen setting is incorrect.".PHP_EOL;
  2914. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  2915. $text .= " allow_url_fopen = On";
  2916. $displayIniMessage = true;
  2917. break;
  2918. case 'ioncube':
  2919. $text = PHP_EOL."Your ionCube Loader extension ($current) is incompatible with Phar files.".PHP_EOL;
  2920. $text .= "Upgrade to ionCube 4.0.9 or higher or remove this line (path may be different) from your `php.ini` to disable it:".PHP_EOL;
  2921. $text .= " zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so";
  2922. $displayIniMessage = true;
  2923. break;
  2924. case 'openssl':
  2925. $text = PHP_EOL."The openssl extension is missing, which means that secure HTTPS transfers are impossible.".PHP_EOL;
  2926. $text .= "If possible you should enable it or recompile php with --with-openssl";
  2927. break;
  2928. }
  2929. $out($text, 'error');
  2930. }
  2931. $output .= PHP_EOL;
  2932. }
  2933. if (!empty($warnings)) {
  2934. foreach ($warnings as $warning => $current) {
  2935. switch ($warning) {
  2936. case 'apc_cli':
  2937. $text = "The apc.enable_cli setting is incorrect.".PHP_EOL;
  2938. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  2939. $text .= " apc.enable_cli = Off";
  2940. $displayIniMessage = true;
  2941. break;
  2942. case 'zlib':
  2943. $text = 'The zlib extension is not loaded, this can slow down Composer a lot.'.PHP_EOL;
  2944. $text .= 'If possible, enable it or recompile php with --with-zlib'.PHP_EOL;
  2945. $displayIniMessage = true;
  2946. break;
  2947. case 'sigchild':
  2948. $text = "PHP was compiled with --enable-sigchild which can cause issues on some platforms.".PHP_EOL;
  2949. $text .= "Recompile it without this flag if possible, see also:".PHP_EOL;
  2950. $text .= " https://bugs.php.net/bug.php?id=22999";
  2951. break;
  2952. case 'curlwrappers':
  2953. $text = "PHP was compiled with --with-curlwrappers which will cause issues with HTTP authentication and GitHub.".PHP_EOL;
  2954. $text .= " Recompile it without this flag if possible";
  2955. break;
  2956. case 'php':
  2957. $text = "Your PHP ({$current}) is quite old, upgrading to PHP 5.3.4 or higher is recommended.".PHP_EOL;
  2958. $text .= " Composer works with 5.3.2+ for most people, but there might be edge case issues.";
  2959. break;
  2960. case 'openssl_version':
  2961. $opensslVersion = strstr(trim(strstr(OPENSSL_VERSION_TEXT, ' ')), ' ', true);
  2962. $opensslVersion = $opensslVersion ?: OPENSSL_VERSION_TEXT;
  2963. $text = "The OpenSSL library ({$opensslVersion}) used by PHP does not support TLSv1.2 or TLSv1.1.".PHP_EOL;
  2964. $text .= "If possible you should upgrade OpenSSL to version 1.0.1 or above.";
  2965. break;
  2966. case 'xdebug_loaded':
  2967. $text = "The xdebug extension is loaded, this can slow down Composer a little.".PHP_EOL;
  2968. $text .= " Disabling it when using Composer is recommended.";
  2969. break;
  2970. case 'xdebug_profile':
  2971. $text = "The xdebug.profiler_enabled setting is enabled, this can slow down Composer a lot.".PHP_EOL;
  2972. $text .= "Add the following to the end of your `php.ini` to disable it:".PHP_EOL;
  2973. $text .= " xdebug.profiler_enabled = 0";
  2974. $displayIniMessage = true;
  2975. break;
  2976. }
  2977. $out($text, 'comment');
  2978. }
  2979. }
  2980. if ($displayIniMessage) {
  2981. $out($iniMessage, 'comment');
  2982. }
  2983. return !$warnings && !$errors ? true : $output;
  2984. }
  2985. }
  2986. <?php
  2987. namespace Composer\Command;
  2988. use Composer\Plugin\CommandEvent;
  2989. use Composer\Plugin\PluginEvents;
  2990. use Symfony\Component\Console\Input\InputInterface;
  2991. use Symfony\Component\Console\Input\InputOption;
  2992. use Symfony\Component\Console\Output\OutputInterface;
  2993. class DumpAutoloadCommand extends BaseCommand
  2994. {
  2995. protected function configure()
  2996. {
  2997. $this
  2998. ->setName('dump-autoload')
  2999. ->setAliases(array('dumpautoload'))
  3000. ->setDescription('Dumps the autoloader.')
  3001. ->setDefinition(array(
  3002. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  3003. new InputOption('optimize', 'o', InputOption::VALUE_NONE, 'Optimizes PSR0 and PSR4 packages to be loaded with classmaps too, good for production.'),
  3004. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize`.'),
  3005. new InputOption('apcu', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  3006. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables autoload-dev rules.'),
  3007. ))
  3008. ->setHelp(<<<EOT
  3009. <info>php composer.phar dump-autoload</info>
  3010. EOT
  3011. )
  3012. ;
  3013. }
  3014. protected function execute(InputInterface $input, OutputInterface $output)
  3015. {
  3016. $composer = $this->getComposer();
  3017. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'dump-autoload', $input, $output);
  3018. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3019. $installationManager = $composer->getInstallationManager();
  3020. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  3021. $package = $composer->getPackage();
  3022. $config = $composer->getConfig();
  3023. $optimize = $input->getOption('optimize') || $config->get('optimize-autoloader');
  3024. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  3025. $apcu = $input->getOption('apcu') || $config->get('apcu-autoloader');
  3026. if ($authoritative) {
  3027. $this->getIO()->writeError('<info>Generating optimized autoload files (authoritative)</info>');
  3028. } elseif ($optimize) {
  3029. $this->getIO()->writeError('<info>Generating optimized autoload files</info>');
  3030. } else {
  3031. $this->getIO()->writeError('<info>Generating autoload files</info>');
  3032. }
  3033. $generator = $composer->getAutoloadGenerator();
  3034. $generator->setDevMode(!$input->getOption('no-dev'));
  3035. $generator->setClassMapAuthoritative($authoritative);
  3036. $generator->setApcu($apcu);
  3037. $generator->setRunScripts(!$input->getOption('no-scripts'));
  3038. $generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize);
  3039. }
  3040. }
  3041. <?php
  3042. namespace Composer\Command;
  3043. use Symfony\Component\Console\Input\InputInterface;
  3044. use Symfony\Component\Console\Input\InputOption;
  3045. use Symfony\Component\Console\Output\OutputInterface;
  3046. use Symfony\Component\Console\Input\InputArgument;
  3047. class ExecCommand extends BaseCommand
  3048. {
  3049. protected function configure()
  3050. {
  3051. $this
  3052. ->setName('exec')
  3053. ->setDescription('Executes a vendored binary/script.')
  3054. ->setDefinition(array(
  3055. new InputOption('list', 'l', InputOption::VALUE_NONE),
  3056. new InputArgument('binary', InputArgument::OPTIONAL, 'The binary to run, e.g. phpunit'),
  3057. new InputArgument(
  3058. 'args',
  3059. InputArgument::IS_ARRAY | InputArgument::OPTIONAL,
  3060. 'Arguments to pass to the binary. Use <info>--</info> to separate from composer arguments'
  3061. ),
  3062. ))
  3063. ;
  3064. }
  3065. protected function execute(InputInterface $input, OutputInterface $output)
  3066. {
  3067. $composer = $this->getComposer();
  3068. $binDir = $composer->getConfig()->get('bin-dir');
  3069. if ($input->getOption('list') || !$input->getArgument('binary')) {
  3070. $bins = glob($binDir . '/*');
  3071. $bins = array_merge($bins, array_map(function ($e) {
  3072. return "$e (local)";
  3073. }, $composer->getPackage()->getBinaries()));
  3074. if (!$bins) {
  3075. throw new \RuntimeException("No binaries found in composer.json or in bin-dir ($binDir)");
  3076. }
  3077. $this->getIO()->write(<<<EOT
  3078. <comment>Available binaries:</comment>
  3079. EOT
  3080. );
  3081. foreach ($bins as $bin) {
  3082. if (isset($previousBin) && $bin === $previousBin.'.bat') {
  3083. continue;
  3084. }
  3085. $previousBin = $bin;
  3086. $bin = basename($bin);
  3087. $this->getIO()->write(<<<EOT
  3088. <info>- $bin</info>
  3089. EOT
  3090. );
  3091. }
  3092. return 0;
  3093. }
  3094. $binary = $input->getArgument('binary');
  3095. $dispatcher = $composer->getEventDispatcher();
  3096. $dispatcher->addListener('__exec_command', $binary);
  3097. if ($output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL) {
  3098. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  3099. }
  3100. return $dispatcher->dispatchScript('__exec_command', true, $input->getArgument('args'));
  3101. }
  3102. }
  3103. <?php
  3104. namespace Composer\Command;
  3105. use Composer\Factory;
  3106. use Symfony\Component\Console\Input\InputInterface;
  3107. use Symfony\Component\Console\Input\InputArgument;
  3108. use Symfony\Component\Console\Input\StringInput;
  3109. use Symfony\Component\Console\Output\OutputInterface;
  3110. class GlobalCommand extends BaseCommand
  3111. {
  3112. protected function configure()
  3113. {
  3114. $this
  3115. ->setName('global')
  3116. ->setDescription('Allows running commands in the global composer dir ($COMPOSER_HOME).')
  3117. ->setDefinition(array(
  3118. new InputArgument('command-name', InputArgument::REQUIRED, ''),
  3119. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  3120. ))
  3121. ->setHelp(<<<EOT
  3122. Use this command as a wrapper to run other Composer commands
  3123. within the global context of COMPOSER_HOME.
  3124. You can use this to install CLI utilities globally, all you need
  3125. is to add the COMPOSER_HOME/vendor/bin dir to your PATH env var.
  3126. COMPOSER_HOME is c:\Users\<user>\AppData\Roaming\Composer on Windows
  3127. and /home/<user>/.composer on unix systems.
  3128. If your system uses freedesktop.org standards, then it will first check
  3129. XDG_CONFIG_HOME or default to /home/<user>/.config/composer
  3130. Note: This path may vary depending on customizations to bin-dir in
  3131. composer.json or the environmental variable COMPOSER_BIN_DIR.
  3132. EOT
  3133. )
  3134. ;
  3135. }
  3136. public function run(InputInterface $input, OutputInterface $output)
  3137. {
  3138. $tokens = preg_split('{\s+}', $input->__toString());
  3139. $args = array();
  3140. foreach ($tokens as $token) {
  3141. if ($token && $token[0] !== '-') {
  3142. $args[] = $token;
  3143. if (count($args) >= 2) {
  3144. break;
  3145. }
  3146. }
  3147. }
  3148. if (count($args) < 2) {
  3149. return parent::run($input, $output);
  3150. }
  3151. $config = Factory::createConfig();
  3152. chdir($config->get('home'));
  3153. $this->getIO()->writeError('<info>Changed current directory to '.$config->get('home').'</info>');
  3154. $input = new StringInput(preg_replace('{\bg(?:l(?:o(?:b(?:a(?:l)?)?)?)?)?\b}', '', $input->__toString(), 1));
  3155. $this->getApplication()->resetComposer();
  3156. return $this->getApplication()->run($input, $output);
  3157. }
  3158. public function isProxyCommand()
  3159. {
  3160. return true;
  3161. }
  3162. }
  3163. <?php
  3164. namespace Composer\Command;
  3165. use Composer\Package\CompletePackageInterface;
  3166. use Composer\Repository\RepositoryInterface;
  3167. use Composer\Repository\ArrayRepository;
  3168. use Composer\Repository\RepositoryFactory;
  3169. use Composer\Util\Platform;
  3170. use Composer\Util\ProcessExecutor;
  3171. use Symfony\Component\Console\Input\InputArgument;
  3172. use Symfony\Component\Console\Input\InputOption;
  3173. use Symfony\Component\Console\Input\InputInterface;
  3174. use Symfony\Component\Console\Output\OutputInterface;
  3175. class HomeCommand extends BaseCommand
  3176. {
  3177. protected function configure()
  3178. {
  3179. $this
  3180. ->setName('browse')
  3181. ->setAliases(array('home'))
  3182. ->setDescription('Opens the package\'s repository URL or homepage in your browser.')
  3183. ->setDefinition(array(
  3184. new InputArgument('packages', InputArgument::IS_ARRAY, 'Package(s) to browse to.'),
  3185. new InputOption('homepage', 'H', InputOption::VALUE_NONE, 'Open the homepage instead of the repository URL.'),
  3186. new InputOption('show', 's', InputOption::VALUE_NONE, 'Only show the homepage or repository URL.'),
  3187. ))
  3188. ->setHelp(<<<EOT
  3189. The home command opens or shows a package's repository URL or
  3190. homepage in your default browser.
  3191. To open the homepage by default, use -H or --homepage.
  3192. To show instead of open the repository or homepage URL, use -s or --show.
  3193. EOT
  3194. );
  3195. }
  3196. protected function execute(InputInterface $input, OutputInterface $output)
  3197. {
  3198. $repos = $this->initializeRepos();
  3199. $io = $this->getIO();
  3200. $return = 0;
  3201. $packages = $input->getArgument('packages');
  3202. if (!$packages) {
  3203. $io->writeError('No package specified, opening homepage for the root package');
  3204. $packages = array($this->getComposer()->getPackage()->getName());
  3205. }
  3206. foreach ($packages as $packageName) {
  3207. $handled = false;
  3208. $packageExists = false;
  3209. foreach ($repos as $repo) {
  3210. foreach ($repo->findPackages($packageName) as $package) {
  3211. $packageExists = true;
  3212. if ($package instanceof CompletePackageInterface && $this->handlePackage($package, $input->getOption('homepage'), $input->getOption('show'))) {
  3213. $handled = true;
  3214. break 2;
  3215. }
  3216. }
  3217. }
  3218. if (!$packageExists) {
  3219. $return = 1;
  3220. $io->writeError('<warning>Package '.$packageName.' not found</warning>');
  3221. }
  3222. if (!$handled) {
  3223. $return = 1;
  3224. $io->writeError('<warning>'.($input->getOption('homepage') ? 'Invalid or missing homepage' : 'Invalid or missing repository URL').' for '.$packageName.'</warning>');
  3225. }
  3226. }
  3227. return $return;
  3228. }
  3229. private function handlePackage(CompletePackageInterface $package, $showHomepage, $showOnly)
  3230. {
  3231. $support = $package->getSupport();
  3232. $url = isset($support['source']) ? $support['source'] : $package->getSourceUrl();
  3233. if (!$url || $showHomepage) {
  3234. $url = $package->getHomepage();
  3235. }
  3236. if (!$url || !filter_var($url, FILTER_VALIDATE_URL)) {
  3237. return false;
  3238. }
  3239. if ($showOnly) {
  3240. $this->getIO()->write(sprintf('<info>%s</info>', $url));
  3241. } else {
  3242. $this->openBrowser($url);
  3243. }
  3244. return true;
  3245. }
  3246. private function openBrowser($url)
  3247. {
  3248. $url = ProcessExecutor::escape($url);
  3249. $process = new ProcessExecutor($this->getIO());
  3250. if (Platform::isWindows()) {
  3251. return $process->execute('start "web" explorer "' . $url . '"', $output);
  3252. }
  3253. $linux = $process->execute('which xdg-open', $output);
  3254. $osx = $process->execute('which open', $output);
  3255. if (0 === $linux) {
  3256. $process->execute('xdg-open ' . $url, $output);
  3257. } elseif (0 === $osx) {
  3258. $process->execute('open ' . $url, $output);
  3259. } else {
  3260. $this->getIO()->writeError('No suitable browser opening command found, open yourself: ' . $url);
  3261. }
  3262. }
  3263. private function initializeRepos()
  3264. {
  3265. $composer = $this->getComposer(false);
  3266. if ($composer) {
  3267. return array_merge(
  3268. array(new ArrayRepository(array($composer->getPackage()))),
  3269. array($composer->getRepositoryManager()->getLocalRepository()),
  3270. $composer->getRepositoryManager()->getRepositories()
  3271. );
  3272. }
  3273. return RepositoryFactory::defaultRepos($this->getIO());
  3274. }
  3275. }
  3276. <?php
  3277. namespace Composer\Command;
  3278. use Composer\DependencyResolver\Pool;
  3279. use Composer\Factory;
  3280. use Composer\Json\JsonFile;
  3281. use Composer\Package\BasePackage;
  3282. use Composer\Package\Version\VersionParser;
  3283. use Composer\Package\Version\VersionSelector;
  3284. use Composer\Repository\CompositeRepository;
  3285. use Composer\Repository\PlatformRepository;
  3286. use Composer\Repository\RepositoryFactory;
  3287. use Composer\Util\ProcessExecutor;
  3288. use Symfony\Component\Console\Input\InputInterface;
  3289. use Symfony\Component\Console\Input\InputOption;
  3290. use Symfony\Component\Console\Output\OutputInterface;
  3291. use Symfony\Component\Process\ExecutableFinder;
  3292. use Symfony\Component\Process\Process;
  3293. class InitCommand extends BaseCommand
  3294. {
  3295. protected $repos;
  3296. private $gitConfig;
  3297. private $pools;
  3298. protected function configure()
  3299. {
  3300. $this
  3301. ->setName('init')
  3302. ->setDescription('Creates a basic composer.json file in current directory.')
  3303. ->setDefinition(array(
  3304. new InputOption('name', null, InputOption::VALUE_REQUIRED, 'Name of the package'),
  3305. new InputOption('description', null, InputOption::VALUE_REQUIRED, 'Description of package'),
  3306. new InputOption('author', null, InputOption::VALUE_REQUIRED, 'Author name of package'),
  3307. new InputOption('type', null, InputOption::VALUE_OPTIONAL, 'Type of package (e.g. library, project, metapackage, composer-plugin)'),
  3308. new InputOption('homepage', null, InputOption::VALUE_REQUIRED, 'Homepage of package'),
  3309. new InputOption('require', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  3310. new InputOption('require-dev', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require for development with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  3311. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum stability (empty or one of: '.implode(', ', array_keys(BasePackage::$stabilities)).')'),
  3312. new InputOption('license', 'l', InputOption::VALUE_REQUIRED, 'License of package'),
  3313. new InputOption('repository', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Add custom repositories, either by URL or using JSON arrays'),
  3314. ))
  3315. ->setHelp(<<<EOT
  3316. The <info>init</info> command creates a basic composer.json file
  3317. in the current directory.
  3318. <info>php composer.phar init</info>
  3319. EOT
  3320. )
  3321. ;
  3322. }
  3323. protected function execute(InputInterface $input, OutputInterface $output)
  3324. {
  3325. $io = $this->getIO();
  3326. $whitelist = array('name', 'description', 'author', 'type', 'homepage', 'require', 'require-dev', 'stability', 'license');
  3327. $options = array_filter(array_intersect_key($input->getOptions(), array_flip($whitelist)));
  3328. if (isset($options['author'])) {
  3329. $options['authors'] = $this->formatAuthors($options['author']);
  3330. unset($options['author']);
  3331. }
  3332. $repositories = $input->getOption('repository');
  3333. if ($repositories) {
  3334. $config = Factory::createConfig($io);
  3335. foreach ($repositories as $repo) {
  3336. $options['repositories'][] = RepositoryFactory::configFromString($io, $config, $repo);
  3337. }
  3338. }
  3339. if (isset($options['stability'])) {
  3340. $options['minimum-stability'] = $options['stability'];
  3341. unset($options['stability']);
  3342. }
  3343. $options['require'] = isset($options['require']) ? $this->formatRequirements($options['require']) : new \stdClass;
  3344. if (array() === $options['require']) {
  3345. $options['require'] = new \stdClass;
  3346. }
  3347. if (isset($options['require-dev'])) {
  3348. $options['require-dev'] = $this->formatRequirements($options['require-dev']);
  3349. if (array() === $options['require-dev']) {
  3350. $options['require-dev'] = new \stdClass;
  3351. }
  3352. }
  3353. $file = new JsonFile(Factory::getComposerFile());
  3354. $json = $file->encode($options);
  3355. if ($input->isInteractive()) {
  3356. $io->writeError(array('', $json, ''));
  3357. if (!$io->askConfirmation('Do you confirm generation [<comment>yes</comment>]? ', true)) {
  3358. $io->writeError('<error>Command aborted</error>');
  3359. return 1;
  3360. }
  3361. }
  3362. $file->write($options);
  3363. if ($input->isInteractive() && is_dir('.git')) {
  3364. $ignoreFile = realpath('.gitignore');
  3365. if (false === $ignoreFile) {
  3366. $ignoreFile = realpath('.') . '/.gitignore';
  3367. }
  3368. if (!$this->hasVendorIgnore($ignoreFile)) {
  3369. $question = 'Would you like the <info>vendor</info> directory added to your <info>.gitignore</info> [<comment>yes</comment>]? ';
  3370. if ($io->askConfirmation($question, true)) {
  3371. $this->addVendorIgnore($ignoreFile);
  3372. }
  3373. }
  3374. }
  3375. }
  3376. protected function interact(InputInterface $input, OutputInterface $output)
  3377. {
  3378. $git = $this->getGitConfig();
  3379. $io = $this->getIO();
  3380. $formatter = $this->getHelperSet()->get('formatter');
  3381. $repositories = $input->getOption('repository');
  3382. if ($repositories) {
  3383. $config = Factory::createConfig($io);
  3384. $repos = array(new PlatformRepository);
  3385. foreach ($repositories as $repo) {
  3386. $repos[] = RepositoryFactory::fromString($io, $config, $repo);
  3387. }
  3388. $repos[] = RepositoryFactory::createRepo($io, $config, array(
  3389. 'type' => 'composer',
  3390. 'url' => 'https://packagist.org',
  3391. ));
  3392. $this->repos = new CompositeRepository($repos);
  3393. unset($repos, $config, $repositories);
  3394. }
  3395. $io->writeError(array(
  3396. '',
  3397. $formatter->formatBlock('Welcome to the Composer config generator', 'bg=blue;fg=white', true),
  3398. '',
  3399. ));
  3400. $io->writeError(array(
  3401. '',
  3402. 'This command will guide you through creating your composer.json config.',
  3403. '',
  3404. ));
  3405. $cwd = realpath(".");
  3406. if (!$name = $input->getOption('name')) {
  3407. $name = basename($cwd);
  3408. $name = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  3409. $name = strtolower($name);
  3410. if (!empty($_SERVER['COMPOSER_DEFAULT_VENDOR'])) {
  3411. $name = $_SERVER['COMPOSER_DEFAULT_VENDOR'] . '/' . $name;
  3412. } elseif (isset($git['github.user'])) {
  3413. $name = $git['github.user'] . '/' . $name;
  3414. } elseif (!empty($_SERVER['USERNAME'])) {
  3415. $name = $_SERVER['USERNAME'] . '/' . $name;
  3416. } elseif (!empty($_SERVER['USER'])) {
  3417. $name = $_SERVER['USER'] . '/' . $name;
  3418. } elseif (get_current_user()) {
  3419. $name = get_current_user() . '/' . $name;
  3420. } else {
  3421. $name = $name . '/' . $name;
  3422. }
  3423. $name = strtolower($name);
  3424. } else {
  3425. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}', $name)) {
  3426. throw new \InvalidArgumentException(
  3427. 'The package name '.$name.' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
  3428. );
  3429. }
  3430. }
  3431. $name = $io->askAndValidate(
  3432. 'Package name (<vendor>/<name>) [<comment>'.$name.'</comment>]: ',
  3433. function ($value) use ($name) {
  3434. if (null === $value) {
  3435. return $name;
  3436. }
  3437. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}', $value)) {
  3438. throw new \InvalidArgumentException(
  3439. 'The package name '.$value.' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
  3440. );
  3441. }
  3442. return $value;
  3443. },
  3444. null,
  3445. $name
  3446. );
  3447. $input->setOption('name', $name);
  3448. $description = $input->getOption('description') ?: false;
  3449. $description = $io->ask(
  3450. 'Description [<comment>'.$description.'</comment>]: ',
  3451. $description
  3452. );
  3453. $input->setOption('description', $description);
  3454. if (null === $author = $input->getOption('author')) {
  3455. if (!empty($_SERVER['COMPOSER_DEFAULT_AUTHOR'])) {
  3456. $author_name = $_SERVER['COMPOSER_DEFAULT_AUTHOR'];
  3457. } elseif (isset($git['user.name'])) {
  3458. $author_name = $git['user.name'];
  3459. }
  3460. if (!empty($_SERVER['COMPOSER_DEFAULT_EMAIL'])) {
  3461. $author_email = $_SERVER['COMPOSER_DEFAULT_EMAIL'];
  3462. } elseif (isset($git['user.email'])) {
  3463. $author_email = $git['user.email'];
  3464. }
  3465. if (isset($author_name) && isset($author_email)) {
  3466. $author = sprintf('%s <%s>', $author_name, $author_email);
  3467. }
  3468. }
  3469. $self = $this;
  3470. $author = $io->askAndValidate(
  3471. 'Author [<comment>'.$author.'</comment>, n to skip]: ',
  3472. function ($value) use ($self, $author) {
  3473. if ($value === 'n' || $value === 'no') {
  3474. return;
  3475. }
  3476. $value = $value ?: $author;
  3477. $author = $self->parseAuthorString($value);
  3478. return sprintf('%s <%s>', $author['name'], $author['email']);
  3479. },
  3480. null,
  3481. $author
  3482. );
  3483. $input->setOption('author', $author);
  3484. $minimumStability = $input->getOption('stability') ?: null;
  3485. $minimumStability = $io->askAndValidate(
  3486. 'Minimum Stability [<comment>'.$minimumStability.'</comment>]: ',
  3487. function ($value) use ($self, $minimumStability) {
  3488. if (null === $value) {
  3489. return $minimumStability;
  3490. }
  3491. if (!isset(BasePackage::$stabilities[$value])) {
  3492. throw new \InvalidArgumentException(
  3493. 'Invalid minimum stability "'.$value.'". Must be empty or one of: '.
  3494. implode(', ', array_keys(BasePackage::$stabilities))
  3495. );
  3496. }
  3497. return $value;
  3498. },
  3499. null,
  3500. $minimumStability
  3501. );
  3502. $input->setOption('stability', $minimumStability);
  3503. $type = $input->getOption('type') ?: false;
  3504. $type = $io->ask(
  3505. 'Package Type (e.g. library, project, metapackage, composer-plugin) [<comment>'.$type.'</comment>]: ',
  3506. $type
  3507. );
  3508. $input->setOption('type', $type);
  3509. if (null === $license = $input->getOption('license')) {
  3510. if (!empty($_SERVER['COMPOSER_DEFAULT_LICENSE'])) {
  3511. $license = $_SERVER['COMPOSER_DEFAULT_LICENSE'];
  3512. }
  3513. }
  3514. $license = $io->ask(
  3515. 'License [<comment>'.$license.'</comment>]: ',
  3516. $license
  3517. );
  3518. $input->setOption('license', $license);
  3519. $io->writeError(array('', 'Define your dependencies.', ''));
  3520. $repos = $this->getRepos();
  3521. $preferredStability = $minimumStability ?: 'stable';
  3522. $phpVersion = $repos->findPackage('php', '*')->getPrettyVersion();
  3523. $question = 'Would you like to define your dependencies (require) interactively [<comment>yes</comment>]? ';
  3524. $require = $input->getOption('require');
  3525. $requirements = array();
  3526. if ($require || $io->askConfirmation($question, true)) {
  3527. $requirements = $this->determineRequirements($input, $output, $require, $phpVersion, $preferredStability);
  3528. }
  3529. $input->setOption('require', $requirements);
  3530. $question = 'Would you like to define your dev dependencies (require-dev) interactively [<comment>yes</comment>]? ';
  3531. $requireDev = $input->getOption('require-dev');
  3532. $devRequirements = array();
  3533. if ($requireDev || $io->askConfirmation($question, true)) {
  3534. $devRequirements = $this->determineRequirements($input, $output, $requireDev, $phpVersion, $preferredStability);
  3535. }
  3536. $input->setOption('require-dev', $devRequirements);
  3537. }
  3538. public function parseAuthorString($author)
  3539. {
  3540. if (preg_match('/^(?P<name>[- .,\p{L}\p{N}\p{Mn}\'’"()]+) <(?P<email>.+?)>$/u', $author, $match)) {
  3541. if ($this->isValidEmail($match['email'])) {
  3542. return array(
  3543. 'name' => trim($match['name']),
  3544. 'email' => $match['email'],
  3545. );
  3546. }
  3547. }
  3548. throw new \InvalidArgumentException(
  3549. 'Invalid author string. Must be in the format: '.
  3550. 'John Smith <john@example.com>'
  3551. );
  3552. }
  3553. protected function findPackages($name)
  3554. {
  3555. return $this->getRepos()->search($name);
  3556. }
  3557. protected function getRepos()
  3558. {
  3559. if (!$this->repos) {
  3560. $this->repos = new CompositeRepository(array_merge(
  3561. array(new PlatformRepository),
  3562. RepositoryFactory::defaultRepos($this->getIO())
  3563. ));
  3564. }
  3565. return $this->repos;
  3566. }
  3567. protected function determineRequirements(InputInterface $input, OutputInterface $output, $requires = array(), $phpVersion = null, $preferredStability = 'stable')
  3568. {
  3569. if ($requires) {
  3570. $requires = $this->normalizeRequirements($requires);
  3571. $result = array();
  3572. $io = $this->getIO();
  3573. foreach ($requires as $requirement) {
  3574. if (!isset($requirement['version'])) {
  3575. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $phpVersion, $preferredStability);
  3576. $requirement['version'] = $version;
  3577. $requirement['name'] = $name;
  3578. $io->writeError(sprintf(
  3579. 'Using version <info>%s</info> for <info>%s</info>',
  3580. $requirement['version'],
  3581. $requirement['name']
  3582. ));
  3583. } else {
  3584. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $phpVersion, $preferredStability, $requirement['version'], 'dev');
  3585. $requirement['name'] = $name;
  3586. }
  3587. $result[] = $requirement['name'] . ' ' . $requirement['version'];
  3588. }
  3589. return $result;
  3590. }
  3591. $versionParser = new VersionParser();
  3592. $io = $this->getIO();
  3593. while (null !== $package = $io->ask('Search for a package: ')) {
  3594. $matches = $this->findPackages($package);
  3595. if (count($matches)) {
  3596. $exactMatch = null;
  3597. $choices = array();
  3598. foreach ($matches as $position => $foundPackage) {
  3599. $abandoned = '';
  3600. if (isset($foundPackage['abandoned'])) {
  3601. if (is_string($foundPackage['abandoned'])) {
  3602. $replacement = sprintf('Use %s instead', $foundPackage['abandoned']);
  3603. } else {
  3604. $replacement = 'No replacement was suggested';
  3605. }
  3606. $abandoned = sprintf('<warning>Abandoned. %s.</warning>', $replacement);
  3607. }
  3608. $choices[] = sprintf(' <info>%5s</info> %s %s', "[$position]", $foundPackage['name'], $abandoned);
  3609. if ($foundPackage['name'] === $package) {
  3610. $exactMatch = true;
  3611. break;
  3612. }
  3613. }
  3614. if (!$exactMatch) {
  3615. $io->writeError(array(
  3616. '',
  3617. sprintf('Found <info>%s</info> packages matching <info>%s</info>', count($matches), $package),
  3618. '',
  3619. ));
  3620. $io->writeError($choices);
  3621. $io->writeError('');
  3622. $validator = function ($selection) use ($matches, $versionParser) {
  3623. if ('' === $selection) {
  3624. return false;
  3625. }
  3626. if (is_numeric($selection) && isset($matches[(int) $selection])) {
  3627. $package = $matches[(int) $selection];
  3628. return $package['name'];
  3629. }
  3630. if (preg_match('{^\s*(?P<name>[\S/]+)(?:\s+(?P<version>\S+))?\s*$}', $selection, $packageMatches)) {
  3631. if (isset($packageMatches['version'])) {
  3632. $versionParser->parseConstraints($packageMatches['version']);
  3633. return $packageMatches['name'].' '.$packageMatches['version'];
  3634. }
  3635. return $packageMatches['name'];
  3636. }
  3637. throw new \Exception('Not a valid selection');
  3638. };
  3639. $package = $io->askAndValidate(
  3640. 'Enter package # to add, or the complete package name if it is not listed: ',
  3641. $validator,
  3642. 3,
  3643. false
  3644. );
  3645. }
  3646. if (false !== $package && false === strpos($package, ' ')) {
  3647. $validator = function ($input) {
  3648. $input = trim($input);
  3649. return $input ?: false;
  3650. };
  3651. $constraint = $io->askAndValidate(
  3652. 'Enter the version constraint to require (or leave blank to use the latest version): ',
  3653. $validator,
  3654. 3,
  3655. false
  3656. );
  3657. if (false === $constraint) {
  3658. list($name, $constraint) = $this->findBestVersionAndNameForPackage($input, $package, $phpVersion, $preferredStability);
  3659. $io->writeError(sprintf(
  3660. 'Using version <info>%s</info> for <info>%s</info>',
  3661. $constraint,
  3662. $package
  3663. ));
  3664. }
  3665. $package .= ' '.$constraint;
  3666. }
  3667. if (false !== $package) {
  3668. $requires[] = $package;
  3669. }
  3670. }
  3671. }
  3672. return $requires;
  3673. }
  3674. protected function formatAuthors($author)
  3675. {
  3676. return array($this->parseAuthorString($author));
  3677. }
  3678. protected function formatRequirements(array $requirements)
  3679. {
  3680. $requires = array();
  3681. $requirements = $this->normalizeRequirements($requirements);
  3682. foreach ($requirements as $requirement) {
  3683. $requires[$requirement['name']] = $requirement['version'];
  3684. }
  3685. return $requires;
  3686. }
  3687. protected function getGitConfig()
  3688. {
  3689. if (null !== $this->gitConfig) {
  3690. return $this->gitConfig;
  3691. }
  3692. $finder = new ExecutableFinder();
  3693. $gitBin = $finder->find('git');
  3694. $cmd = new Process(sprintf('%s config -l', ProcessExecutor::escape($gitBin)));
  3695. $cmd->run();
  3696. if ($cmd->isSuccessful()) {
  3697. $this->gitConfig = array();
  3698. preg_match_all('{^([^=]+)=(.*)$}m', $cmd->getOutput(), $matches, PREG_SET_ORDER);
  3699. foreach ($matches as $match) {
  3700. $this->gitConfig[$match[1]] = $match[2];
  3701. }
  3702. return $this->gitConfig;
  3703. }
  3704. return $this->gitConfig = array();
  3705. }
  3706. protected function hasVendorIgnore($ignoreFile, $vendor = 'vendor')
  3707. {
  3708. if (!file_exists($ignoreFile)) {
  3709. return false;
  3710. }
  3711. $pattern = sprintf('{^/?%s(/\*?)?$}', preg_quote($vendor));
  3712. $lines = file($ignoreFile, FILE_IGNORE_NEW_LINES);
  3713. foreach ($lines as $line) {
  3714. if (preg_match($pattern, $line)) {
  3715. return true;
  3716. }
  3717. }
  3718. return false;
  3719. }
  3720. protected function normalizeRequirements(array $requirements)
  3721. {
  3722. $parser = new VersionParser();
  3723. return $parser->parseNameVersionPairs($requirements);
  3724. }
  3725. protected function addVendorIgnore($ignoreFile, $vendor = '/vendor/')
  3726. {
  3727. $contents = "";
  3728. if (file_exists($ignoreFile)) {
  3729. $contents = file_get_contents($ignoreFile);
  3730. if ("\n" !== substr($contents, 0, -1)) {
  3731. $contents .= "\n";
  3732. }
  3733. }
  3734. file_put_contents($ignoreFile, $contents . $vendor. "\n");
  3735. }
  3736. protected function isValidEmail($email)
  3737. {
  3738. if (!function_exists('filter_var')) {
  3739. return true;
  3740. }
  3741. if (PHP_VERSION_ID < 50303) {
  3742. return true;
  3743. }
  3744. return false !== filter_var($email, FILTER_VALIDATE_EMAIL);
  3745. }
  3746. private function getPool(InputInterface $input, $minimumStability = null)
  3747. {
  3748. $key = $minimumStability ?: 'default';
  3749. if (!isset($this->pools[$key])) {
  3750. $this->pools[$key] = $pool = new Pool($minimumStability ?: $this->getMinimumStability($input));
  3751. $pool->addRepository($this->getRepos());
  3752. }
  3753. return $this->pools[$key];
  3754. }
  3755. private function getMinimumStability(InputInterface $input)
  3756. {
  3757. if ($input->hasOption('stability')) {
  3758. return $input->getOption('stability') ?: 'stable';
  3759. }
  3760. $file = Factory::getComposerFile();
  3761. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  3762. if (!empty($composer['minimum-stability'])) {
  3763. return $composer['minimum-stability'];
  3764. }
  3765. }
  3766. return 'stable';
  3767. }
  3768. private function findBestVersionAndNameForPackage(InputInterface $input, $name, $phpVersion, $preferredStability = 'stable', $requiredVersion = null, $minimumStability = null)
  3769. {
  3770. $versionSelector = new VersionSelector($this->getPool($input, $minimumStability));
  3771. $package = $versionSelector->findBestCandidate($name, $requiredVersion, $phpVersion, $preferredStability);
  3772. if ($input->hasOption('ignore-platform-reqs') && $input->getOption('ignore-platform-reqs')) {
  3773. $phpVersion = null;
  3774. $package = $versionSelector->findBestCandidate($name, $requiredVersion, $phpVersion, $preferredStability);
  3775. }
  3776. if (!$package) {
  3777. if ($phpVersion && $versionSelector->findBestCandidate($name, $requiredVersion, null, $preferredStability)) {
  3778. throw new \InvalidArgumentException(sprintf(
  3779. 'Package %s at version %s has a PHP requirement incompatible with your PHP version (%s)', $name, $requiredVersion, $phpVersion
  3780. ));
  3781. }
  3782. if ($requiredVersion && $versionSelector->findBestCandidate($name, null, $phpVersion, $preferredStability)) {
  3783. throw new \InvalidArgumentException(sprintf(
  3784. 'Could not find package %s in a version matching %s', $name, $requiredVersion
  3785. ));
  3786. }
  3787. if ($phpVersion && $versionSelector->findBestCandidate($name)) {
  3788. throw new \InvalidArgumentException(sprintf(
  3789. 'Could not find package %s in any version matching your PHP version (%s)', $name, $phpVersion
  3790. ));
  3791. }
  3792. $similar = $this->findSimilar($name);
  3793. if ($similar) {
  3794. if ($requiredVersion === null && in_array($name, $similar, true)) {
  3795. throw new \InvalidArgumentException(sprintf(
  3796. 'Could not find a version of package %s matching your minimum-stability (%s). Require it with an explicit version constraint allowing its desired stability.',
  3797. $name,
  3798. $this->getMinimumStability($input)
  3799. ));
  3800. }
  3801. throw new \InvalidArgumentException(sprintf(
  3802. "Could not find package %s.\n\nDid you mean " . (count($similar) > 1 ? 'one of these' : 'this') . "?\n %s",
  3803. $name,
  3804. implode("\n ", $similar)
  3805. ));
  3806. }
  3807. throw new \InvalidArgumentException(sprintf(
  3808. 'Could not find a matching version of package %s. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability (%s).',
  3809. $name,
  3810. $this->getMinimumStability($input)
  3811. ));
  3812. }
  3813. return array(
  3814. $package->getPrettyName(),
  3815. $versionSelector->findRecommendedRequireVersion($package)
  3816. );
  3817. }
  3818. private function findSimilar($package)
  3819. {
  3820. try {
  3821. $results = $this->repos->search($package);
  3822. } catch (\Exception $e) {
  3823. return array();
  3824. }
  3825. $similarPackages = array();
  3826. foreach ($results as $result) {
  3827. $similarPackages[$result['name']] = levenshtein($package, $result['name']);
  3828. }
  3829. asort($similarPackages);
  3830. return array_keys(array_slice($similarPackages, 0, 5));
  3831. }
  3832. }
  3833. <?php
  3834. namespace Composer\Command;
  3835. use Composer\Installer;
  3836. use Composer\Plugin\CommandEvent;
  3837. use Composer\Plugin\PluginEvents;
  3838. use Symfony\Component\Console\Input\InputInterface;
  3839. use Symfony\Component\Console\Input\InputOption;
  3840. use Symfony\Component\Console\Input\InputArgument;
  3841. use Symfony\Component\Console\Output\OutputInterface;
  3842. class InstallCommand extends BaseCommand
  3843. {
  3844. protected function configure()
  3845. {
  3846. $this
  3847. ->setName('install')
  3848. ->setDescription('Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.')
  3849. ->setDefinition(array(
  3850. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  3851. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  3852. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  3853. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  3854. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  3855. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  3856. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  3857. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  3858. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  3859. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  3860. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  3861. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  3862. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  3863. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  3864. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  3865. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Should not be provided, use composer require instead to add a given package to composer.json.'),
  3866. ))
  3867. ->setHelp(<<<EOT
  3868. The <info>install</info> command reads the composer.lock file from
  3869. the current directory, processes it, and downloads and installs all the
  3870. libraries and dependencies outlined in that file. If the file does not
  3871. exist it will look for composer.json and do the same.
  3872. <info>php composer.phar install</info>
  3873. EOT
  3874. )
  3875. ;
  3876. }
  3877. protected function execute(InputInterface $input, OutputInterface $output)
  3878. {
  3879. $io = $this->getIO();
  3880. if ($args = $input->getArgument('packages')) {
  3881. $io->writeError('<error>Invalid argument '.implode(' ', $args).'. Use "composer require '.implode(' ', $args).'" instead to add packages to your composer.json.</error>');
  3882. return 1;
  3883. }
  3884. if ($input->getOption('no-custom-installers')) {
  3885. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  3886. $input->setOption('no-plugins', true);
  3887. }
  3888. if ($input->getOption('dev')) {
  3889. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  3890. }
  3891. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  3892. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  3893. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'install', $input, $output);
  3894. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3895. $install = Installer::create($io, $composer);
  3896. $config = $composer->getConfig();
  3897. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  3898. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  3899. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  3900. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  3901. $install
  3902. ->setDryRun($input->getOption('dry-run'))
  3903. ->setVerbose($input->getOption('verbose'))
  3904. ->setPreferSource($preferSource)
  3905. ->setPreferDist($preferDist)
  3906. ->setDevMode(!$input->getOption('no-dev'))
  3907. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  3908. ->setRunScripts(!$input->getOption('no-scripts'))
  3909. ->setSkipSuggest($input->getOption('no-suggest'))
  3910. ->setOptimizeAutoloader($optimize)
  3911. ->setClassMapAuthoritative($authoritative)
  3912. ->setApcuAutoloader($apcu)
  3913. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  3914. ;
  3915. if ($input->getOption('no-plugins')) {
  3916. $install->disablePlugins();
  3917. }
  3918. return $install->run();
  3919. }
  3920. }
  3921. <?php
  3922. namespace Composer\Command;
  3923. use Composer\Json\JsonFile;
  3924. use Composer\Plugin\CommandEvent;
  3925. use Composer\Plugin\PluginEvents;
  3926. use Composer\Package\PackageInterface;
  3927. use Composer\Repository\RepositoryInterface;
  3928. use Symfony\Component\Console\Helper\Table;
  3929. use Symfony\Component\Console\Input\InputInterface;
  3930. use Symfony\Component\Console\Input\InputOption;
  3931. use Symfony\Component\Console\Output\OutputInterface;
  3932. class LicensesCommand extends BaseCommand
  3933. {
  3934. protected function configure()
  3935. {
  3936. $this
  3937. ->setName('licenses')
  3938. ->setDescription('Shows information about licenses of dependencies.')
  3939. ->setDefinition(array(
  3940. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  3941. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
  3942. ))
  3943. ->setHelp(<<<EOT
  3944. The license command displays detailed information about the licenses of
  3945. the installed dependencies.
  3946. EOT
  3947. )
  3948. ;
  3949. }
  3950. protected function execute(InputInterface $input, OutputInterface $output)
  3951. {
  3952. $composer = $this->getComposer();
  3953. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'licenses', $input, $output);
  3954. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3955. $root = $composer->getPackage();
  3956. $repo = $composer->getRepositoryManager()->getLocalRepository();
  3957. if ($input->getOption('no-dev')) {
  3958. $packages = $this->filterRequiredPackages($repo, $root);
  3959. } else {
  3960. $packages = $this->appendPackages($repo->getPackages(), array());
  3961. }
  3962. ksort($packages);
  3963. $io = $this->getIO();
  3964. switch ($format = $input->getOption('format')) {
  3965. case 'text':
  3966. $io->write('Name: <comment>'.$root->getPrettyName().'</comment>');
  3967. $io->write('Version: <comment>'.$root->getFullPrettyVersion().'</comment>');
  3968. $io->write('Licenses: <comment>'.(implode(', ', $root->getLicense()) ?: 'none').'</comment>');
  3969. $io->write('Dependencies:');
  3970. $io->write('');
  3971. $table = new Table($output);
  3972. $table->setStyle('compact');
  3973. $table->getStyle()->setVerticalBorderChar('');
  3974. $table->getStyle()->setCellRowContentFormat('%s ');
  3975. $table->setHeaders(array('Name', 'Version', 'License'));
  3976. foreach ($packages as $package) {
  3977. $table->addRow(array(
  3978. $package->getPrettyName(),
  3979. $package->getFullPrettyVersion(),
  3980. implode(', ', $package->getLicense()) ?: 'none',
  3981. ));
  3982. }
  3983. $table->render();
  3984. break;
  3985. case 'json':
  3986. $dependencies = array();
  3987. foreach ($packages as $package) {
  3988. $dependencies[$package->getPrettyName()] = array(
  3989. 'version' => $package->getFullPrettyVersion(),
  3990. 'license' => $package->getLicense(),
  3991. );
  3992. }
  3993. $io->write(JsonFile::encode(array(
  3994. 'name' => $root->getPrettyName(),
  3995. 'version' => $root->getFullPrettyVersion(),
  3996. 'license' => $root->getLicense(),
  3997. 'dependencies' => $dependencies,
  3998. )));
  3999. break;
  4000. default:
  4001. throw new \RuntimeException(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  4002. }
  4003. }
  4004. private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array())
  4005. {
  4006. $requires = array_keys($package->getRequires());
  4007. $packageListNames = array_keys($bucket);
  4008. $packages = array_filter(
  4009. $repo->getPackages(),
  4010. function ($package) use ($requires, $packageListNames) {
  4011. return in_array($package->getName(), $requires) && !in_array($package->getName(), $packageListNames);
  4012. }
  4013. );
  4014. $bucket = $this->appendPackages($packages, $bucket);
  4015. foreach ($packages as $package) {
  4016. $bucket = $this->filterRequiredPackages($repo, $package, $bucket);
  4017. }
  4018. return $bucket;
  4019. }
  4020. public function appendPackages(array $packages, array $bucket)
  4021. {
  4022. foreach ($packages as $package) {
  4023. $bucket[$package->getName()] = $package;
  4024. }
  4025. return $bucket;
  4026. }
  4027. }
  4028. <?php
  4029. namespace Composer\Command;
  4030. use Symfony\Component\Console\Input\InputInterface;
  4031. use Symfony\Component\Console\Input\InputArgument;
  4032. use Symfony\Component\Console\Input\ArrayInput;
  4033. use Symfony\Component\Console\Input\InputOption;
  4034. use Symfony\Component\Console\Output\OutputInterface;
  4035. class OutdatedCommand extends ShowCommand
  4036. {
  4037. protected function configure()
  4038. {
  4039. $this
  4040. ->setName('outdated')
  4041. ->setDescription('Shows a list of installed packages that have updates available, including their latest version.')
  4042. ->setDefinition(array(
  4043. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  4044. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show only packages that are outdated (this is the default, but present here for compat with `show`'),
  4045. new InputOption('all', 'a', InputOption::VALUE_NONE, 'Show all installed packages with their latest versions'),
  4046. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  4047. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  4048. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  4049. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4050. ))
  4051. ->setHelp(<<<EOT
  4052. The outdated command is just a proxy for `composer show -l`
  4053. The color coding (or signage if you have ANSI colors disabled) for dependency versions is as such:
  4054. - <info>green</info> (=): Dependency is in the latest version and is up to date.
  4055. - <comment>yellow</comment> (~): Dependency has a new version available that includes backwards
  4056. compatibility breaks according to semver, so upgrade when you can but it
  4057. may involve work.
  4058. - <highlight>red</highlight> (!): Dependency has a new version that is semver-compatible and you should upgrade it.
  4059. EOT
  4060. )
  4061. ;
  4062. }
  4063. protected function execute(InputInterface $input, OutputInterface $output)
  4064. {
  4065. $args = array(
  4066. 'show',
  4067. '--latest' => true,
  4068. );
  4069. if (!$input->getOption('all')) {
  4070. $args['--outdated'] = true;
  4071. }
  4072. if ($input->getOption('direct')) {
  4073. $args['--direct'] = true;
  4074. }
  4075. if ($input->getArgument('package')) {
  4076. $args['package'] = $input->getArgument('package');
  4077. }
  4078. if ($input->getOption('strict')) {
  4079. $args['--strict'] = true;
  4080. }
  4081. if ($input->getOption('minor-only')) {
  4082. $args['--minor-only'] = true;
  4083. }
  4084. $args['--format'] = $input->getOption('format');
  4085. $input = new ArrayInput($args);
  4086. return $this->getApplication()->run($input, $output);
  4087. }
  4088. public function isProxyCommand()
  4089. {
  4090. return true;
  4091. }
  4092. }
  4093. <?php
  4094. namespace Composer\Command;
  4095. use Symfony\Component\Console\Input\InputInterface;
  4096. use Symfony\Component\Console\Output\OutputInterface;
  4097. class ProhibitsCommand extends BaseDependencyCommand
  4098. {
  4099. protected function configure()
  4100. {
  4101. parent::configure();
  4102. $this
  4103. ->setName('prohibits')
  4104. ->setAliases(array('why-not'))
  4105. ->setDescription('Shows which packages prevent the given package from being installed.')
  4106. ->setHelp(<<<EOT
  4107. Displays detailed information about why a package cannot be installed.
  4108. <info>php composer.phar prohibits composer/composer</info>
  4109. EOT
  4110. )
  4111. ;
  4112. }
  4113. protected function execute(InputInterface $input, OutputInterface $output)
  4114. {
  4115. return parent::doExecute($input, $output, true);
  4116. }
  4117. }
  4118. <?php
  4119. namespace Composer\Command;
  4120. use Composer\Config\JsonConfigSource;
  4121. use Composer\Installer;
  4122. use Composer\Plugin\CommandEvent;
  4123. use Composer\Plugin\PluginEvents;
  4124. use Composer\Json\JsonFile;
  4125. use Composer\Factory;
  4126. use Symfony\Component\Console\Input\InputInterface;
  4127. use Symfony\Component\Console\Input\InputOption;
  4128. use Symfony\Component\Console\Input\InputArgument;
  4129. use Symfony\Component\Console\Output\OutputInterface;
  4130. class RemoveCommand extends BaseCommand
  4131. {
  4132. protected function configure()
  4133. {
  4134. $this
  4135. ->setName('remove')
  4136. ->setDescription('Removes a package from the require or require-dev.')
  4137. ->setDefinition(array(
  4138. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'Packages that should be removed.'),
  4139. new InputOption('dev', null, InputOption::VALUE_NONE, 'Removes a package from the require-dev section.'),
  4140. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4141. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4142. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4143. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4144. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated with explicit dependencies. (Deprecrated, is now default behavior)'),
  4145. new InputOption('no-update-with-dependencies', null, InputOption::VALUE_NONE, 'Does not allow inherited dependencies to be updated with explicit dependencies.'),
  4146. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4147. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4148. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4149. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4150. ))
  4151. ->setHelp(<<<EOT
  4152. The <info>remove</info> command removes a package from the current
  4153. list of installed packages
  4154. <info>php composer.phar remove</info>
  4155. EOT
  4156. )
  4157. ;
  4158. }
  4159. protected function execute(InputInterface $input, OutputInterface $output)
  4160. {
  4161. $packages = $input->getArgument('packages');
  4162. $packages = array_map('strtolower', $packages);
  4163. $file = Factory::getComposerFile();
  4164. $jsonFile = new JsonFile($file);
  4165. $composer = $jsonFile->read();
  4166. $composerBackup = file_get_contents($jsonFile->getPath());
  4167. $json = new JsonConfigSource($jsonFile);
  4168. $type = $input->getOption('dev') ? 'require-dev' : 'require';
  4169. $altType = !$input->getOption('dev') ? 'require-dev' : 'require';
  4170. $io = $this->getIO();
  4171. if ($input->getOption('update-with-dependencies')) {
  4172. $io->writeError('<warning>You are using the deprecated option "update-with-dependencies". This is now default behaviour. The --no-update-with-dependencies option can be used to remove a package without its dependencies.</warning>');
  4173. }
  4174. foreach (array('require', 'require-dev') as $linkType) {
  4175. if (isset($composer[$linkType])) {
  4176. foreach ($composer[$linkType] as $name => $version) {
  4177. $composer[$linkType][strtolower($name)] = $name;
  4178. }
  4179. }
  4180. }
  4181. foreach ($packages as $package) {
  4182. if (isset($composer[$type][$package])) {
  4183. $json->removeLink($type, $composer[$type][$package]);
  4184. } elseif (isset($composer[$altType][$package])) {
  4185. $io->writeError('<warning>'.$composer[$altType][$package].' could not be found in '.$type.' but it is present in '.$altType.'</warning>');
  4186. if ($io->isInteractive()) {
  4187. if ($io->askConfirmation('Do you want to remove it from '.$altType.' [<comment>yes</comment>]? ', true)) {
  4188. $json->removeLink($altType, $composer[$altType][$package]);
  4189. }
  4190. }
  4191. } else {
  4192. $io->writeError('<warning>'.$package.' is not required in your composer.json and has not been removed</warning>');
  4193. }
  4194. }
  4195. if ($input->getOption('no-update')) {
  4196. return 0;
  4197. }
  4198. $this->resetComposer();
  4199. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4200. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4201. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'remove', $input, $output);
  4202. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4203. $install = Installer::create($io, $composer);
  4204. $updateDevMode = !$input->getOption('update-no-dev');
  4205. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4206. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4207. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4208. $install
  4209. ->setVerbose($input->getOption('verbose'))
  4210. ->setDevMode($updateDevMode)
  4211. ->setOptimizeAutoloader($optimize)
  4212. ->setClassMapAuthoritative($authoritative)
  4213. ->setApcuAutoloader($apcu)
  4214. ->setUpdate(true)
  4215. ->setUpdateWhitelist($packages)
  4216. ->setWhitelistTransitiveDependencies(!$input->getOption('no-update-with-dependencies'))
  4217. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4218. ->setRunScripts(!$input->getOption('no-scripts'))
  4219. ;
  4220. $status = $install->run();
  4221. if ($status !== 0) {
  4222. $io->writeError("\n".'<error>Removal failed, reverting '.$file.' to its original content.</error>');
  4223. file_put_contents($jsonFile->getPath(), $composerBackup);
  4224. }
  4225. return $status;
  4226. }
  4227. }
  4228. <?php
  4229. namespace Composer\Command;
  4230. use Symfony\Component\Console\Input\InputInterface;
  4231. use Symfony\Component\Console\Input\InputArgument;
  4232. use Symfony\Component\Console\Input\InputOption;
  4233. use Symfony\Component\Console\Output\OutputInterface;
  4234. use Composer\Factory;
  4235. use Composer\Installer;
  4236. use Composer\Json\JsonFile;
  4237. use Composer\Json\JsonManipulator;
  4238. use Composer\Package\Version\VersionParser;
  4239. use Composer\Plugin\CommandEvent;
  4240. use Composer\Plugin\PluginEvents;
  4241. use Composer\Repository\CompositeRepository;
  4242. use Composer\Repository\PlatformRepository;
  4243. class RequireCommand extends InitCommand
  4244. {
  4245. protected function configure()
  4246. {
  4247. $this
  4248. ->setName('require')
  4249. ->setDescription('Adds required packages to your composer.json and installs them.')
  4250. ->setDefinition(array(
  4251. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Optional package name can also include a version constraint, e.g. foo/bar or foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  4252. new InputOption('dev', null, InputOption::VALUE_NONE, 'Add requirement to require-dev.'),
  4253. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  4254. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  4255. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4256. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  4257. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4258. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4259. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4260. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated, except those that are root requirements.'),
  4261. new InputOption('update-with-all-dependencies', null, InputOption::VALUE_NONE, 'Allows all inherited dependencies to be updated, including those that are root requirements.'),
  4262. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4263. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  4264. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  4265. new InputOption('sort-packages', null, InputOption::VALUE_NONE, 'Sorts packages when adding/updating a new dependency'),
  4266. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4267. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4268. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4269. ))
  4270. ->setHelp(<<<EOT
  4271. The require command adds required packages to your composer.json and installs them.
  4272. If you do not specify a package, composer will prompt you to search for a package, and given results, provide a list of
  4273. matches to require.
  4274. If you do not specify a version constraint, composer will choose a suitable one based on the available package versions.
  4275. If you do not want to install the new dependencies immediately you can call it with --no-update
  4276. EOT
  4277. )
  4278. ;
  4279. }
  4280. protected function execute(InputInterface $input, OutputInterface $output)
  4281. {
  4282. $file = Factory::getComposerFile();
  4283. $io = $this->getIO();
  4284. $newlyCreated = !file_exists($file);
  4285. if ($newlyCreated && !file_put_contents($file, "{\n}\n")) {
  4286. $io->writeError('<error>'.$file.' could not be created.</error>');
  4287. return 1;
  4288. }
  4289. if (!is_readable($file)) {
  4290. $io->writeError('<error>'.$file.' is not readable.</error>');
  4291. return 1;
  4292. }
  4293. if (!is_writable($file)) {
  4294. $io->writeError('<error>'.$file.' is not writable.</error>');
  4295. return 1;
  4296. }
  4297. if (filesize($file) === 0) {
  4298. file_put_contents($file, "{\n}\n");
  4299. }
  4300. $json = new JsonFile($file);
  4301. $composerBackup = file_get_contents($json->getPath());
  4302. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4303. $repos = $composer->getRepositoryManager()->getRepositories();
  4304. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  4305. $this->repos = new CompositeRepository(array_merge(
  4306. array(new PlatformRepository(array(), $platformOverrides)),
  4307. $repos
  4308. ));
  4309. if ($composer->getPackage()->getPreferStable()) {
  4310. $preferredStability = 'stable';
  4311. } else {
  4312. $preferredStability = $composer->getPackage()->getMinimumStability();
  4313. }
  4314. $phpVersion = $this->repos->findPackage('php', '*')->getPrettyVersion();
  4315. $requirements = $this->determineRequirements($input, $output, $input->getArgument('packages'), $phpVersion, $preferredStability);
  4316. $requireKey = $input->getOption('dev') ? 'require-dev' : 'require';
  4317. $removeKey = $input->getOption('dev') ? 'require' : 'require-dev';
  4318. $requirements = $this->formatRequirements($requirements);
  4319. $versionParser = new VersionParser();
  4320. foreach ($requirements as $constraint) {
  4321. $versionParser->parseConstraints($constraint);
  4322. }
  4323. $sortPackages = $input->getOption('sort-packages') || $composer->getConfig()->get('sort-packages');
  4324. if (!$this->updateFileCleanly($json, $requirements, $requireKey, $removeKey, $sortPackages)) {
  4325. $composerDefinition = $json->read();
  4326. foreach ($requirements as $package => $version) {
  4327. $composerDefinition[$requireKey][$package] = $version;
  4328. unset($composerDefinition[$removeKey][$package]);
  4329. }
  4330. $json->write($composerDefinition);
  4331. }
  4332. $io->writeError('<info>'.$file.' has been '.($newlyCreated ? 'created' : 'updated').'</info>');
  4333. if ($input->getOption('no-update')) {
  4334. return 0;
  4335. }
  4336. $updateDevMode = !$input->getOption('update-no-dev');
  4337. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4338. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4339. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4340. $this->resetComposer();
  4341. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4342. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4343. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'require', $input, $output);
  4344. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4345. $install = Installer::create($io, $composer);
  4346. $install
  4347. ->setVerbose($input->getOption('verbose'))
  4348. ->setPreferSource($input->getOption('prefer-source'))
  4349. ->setPreferDist($input->getOption('prefer-dist'))
  4350. ->setDevMode($updateDevMode)
  4351. ->setRunScripts(!$input->getOption('no-scripts'))
  4352. ->setSkipSuggest($input->getOption('no-suggest'))
  4353. ->setOptimizeAutoloader($optimize)
  4354. ->setClassMapAuthoritative($authoritative)
  4355. ->setApcuAutoloader($apcu)
  4356. ->setUpdate(true)
  4357. ->setUpdateWhitelist(array_keys($requirements))
  4358. ->setWhitelistTransitiveDependencies($input->getOption('update-with-dependencies'))
  4359. ->setWhitelistAllDependencies($input->getOption('update-with-all-dependencies'))
  4360. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4361. ->setPreferStable($input->getOption('prefer-stable'))
  4362. ->setPreferLowest($input->getOption('prefer-lowest'))
  4363. ;
  4364. $status = $install->run();
  4365. if ($status !== 0) {
  4366. if ($newlyCreated) {
  4367. $io->writeError("\n".'<error>Installation failed, deleting '.$file.'.</error>');
  4368. unlink($json->getPath());
  4369. } else {
  4370. $io->writeError("\n".'<error>Installation failed, reverting '.$file.' to its original content.</error>');
  4371. file_put_contents($json->getPath(), $composerBackup);
  4372. }
  4373. }
  4374. return $status;
  4375. }
  4376. private function updateFileCleanly($json, array $new, $requireKey, $removeKey, $sortPackages)
  4377. {
  4378. $contents = file_get_contents($json->getPath());
  4379. $manipulator = new JsonManipulator($contents);
  4380. foreach ($new as $package => $constraint) {
  4381. if (!$manipulator->addLink($requireKey, $package, $constraint, $sortPackages)) {
  4382. return false;
  4383. }
  4384. if (!$manipulator->removeSubNode($removeKey, $package)) {
  4385. return false;
  4386. }
  4387. }
  4388. file_put_contents($json->getPath(), $manipulator->getContents());
  4389. return true;
  4390. }
  4391. protected function interact(InputInterface $input, OutputInterface $output)
  4392. {
  4393. return;
  4394. }
  4395. }
  4396. <?php
  4397. namespace Composer\Command;
  4398. use Composer\Script\Event as ScriptEvent;
  4399. use Composer\Script\ScriptEvents;
  4400. use Composer\Util\ProcessExecutor;
  4401. use Symfony\Component\Console\Input\InputInterface;
  4402. use Symfony\Component\Console\Input\InputOption;
  4403. use Symfony\Component\Console\Input\InputArgument;
  4404. use Symfony\Component\Console\Output\OutputInterface;
  4405. use Symfony\Component\Console\Helper\Table;
  4406. class RunScriptCommand extends BaseCommand
  4407. {
  4408. protected $scriptEvents = array(
  4409. ScriptEvents::PRE_INSTALL_CMD,
  4410. ScriptEvents::POST_INSTALL_CMD,
  4411. ScriptEvents::PRE_UPDATE_CMD,
  4412. ScriptEvents::POST_UPDATE_CMD,
  4413. ScriptEvents::PRE_STATUS_CMD,
  4414. ScriptEvents::POST_STATUS_CMD,
  4415. ScriptEvents::POST_ROOT_PACKAGE_INSTALL,
  4416. ScriptEvents::POST_CREATE_PROJECT_CMD,
  4417. ScriptEvents::PRE_ARCHIVE_CMD,
  4418. ScriptEvents::POST_ARCHIVE_CMD,
  4419. ScriptEvents::PRE_AUTOLOAD_DUMP,
  4420. ScriptEvents::POST_AUTOLOAD_DUMP,
  4421. );
  4422. protected function configure()
  4423. {
  4424. $this
  4425. ->setName('run-script')
  4426. ->setDescription('Runs the scripts defined in composer.json.')
  4427. ->setDefinition(array(
  4428. new InputArgument('script', InputArgument::OPTIONAL, 'Script name to run.'),
  4429. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4430. new InputOption('timeout', null, InputOption::VALUE_REQUIRED, 'Sets script timeout in seconds, or 0 for never.'),
  4431. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  4432. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  4433. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List scripts.'),
  4434. ))
  4435. ->setHelp(<<<EOT
  4436. The <info>run-script</info> command runs scripts defined in composer.json:
  4437. <info>php composer.phar run-script post-update-cmd</info>
  4438. EOT
  4439. )
  4440. ;
  4441. }
  4442. protected function execute(InputInterface $input, OutputInterface $output)
  4443. {
  4444. if ($input->getOption('list')) {
  4445. return $this->listScripts($output);
  4446. } elseif (!$input->getArgument('script')) {
  4447. throw new \RuntimeException('Missing required argument "script"');
  4448. }
  4449. $script = $input->getArgument('script');
  4450. if (!in_array($script, $this->scriptEvents)) {
  4451. if (defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  4452. throw new \InvalidArgumentException(sprintf('Script "%s" cannot be run with this command', $script));
  4453. }
  4454. }
  4455. $composer = $this->getComposer();
  4456. $devMode = $input->getOption('dev') || !$input->getOption('no-dev');
  4457. $event = new ScriptEvent($script, $composer, $this->getIO(), $devMode);
  4458. $hasListeners = $composer->getEventDispatcher()->hasEventListeners($event);
  4459. if (!$hasListeners) {
  4460. throw new \InvalidArgumentException(sprintf('Script "%s" is not defined in this package', $script));
  4461. }
  4462. $args = $input->getArgument('args');
  4463. if (null !== $timeout = $input->getOption('timeout')) {
  4464. if (!ctype_digit($timeout)) {
  4465. throw new \RuntimeException('Timeout value must be numeric and positive if defined, or 0 for forever');
  4466. }
  4467. ProcessExecutor::setTimeout((int) $timeout);
  4468. }
  4469. return $composer->getEventDispatcher()->dispatchScript($script, $devMode, $args);
  4470. }
  4471. protected function listScripts(OutputInterface $output)
  4472. {
  4473. $scripts = $this->getComposer()->getPackage()->getScripts();
  4474. if (!count($scripts)) {
  4475. return 0;
  4476. }
  4477. $io = $this->getIO();
  4478. $io->writeError('<info>scripts:</info>');
  4479. $table = array();
  4480. foreach ($scripts as $name => $script) {
  4481. $description = '';
  4482. try {
  4483. $cmd = $this->getApplication()->find($name);
  4484. if ($cmd instanceof ScriptAliasCommand) {
  4485. $description = $cmd->getDescription();
  4486. }
  4487. } catch (\Symfony\Component\Console\Exception\CommandNotFoundException $e) {
  4488. }
  4489. $table[] = array(' '.$name, $description);
  4490. }
  4491. $renderer = new Table($output);
  4492. $renderer->setStyle('compact');
  4493. $renderer->getStyle()->setVerticalBorderChar('');
  4494. $renderer->getStyle()->setCellRowContentFormat('%s ');
  4495. $renderer->setRows($table)->render();
  4496. return 0;
  4497. }
  4498. }
  4499. <?php
  4500. namespace Composer\Command;
  4501. use Symfony\Component\Console\Input\InputInterface;
  4502. use Symfony\Component\Console\Input\InputOption;
  4503. use Symfony\Component\Console\Input\InputArgument;
  4504. use Symfony\Component\Console\Output\OutputInterface;
  4505. class ScriptAliasCommand extends BaseCommand
  4506. {
  4507. private $script;
  4508. private $description;
  4509. public function __construct($script, $description)
  4510. {
  4511. $this->script = $script;
  4512. $this->description = empty($description) ? 'Runs the '.$script.' script as defined in composer.json.' : $description;
  4513. parent::__construct();
  4514. }
  4515. protected function configure()
  4516. {
  4517. $this
  4518. ->setName($this->script)
  4519. ->setDescription($this->description)
  4520. ->setDefinition(array(
  4521. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  4522. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  4523. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4524. ))
  4525. ->setHelp(<<<EOT
  4526. The <info>run-script</info> command runs scripts defined in composer.json:
  4527. <info>php composer.phar run-script post-update-cmd</info>
  4528. EOT
  4529. )
  4530. ;
  4531. }
  4532. protected function execute(InputInterface $input, OutputInterface $output)
  4533. {
  4534. $composer = $this->getComposer();
  4535. $args = $input->getArguments();
  4536. return $composer->getEventDispatcher()->dispatchScript($this->script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args']);
  4537. }
  4538. }
  4539. <?php
  4540. namespace Composer\Command;
  4541. use Composer\Factory;
  4542. use Symfony\Component\Console\Input\InputInterface;
  4543. use Symfony\Component\Console\Input\InputArgument;
  4544. use Symfony\Component\Console\Input\InputOption;
  4545. use Symfony\Component\Console\Output\OutputInterface;
  4546. use Composer\Repository\CompositeRepository;
  4547. use Composer\Repository\PlatformRepository;
  4548. use Composer\Repository\RepositoryInterface;
  4549. use Composer\Plugin\CommandEvent;
  4550. use Composer\Plugin\PluginEvents;
  4551. class SearchCommand extends BaseCommand
  4552. {
  4553. protected $matches;
  4554. protected $lowMatches = array();
  4555. protected $tokens;
  4556. protected $output;
  4557. protected $onlyName;
  4558. protected function configure()
  4559. {
  4560. $this
  4561. ->setName('search')
  4562. ->setDescription('Searches for packages.')
  4563. ->setDefinition(array(
  4564. new InputOption('only-name', 'N', InputOption::VALUE_NONE, 'Search only in name'),
  4565. new InputOption('type', 't', InputOption::VALUE_REQUIRED, 'Search for a specific package type'),
  4566. new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'),
  4567. ))
  4568. ->setHelp(<<<EOT
  4569. The search command searches for packages by its name
  4570. <info>php composer.phar search symfony composer</info>
  4571. EOT
  4572. )
  4573. ;
  4574. }
  4575. protected function execute(InputInterface $input, OutputInterface $output)
  4576. {
  4577. $platformRepo = new PlatformRepository;
  4578. $io = $this->getIO();
  4579. if (!($composer = $this->getComposer(false))) {
  4580. $composer = Factory::create($this->getIO(), array());
  4581. }
  4582. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  4583. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  4584. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  4585. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'search', $input, $output);
  4586. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4587. $onlyName = $input->getOption('only-name');
  4588. $type = $input->getOption('type') ?: null;
  4589. $flags = $onlyName ? RepositoryInterface::SEARCH_NAME : RepositoryInterface::SEARCH_FULLTEXT;
  4590. $results = $repos->search(implode(' ', $input->getArgument('tokens')), $flags, $type);
  4591. foreach ($results as $result) {
  4592. $io->write($result['name'] . (isset($result['description']) ? ' '. $result['description'] : ''));
  4593. }
  4594. }
  4595. }
  4596. <?php
  4597. namespace Composer\Command;
  4598. use Composer\Composer;
  4599. use Composer\Factory;
  4600. use Composer\Config;
  4601. use Composer\Util\Filesystem;
  4602. use Composer\SelfUpdate\Keys;
  4603. use Composer\SelfUpdate\Versions;
  4604. use Composer\IO\IOInterface;
  4605. use Composer\Downloader\FilesystemException;
  4606. use Symfony\Component\Console\Input\InputInterface;
  4607. use Symfony\Component\Console\Input\InputOption;
  4608. use Symfony\Component\Console\Input\InputArgument;
  4609. use Symfony\Component\Console\Output\OutputInterface;
  4610. use Symfony\Component\Finder\Finder;
  4611. class SelfUpdateCommand extends BaseCommand
  4612. {
  4613. const HOMEPAGE = 'getcomposer.org';
  4614. const OLD_INSTALL_EXT = '-old.phar';
  4615. protected function configure()
  4616. {
  4617. $this
  4618. ->setName('self-update')
  4619. ->setAliases(array('selfupdate'))
  4620. ->setDescription('Updates composer.phar to the latest version.')
  4621. ->setDefinition(array(
  4622. new InputOption('rollback', 'r', InputOption::VALUE_NONE, 'Revert to an older installation of composer'),
  4623. new InputOption('clean-backups', null, InputOption::VALUE_NONE, 'Delete old backups during an update. This makes the current version of composer the only backup available after the update'),
  4624. new InputArgument('version', InputArgument::OPTIONAL, 'The version to update to'),
  4625. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4626. new InputOption('update-keys', null, InputOption::VALUE_NONE, 'Prompt user for a key update'),
  4627. new InputOption('stable', null, InputOption::VALUE_NONE, 'Force an update to the stable channel'),
  4628. new InputOption('preview', null, InputOption::VALUE_NONE, 'Force an update to the preview channel'),
  4629. new InputOption('snapshot', null, InputOption::VALUE_NONE, 'Force an update to the snapshot channel'),
  4630. new InputOption('set-channel-only', null, InputOption::VALUE_NONE, 'Only store the channel as the default one and then exit'),
  4631. ))
  4632. ->setHelp(<<<EOT
  4633. The <info>self-update</info> command checks getcomposer.org for newer
  4634. versions of composer and if found, installs the latest.
  4635. <info>php composer.phar self-update</info>
  4636. EOT
  4637. )
  4638. ;
  4639. }
  4640. protected function execute(InputInterface $input, OutputInterface $output)
  4641. {
  4642. $config = Factory::createConfig();
  4643. if ($config->get('disable-tls') === true) {
  4644. $baseUrl = 'http://' . self::HOMEPAGE;
  4645. } else {
  4646. $baseUrl = 'https://' . self::HOMEPAGE;
  4647. }
  4648. $io = $this->getIO();
  4649. $remoteFilesystem = Factory::createRemoteFilesystem($io, $config);
  4650. $versionsUtil = new Versions($config, $remoteFilesystem);
  4651. foreach (array('stable', 'preview', 'snapshot') as $channel) {
  4652. if ($input->getOption($channel)) {
  4653. $versionsUtil->setChannel($channel);
  4654. }
  4655. }
  4656. if ($input->getOption('set-channel-only')) {
  4657. return 0;
  4658. }
  4659. $cacheDir = $config->get('cache-dir');
  4660. $rollbackDir = $config->get('data-dir');
  4661. $home = $config->get('home');
  4662. $localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0];
  4663. if ($input->getOption('update-keys')) {
  4664. return $this->fetchKeys($io, $config);
  4665. }
  4666. $tmpDir = is_writable(dirname($localFilename)) ? dirname($localFilename) : $cacheDir;
  4667. if (!is_writable($tmpDir)) {
  4668. throw new FilesystemException('Composer update failed: the "'.$tmpDir.'" directory used to download the temp file could not be written');
  4669. }
  4670. if (function_exists('posix_getpwuid') && function_exists('posix_geteuid')) {
  4671. $composeUser = posix_getpwuid(posix_geteuid());
  4672. $homeOwner = posix_getpwuid(fileowner($home));
  4673. if (isset($composeUser['name']) && isset($homeOwner['name']) && $composeUser['name'] !== $homeOwner['name']) {
  4674. $io->writeError('<warning>You are running composer as "'.$composeUser['name'].'", while "'.$home.'" is owned by "'.$homeOwner['name'].'"</warning>');
  4675. }
  4676. }
  4677. if ($input->getOption('rollback')) {
  4678. return $this->rollback($output, $rollbackDir, $localFilename);
  4679. }
  4680. $latest = $versionsUtil->getLatest();
  4681. $latestVersion = $latest['version'];
  4682. $updateVersion = $input->getArgument('version') ?: $latestVersion;
  4683. if (preg_match('{^[0-9a-f]{40}$}', $updateVersion) && $updateVersion !== $latestVersion) {
  4684. $io->writeError('<error>You can not update to a specific SHA-1 as those phars are not available for download</error>');
  4685. return 1;
  4686. }
  4687. if (Composer::VERSION === $updateVersion) {
  4688. $io->writeError(sprintf('<info>You are already using composer version %s (%s channel).</info>', $updateVersion, $versionsUtil->getChannel()));
  4689. if ($input->getOption('clean-backups')) {
  4690. $this->cleanBackups($rollbackDir, $this->getLastBackupVersion($rollbackDir));
  4691. }
  4692. return 0;
  4693. }
  4694. $tempFilename = $tmpDir . '/' . basename($localFilename, '.phar').'-temp.phar';
  4695. $backupFile = sprintf(
  4696. '%s/%s-%s%s',
  4697. $rollbackDir,
  4698. strtr(Composer::RELEASE_DATE, ' :', '_-'),
  4699. preg_replace('{^([0-9a-f]{7})[0-9a-f]{33}$}', '$1', Composer::VERSION),
  4700. self::OLD_INSTALL_EXT
  4701. );
  4702. $updatingToTag = !preg_match('{^[0-9a-f]{40}$}', $updateVersion);
  4703. $io->write(sprintf("Updating to version <info>%s</info> (%s channel).", $updateVersion, $versionsUtil->getChannel()));
  4704. $remoteFilename = $baseUrl . ($updatingToTag ? "/download/{$updateVersion}/composer.phar" : '/composer.phar');
  4705. $signature = $remoteFilesystem->getContents(self::HOMEPAGE, $remoteFilename.'.sig', false);
  4706. $io->writeError(' ', false);
  4707. $remoteFilesystem->copy(self::HOMEPAGE, $remoteFilename, $tempFilename, !$input->getOption('no-progress'));
  4708. $io->writeError('');
  4709. if (!file_exists($tempFilename) || !$signature) {
  4710. $io->writeError('<error>The download of the new composer version failed for an unexpected reason</error>');
  4711. return 1;
  4712. }
  4713. if (!extension_loaded('openssl') && $config->get('disable-tls')) {
  4714. $io->writeError('<warning>Skipping phar signature verification as you have disabled OpenSSL via config.disable-tls</warning>');
  4715. } else {
  4716. if (!extension_loaded('openssl')) {
  4717. throw new \RuntimeException('The openssl extension is required for phar signatures to be verified but it is not available. '
  4718. . 'If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the \'disable-tls\' option to true.');
  4719. }
  4720. $sigFile = 'file://'.$home.'/' . ($updatingToTag ? 'keys.tags.pub' : 'keys.dev.pub');
  4721. if (!file_exists($sigFile)) {
  4722. file_put_contents($home.'/keys.dev.pub', <<<DEVPUBKEY
  4723. -----BEGIN PUBLIC KEY-----
  4724. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnBDHjZS6e0ZMoK3xTD7f
  4725. FNCzlXjX/Aie2dit8QXA03pSrOTbaMnxON3hUL47Lz3g1SC6YJEMVHr0zYq4elWi
  4726. i3ecFEgzLcj+pZM5X6qWu2Ozz4vWx3JYo1/a/HYdOuW9e3lwS8VtS0AVJA+U8X0A
  4727. hZnBmGpltHhO8hPKHgkJtkTUxCheTcbqn4wGHl8Z2SediDcPTLwqezWKUfrYzu1f
  4728. o/j3WFwFs6GtK4wdYtiXr+yspBZHO3y1udf8eFFGcb2V3EaLOrtfur6XQVizjOuk
  4729. 8lw5zzse1Qp/klHqbDRsjSzJ6iL6F4aynBc6Euqt/8ccNAIz0rLjLhOraeyj4eNn
  4730. 8iokwMKiXpcrQLTKH+RH1JCuOVxQ436bJwbSsp1VwiqftPQieN+tzqy+EiHJJmGf
  4731. TBAbWcncicCk9q2md+AmhNbvHO4PWbbz9TzC7HJb460jyWeuMEvw3gNIpEo2jYa9
  4732. pMV6cVqnSa+wOc0D7pC9a6bne0bvLcm3S+w6I5iDB3lZsb3A9UtRiSP7aGSo7D72
  4733. 8tC8+cIgZcI7k9vjvOqH+d7sdOU2yPCnRY6wFh62/g8bDnUpr56nZN1G89GwM4d4
  4734. r/TU7BQQIzsZgAiqOGXvVklIgAMiV0iucgf3rNBLjjeNEwNSTTG9F0CtQ+7JLwaE
  4735. wSEuAuRm+pRqi8BRnQ/GKUcCAwEAAQ==
  4736. -----END PUBLIC KEY-----
  4737. DEVPUBKEY
  4738. );
  4739. file_put_contents($home.'/keys.tags.pub', <<<TAGSPUBKEY
  4740. -----BEGIN PUBLIC KEY-----
  4741. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0Vi/2K6apCVj76nCnCl2
  4742. MQUPdK+A9eqkYBacXo2wQBYmyVlXm2/n/ZsX6pCLYPQTHyr5jXbkQzBw8SKqPdlh
  4743. vA7NpbMeNCz7wP/AobvUXM8xQuXKbMDTY2uZ4O7sM+PfGbptKPBGLe8Z8d2sUnTO
  4744. bXtX6Lrj13wkRto7st/w/Yp33RHe9SlqkiiS4MsH1jBkcIkEHsRaveZzedUaxY0M
  4745. mba0uPhGUInpPzEHwrYqBBEtWvP97t2vtfx8I5qv28kh0Y6t+jnjL1Urid2iuQZf
  4746. noCMFIOu4vksK5HxJxxrN0GOmGmwVQjOOtxkwikNiotZGPR4KsVj8NnBrLX7oGuM
  4747. nQvGciiu+KoC2r3HDBrpDeBVdOWxDzT5R4iI0KoLzFh2pKqwbY+obNPS2bj+2dgJ
  4748. rV3V5Jjry42QOCBN3c88wU1PKftOLj2ECpewY6vnE478IipiEu7EAdK8Zwj2LmTr
  4749. RKQUSa9k7ggBkYZWAeO/2Ag0ey3g2bg7eqk+sHEq5ynIXd5lhv6tC5PBdHlWipDK
  4750. tl2IxiEnejnOmAzGVivE1YGduYBjN+mjxDVy8KGBrjnz1JPgAvgdwJ2dYw4Rsc/e
  4751. TzCFWGk/HM6a4f0IzBWbJ5ot0PIi4amk07IotBXDWwqDiQTwyuGCym5EqWQ2BD95
  4752. RGv89BPD+2DLnJysngsvVaUCAwEAAQ==
  4753. -----END PUBLIC KEY-----
  4754. TAGSPUBKEY
  4755. );
  4756. }
  4757. $pubkeyid = openssl_pkey_get_public($sigFile);
  4758. $algo = defined('OPENSSL_ALGO_SHA384') ? OPENSSL_ALGO_SHA384 : 'SHA384';
  4759. if (!in_array('SHA384', openssl_get_md_methods())) {
  4760. throw new \RuntimeException('SHA384 is not supported by your openssl extension, could not verify the phar file integrity');
  4761. }
  4762. $signature = json_decode($signature, true);
  4763. $signature = base64_decode($signature['sha384']);
  4764. $verified = 1 === openssl_verify(file_get_contents($tempFilename), $signature, $pubkeyid, $algo);
  4765. openssl_free_key($pubkeyid);
  4766. if (!$verified) {
  4767. throw new \RuntimeException('The phar signature did not match the file you downloaded, this means your public keys are outdated or that the phar file is corrupt/has been modified');
  4768. }
  4769. }
  4770. if ($input->getOption('clean-backups')) {
  4771. $this->cleanBackups($rollbackDir);
  4772. }
  4773. if ($err = $this->setLocalPhar($localFilename, $tempFilename, $backupFile)) {
  4774. @unlink($tempFilename);
  4775. $io->writeError('<error>The file is corrupted ('.$err->getMessage().').</error>');
  4776. $io->writeError('<error>Please re-run the self-update command to try again.</error>');
  4777. return 1;
  4778. }
  4779. if (file_exists($backupFile)) {
  4780. $io->writeError(sprintf(
  4781. 'Use <info>composer self-update --rollback</info> to return to version <comment>%s</comment>',
  4782. Composer::VERSION
  4783. ));
  4784. } else {
  4785. $io->writeError('<warning>A backup of the current version could not be written to '.$backupFile.', no rollback possible</warning>');
  4786. }
  4787. }
  4788. protected function fetchKeys(IOInterface $io, Config $config)
  4789. {
  4790. if (!$io->isInteractive()) {
  4791. throw new \RuntimeException('Public keys can not be fetched in non-interactive mode, please run Composer interactively');
  4792. }
  4793. $io->write('Open <info>https://composer.github.io/pubkeys.html</info> to find the latest keys');
  4794. $validator = function ($value) {
  4795. if (!preg_match('{^-----BEGIN PUBLIC KEY-----$}', trim($value))) {
  4796. throw new \UnexpectedValueException('Invalid input');
  4797. }
  4798. return trim($value)."\n";
  4799. };
  4800. $devKey = '';
  4801. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $devKey, $match)) {
  4802. $devKey = $io->askAndValidate('Enter Dev / Snapshot Public Key (including lines with -----): ', $validator);
  4803. while ($line = $io->ask('')) {
  4804. $devKey .= trim($line)."\n";
  4805. if (trim($line) === '-----END PUBLIC KEY-----') {
  4806. break;
  4807. }
  4808. }
  4809. }
  4810. file_put_contents($keyPath = $config->get('home').'/keys.dev.pub', $match[0]);
  4811. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  4812. $tagsKey = '';
  4813. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $tagsKey, $match)) {
  4814. $tagsKey = $io->askAndValidate('Enter Tags Public Key (including lines with -----): ', $validator);
  4815. while ($line = $io->ask('')) {
  4816. $tagsKey .= trim($line)."\n";
  4817. if (trim($line) === '-----END PUBLIC KEY-----') {
  4818. break;
  4819. }
  4820. }
  4821. }
  4822. file_put_contents($keyPath = $config->get('home').'/keys.tags.pub', $match[0]);
  4823. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  4824. $io->write('Public keys stored in '.$config->get('home'));
  4825. }
  4826. protected function rollback(OutputInterface $output, $rollbackDir, $localFilename)
  4827. {
  4828. $rollbackVersion = $this->getLastBackupVersion($rollbackDir);
  4829. if (!$rollbackVersion) {
  4830. throw new \UnexpectedValueException('Composer rollback failed: no installation to roll back to in "'.$rollbackDir.'"');
  4831. }
  4832. $oldFile = $rollbackDir . '/' . $rollbackVersion . self::OLD_INSTALL_EXT;
  4833. if (!is_file($oldFile)) {
  4834. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be found');
  4835. }
  4836. if (!is_readable($oldFile)) {
  4837. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be read');
  4838. }
  4839. $io = $this->getIO();
  4840. $io->writeError(sprintf("Rolling back to version <info>%s</info>.", $rollbackVersion));
  4841. if ($err = $this->setLocalPhar($localFilename, $oldFile)) {
  4842. $io->writeError('<error>The backup file was corrupted ('.$err->getMessage().').</error>');
  4843. return 1;
  4844. }
  4845. return 0;
  4846. }
  4847. protected function setLocalPhar($localFilename, $newFilename, $backupTarget = null)
  4848. {
  4849. try {
  4850. @chmod($newFilename, fileperms($localFilename));
  4851. if (!ini_get('phar.readonly')) {
  4852. $phar = new \Phar($newFilename);
  4853. unset($phar);
  4854. }
  4855. if ($backupTarget && file_exists($localFilename)) {
  4856. @copy($localFilename, $backupTarget);
  4857. }
  4858. rename($newFilename, $localFilename);
  4859. return null;
  4860. } catch (\Exception $e) {
  4861. if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
  4862. throw $e;
  4863. }
  4864. return $e;
  4865. }
  4866. }
  4867. protected function cleanBackups($rollbackDir, $except = null)
  4868. {
  4869. $finder = $this->getOldInstallationFinder($rollbackDir);
  4870. $io = $this->getIO();
  4871. $fs = new Filesystem;
  4872. foreach ($finder as $file) {
  4873. if ($except && $file->getBasename(self::OLD_INSTALL_EXT) === $except) {
  4874. continue;
  4875. }
  4876. $file = (string) $file;
  4877. $io->writeError('<info>Removing: '.$file.'</info>');
  4878. $fs->remove($file);
  4879. }
  4880. }
  4881. protected function getLastBackupVersion($rollbackDir)
  4882. {
  4883. $finder = $this->getOldInstallationFinder($rollbackDir);
  4884. $finder->sortByName();
  4885. $files = iterator_to_array($finder);
  4886. if (count($files)) {
  4887. return basename(end($files), self::OLD_INSTALL_EXT);
  4888. }
  4889. return false;
  4890. }
  4891. protected function getOldInstallationFinder($rollbackDir)
  4892. {
  4893. $finder = Finder::create()
  4894. ->depth(0)
  4895. ->files()
  4896. ->name('*' . self::OLD_INSTALL_EXT)
  4897. ->in($rollbackDir);
  4898. return $finder;
  4899. }
  4900. }
  4901. <?php
  4902. namespace Composer\Command;
  4903. use Composer\Composer;
  4904. use Composer\DependencyResolver\DefaultPolicy;
  4905. use Composer\DependencyResolver\Pool;
  4906. use Composer\Json\JsonFile;
  4907. use Composer\Package\BasePackage;
  4908. use Composer\Package\CompletePackageInterface;
  4909. use Composer\Package\PackageInterface;
  4910. use Composer\Package\Version\VersionParser;
  4911. use Composer\Package\Version\VersionSelector;
  4912. use Composer\Plugin\CommandEvent;
  4913. use Composer\Plugin\PluginEvents;
  4914. use Composer\Repository\ArrayRepository;
  4915. use Composer\Repository\ComposerRepository;
  4916. use Composer\Repository\CompositeRepository;
  4917. use Composer\Repository\PlatformRepository;
  4918. use Composer\Repository\RepositoryFactory;
  4919. use Composer\Repository\RepositoryInterface;
  4920. use Composer\Semver\Constraint\ConstraintInterface;
  4921. use Composer\Semver\Semver;
  4922. use Composer\Spdx\SpdxLicenses;
  4923. use Composer\Util\Platform;
  4924. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  4925. use Symfony\Component\Console\Input\InputArgument;
  4926. use Symfony\Component\Console\Input\InputInterface;
  4927. use Symfony\Component\Console\Input\InputOption;
  4928. use Symfony\Component\Console\Output\OutputInterface;
  4929. use Symfony\Component\Console\Terminal;
  4930. class ShowCommand extends BaseCommand
  4931. {
  4932. protected $versionParser;
  4933. protected $colors;
  4934. private $pool;
  4935. protected function configure()
  4936. {
  4937. $this
  4938. ->setName('show')
  4939. ->setAliases(array('info'))
  4940. ->setDescription('Shows information about packages.')
  4941. ->setDefinition(array(
  4942. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  4943. new InputArgument('version', InputArgument::OPTIONAL, 'Version or version constraint to inspect'),
  4944. new InputOption('all', null, InputOption::VALUE_NONE, 'List all packages'),
  4945. new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only (enabled by default, only present for BC).'),
  4946. new InputOption('platform', 'p', InputOption::VALUE_NONE, 'List platform packages only'),
  4947. new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available packages only'),
  4948. new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'),
  4949. new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'),
  4950. new InputOption('path', 'P', InputOption::VALUE_NONE, 'Show package paths'),
  4951. new InputOption('tree', 't', InputOption::VALUE_NONE, 'List the dependencies as a tree'),
  4952. new InputOption('latest', 'l', InputOption::VALUE_NONE, 'Show the latest version'),
  4953. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show the latest version but only for packages that are outdated'),
  4954. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  4955. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  4956. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  4957. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4958. ))
  4959. ->setHelp(<<<EOT
  4960. The show command displays detailed information about a package, or
  4961. lists all packages available.
  4962. EOT
  4963. )
  4964. ;
  4965. }
  4966. protected function execute(InputInterface $input, OutputInterface $output)
  4967. {
  4968. $this->versionParser = new VersionParser;
  4969. if ($input->getOption('tree')) {
  4970. $this->initStyles($output);
  4971. }
  4972. $composer = $this->getComposer(false);
  4973. $io = $this->getIO();
  4974. if ($input->getOption('installed')) {
  4975. $io->writeError('<warning>You are using the deprecated option "installed". Only installed packages are shown by default now. The --all option can be used to show all packages.</warning>');
  4976. }
  4977. if ($input->getOption('outdated')) {
  4978. $input->setOption('latest', true);
  4979. }
  4980. if ($input->getOption('direct') && ($input->getOption('all') || $input->getOption('available') || $input->getOption('platform'))) {
  4981. $io->writeError('The --direct (-D) option is not usable in combination with --all, --platform (-p) or --available (-a)');
  4982. return 1;
  4983. }
  4984. if ($input->getOption('tree') && ($input->getOption('all') || $input->getOption('available'))) {
  4985. $io->writeError('The --tree (-t) option is not usable in combination with --all or --available (-a)');
  4986. return 1;
  4987. }
  4988. $format = $input->getOption('format');
  4989. if (!in_array($format, array('text', 'json'))) {
  4990. $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  4991. return 1;
  4992. }
  4993. $platformOverrides = array();
  4994. if ($composer) {
  4995. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  4996. }
  4997. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  4998. $phpVersion = $platformRepo->findPackage('php', '*')->getVersion();
  4999. if ($input->getOption('self')) {
  5000. $package = $this->getComposer()->getPackage();
  5001. $repos = $installedRepo = new ArrayRepository(array($package));
  5002. } elseif ($input->getOption('platform')) {
  5003. $repos = $installedRepo = $platformRepo;
  5004. } elseif ($input->getOption('available')) {
  5005. $installedRepo = $platformRepo;
  5006. if ($composer) {
  5007. $repos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  5008. } else {
  5009. $defaultRepos = RepositoryFactory::defaultRepos($io);
  5010. $repos = new CompositeRepository($defaultRepos);
  5011. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  5012. }
  5013. } elseif ($input->getOption('all') && $composer) {
  5014. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  5015. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  5016. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  5017. } elseif ($input->getOption('all')) {
  5018. $defaultRepos = RepositoryFactory::defaultRepos($io);
  5019. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  5020. $installedRepo = $platformRepo;
  5021. $repos = new CompositeRepository(array_merge(array($installedRepo), $defaultRepos));
  5022. } else {
  5023. $repos = $installedRepo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
  5024. $rootPkg = $this->getComposer()->getPackage();
  5025. if (!$installedRepo->getPackages() && ($rootPkg->getRequires() || $rootPkg->getDevRequires())) {
  5026. $io->writeError('<warning>No dependencies installed. Try running composer install or update.</warning>');
  5027. }
  5028. }
  5029. if ($composer) {
  5030. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'show', $input, $output);
  5031. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5032. }
  5033. if ($input->getOption('latest') && null === $composer) {
  5034. $io->writeError('No composer.json found in the current directory, disabling "latest" option');
  5035. $input->setOption('latest', false);
  5036. }
  5037. $packageFilter = $input->getArgument('package');
  5038. if (($packageFilter && false === strpos($packageFilter, '*')) || !empty($package)) {
  5039. if ('json' === $format) {
  5040. $io->writeError('Format "json" is only supported for package listings, falling back to format "text"');
  5041. }
  5042. if (empty($package)) {
  5043. list($package, $versions) = $this->getPackage($installedRepo, $repos, $input->getArgument('package'), $input->getArgument('version'));
  5044. if (empty($package)) {
  5045. $options = $input->getOptions();
  5046. if (!isset($options['working-dir']) || !file_exists('composer.json')) {
  5047. throw new \InvalidArgumentException('Package ' . $packageFilter . ' not found');
  5048. }
  5049. $io->writeError('Package ' . $packageFilter . ' not found in ' . $options['working-dir'] . '/composer.json');
  5050. return 1;
  5051. }
  5052. } else {
  5053. $versions = array($package->getPrettyVersion() => $package->getVersion());
  5054. }
  5055. $exitCode = 0;
  5056. if ($input->getOption('tree')) {
  5057. $this->displayPackageTree($package, $installedRepo, $repos);
  5058. } else {
  5059. $latestPackage = null;
  5060. if ($input->getOption('latest')) {
  5061. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion);
  5062. }
  5063. if ($input->getOption('outdated') && $input->getOption('strict') && $latestPackage && $latestPackage->getFullPrettyVersion() !== $package->getFullPrettyVersion() && !$latestPackage->isAbandoned()) {
  5064. $exitCode = 1;
  5065. }
  5066. $this->printMeta($package, $versions, $installedRepo, $latestPackage ?: null);
  5067. $this->printLinks($package, 'requires');
  5068. $this->printLinks($package, 'devRequires', 'requires (dev)');
  5069. if ($package->getSuggests()) {
  5070. $io->write("\n<info>suggests</info>");
  5071. foreach ($package->getSuggests() as $suggested => $reason) {
  5072. $io->write($suggested . ' <comment>' . $reason . '</comment>');
  5073. }
  5074. }
  5075. $this->printLinks($package, 'provides');
  5076. $this->printLinks($package, 'conflicts');
  5077. $this->printLinks($package, 'replaces');
  5078. }
  5079. return $exitCode;
  5080. }
  5081. if ($input->getOption('tree')) {
  5082. if ('json' === $format) {
  5083. $io->writeError('Format "json" is only supported for package listings, falling back to format "text"');
  5084. }
  5085. $rootRequires = $this->getRootRequires();
  5086. $packages = $installedRepo->getPackages();
  5087. usort($packages, 'strcmp');
  5088. foreach ($packages as $package) {
  5089. if (in_array($package->getName(), $rootRequires, true)) {
  5090. $this->displayPackageTree($package, $installedRepo, $repos);
  5091. }
  5092. }
  5093. return 0;
  5094. }
  5095. if ($repos instanceof CompositeRepository) {
  5096. $repos = $repos->getRepositories();
  5097. } elseif (!is_array($repos)) {
  5098. $repos = array($repos);
  5099. }
  5100. $packages = array();
  5101. if (null !== $packageFilter) {
  5102. $packageFilter = '{^'.str_replace('\\*', '.*?', preg_quote($packageFilter)).'$}i';
  5103. }
  5104. $packageListFilter = array();
  5105. if ($input->getOption('direct')) {
  5106. $packageListFilter = $this->getRootRequires();
  5107. }
  5108. if (class_exists('Symfony\Component\Console\Terminal')) {
  5109. $terminal = new Terminal();
  5110. $width = $terminal->getWidth();
  5111. } else {
  5112. list($width) = $this->getApplication()->getTerminalDimensions();
  5113. }
  5114. if (null === $width) {
  5115. $width = PHP_INT_MAX;
  5116. }
  5117. if (Platform::isWindows()) {
  5118. $width--;
  5119. } else {
  5120. $width = max(80, $width);
  5121. }
  5122. if ($input->getOption('path') && null === $composer) {
  5123. $io->writeError('No composer.json found in the current directory, disabling "path" option');
  5124. $input->setOption('path', false);
  5125. }
  5126. foreach ($repos as $repo) {
  5127. if ($repo === $platformRepo) {
  5128. $type = 'platform';
  5129. } elseif (
  5130. $repo === $installedRepo
  5131. || ($installedRepo instanceof CompositeRepository && in_array($repo, $installedRepo->getRepositories(), true))
  5132. ) {
  5133. $type = 'installed';
  5134. } else {
  5135. $type = 'available';
  5136. }
  5137. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  5138. foreach ($repo->getProviderNames() as $name) {
  5139. if (!$packageFilter || preg_match($packageFilter, $name)) {
  5140. $packages[$type][$name] = $name;
  5141. }
  5142. }
  5143. } else {
  5144. foreach ($repo->getPackages() as $package) {
  5145. if (!isset($packages[$type][$package->getName()])
  5146. || !is_object($packages[$type][$package->getName()])
  5147. || version_compare($packages[$type][$package->getName()]->getVersion(), $package->getVersion(), '<')
  5148. ) {
  5149. if (!$packageFilter || preg_match($packageFilter, $package->getName())) {
  5150. if (!$packageListFilter || in_array($package->getName(), $packageListFilter, true)) {
  5151. $packages[$type][$package->getName()] = $package;
  5152. }
  5153. }
  5154. }
  5155. }
  5156. }
  5157. }
  5158. $showAllTypes = $input->getOption('all');
  5159. $showLatest = $input->getOption('latest');
  5160. $showMinorOnly = $input->getOption('minor-only');
  5161. $indent = $showAllTypes ? ' ' : '';
  5162. $latestPackages = array();
  5163. $exitCode = 0;
  5164. $viewData = array();
  5165. $viewMetaData = array();
  5166. foreach (array('platform' => true, 'available' => false, 'installed' => true) as $type => $showVersion) {
  5167. if (isset($packages[$type])) {
  5168. ksort($packages[$type]);
  5169. $nameLength = $versionLength = $latestLength = 0;
  5170. if ($showLatest && $showVersion) {
  5171. foreach ($packages[$type] as $package) {
  5172. if (is_object($package)) {
  5173. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion, $showMinorOnly);
  5174. if ($latestPackage === false) {
  5175. continue;
  5176. }
  5177. $latestPackages[$package->getPrettyName()] = $latestPackage;
  5178. }
  5179. }
  5180. }
  5181. $writePath = !$input->getOption('name-only') && $input->getOption('path');
  5182. $writeVersion = !$input->getOption('name-only') && !$input->getOption('path') && $showVersion;
  5183. $writeLatest = $writeVersion && $showLatest;
  5184. $writeDescription = !$input->getOption('name-only') && !$input->getOption('path');
  5185. $hasOutdatedPackages = false;
  5186. $viewData[$type] = array();
  5187. foreach ($packages[$type] as $package) {
  5188. $packageViewData = array();
  5189. if (is_object($package)) {
  5190. $latestPackage = null;
  5191. if ($showLatest && isset($latestPackages[$package->getPrettyName()])) {
  5192. $latestPackage = $latestPackages[$package->getPrettyName()];
  5193. }
  5194. if ($input->getOption('outdated') && $latestPackage && $latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion() && !$latestPackage->isAbandoned()) {
  5195. continue;
  5196. } elseif ($input->getOption('outdated') || $input->getOption('strict')) {
  5197. $hasOutdatedPackages = true;
  5198. }
  5199. $packageViewData['name'] = $package->getPrettyName();
  5200. $nameLength = max($nameLength, strlen($package->getPrettyName()));
  5201. if ($writeVersion) {
  5202. $packageViewData['version'] = $package->getFullPrettyVersion();
  5203. $versionLength = max($versionLength, strlen($package->getFullPrettyVersion()));
  5204. }
  5205. if ($writeLatest && $latestPackage) {
  5206. $packageViewData['latest'] = $latestPackage->getFullPrettyVersion();
  5207. $packageViewData['latest-status'] = $this->getUpdateStatus($latestPackage, $package);
  5208. $latestLength = max($latestLength, strlen($latestPackage->getFullPrettyVersion()));
  5209. }
  5210. if ($writeDescription) {
  5211. $packageViewData['description'] = $package->getDescription();
  5212. }
  5213. if ($writePath) {
  5214. $packageViewData['path'] = strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n");
  5215. }
  5216. if ($latestPackage && $latestPackage->isAbandoned()) {
  5217. $replacement = (is_string($latestPackage->getReplacementPackage()))
  5218. ? 'Use ' . $latestPackage->getReplacementPackage() . ' instead'
  5219. : 'No replacement was suggested';
  5220. $packageWarning = sprintf(
  5221. 'Package %s is abandoned, you should avoid using it. %s.',
  5222. $package->getPrettyName(),
  5223. $replacement
  5224. );
  5225. $packageViewData['warning'] = $packageWarning;
  5226. }
  5227. } else {
  5228. $packageViewData['name'] = $package;
  5229. $nameLength = max($nameLength, strlen($package));
  5230. }
  5231. $viewData[$type][] = $packageViewData;
  5232. }
  5233. $viewMetaData[$type] = array(
  5234. 'nameLength' => $nameLength,
  5235. 'versionLength' => $versionLength,
  5236. 'latestLength' => $latestLength,
  5237. );
  5238. if ($input->getOption('strict') && $hasOutdatedPackages) {
  5239. $exitCode = 1;
  5240. break;
  5241. }
  5242. }
  5243. }
  5244. if ('json' === $format) {
  5245. $io->write(JsonFile::encode($viewData));
  5246. } else {
  5247. foreach ($viewData as $type => $packages) {
  5248. $nameLength = $viewMetaData[$type]['nameLength'];
  5249. $versionLength = $viewMetaData[$type]['versionLength'];
  5250. $latestLength = $viewMetaData[$type]['latestLength'];
  5251. $writeVersion = $nameLength + $versionLength + 3 <= $width;
  5252. $writeLatest = $nameLength + $versionLength + $latestLength + 3 <= $width;
  5253. $writeDescription = $nameLength + $versionLength + $latestLength + 24 <= $width;
  5254. if ($writeLatest && !$io->isDecorated()) {
  5255. $latestLength += 2;
  5256. }
  5257. if ($showAllTypes) {
  5258. if ('available' === $type) {
  5259. $io->write('<comment>' . $type . '</comment>:');
  5260. } else {
  5261. $io->write('<info>' . $type . '</info>:');
  5262. }
  5263. }
  5264. foreach ($packages as $package) {
  5265. $io->write($indent . str_pad($package['name'], $nameLength, ' '), false);
  5266. if (isset($package['version']) && $writeVersion) {
  5267. $io->write(' ' . str_pad($package['version'], $versionLength, ' '), false);
  5268. }
  5269. if (isset($package['latest']) && $writeLatest) {
  5270. $latestVersion = $package['latest'];
  5271. $updateStatus = $package['latest-status'];
  5272. $style = $this->updateStatusToVersionStyle($updateStatus);
  5273. if (!$io->isDecorated()) {
  5274. $latestVersion = str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('=', '!', '~'), $updateStatus) . ' ' . $latestVersion;
  5275. }
  5276. $io->write(' <' . $style . '>' . str_pad($latestVersion, $latestLength, ' ') . '</' . $style . '>', false);
  5277. }
  5278. if (isset($package['description']) && $writeDescription) {
  5279. $description = strtok($package['description'], "\r\n");
  5280. $remaining = $width - $nameLength - $versionLength - 4;
  5281. if ($writeLatest) {
  5282. $remaining -= $latestLength;
  5283. }
  5284. if (strlen($description) > $remaining) {
  5285. $description = substr($description, 0, $remaining - 3) . '...';
  5286. }
  5287. $io->write(' ' . $description, false);
  5288. }
  5289. if (isset($package['path'])) {
  5290. $io->write(' ' . $package['path'], false);
  5291. }
  5292. $io->write('');
  5293. if (isset($package['warning'])) {
  5294. $io->writeError('<warning>' . $package['warning'] . '</warning>');
  5295. }
  5296. }
  5297. if ($showAllTypes) {
  5298. $io->write('');
  5299. }
  5300. }
  5301. }
  5302. return $exitCode;
  5303. }
  5304. protected function getRootRequires()
  5305. {
  5306. $rootPackage = $this->getComposer()->getPackage();
  5307. return array_map(
  5308. 'strtolower',
  5309. array_keys(array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()))
  5310. );
  5311. }
  5312. protected function getVersionStyle(PackageInterface $latestPackage, PackageInterface $package)
  5313. {
  5314. return $this->updateStatusToVersionStyle($this->getUpdateStatus($latestPackage, $package));
  5315. }
  5316. protected function getPackage(RepositoryInterface $installedRepo, RepositoryInterface $repos, $name, $version = null)
  5317. {
  5318. $name = strtolower($name);
  5319. $constraint = is_string($version) ? $this->versionParser->parseConstraints($version) : $version;
  5320. $policy = new DefaultPolicy();
  5321. $pool = new Pool('dev');
  5322. $pool->addRepository($repos);
  5323. $matchedPackage = null;
  5324. $versions = array();
  5325. $matches = $pool->whatProvides($name, $constraint);
  5326. foreach ($matches as $index => $package) {
  5327. if ($package->getName() !== $name) {
  5328. unset($matches[$index]);
  5329. continue;
  5330. }
  5331. if (null === $version && $installedRepo->hasPackage($package)) {
  5332. $matchedPackage = $package;
  5333. }
  5334. $versions[$package->getPrettyVersion()] = $package->getVersion();
  5335. $matches[$index] = $package->getId();
  5336. }
  5337. if (!$matchedPackage && $matches && $preferred = $policy->selectPreferredPackages($pool, array(), $matches)) {
  5338. $matchedPackage = $pool->literalToPackage($preferred[0]);
  5339. }
  5340. return array($matchedPackage, $versions);
  5341. }
  5342. protected function printMeta(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, PackageInterface $latestPackage = null)
  5343. {
  5344. $io = $this->getIO();
  5345. $io->write('<info>name</info> : ' . $package->getPrettyName());
  5346. $io->write('<info>descrip.</info> : ' . $package->getDescription());
  5347. $io->write('<info>keywords</info> : ' . implode(', ', $package->getKeywords() ?: array()));
  5348. $this->printVersions($package, $versions, $installedRepo);
  5349. if ($latestPackage) {
  5350. $style = $this->getVersionStyle($latestPackage, $package);
  5351. $io->write('<info>latest</info> : <'.$style.'>' . $latestPackage->getPrettyVersion() . '</'.$style.'>');
  5352. } else {
  5353. $latestPackage = $package;
  5354. }
  5355. $io->write('<info>type</info> : ' . $package->getType());
  5356. $this->printLicenses($package);
  5357. $io->write('<info>source</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference()));
  5358. $io->write('<info>dist</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference()));
  5359. $io->write('<info>names</info> : ' . implode(', ', $package->getNames()));
  5360. if ($latestPackage->isAbandoned()) {
  5361. $replacement = ($latestPackage->getReplacementPackage() !== null)
  5362. ? ' The author suggests using the ' . $latestPackage->getReplacementPackage(). ' package instead.'
  5363. : null;
  5364. $io->writeError(
  5365. sprintf('<warning>Attention: This package is abandoned and no longer maintained.%s</warning>', $replacement)
  5366. );
  5367. }
  5368. if ($package->getSupport()) {
  5369. $io->write("\n<info>support</info>");
  5370. foreach ($package->getSupport() as $type => $value) {
  5371. $io->write('<comment>' . $type . '</comment> : '.$value);
  5372. }
  5373. }
  5374. if ($package->getAutoload()) {
  5375. $io->write("\n<info>autoload</info>");
  5376. foreach ($package->getAutoload() as $type => $autoloads) {
  5377. $io->write('<comment>' . $type . '</comment>');
  5378. if ($type === 'psr-0') {
  5379. foreach ($autoloads as $name => $path) {
  5380. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  5381. }
  5382. } elseif ($type === 'psr-4') {
  5383. foreach ($autoloads as $name => $path) {
  5384. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  5385. }
  5386. } elseif ($type === 'classmap') {
  5387. $io->write(implode(', ', $autoloads));
  5388. }
  5389. }
  5390. if ($package->getIncludePaths()) {
  5391. $io->write('<comment>include-path</comment>');
  5392. $io->write(implode(', ', $package->getIncludePaths()));
  5393. }
  5394. }
  5395. }
  5396. protected function printVersions(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo)
  5397. {
  5398. uasort($versions, 'version_compare');
  5399. $versions = array_keys(array_reverse($versions));
  5400. if ($installedRepo->hasPackage($package)) {
  5401. $installedVersion = $package->getPrettyVersion();
  5402. $key = array_search($installedVersion, $versions);
  5403. if (false !== $key) {
  5404. $versions[$key] = '<info>* ' . $installedVersion . '</info>';
  5405. }
  5406. }
  5407. $versions = implode(', ', $versions);
  5408. $this->getIO()->write('<info>versions</info> : ' . $versions);
  5409. }
  5410. protected function printLinks(CompletePackageInterface $package, $linkType, $title = null)
  5411. {
  5412. $title = $title ?: $linkType;
  5413. $io = $this->getIO();
  5414. if ($links = $package->{'get'.ucfirst($linkType)}()) {
  5415. $io->write("\n<info>" . $title . "</info>");
  5416. foreach ($links as $link) {
  5417. $io->write($link->getTarget() . ' <comment>' . $link->getPrettyConstraint() . '</comment>');
  5418. }
  5419. }
  5420. }
  5421. protected function printLicenses(CompletePackageInterface $package)
  5422. {
  5423. $spdxLicenses = new SpdxLicenses();
  5424. $licenses = $package->getLicense();
  5425. $io = $this->getIO();
  5426. foreach ($licenses as $licenseId) {
  5427. $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
  5428. if (!$license) {
  5429. $out = $licenseId;
  5430. } else {
  5431. if ($license[1] === true) {
  5432. $out = sprintf('%s (%s) (OSI approved) %s', $license[0], $licenseId, $license[2]);
  5433. } else {
  5434. $out = sprintf('%s (%s) %s', $license[0], $licenseId, $license[2]);
  5435. }
  5436. }
  5437. $io->write('<info>license</info> : ' . $out);
  5438. }
  5439. }
  5440. protected function initStyles(OutputInterface $output)
  5441. {
  5442. $this->colors = array(
  5443. 'green',
  5444. 'yellow',
  5445. 'cyan',
  5446. 'magenta',
  5447. 'blue',
  5448. );
  5449. foreach ($this->colors as $color) {
  5450. $style = new OutputFormatterStyle($color);
  5451. $output->getFormatter()->setStyle($color, $style);
  5452. }
  5453. }
  5454. protected function displayPackageTree(PackageInterface $package, RepositoryInterface $installedRepo, RepositoryInterface $distantRepos)
  5455. {
  5456. $io = $this->getIO();
  5457. $io->write(sprintf('<info>%s</info>', $package->getPrettyName()), false);
  5458. $io->write(' ' . $package->getPrettyVersion(), false);
  5459. $io->write(' ' . strtok($package->getDescription(), "\r\n"));
  5460. if (is_object($package)) {
  5461. $requires = $package->getRequires();
  5462. ksort($requires);
  5463. $treeBar = '├';
  5464. $j = 0;
  5465. $total = count($requires);
  5466. foreach ($requires as $requireName => $require) {
  5467. $j++;
  5468. if ($j == 0) {
  5469. $this->writeTreeLine($treeBar);
  5470. }
  5471. if ($j == $total) {
  5472. $treeBar = 'â””';
  5473. }
  5474. $level = 1;
  5475. $color = $this->colors[$level];
  5476. $info = sprintf('%s──<%s>%s</%s> %s', $treeBar, $color, $requireName, $color, $require->getPrettyConstraint());
  5477. $this->writeTreeLine($info);
  5478. $treeBar = str_replace('â””', ' ', $treeBar);
  5479. $packagesInTree = array($package->getName(), $requireName);
  5480. $this->displayTree($requireName, $require, $installedRepo, $distantRepos, $packagesInTree, $treeBar, $level + 1);
  5481. }
  5482. }
  5483. }
  5484. protected function displayTree($name, $package, RepositoryInterface $installedRepo, RepositoryInterface $distantRepos, array $packagesInTree, $previousTreeBar = '├', $level = 1)
  5485. {
  5486. $previousTreeBar = str_replace('├', '│', $previousTreeBar);
  5487. list($package, $versions) = $this->getPackage($installedRepo, $distantRepos, $name, $package->getPrettyConstraint() === 'self.version' ? $package->getConstraint() : $package->getPrettyConstraint());
  5488. if (is_object($package)) {
  5489. $requires = $package->getRequires();
  5490. ksort($requires);
  5491. $treeBar = $previousTreeBar . ' ├';
  5492. $i = 0;
  5493. $total = count($requires);
  5494. foreach ($requires as $requireName => $require) {
  5495. $currentTree = $packagesInTree;
  5496. $i++;
  5497. if ($i == $total) {
  5498. $treeBar = $previousTreeBar . ' â””';
  5499. }
  5500. $colorIdent = $level % count($this->colors);
  5501. $color = $this->colors[$colorIdent];
  5502. $circularWarn = in_array($requireName, $currentTree) ? '(circular dependency aborted here)' : '';
  5503. $info = rtrim(sprintf('%s──<%s>%s</%s> %s %s', $treeBar, $color, $requireName, $color, $require->getPrettyConstraint(), $circularWarn));
  5504. $this->writeTreeLine($info);
  5505. $treeBar = str_replace('â””', ' ', $treeBar);
  5506. if (!in_array($requireName, $currentTree)) {
  5507. $currentTree[] = $requireName;
  5508. $this->displayTree($requireName, $require, $installedRepo, $distantRepos, $currentTree, $treeBar, $level + 1);
  5509. }
  5510. }
  5511. }
  5512. }
  5513. private function updateStatusToVersionStyle($updateStatus)
  5514. {
  5515. return str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('info', 'highlight', 'comment'), $updateStatus);
  5516. }
  5517. private function getUpdateStatus(PackageInterface $latestPackage, PackageInterface $package)
  5518. {
  5519. if ($latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion()) {
  5520. return 'up-to-date';
  5521. }
  5522. $constraint = $package->getVersion();
  5523. if (0 !== strpos($constraint, 'dev-')) {
  5524. $constraint = '^'.$constraint;
  5525. }
  5526. if ($latestPackage->getVersion() && Semver::satisfies($latestPackage->getVersion(), $constraint)) {
  5527. return 'semver-safe-update';
  5528. }
  5529. return 'update-possible';
  5530. }
  5531. private function writeTreeLine($line)
  5532. {
  5533. $io = $this->getIO();
  5534. if (!$io->isDecorated()) {
  5535. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  5536. }
  5537. $io->write($line);
  5538. }
  5539. private function findLatestPackage(PackageInterface $package, Composer $composer, $phpVersion, $minorOnly = false)
  5540. {
  5541. $name = $package->getName();
  5542. $versionSelector = new VersionSelector($this->getPool($composer));
  5543. $stability = $composer->getPackage()->getMinimumStability();
  5544. $flags = $composer->getPackage()->getStabilityFlags();
  5545. if (isset($flags[$name])) {
  5546. $stability = array_search($flags[$name], BasePackage::$stabilities, true);
  5547. }
  5548. $bestStability = $stability;
  5549. if ($composer->getPackage()->getPreferStable()) {
  5550. $bestStability = $package->getStability();
  5551. }
  5552. $targetVersion = null;
  5553. if (0 === strpos($package->getVersion(), 'dev-')) {
  5554. $targetVersion = $package->getVersion();
  5555. }
  5556. if ($targetVersion === null && $minorOnly) {
  5557. $targetVersion = '^' . $package->getVersion();
  5558. }
  5559. return $versionSelector->findBestCandidate($name, $targetVersion, $phpVersion, $bestStability);
  5560. }
  5561. private function getPool(Composer $composer)
  5562. {
  5563. if (!$this->pool) {
  5564. $this->pool = new Pool($composer->getPackage()->getMinimumStability(), $composer->getPackage()->getStabilityFlags());
  5565. $this->pool->addRepository(new CompositeRepository($composer->getRepositoryManager()->getRepositories()));
  5566. }
  5567. return $this->pool;
  5568. }
  5569. }
  5570. <?php
  5571. namespace Composer\Command;
  5572. use Symfony\Component\Console\Input\InputInterface;
  5573. use Symfony\Component\Console\Input\InputOption;
  5574. use Symfony\Component\Console\Output\OutputInterface;
  5575. use Composer\Downloader\ChangeReportInterface;
  5576. use Composer\Downloader\DvcsDownloaderInterface;
  5577. use Composer\Downloader\VcsCapableDownloaderInterface;
  5578. use Composer\Package\Dumper\ArrayDumper;
  5579. use Composer\Package\Version\VersionGuesser;
  5580. use Composer\Package\Version\VersionParser;
  5581. use Composer\Plugin\CommandEvent;
  5582. use Composer\Plugin\PluginEvents;
  5583. use Composer\Script\ScriptEvents;
  5584. use Composer\Util\ProcessExecutor;
  5585. class StatusCommand extends BaseCommand
  5586. {
  5587. const EXIT_CODE_ERRORS = 1;
  5588. const EXIT_CODE_UNPUSHED_CHANGES = 2;
  5589. const EXIT_CODE_VERSION_CHANGES = 4;
  5590. protected function configure()
  5591. {
  5592. $this
  5593. ->setName('status')
  5594. ->setDescription('Shows a list of locally modified packages, for packages installed from source.')
  5595. ->setDefinition(array(
  5596. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Show modified files for each directory that contains changes.'),
  5597. ))
  5598. ->setHelp(<<<EOT
  5599. The status command displays a list of dependencies that have
  5600. been modified locally.
  5601. EOT
  5602. )
  5603. ;
  5604. }
  5605. protected function execute(InputInterface $input, OutputInterface $output)
  5606. {
  5607. $composer = $this->getComposer();
  5608. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'status', $input, $output);
  5609. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5610. $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
  5611. $dm = $composer->getDownloadManager();
  5612. $im = $composer->getInstallationManager();
  5613. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_STATUS_CMD, true);
  5614. $errors = array();
  5615. $io = $this->getIO();
  5616. $unpushedChanges = array();
  5617. $vcsVersionChanges = array();
  5618. $parser = new VersionParser;
  5619. $guesser = new VersionGuesser($composer->getConfig(), new ProcessExecutor($io), $parser);
  5620. $dumper = new ArrayDumper;
  5621. foreach ($installedRepo->getCanonicalPackages() as $package) {
  5622. $downloader = $dm->getDownloaderForInstalledPackage($package);
  5623. $targetDir = $im->getInstallPath($package);
  5624. if ($downloader instanceof ChangeReportInterface) {
  5625. if (is_link($targetDir)) {
  5626. $errors[$targetDir] = $targetDir . ' is a symbolic link.';
  5627. }
  5628. if ($changes = $downloader->getLocalChanges($package, $targetDir)) {
  5629. $errors[$targetDir] = $changes;
  5630. }
  5631. }
  5632. if ($downloader instanceof VcsCapableDownloaderInterface) {
  5633. if ($currentRef = $downloader->getVcsReference($package, $targetDir)) {
  5634. switch ($package->getInstallationSource()) {
  5635. case 'source':
  5636. $previousRef = $package->getSourceReference();
  5637. break;
  5638. case 'dist':
  5639. $previousRef = $package->getDistReference();
  5640. break;
  5641. default:
  5642. $previousRef = null;
  5643. }
  5644. $currentVersion = $guesser->guessVersion($dumper->dump($package), $targetDir);
  5645. if ($previousRef && $currentVersion && $currentVersion['commit'] !== $previousRef) {
  5646. $vcsVersionChanges[$targetDir] = array(
  5647. 'previous' => array(
  5648. 'version' => $package->getPrettyVersion(),
  5649. 'ref' => $previousRef,
  5650. ),
  5651. 'current' => array(
  5652. 'version' => $currentVersion['pretty_version'],
  5653. 'ref' => $currentVersion['commit'],
  5654. ),
  5655. );
  5656. }
  5657. }
  5658. }
  5659. if ($downloader instanceof DvcsDownloaderInterface) {
  5660. if ($unpushed = $downloader->getUnpushedChanges($package, $targetDir)) {
  5661. $unpushedChanges[$targetDir] = $unpushed;
  5662. }
  5663. }
  5664. }
  5665. if (!$errors && !$unpushedChanges && !$vcsVersionChanges) {
  5666. $io->writeError('<info>No local changes</info>');
  5667. return 0;
  5668. }
  5669. if ($errors) {
  5670. $io->writeError('<error>You have changes in the following dependencies:</error>');
  5671. foreach ($errors as $path => $changes) {
  5672. if ($input->getOption('verbose')) {
  5673. $indentedChanges = implode("\n", array_map(function ($line) {
  5674. return ' ' . ltrim($line);
  5675. }, explode("\n", $changes)));
  5676. $io->write('<info>'.$path.'</info>:');
  5677. $io->write($indentedChanges);
  5678. } else {
  5679. $io->write($path);
  5680. }
  5681. }
  5682. }
  5683. if ($unpushedChanges) {
  5684. $io->writeError('<warning>You have unpushed changes on the current branch in the following dependencies:</warning>');
  5685. foreach ($unpushedChanges as $path => $changes) {
  5686. if ($input->getOption('verbose')) {
  5687. $indentedChanges = implode("\n", array_map(function ($line) {
  5688. return ' ' . ltrim($line);
  5689. }, explode("\n", $changes)));
  5690. $io->write('<info>'.$path.'</info>:');
  5691. $io->write($indentedChanges);
  5692. } else {
  5693. $io->write($path);
  5694. }
  5695. }
  5696. }
  5697. if ($vcsVersionChanges) {
  5698. $io->writeError('<warning>You have version variations in the following dependencies:</warning>');
  5699. foreach ($vcsVersionChanges as $path => $changes) {
  5700. if ($input->getOption('verbose')) {
  5701. $currentVersion = $changes['current']['version'] ?: $changes['current']['ref'];
  5702. $previousVersion = $changes['previous']['version'] ?: $changes['previous']['ref'];
  5703. if ($io->isVeryVerbose()) {
  5704. $currentVersion .= sprintf(' (%s)', $changes['current']['ref']);
  5705. $previousVersion .= sprintf(' (%s)', $changes['previous']['ref']);
  5706. }
  5707. $io->write('<info>'.$path.'</info>:');
  5708. $io->write(sprintf(' From <comment>%s</comment> to <comment>%s</comment>', $previousVersion, $currentVersion));
  5709. } else {
  5710. $io->write($path);
  5711. }
  5712. }
  5713. }
  5714. if (($errors || $unpushedChanges || $vcsVersionChanges) && !$input->getOption('verbose')) {
  5715. $io->writeError('Use --verbose (-v) to see a list of files');
  5716. }
  5717. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_STATUS_CMD, true);
  5718. return ($errors ? self::EXIT_CODE_ERRORS : 0) + ($unpushedChanges ? self::EXIT_CODE_UNPUSHED_CHANGES : 0) + ($vcsVersionChanges ? self::EXIT_CODE_VERSION_CHANGES : 0);
  5719. }
  5720. }
  5721. <?php
  5722. namespace Composer\Command;
  5723. use Composer\Repository\PlatformRepository;
  5724. use Symfony\Component\Console\Input\InputArgument;
  5725. use Symfony\Component\Console\Input\InputInterface;
  5726. use Symfony\Component\Console\Input\InputOption;
  5727. use Symfony\Component\Console\Output\OutputInterface;
  5728. class SuggestsCommand extends BaseCommand
  5729. {
  5730. protected function configure()
  5731. {
  5732. $this
  5733. ->setName('suggests')
  5734. ->setDescription('Shows package suggestions.')
  5735. ->setDefinition(array(
  5736. new InputOption('by-package', null, InputOption::VALUE_NONE, 'Groups output by suggesting package'),
  5737. new InputOption('by-suggestion', null, InputOption::VALUE_NONE, 'Groups output by suggested package'),
  5738. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Exclude suggestions from require-dev packages'),
  5739. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that you want to list suggestions from.'),
  5740. ))
  5741. ->setHelp(<<<EOT
  5742. The <info>%command.name%</info> command shows a sorted list of suggested packages.
  5743. Enabling <info>-v</info> implies <info>--by-package --by-suggestion</info>, showing both lists.
  5744. EOT
  5745. )
  5746. ;
  5747. }
  5748. protected function execute(InputInterface $input, OutputInterface $output)
  5749. {
  5750. $lock = $this->getComposer()->getLocker()->getLockData();
  5751. if (empty($lock)) {
  5752. throw new \RuntimeException('Lockfile seems to be empty?');
  5753. }
  5754. $packages = $lock['packages'];
  5755. if (!$input->getOption('no-dev')) {
  5756. $packages += $lock['packages-dev'];
  5757. }
  5758. $filter = $input->getArgument('packages');
  5759. $installed = array();
  5760. foreach ($packages as $package) {
  5761. $installed[] = $package['name'];
  5762. if (!empty($package['provide'])) {
  5763. $installed = array_merge($installed, array_keys($package['provide']));
  5764. }
  5765. if (!empty($package['replace'])) {
  5766. $installed = array_merge($installed, array_keys($package['replace']));
  5767. }
  5768. }
  5769. $installed = array_flip($installed);
  5770. ksort($installed);
  5771. $platform = new PlatformRepository(array(), $this->getComposer()->getConfig()->get('platform') ?: array());
  5772. $suggesters = array();
  5773. $suggested = array();
  5774. foreach ($packages as $package) {
  5775. $packageName = $package['name'];
  5776. if ((!empty($filter) && !in_array($packageName, $filter)) || empty($package['suggest'])) {
  5777. continue;
  5778. }
  5779. foreach ($package['suggest'] as $suggestion => $reason) {
  5780. if (false === strpos('/', $suggestion) && null !== $platform->findPackage($suggestion, '*')) {
  5781. continue;
  5782. }
  5783. if (!isset($installed[$suggestion])) {
  5784. $suggesters[$packageName][$suggestion] = $reason;
  5785. $suggested[$suggestion][$packageName] = $reason;
  5786. }
  5787. }
  5788. }
  5789. ksort($suggesters);
  5790. ksort($suggested);
  5791. $mode = 0;
  5792. $io = $this->getIO();
  5793. if ($input->getOption('by-package') || $io->isVerbose()) {
  5794. $mode |= 1;
  5795. }
  5796. if ($input->getOption('by-suggestion')) {
  5797. $mode |= 2;
  5798. }
  5799. if ($mode === 0) {
  5800. foreach (array_keys($suggested) as $suggestion) {
  5801. $io->write(sprintf('<info>%s</info>', $suggestion));
  5802. }
  5803. return;
  5804. }
  5805. if ($mode & 1) {
  5806. foreach ($suggesters as $suggester => $suggestions) {
  5807. $io->write(sprintf('<comment>%s</comment> suggests:', $suggester));
  5808. foreach ($suggestions as $suggestion => $reason) {
  5809. $io->write(sprintf(' - <info>%s</info>: %s', $suggestion, $reason ?: '*'));
  5810. }
  5811. $io->write('');
  5812. }
  5813. }
  5814. if ($mode & 2) {
  5815. if ($mode & 1) {
  5816. $io->write(str_repeat('-', 78));
  5817. }
  5818. foreach ($suggested as $suggestion => $suggesters) {
  5819. $io->write(sprintf('<comment>%s</comment> is suggested by:', $suggestion));
  5820. foreach ($suggesters as $suggester => $reason) {
  5821. $io->write(sprintf(' - <info>%s</info>: %s', $suggester, $reason ?: '*'));
  5822. }
  5823. $io->write('');
  5824. }
  5825. }
  5826. }
  5827. }
  5828. <?php
  5829. namespace Composer\Command;
  5830. use Composer\Composer;
  5831. use Composer\Installer;
  5832. use Composer\IO\IOInterface;
  5833. use Composer\Plugin\CommandEvent;
  5834. use Composer\Plugin\PluginEvents;
  5835. use Symfony\Component\Console\Helper\Table;
  5836. use Symfony\Component\Console\Input\InputInterface;
  5837. use Symfony\Component\Console\Input\InputOption;
  5838. use Symfony\Component\Console\Input\InputArgument;
  5839. use Symfony\Component\Console\Output\OutputInterface;
  5840. use Symfony\Component\Console\Question\Question;
  5841. class UpdateCommand extends BaseCommand
  5842. {
  5843. protected function configure()
  5844. {
  5845. $this
  5846. ->setName('update')
  5847. ->setAliases(array('upgrade'))
  5848. ->setDescription('Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file.')
  5849. ->setDefinition(array(
  5850. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that should be updated, if not provided all packages are.'),
  5851. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  5852. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  5853. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  5854. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  5855. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  5856. new InputOption('lock', null, InputOption::VALUE_NONE, 'Only updates the lock file hash to suppress warning about the lock file being out of date.'),
  5857. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  5858. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  5859. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  5860. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  5861. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  5862. new InputOption('with-dependencies', null, InputOption::VALUE_NONE, 'Add also dependencies of whitelisted packages to the whitelist, except those defined in root package.'),
  5863. new InputOption('with-all-dependencies', null, InputOption::VALUE_NONE, 'Add also all dependencies of whitelisted packages to the whitelist, including those defined in root package.'),
  5864. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  5865. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump.'),
  5866. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  5867. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  5868. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  5869. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  5870. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  5871. new InputOption('interactive', 'i', InputOption::VALUE_NONE, 'Interactive interface with autocompletion to select the packages to update.'),
  5872. new InputOption('root-reqs', null, InputOption::VALUE_NONE, 'Restricts the update to your first degree dependencies.'),
  5873. ))
  5874. ->setHelp(<<<EOT
  5875. The <info>update</info> command reads the composer.json file from the
  5876. current directory, processes it, and updates, removes or installs all the
  5877. dependencies.
  5878. <info>php composer.phar update</info>
  5879. To limit the update operation to a few packages, you can list the package(s)
  5880. you want to update as such:
  5881. <info>php composer.phar update vendor/package1 foo/mypackage [...]</info>
  5882. You may also use an asterisk (*) pattern to limit the update operation to package(s)
  5883. from a specific vendor:
  5884. <info>php composer.phar update vendor/package1 foo/* [...]</info>
  5885. To select packages names interactively with auto-completion use <info>-i</info>.
  5886. EOT
  5887. )
  5888. ;
  5889. }
  5890. protected function execute(InputInterface $input, OutputInterface $output)
  5891. {
  5892. $io = $this->getIO();
  5893. if ($input->getOption('no-custom-installers')) {
  5894. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  5895. $input->setOption('no-plugins', true);
  5896. }
  5897. if ($input->getOption('dev')) {
  5898. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  5899. }
  5900. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  5901. $packages = $input->getArgument('packages');
  5902. if ($input->getOption('interactive')) {
  5903. $packages = $this->getPackagesInteractively($io, $input, $output, $composer, $packages);
  5904. }
  5905. if ($input->getOption('root-reqs')) {
  5906. $require = array_keys($composer->getPackage()->getRequires());
  5907. if (!$input->getOption('no-dev')) {
  5908. $requireDev = array_keys($composer->getPackage()->getDevRequires());
  5909. $require = array_merge($require, $requireDev);
  5910. }
  5911. if (!empty($packages)) {
  5912. $packages = array_intersect($packages, $require);
  5913. } else {
  5914. $packages = $require;
  5915. }
  5916. }
  5917. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  5918. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'update', $input, $output);
  5919. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5920. $install = Installer::create($io, $composer);
  5921. $config = $composer->getConfig();
  5922. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  5923. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  5924. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  5925. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  5926. $install
  5927. ->setDryRun($input->getOption('dry-run'))
  5928. ->setVerbose($input->getOption('verbose'))
  5929. ->setPreferSource($preferSource)
  5930. ->setPreferDist($preferDist)
  5931. ->setDevMode(!$input->getOption('no-dev'))
  5932. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  5933. ->setRunScripts(!$input->getOption('no-scripts'))
  5934. ->setSkipSuggest($input->getOption('no-suggest'))
  5935. ->setOptimizeAutoloader($optimize)
  5936. ->setClassMapAuthoritative($authoritative)
  5937. ->setApcuAutoloader($apcu)
  5938. ->setUpdate(true)
  5939. ->setUpdateWhitelist($input->getOption('lock') ? array('lock') : $packages)
  5940. ->setWhitelistTransitiveDependencies($input->getOption('with-dependencies'))
  5941. ->setWhitelistAllDependencies($input->getOption('with-all-dependencies'))
  5942. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  5943. ->setPreferStable($input->getOption('prefer-stable'))
  5944. ->setPreferLowest($input->getOption('prefer-lowest'))
  5945. ;
  5946. if ($input->getOption('no-plugins')) {
  5947. $install->disablePlugins();
  5948. }
  5949. return $install->run();
  5950. }
  5951. private function getPackagesInteractively(IOInterface $io, InputInterface $input, OutputInterface $output, Composer $composer, array $packages)
  5952. {
  5953. if (!$input->isInteractive()) {
  5954. throw new \InvalidArgumentException('--interactive cannot be used in non-interactive terminals.');
  5955. }
  5956. $requires = array_merge(
  5957. $composer->getPackage()->getRequires(),
  5958. $composer->getPackage()->getDevRequires()
  5959. );
  5960. $autocompleterValues = array();
  5961. foreach ($requires as $require) {
  5962. $target = $require->getTarget();
  5963. $autocompleterValues[strtolower($target)] = $target;
  5964. }
  5965. $installedPackages = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  5966. foreach ($installedPackages as $package) {
  5967. $autocompleterValues[$package->getName()] = $package->getPrettyName();
  5968. }
  5969. $helper = $this->getHelper('question');
  5970. $question = new Question('<comment>Enter package name: </comment>', null);
  5971. $io->writeError('<info>Press enter without value to end submission</info>');
  5972. do {
  5973. $autocompleterValues = array_diff($autocompleterValues, $packages);
  5974. $question->setAutocompleterValues($autocompleterValues);
  5975. $addedPackage = $helper->ask($input, $output, $question);
  5976. if (!is_string($addedPackage) || empty($addedPackage)) {
  5977. break;
  5978. }
  5979. $addedPackage = strtolower($addedPackage);
  5980. if (!in_array($addedPackage, $packages)) {
  5981. $packages[] = $addedPackage;
  5982. }
  5983. } while (true);
  5984. $packages = array_filter($packages);
  5985. if (!$packages) {
  5986. throw new \InvalidArgumentException('You must enter minimum one package.');
  5987. }
  5988. $table = new Table($output);
  5989. $table->setHeaders(array('Selected packages'));
  5990. foreach ($packages as $package) {
  5991. $table->addRow(array($package));
  5992. }
  5993. $table->render();
  5994. if ($io->askConfirmation(sprintf(
  5995. 'Would you like to continue and update the above package%s [<comment>yes</comment>]? ',
  5996. 1 === count($packages) ? '' : 's'
  5997. ), true)) {
  5998. return $packages;
  5999. }
  6000. throw new \RuntimeException('Installation aborted.');
  6001. }
  6002. }
  6003. <?php
  6004. namespace Composer\Command;
  6005. use Composer\Factory;
  6006. use Composer\Package\Loader\ValidatingArrayLoader;
  6007. use Composer\Plugin\CommandEvent;
  6008. use Composer\Plugin\PluginEvents;
  6009. use Composer\Util\ConfigValidator;
  6010. use Symfony\Component\Console\Input\InputArgument;
  6011. use Symfony\Component\Console\Input\InputInterface;
  6012. use Symfony\Component\Console\Input\InputOption;
  6013. use Symfony\Component\Console\Output\OutputInterface;
  6014. class ValidateCommand extends BaseCommand
  6015. {
  6016. protected function configure()
  6017. {
  6018. $this
  6019. ->setName('validate')
  6020. ->setDescription('Validates a composer.json and composer.lock.')
  6021. ->setDefinition(array(
  6022. new InputOption('no-check-all', null, InputOption::VALUE_NONE, 'Do not make a complete validation'),
  6023. new InputOption('no-check-lock', null, InputOption::VALUE_NONE, 'Do not check if lock file is up to date'),
  6024. new InputOption('no-check-publish', null, InputOption::VALUE_NONE, 'Do not check for publish errors'),
  6025. new InputOption('with-dependencies', 'A', InputOption::VALUE_NONE, 'Also validate the composer.json of all installed dependencies'),
  6026. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code for warnings as well as errors'),
  6027. new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file'),
  6028. ))
  6029. ->setHelp(<<<EOT
  6030. The validate command validates a given composer.json and composer.lock
  6031. Exit codes in case of errors are:
  6032. 1 validation warning(s), only when --strict is given
  6033. 2 validation error(s)
  6034. 3 file unreadable or missing
  6035. EOT
  6036. );
  6037. }
  6038. protected function execute(InputInterface $input, OutputInterface $output)
  6039. {
  6040. $file = $input->getArgument('file') ?: Factory::getComposerFile();
  6041. $io = $this->getIO();
  6042. if (!file_exists($file)) {
  6043. $io->writeError('<error>' . $file . ' not found.</error>');
  6044. return 3;
  6045. }
  6046. if (!is_readable($file)) {
  6047. $io->writeError('<error>' . $file . ' is not readable.</error>');
  6048. return 3;
  6049. }
  6050. $validator = new ConfigValidator($io);
  6051. $checkAll = $input->getOption('no-check-all') ? 0 : ValidatingArrayLoader::CHECK_ALL;
  6052. $checkPublish = !$input->getOption('no-check-publish');
  6053. $checkLock = !$input->getOption('no-check-lock');
  6054. $isStrict = $input->getOption('strict');
  6055. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  6056. $lockErrors = array();
  6057. $composer = Factory::create($io, $file);
  6058. $locker = $composer->getLocker();
  6059. if ($locker->isLocked() && !$locker->isFresh()) {
  6060. $lockErrors[] = 'The lock file is not up to date with the latest changes in composer.json, it is recommended that you run `composer update`.';
  6061. }
  6062. $this->outputResult($io, $file, $errors, $warnings, $checkPublish, $publishErrors, $checkLock, $lockErrors, true);
  6063. $exitCode = $errors || ($publishErrors && $checkPublish) || ($lockErrors && $checkLock) ? 2 : ($isStrict && $warnings ? 1 : 0);
  6064. if ($input->getOption('with-dependencies')) {
  6065. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  6066. foreach ($localRepo->getPackages() as $package) {
  6067. $path = $composer->getInstallationManager()->getInstallPath($package);
  6068. $file = $path . '/composer.json';
  6069. if (is_dir($path) && file_exists($file)) {
  6070. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  6071. $this->outputResult($io, $package->getPrettyName(), $errors, $warnings, $checkPublish, $publishErrors);
  6072. $depCode = $errors || ($publishErrors && $checkPublish) ? 2 : ($isStrict && $warnings ? 1 : 0);
  6073. $exitCode = max($depCode, $exitCode);
  6074. }
  6075. }
  6076. }
  6077. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'validate', $input, $output);
  6078. $eventCode = $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6079. $exitCode = max($eventCode, $exitCode);
  6080. return $exitCode;
  6081. }
  6082. private function outputResult($io, $name, &$errors, &$warnings, $checkPublish = false, $publishErrors = array(), $checkLock = false, $lockErrors = array(), $printSchemaUrl = false)
  6083. {
  6084. if (!$errors && !$publishErrors && !$warnings) {
  6085. $io->write('<info>' . $name . ' is valid</info>');
  6086. } elseif (!$errors && !$publishErrors) {
  6087. $io->writeError('<info>' . $name . ' is valid, but with a few warnings</info>');
  6088. if ($printSchemaUrl) {
  6089. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  6090. }
  6091. } elseif (!$errors) {
  6092. $io->writeError('<info>' . $name . ' is valid for simple usage with composer but has</info>');
  6093. $io->writeError('<info>strict errors that make it unable to be published as a package:</info>');
  6094. if ($printSchemaUrl) {
  6095. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  6096. }
  6097. } else {
  6098. $io->writeError('<error>' . $name . ' is invalid, the following errors/warnings were found:</error>');
  6099. }
  6100. if ($checkPublish) {
  6101. $errors = array_merge($errors, $publishErrors);
  6102. } else {
  6103. $warnings = array_merge($warnings, $publishErrors);
  6104. }
  6105. if ($checkLock) {
  6106. $errors = array_merge($errors, $lockErrors);
  6107. } else {
  6108. $warnings = array_merge($warnings, $lockErrors);
  6109. }
  6110. $messages = array(
  6111. 'error' => $errors,
  6112. 'warning' => $warnings,
  6113. );
  6114. foreach ($messages as $style => $msgs) {
  6115. foreach ($msgs as $msg) {
  6116. $io->writeError('<' . $style . '>' . $msg . '</' . $style . '>');
  6117. }
  6118. }
  6119. }
  6120. }
  6121. <?php
  6122. namespace Composer;
  6123. use Composer\Package\RootPackageInterface;
  6124. use Composer\Package\Locker;
  6125. use Composer\Repository\RepositoryManager;
  6126. use Composer\Installer\InstallationManager;
  6127. use Composer\Plugin\PluginManager;
  6128. use Composer\Downloader\DownloadManager;
  6129. use Composer\EventDispatcher\EventDispatcher;
  6130. use Composer\Autoload\AutoloadGenerator;
  6131. use Composer\Package\Archiver\ArchiveManager;
  6132. class Composer
  6133. {
  6134. const VERSION = '1.6.5';
  6135. const BRANCH_ALIAS_VERSION = '';
  6136. const RELEASE_DATE = '2018-05-04 11:44:59';
  6137. private $package;
  6138. private $locker;
  6139. private $repositoryManager;
  6140. private $downloadManager;
  6141. private $installationManager;
  6142. private $pluginManager;
  6143. private $config;
  6144. private $eventDispatcher;
  6145. private $autoloadGenerator;
  6146. private $archiveManager;
  6147. public function setPackage(RootPackageInterface $package)
  6148. {
  6149. $this->package = $package;
  6150. }
  6151. public function getPackage()
  6152. {
  6153. return $this->package;
  6154. }
  6155. public function setConfig(Config $config)
  6156. {
  6157. $this->config = $config;
  6158. }
  6159. public function getConfig()
  6160. {
  6161. return $this->config;
  6162. }
  6163. public function setLocker(Locker $locker)
  6164. {
  6165. $this->locker = $locker;
  6166. }
  6167. public function getLocker()
  6168. {
  6169. return $this->locker;
  6170. }
  6171. public function setRepositoryManager(RepositoryManager $manager)
  6172. {
  6173. $this->repositoryManager = $manager;
  6174. }
  6175. public function getRepositoryManager()
  6176. {
  6177. return $this->repositoryManager;
  6178. }
  6179. public function setDownloadManager(DownloadManager $manager)
  6180. {
  6181. $this->downloadManager = $manager;
  6182. }
  6183. public function getDownloadManager()
  6184. {
  6185. return $this->downloadManager;
  6186. }
  6187. public function setArchiveManager(ArchiveManager $manager)
  6188. {
  6189. $this->archiveManager = $manager;
  6190. }
  6191. public function getArchiveManager()
  6192. {
  6193. return $this->archiveManager;
  6194. }
  6195. public function setInstallationManager(InstallationManager $manager)
  6196. {
  6197. $this->installationManager = $manager;
  6198. }
  6199. public function getInstallationManager()
  6200. {
  6201. return $this->installationManager;
  6202. }
  6203. public function setPluginManager(PluginManager $manager)
  6204. {
  6205. $this->pluginManager = $manager;
  6206. }
  6207. public function getPluginManager()
  6208. {
  6209. return $this->pluginManager;
  6210. }
  6211. public function setEventDispatcher(EventDispatcher $eventDispatcher)
  6212. {
  6213. $this->eventDispatcher = $eventDispatcher;
  6214. }
  6215. public function getEventDispatcher()
  6216. {
  6217. return $this->eventDispatcher;
  6218. }
  6219. public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator)
  6220. {
  6221. $this->autoloadGenerator = $autoloadGenerator;
  6222. }
  6223. public function getAutoloadGenerator()
  6224. {
  6225. return $this->autoloadGenerator;
  6226. }
  6227. }
  6228. <?php
  6229. namespace Composer;
  6230. use Composer\Config\ConfigSourceInterface;
  6231. use Composer\Downloader\TransportException;
  6232. use Composer\IO\IOInterface;
  6233. use Composer\Util\Platform;
  6234. class Config
  6235. {
  6236. const RELATIVE_PATHS = 1;
  6237. public static $defaultConfig = array(
  6238. 'process-timeout' => 300,
  6239. 'use-include-path' => false,
  6240. 'preferred-install' => 'auto',
  6241. 'notify-on-install' => true,
  6242. 'github-protocols' => array('https', 'ssh', 'git'),
  6243. 'vendor-dir' => 'vendor',
  6244. 'bin-dir' => '{$vendor-dir}/bin',
  6245. 'cache-dir' => '{$home}/cache',
  6246. 'data-dir' => '{$home}',
  6247. 'cache-files-dir' => '{$cache-dir}/files',
  6248. 'cache-repo-dir' => '{$cache-dir}/repo',
  6249. 'cache-vcs-dir' => '{$cache-dir}/vcs',
  6250. 'cache-ttl' => 15552000,
  6251. 'cache-files-ttl' => null,
  6252. 'cache-files-maxsize' => '300MiB',
  6253. 'bin-compat' => 'auto',
  6254. 'discard-changes' => false,
  6255. 'autoloader-suffix' => null,
  6256. 'sort-packages' => false,
  6257. 'optimize-autoloader' => false,
  6258. 'classmap-authoritative' => false,
  6259. 'apcu-autoloader' => false,
  6260. 'prepend-autoloader' => true,
  6261. 'github-domains' => array('github.com'),
  6262. 'bitbucket-expose-hostname' => true,
  6263. 'disable-tls' => false,
  6264. 'secure-http' => true,
  6265. 'cafile' => null,
  6266. 'capath' => null,
  6267. 'github-expose-hostname' => true,
  6268. 'gitlab-domains' => array('gitlab.com'),
  6269. 'store-auths' => 'prompt',
  6270. 'platform' => array(),
  6271. 'archive-format' => 'tar',
  6272. 'archive-dir' => '.',
  6273. 'htaccess-protect' => true,
  6274. );
  6275. public static $defaultRepositories = array(
  6276. 'packagist.org' => array(
  6277. 'type' => 'composer',
  6278. 'url' => 'https?://packagist.org',
  6279. 'allow_ssl_downgrade' => true,
  6280. ),
  6281. );
  6282. private $config;
  6283. private $baseDir;
  6284. private $repositories;
  6285. private $configSource;
  6286. private $authConfigSource;
  6287. private $useEnvironment;
  6288. private $warnedHosts = array();
  6289. public function __construct($useEnvironment = true, $baseDir = null)
  6290. {
  6291. $this->config = static::$defaultConfig;
  6292. $this->repositories = static::$defaultRepositories;
  6293. $this->useEnvironment = (bool) $useEnvironment;
  6294. $this->baseDir = $baseDir;
  6295. }
  6296. public function setConfigSource(ConfigSourceInterface $source)
  6297. {
  6298. $this->configSource = $source;
  6299. }
  6300. public function getConfigSource()
  6301. {
  6302. return $this->configSource;
  6303. }
  6304. public function setAuthConfigSource(ConfigSourceInterface $source)
  6305. {
  6306. $this->authConfigSource = $source;
  6307. }
  6308. public function getAuthConfigSource()
  6309. {
  6310. return $this->authConfigSource;
  6311. }
  6312. public function merge($config)
  6313. {
  6314. if (!empty($config['config']) && is_array($config['config'])) {
  6315. foreach ($config['config'] as $key => $val) {
  6316. if (in_array($key, array('bitbucket-oauth', 'github-oauth', 'gitlab-oauth', 'gitlab-token', 'http-basic')) && isset($this->config[$key])) {
  6317. $this->config[$key] = array_merge($this->config[$key], $val);
  6318. } elseif ('preferred-install' === $key && isset($this->config[$key])) {
  6319. if (is_array($val) || is_array($this->config[$key])) {
  6320. if (is_string($val)) {
  6321. $val = array('*' => $val);
  6322. }
  6323. if (is_string($this->config[$key])) {
  6324. $this->config[$key] = array('*' => $this->config[$key]);
  6325. }
  6326. $this->config[$key] = array_merge($this->config[$key], $val);
  6327. if (isset($this->config[$key]['*'])) {
  6328. $wildcard = $this->config[$key]['*'];
  6329. unset($this->config[$key]['*']);
  6330. $this->config[$key]['*'] = $wildcard;
  6331. }
  6332. } else {
  6333. $this->config[$key] = $val;
  6334. }
  6335. } else {
  6336. $this->config[$key] = $val;
  6337. }
  6338. }
  6339. }
  6340. if (!empty($config['repositories']) && is_array($config['repositories'])) {
  6341. $this->repositories = array_reverse($this->repositories, true);
  6342. $newRepos = array_reverse($config['repositories'], true);
  6343. foreach ($newRepos as $name => $repository) {
  6344. if (false === $repository) {
  6345. $this->disableRepoByName($name);
  6346. continue;
  6347. }
  6348. if (is_array($repository) && 1 === count($repository) && false === current($repository)) {
  6349. $this->disableRepoByName(key($repository));
  6350. continue;
  6351. }
  6352. if (is_int($name)) {
  6353. $this->repositories[] = $repository;
  6354. } else {
  6355. if ($name === 'packagist') {
  6356. $this->repositories[$name . '.org'] = $repository;
  6357. } else {
  6358. $this->repositories[$name] = $repository;
  6359. }
  6360. }
  6361. }
  6362. $this->repositories = array_reverse($this->repositories, true);
  6363. }
  6364. }
  6365. public function getRepositories()
  6366. {
  6367. return $this->repositories;
  6368. }
  6369. public function get($key, $flags = 0)
  6370. {
  6371. switch ($key) {
  6372. case 'vendor-dir':
  6373. case 'bin-dir':
  6374. case 'process-timeout':
  6375. case 'data-dir':
  6376. case 'cache-dir':
  6377. case 'cache-files-dir':
  6378. case 'cache-repo-dir':
  6379. case 'cache-vcs-dir':
  6380. case 'cafile':
  6381. case 'capath':
  6382. case 'htaccess-protect':
  6383. $env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
  6384. $val = $this->getComposerEnv($env);
  6385. $val = rtrim((string) $this->process(false !== $val ? $val : $this->config[$key], $flags), '/\\');
  6386. $val = Platform::expandPath($val);
  6387. if (substr($key, -4) !== '-dir') {
  6388. return $val;
  6389. }
  6390. return (($flags & self::RELATIVE_PATHS) == self::RELATIVE_PATHS) ? $val : $this->realpath($val);
  6391. case 'cache-ttl':
  6392. return (int) $this->config[$key];
  6393. case 'cache-files-maxsize':
  6394. if (!preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $this->config[$key], $matches)) {
  6395. throw new \RuntimeException(
  6396. "Could not parse the value of 'cache-files-maxsize': {$this->config[$key]}"
  6397. );
  6398. }
  6399. $size = $matches[1];
  6400. if (isset($matches[2])) {
  6401. switch (strtolower($matches[2])) {
  6402. case 'g':
  6403. $size *= 1024;
  6404. case 'm':
  6405. $size *= 1024;
  6406. case 'k':
  6407. $size *= 1024;
  6408. break;
  6409. }
  6410. }
  6411. return $size;
  6412. case 'cache-files-ttl':
  6413. if (isset($this->config[$key])) {
  6414. return (int) $this->config[$key];
  6415. }
  6416. return (int) $this->config['cache-ttl'];
  6417. case 'home':
  6418. $val = preg_replace('#^(\$HOME|~)(/|$)#', rtrim(getenv('HOME') ?: getenv('USERPROFILE'), '/\\') . '/', $this->config[$key]);
  6419. return rtrim($this->process($val, $flags), '/\\');
  6420. case 'bin-compat':
  6421. $value = $this->getComposerEnv('COMPOSER_BIN_COMPAT') ?: $this->config[$key];
  6422. if (!in_array($value, array('auto', 'full'))) {
  6423. throw new \RuntimeException(
  6424. "Invalid value for 'bin-compat': {$value}. Expected auto, full"
  6425. );
  6426. }
  6427. return $value;
  6428. case 'discard-changes':
  6429. if ($env = $this->getComposerEnv('COMPOSER_DISCARD_CHANGES')) {
  6430. if (!in_array($env, array('stash', 'true', 'false', '1', '0'), true)) {
  6431. throw new \RuntimeException(
  6432. "Invalid value for COMPOSER_DISCARD_CHANGES: {$env}. Expected 1, 0, true, false or stash"
  6433. );
  6434. }
  6435. if ('stash' === $env) {
  6436. return 'stash';
  6437. }
  6438. return $env !== 'false' && (bool) $env;
  6439. }
  6440. if (!in_array($this->config[$key], array(true, false, 'stash'), true)) {
  6441. throw new \RuntimeException(
  6442. "Invalid value for 'discard-changes': {$this->config[$key]}. Expected true, false or stash"
  6443. );
  6444. }
  6445. return $this->config[$key];
  6446. case 'github-protocols':
  6447. $protos = $this->config['github-protocols'];
  6448. if ($this->config['secure-http'] && false !== ($index = array_search('git', $protos))) {
  6449. unset($protos[$index]);
  6450. }
  6451. if (reset($protos) === 'http') {
  6452. throw new \RuntimeException('The http protocol for github is not available anymore, update your config\'s github-protocols to use "https", "git" or "ssh"');
  6453. }
  6454. return $protos;
  6455. case 'disable-tls':
  6456. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  6457. case 'secure-http':
  6458. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  6459. default:
  6460. if (!isset($this->config[$key])) {
  6461. return null;
  6462. }
  6463. return $this->process($this->config[$key], $flags);
  6464. }
  6465. }
  6466. public function all($flags = 0)
  6467. {
  6468. $all = array(
  6469. 'repositories' => $this->getRepositories(),
  6470. );
  6471. foreach (array_keys($this->config) as $key) {
  6472. $all['config'][$key] = $this->get($key, $flags);
  6473. }
  6474. return $all;
  6475. }
  6476. public function raw()
  6477. {
  6478. return array(
  6479. 'repositories' => $this->getRepositories(),
  6480. 'config' => $this->config,
  6481. );
  6482. }
  6483. public function has($key)
  6484. {
  6485. return array_key_exists($key, $this->config);
  6486. }
  6487. private function process($value, $flags)
  6488. {
  6489. $config = $this;
  6490. if (!is_string($value)) {
  6491. return $value;
  6492. }
  6493. return preg_replace_callback('#\{\$(.+)\}#', function ($match) use ($config, $flags) {
  6494. return $config->get($match[1], $flags);
  6495. }, $value);
  6496. }
  6497. private function realpath($path)
  6498. {
  6499. if (preg_match('{^(?:/|[a-z]:|[a-z0-9.]+://)}i', $path)) {
  6500. return $path;
  6501. }
  6502. return $this->baseDir . '/' . $path;
  6503. }
  6504. private function getComposerEnv($var)
  6505. {
  6506. if ($this->useEnvironment) {
  6507. return getenv($var);
  6508. }
  6509. return false;
  6510. }
  6511. private function disableRepoByName($name)
  6512. {
  6513. if (isset($this->repositories[$name])) {
  6514. unset($this->repositories[$name]);
  6515. } elseif ($name === 'packagist') {
  6516. unset($this->repositories['packagist.org']);
  6517. }
  6518. }
  6519. public function prohibitUrlByConfig($url, IOInterface $io = null)
  6520. {
  6521. if (false === filter_var($url, FILTER_VALIDATE_URL)) {
  6522. return;
  6523. }
  6524. $scheme = parse_url($url, PHP_URL_SCHEME);
  6525. if (in_array($scheme, array('http', 'git', 'ftp', 'svn'))) {
  6526. if ($this->get('secure-http')) {
  6527. throw new TransportException("Your configuration does not allow connections to $url. See https://getcomposer.org/doc/06-config.md#secure-http for details.");
  6528. } elseif ($io) {
  6529. $host = parse_url($url, PHP_URL_HOST);
  6530. if (!isset($this->warnedHosts[$host])) {
  6531. $io->writeError("<warning>Warning: Accessing $host over $scheme which is an insecure protocol.</warning>");
  6532. }
  6533. $this->warnedHosts[$host] = true;
  6534. }
  6535. }
  6536. }
  6537. }
  6538. <?php
  6539. namespace Composer\Config;
  6540. interface ConfigSourceInterface
  6541. {
  6542. public function addRepository($name, $config);
  6543. public function removeRepository($name);
  6544. public function addConfigSetting($name, $value);
  6545. public function removeConfigSetting($name);
  6546. public function addProperty($name, $value);
  6547. public function removeProperty($name);
  6548. public function addLink($type, $name, $value);
  6549. public function removeLink($type, $name);
  6550. public function getName();
  6551. }
  6552. <?php
  6553. namespace Composer\Config;
  6554. use Composer\Json\JsonFile;
  6555. use Composer\Json\JsonManipulator;
  6556. use Composer\Util\Silencer;
  6557. class JsonConfigSource implements ConfigSourceInterface
  6558. {
  6559. private $file;
  6560. private $authConfig;
  6561. public function __construct(JsonFile $file, $authConfig = false)
  6562. {
  6563. $this->file = $file;
  6564. $this->authConfig = $authConfig;
  6565. }
  6566. public function getName()
  6567. {
  6568. return $this->file->getPath();
  6569. }
  6570. public function addRepository($name, $config)
  6571. {
  6572. $this->manipulateJson('addRepository', $name, $config, function (&$config, $repo, $repoConfig) {
  6573. if (isset($config['repositories'])) {
  6574. foreach ($config['repositories'] as $index => $val) {
  6575. if ($index === $repo) {
  6576. continue;
  6577. }
  6578. if (is_numeric($index) && ($val === array('packagist' => false) || $val === array('packagist.org' => false))) {
  6579. unset($config['repositories'][$index]);
  6580. $config['repositories']['packagist.org'] = false;
  6581. break;
  6582. }
  6583. }
  6584. }
  6585. $config['repositories'][$repo] = $repoConfig;
  6586. });
  6587. }
  6588. public function removeRepository($name)
  6589. {
  6590. $this->manipulateJson('removeRepository', $name, function (&$config, $repo) {
  6591. unset($config['repositories'][$repo]);
  6592. });
  6593. }
  6594. public function addConfigSetting($name, $value)
  6595. {
  6596. $authConfig = $this->authConfig;
  6597. $this->manipulateJson('addConfigSetting', $name, $value, function (&$config, $key, $val) use ($authConfig) {
  6598. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|platform)\.}', $key)) {
  6599. list($key, $host) = explode('.', $key, 2);
  6600. if ($authConfig) {
  6601. $config[$key][$host] = $val;
  6602. } else {
  6603. $config['config'][$key][$host] = $val;
  6604. }
  6605. } else {
  6606. $config['config'][$key] = $val;
  6607. }
  6608. });
  6609. }
  6610. public function removeConfigSetting($name)
  6611. {
  6612. $authConfig = $this->authConfig;
  6613. $this->manipulateJson('removeConfigSetting', $name, function (&$config, $key) use ($authConfig) {
  6614. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|platform)\.}', $key)) {
  6615. list($key, $host) = explode('.', $key, 2);
  6616. if ($authConfig) {
  6617. unset($config[$key][$host]);
  6618. } else {
  6619. unset($config['config'][$key][$host]);
  6620. }
  6621. } else {
  6622. unset($config['config'][$key]);
  6623. }
  6624. });
  6625. }
  6626. public function addProperty($name, $value)
  6627. {
  6628. $this->manipulateJson('addProperty', $name, $value, function (&$config, $key, $val) {
  6629. if (substr($key, 0, 6) === 'extra.') {
  6630. $bits = explode('.', $key);
  6631. $last = array_pop($bits);
  6632. $arr = &$config['extra'];
  6633. foreach ($bits as $bit) {
  6634. if (!isset($arr[$bit])) {
  6635. $arr[$bit] = array();
  6636. }
  6637. $arr = &$arr[$bit];
  6638. }
  6639. $arr[$last] = $val;
  6640. } else {
  6641. $config[$key] = $val;
  6642. }
  6643. });
  6644. }
  6645. public function removeProperty($name)
  6646. {
  6647. $authConfig = $this->authConfig;
  6648. $this->manipulateJson('removeProperty', $name, function (&$config, $key) {
  6649. if (substr($key, 0, 6) === 'extra.') {
  6650. $bits = explode('.', $key);
  6651. $last = array_pop($bits);
  6652. $arr = &$config['extra'];
  6653. foreach ($bits as $bit) {
  6654. if (!isset($arr[$bit])) {
  6655. return;
  6656. }
  6657. $arr = &$arr[$bit];
  6658. }
  6659. unset($arr[$last]);
  6660. } else {
  6661. unset($config[$key]);
  6662. }
  6663. });
  6664. }
  6665. public function addLink($type, $name, $value)
  6666. {
  6667. $this->manipulateJson('addLink', $type, $name, $value, function (&$config, $type, $name, $value) {
  6668. $config[$type][$name] = $value;
  6669. });
  6670. }
  6671. public function removeLink($type, $name)
  6672. {
  6673. $this->manipulateJson('removeSubNode', $type, $name, function (&$config, $type, $name) {
  6674. unset($config[$type][$name]);
  6675. });
  6676. }
  6677. protected function manipulateJson($method, $args, $fallback)
  6678. {
  6679. $args = func_get_args();
  6680. array_shift($args);
  6681. $fallback = array_pop($args);
  6682. if ($this->file->exists()) {
  6683. if (!is_writable($this->file->getPath())) {
  6684. throw new \RuntimeException(sprintf('The file "%s" is not writable.', $this->file->getPath()));
  6685. }
  6686. if (!is_readable($this->file->getPath())) {
  6687. throw new \RuntimeException(sprintf('The file "%s" is not readable.', $this->file->getPath()));
  6688. }
  6689. $contents = file_get_contents($this->file->getPath());
  6690. } elseif ($this->authConfig) {
  6691. $contents = "{\n}\n";
  6692. } else {
  6693. $contents = "{\n \"config\": {\n }\n}\n";
  6694. }
  6695. $manipulator = new JsonManipulator($contents);
  6696. $newFile = !$this->file->exists();
  6697. if ($this->authConfig && $method === 'addConfigSetting') {
  6698. $method = 'addSubNode';
  6699. list($mainNode, $name) = explode('.', $args[0], 2);
  6700. $args = array($mainNode, $name, $args[1]);
  6701. } elseif ($this->authConfig && $method === 'removeConfigSetting') {
  6702. $method = 'removeSubNode';
  6703. list($mainNode, $name) = explode('.', $args[0], 2);
  6704. $args = array($mainNode, $name);
  6705. }
  6706. if (call_user_func_array(array($manipulator, $method), $args)) {
  6707. file_put_contents($this->file->getPath(), $manipulator->getContents());
  6708. } else {
  6709. $config = $this->file->read();
  6710. $this->arrayUnshiftRef($args, $config);
  6711. call_user_func_array($fallback, $args);
  6712. $this->file->write($config);
  6713. }
  6714. if ($newFile) {
  6715. Silencer::call('chmod', $this->file->getPath(), 0600);
  6716. }
  6717. }
  6718. private function arrayUnshiftRef(&$array, &$value)
  6719. {
  6720. $return = array_unshift($array, '');
  6721. $array[0] = &$value;
  6722. return $return;
  6723. }
  6724. }
  6725. <?php
  6726. namespace Composer\Console;
  6727. use Composer\Util\Platform;
  6728. use Composer\Util\Silencer;
  6729. use Symfony\Component\Console\Application as BaseApplication;
  6730. use Symfony\Component\Console\Input\InputInterface;
  6731. use Symfony\Component\Console\Input\InputOption;
  6732. use Symfony\Component\Console\Output\OutputInterface;
  6733. use Composer\Command;
  6734. use Composer\Composer;
  6735. use Composer\Factory;
  6736. use Composer\IO\IOInterface;
  6737. use Composer\IO\ConsoleIO;
  6738. use Composer\Json\JsonValidationException;
  6739. use Composer\Util\ErrorHandler;
  6740. use Composer\EventDispatcher\ScriptExecutionException;
  6741. use Composer\Exception\NoSslException;
  6742. class Application extends BaseApplication
  6743. {
  6744. protected $composer;
  6745. protected $io;
  6746. private static $logo = ' ______
  6747. / ____/___ ____ ___ ____ ____ ________ _____
  6748. / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
  6749. / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
  6750. \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
  6751. /_/
  6752. ';
  6753. private $hasPluginCommands = false;
  6754. private $disablePluginsByDefault = false;
  6755. public function __construct()
  6756. {
  6757. static $shutdownRegistered = false;
  6758. if (function_exists('ini_set') && extension_loaded('xdebug')) {
  6759. ini_set('xdebug.show_exception_trace', false);
  6760. ini_set('xdebug.scream', false);
  6761. }
  6762. if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
  6763. date_default_timezone_set(Silencer::call('date_default_timezone_get'));
  6764. }
  6765. if (!$shutdownRegistered) {
  6766. $shutdownRegistered = true;
  6767. register_shutdown_function(function () {
  6768. $lastError = error_get_last();
  6769. if ($lastError && $lastError['message'] &&
  6770. (strpos($lastError['message'], 'Allowed memory') !== false ||
  6771. strpos($lastError['message'], 'exceeded memory') !== false )) {
  6772. echo "\n". 'Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.';
  6773. }
  6774. });
  6775. }
  6776. parent::__construct('Composer', Composer::VERSION);
  6777. }
  6778. public function run(InputInterface $input = null, OutputInterface $output = null)
  6779. {
  6780. if (null === $output) {
  6781. $output = Factory::createOutput();
  6782. }
  6783. return parent::run($input, $output);
  6784. }
  6785. public function doRun(InputInterface $input, OutputInterface $output)
  6786. {
  6787. $this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins');
  6788. $io = $this->io = new ConsoleIO($input, $output, $this->getHelperSet());
  6789. ErrorHandler::register($io);
  6790. if ($newWorkDir = $this->getNewWorkingDir($input)) {
  6791. $oldWorkingDir = getcwd();
  6792. chdir($newWorkDir);
  6793. $io->writeError('Changed CWD to ' . getcwd(), true, IOInterface::DEBUG);
  6794. }
  6795. $commandName = '';
  6796. if ($name = $this->getCommandName($input)) {
  6797. try {
  6798. $commandName = $this->find($name)->getName();
  6799. } catch (\InvalidArgumentException $e) {
  6800. }
  6801. }
  6802. if ($io->isInteractive() && !$newWorkDir && !in_array($commandName, array('', 'list', 'init', 'about', 'help', 'diagnose', 'self-update', 'global', 'create-project'), true) && !file_exists(Factory::getComposerFile())) {
  6803. $dir = dirname(getcwd());
  6804. $home = realpath(getenv('HOME') ?: getenv('USERPROFILE') ?: '/');
  6805. while (dirname($dir) !== $dir && $dir !== $home) {
  6806. if (file_exists($dir.'/'.Factory::getComposerFile())) {
  6807. if ($io->askConfirmation('<info>No composer.json in current directory, do you want to use the one at '.$dir.'?</info> [<comment>Y,n</comment>]? ', true)) {
  6808. $oldWorkingDir = getcwd();
  6809. chdir($dir);
  6810. }
  6811. break;
  6812. }
  6813. $dir = dirname($dir);
  6814. }
  6815. }
  6816. if (!$this->disablePluginsByDefault && !$this->hasPluginCommands && 'global' !== $commandName) {
  6817. try {
  6818. foreach ($this->getPluginCommands() as $command) {
  6819. if ($this->has($command->getName())) {
  6820. $io->writeError('<warning>Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped</warning>');
  6821. } else {
  6822. $this->add($command);
  6823. }
  6824. }
  6825. } catch (NoSslException $e) {
  6826. }
  6827. $this->hasPluginCommands = true;
  6828. }
  6829. $isProxyCommand = false;
  6830. if ($name = $this->getCommandName($input)) {
  6831. try {
  6832. $command = $this->find($name);
  6833. $commandName = $command->getName();
  6834. $isProxyCommand = ($command instanceof Command\BaseCommand && $command->isProxyCommand());
  6835. } catch (\InvalidArgumentException $e) {
  6836. }
  6837. }
  6838. if (!$isProxyCommand) {
  6839. $io->writeError(sprintf(
  6840. 'Running %s (%s) with %s on %s',
  6841. Composer::VERSION,
  6842. Composer::RELEASE_DATE,
  6843. defined('HHVM_VERSION') ? 'HHVM '.HHVM_VERSION : 'PHP '.PHP_VERSION,
  6844. function_exists('php_uname') ? php_uname('s') . ' / ' . php_uname('r') : 'Unknown OS'
  6845. ), true, IOInterface::DEBUG);
  6846. if (PHP_VERSION_ID < 50302) {
  6847. $io->writeError('<warning>Composer only officially supports PHP 5.3.2 and above, you will most likely encounter problems with your PHP '.PHP_VERSION.', upgrading is strongly recommended.</warning>');
  6848. }
  6849. if (extension_loaded('xdebug') && !getenv('COMPOSER_DISABLE_XDEBUG_WARN')) {
  6850. $io->writeError('<warning>You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug</warning>');
  6851. }
  6852. if (defined('COMPOSER_DEV_WARNING_TIME') && $commandName !== 'self-update' && $commandName !== 'selfupdate' && time() > COMPOSER_DEV_WARNING_TIME) {
  6853. $io->writeError(sprintf('<warning>Warning: This development build of composer is over 60 days old. It is recommended to update it by running "%s self-update" to get the latest version.</warning>', $_SERVER['PHP_SELF']));
  6854. }
  6855. if (getenv('COMPOSER_NO_INTERACTION')) {
  6856. $input->setInteractive(false);
  6857. }
  6858. if (!Platform::isWindows() && function_exists('exec') && !getenv('COMPOSER_ALLOW_SUPERUSER')) {
  6859. if (function_exists('posix_getuid') && posix_getuid() === 0) {
  6860. if ($commandName !== 'self-update' && $commandName !== 'selfupdate') {
  6861. $io->writeError('<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>');
  6862. }
  6863. if ($uid = (int) getenv('SUDO_UID')) {
  6864. Silencer::call('exec', "sudo -u \\#{$uid} sudo -K > /dev/null 2>&1");
  6865. }
  6866. }
  6867. Silencer::call('exec', 'sudo -K > /dev/null 2>&1');
  6868. }
  6869. Silencer::call(function () use ($io) {
  6870. $tempfile = sys_get_temp_dir() . '/temp-' . md5(microtime());
  6871. if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) == __FILE__) && unlink($tempfile) && !file_exists($tempfile))) {
  6872. $io->writeError(sprintf('<error>PHP temp directory (%s) does not exist or is not writable to Composer. Set sys_temp_dir in your php.ini</error>', sys_get_temp_dir()));
  6873. }
  6874. });
  6875. $file = Factory::getComposerFile();
  6876. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  6877. if (isset($composer['scripts']) && is_array($composer['scripts'])) {
  6878. foreach ($composer['scripts'] as $script => $dummy) {
  6879. if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  6880. if ($this->has($script)) {
  6881. $io->writeError('<warning>A script named '.$script.' would override a Composer command and has been skipped</warning>');
  6882. } else {
  6883. $description = null;
  6884. if (isset($composer['scripts-descriptions'][$script])) {
  6885. $description = $composer['scripts-descriptions'][$script];
  6886. }
  6887. $this->add(new Command\ScriptAliasCommand($script, $description));
  6888. }
  6889. }
  6890. }
  6891. }
  6892. }
  6893. }
  6894. try {
  6895. if ($input->hasParameterOption('--profile')) {
  6896. $startTime = microtime(true);
  6897. $this->io->enableDebugging($startTime);
  6898. }
  6899. $result = parent::doRun($input, $output);
  6900. if (isset($oldWorkingDir)) {
  6901. chdir($oldWorkingDir);
  6902. }
  6903. if (isset($startTime)) {
  6904. $io->writeError('<info>Memory usage: '.round(memory_get_usage() / 1024 / 1024, 2).'MB (peak: '.round(memory_get_peak_usage() / 1024 / 1024, 2).'MB), time: '.round(microtime(true) - $startTime, 2).'s');
  6905. }
  6906. restore_error_handler();
  6907. return $result;
  6908. } catch (ScriptExecutionException $e) {
  6909. return $e->getCode();
  6910. } catch (\Exception $e) {
  6911. $this->hintCommonErrors($e);
  6912. restore_error_handler();
  6913. throw $e;
  6914. }
  6915. }
  6916. private function getNewWorkingDir(InputInterface $input)
  6917. {
  6918. $workingDir = $input->getParameterOption(array('--working-dir', '-d'));
  6919. if (false !== $workingDir && !is_dir($workingDir)) {
  6920. throw new \RuntimeException('Invalid working directory specified, '.$workingDir.' does not exist.');
  6921. }
  6922. return $workingDir;
  6923. }
  6924. private function hintCommonErrors($exception)
  6925. {
  6926. $io = $this->getIO();
  6927. Silencer::suppress();
  6928. try {
  6929. $composer = $this->getComposer(false, true);
  6930. if ($composer) {
  6931. $config = $composer->getConfig();
  6932. $minSpaceFree = 1024 * 1024;
  6933. if ((($df = disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  6934. || (($df = disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  6935. || (($df = disk_free_space($dir = sys_get_temp_dir())) !== false && $df < $minSpaceFree)
  6936. ) {
  6937. $io->writeError('<error>The disk hosting '.$dir.' is full, this may be the cause of the following exception</error>', true, IOInterface::QUIET);
  6938. }
  6939. }
  6940. } catch (\Exception $e) {
  6941. }
  6942. Silencer::restore();
  6943. if (Platform::isWindows() && false !== strpos($exception->getMessage(), 'The system cannot find the path specified')) {
  6944. $io->writeError('<error>The following exception may be caused by a stale entry in your cmd.exe AutoRun</error>', true, IOInterface::QUIET);
  6945. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#-the-system-cannot-find-the-path-specified-windows- for details</error>', true, IOInterface::QUIET);
  6946. }
  6947. if (false !== strpos($exception->getMessage(), 'fork failed - Cannot allocate memory')) {
  6948. $io->writeError('<error>The following exception is caused by a lack of memory or swap, or not having swap configured</error>', true, IOInterface::QUIET);
  6949. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details</error>', true, IOInterface::QUIET);
  6950. }
  6951. }
  6952. public function getComposer($required = true, $disablePlugins = null)
  6953. {
  6954. if (null === $disablePlugins) {
  6955. $disablePlugins = $this->disablePluginsByDefault;
  6956. }
  6957. if (null === $this->composer) {
  6958. try {
  6959. $this->composer = Factory::create($this->io, null, $disablePlugins);
  6960. } catch (\InvalidArgumentException $e) {
  6961. if ($required) {
  6962. $this->io->writeError($e->getMessage());
  6963. exit(1);
  6964. }
  6965. } catch (JsonValidationException $e) {
  6966. $errors = ' - ' . implode(PHP_EOL . ' - ', $e->getErrors());
  6967. $message = $e->getMessage() . ':' . PHP_EOL . $errors;
  6968. throw new JsonValidationException($message);
  6969. }
  6970. }
  6971. return $this->composer;
  6972. }
  6973. public function resetComposer()
  6974. {
  6975. $this->composer = null;
  6976. }
  6977. public function getIO()
  6978. {
  6979. return $this->io;
  6980. }
  6981. public function getHelp()
  6982. {
  6983. return self::$logo . parent::getHelp();
  6984. }
  6985. protected function getDefaultCommands()
  6986. {
  6987. $commands = array_merge(parent::getDefaultCommands(), array(
  6988. new Command\AboutCommand(),
  6989. new Command\ConfigCommand(),
  6990. new Command\DependsCommand(),
  6991. new Command\ProhibitsCommand(),
  6992. new Command\InitCommand(),
  6993. new Command\InstallCommand(),
  6994. new Command\CreateProjectCommand(),
  6995. new Command\UpdateCommand(),
  6996. new Command\SearchCommand(),
  6997. new Command\ValidateCommand(),
  6998. new Command\ShowCommand(),
  6999. new Command\SuggestsCommand(),
  7000. new Command\RequireCommand(),
  7001. new Command\DumpAutoloadCommand(),
  7002. new Command\StatusCommand(),
  7003. new Command\ArchiveCommand(),
  7004. new Command\DiagnoseCommand(),
  7005. new Command\RunScriptCommand(),
  7006. new Command\LicensesCommand(),
  7007. new Command\GlobalCommand(),
  7008. new Command\ClearCacheCommand(),
  7009. new Command\RemoveCommand(),
  7010. new Command\HomeCommand(),
  7011. new Command\ExecCommand(),
  7012. new Command\OutdatedCommand(),
  7013. new Command\CheckPlatformReqsCommand(),
  7014. ));
  7015. if ('phar:' === substr(__FILE__, 0, 5)) {
  7016. $commands[] = new Command\SelfUpdateCommand();
  7017. }
  7018. return $commands;
  7019. }
  7020. public function getLongVersion()
  7021. {
  7022. if (Composer::BRANCH_ALIAS_VERSION) {
  7023. return sprintf(
  7024. '<info>%s</info> version <comment>%s (%s)</comment> %s',
  7025. $this->getName(),
  7026. Composer::BRANCH_ALIAS_VERSION,
  7027. $this->getVersion(),
  7028. Composer::RELEASE_DATE
  7029. );
  7030. }
  7031. return parent::getLongVersion() . ' ' . Composer::RELEASE_DATE;
  7032. }
  7033. protected function getDefaultInputDefinition()
  7034. {
  7035. $definition = parent::getDefaultInputDefinition();
  7036. $definition->addOption(new InputOption('--profile', null, InputOption::VALUE_NONE, 'Display timing and memory usage information'));
  7037. $definition->addOption(new InputOption('--no-plugins', null, InputOption::VALUE_NONE, 'Whether to disable plugins.'));
  7038. $definition->addOption(new InputOption('--working-dir', '-d', InputOption::VALUE_REQUIRED, 'If specified, use the given directory as working directory.'));
  7039. return $definition;
  7040. }
  7041. private function getPluginCommands()
  7042. {
  7043. $commands = array();
  7044. $composer = $this->getComposer(false, false);
  7045. if (null === $composer) {
  7046. $composer = Factory::createGlobal($this->io, false);
  7047. }
  7048. if (null !== $composer) {
  7049. $pm = $composer->getPluginManager();
  7050. foreach ($pm->getPluginCapabilities('Composer\Plugin\Capability\CommandProvider', array('composer' => $composer, 'io' => $this->io)) as $capability) {
  7051. $newCommands = $capability->getCommands();
  7052. if (!is_array($newCommands)) {
  7053. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' failed to return an array from getCommands');
  7054. }
  7055. foreach ($newCommands as $command) {
  7056. if (!$command instanceof Command\BaseCommand) {
  7057. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' returned an invalid value, we expected an array of Composer\Command\BaseCommand objects');
  7058. }
  7059. }
  7060. $commands = array_merge($commands, $newCommands);
  7061. }
  7062. }
  7063. return $commands;
  7064. }
  7065. }
  7066. <?php
  7067. namespace Composer\Console;
  7068. use Symfony\Component\Console\Formatter\OutputFormatter;
  7069. class HtmlOutputFormatter extends OutputFormatter
  7070. {
  7071. private static $availableForegroundColors = array(
  7072. 30 => 'black',
  7073. 31 => 'red',
  7074. 32 => 'green',
  7075. 33 => 'yellow',
  7076. 34 => 'blue',
  7077. 35 => 'magenta',
  7078. 36 => 'cyan',
  7079. 37 => 'white',
  7080. );
  7081. private static $availableBackgroundColors = array(
  7082. 40 => 'black',
  7083. 41 => 'red',
  7084. 42 => 'green',
  7085. 43 => 'yellow',
  7086. 44 => 'blue',
  7087. 45 => 'magenta',
  7088. 46 => 'cyan',
  7089. 47 => 'white',
  7090. );
  7091. private static $availableOptions = array(
  7092. 1 => 'bold',
  7093. 4 => 'underscore',
  7094. );
  7095. public function __construct(array $styles = array())
  7096. {
  7097. parent::__construct(true, $styles);
  7098. }
  7099. public function format($message)
  7100. {
  7101. $formatted = parent::format($message);
  7102. $clearEscapeCodes = '(?:39|49|0|22|24|25|27|28)';
  7103. return preg_replace_callback("{\033\[([0-9;]+)m(.*?)\033\[(?:".$clearEscapeCodes.";)*?".$clearEscapeCodes."m}s", array($this, 'formatHtml'), $formatted);
  7104. }
  7105. private function formatHtml($matches)
  7106. {
  7107. $out = '<span style="';
  7108. foreach (explode(';', $matches[1]) as $code) {
  7109. if (isset(self::$availableForegroundColors[$code])) {
  7110. $out .= 'color:'.self::$availableForegroundColors[$code].';';
  7111. } elseif (isset(self::$availableBackgroundColors[$code])) {
  7112. $out .= 'background-color:'.self::$availableBackgroundColors[$code].';';
  7113. } elseif (isset(self::$availableOptions[$code])) {
  7114. switch (self::$availableOptions[$code]) {
  7115. case 'bold':
  7116. $out .= 'font-weight:bold;';
  7117. break;
  7118. case 'underscore':
  7119. $out .= 'text-decoration:underline;';
  7120. break;
  7121. }
  7122. }
  7123. }
  7124. return $out.'">'.$matches[2].'</span>';
  7125. }
  7126. }
  7127. <?php
  7128. namespace Composer\DependencyResolver;
  7129. class Decisions implements \Iterator, \Countable
  7130. {
  7131. const DECISION_LITERAL = 0;
  7132. const DECISION_REASON = 1;
  7133. protected $pool;
  7134. protected $decisionMap;
  7135. protected $decisionQueue = array();
  7136. public function __construct($pool)
  7137. {
  7138. $this->pool = $pool;
  7139. $this->decisionMap = array();
  7140. }
  7141. public function decide($literal, $level, $why)
  7142. {
  7143. $this->addDecision($literal, $level);
  7144. $this->decisionQueue[] = array(
  7145. self::DECISION_LITERAL => $literal,
  7146. self::DECISION_REASON => $why,
  7147. );
  7148. }
  7149. public function satisfy($literal)
  7150. {
  7151. $packageId = abs($literal);
  7152. return (
  7153. $literal > 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 ||
  7154. $literal < 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0
  7155. );
  7156. }
  7157. public function conflict($literal)
  7158. {
  7159. $packageId = abs($literal);
  7160. return (
  7161. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 && $literal < 0) ||
  7162. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0 && $literal > 0)
  7163. );
  7164. }
  7165. public function decided($literalOrPackageId)
  7166. {
  7167. return !empty($this->decisionMap[abs($literalOrPackageId)]);
  7168. }
  7169. public function undecided($literalOrPackageId)
  7170. {
  7171. return empty($this->decisionMap[abs($literalOrPackageId)]);
  7172. }
  7173. public function decidedInstall($literalOrPackageId)
  7174. {
  7175. $packageId = abs($literalOrPackageId);
  7176. return isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0;
  7177. }
  7178. public function decisionLevel($literalOrPackageId)
  7179. {
  7180. $packageId = abs($literalOrPackageId);
  7181. if (isset($this->decisionMap[$packageId])) {
  7182. return abs($this->decisionMap[$packageId]);
  7183. }
  7184. return 0;
  7185. }
  7186. public function decisionRule($literalOrPackageId)
  7187. {
  7188. $packageId = abs($literalOrPackageId);
  7189. foreach ($this->decisionQueue as $i => $decision) {
  7190. if ($packageId === abs($decision[self::DECISION_LITERAL])) {
  7191. return $decision[self::DECISION_REASON];
  7192. }
  7193. }
  7194. return null;
  7195. }
  7196. public function atOffset($queueOffset)
  7197. {
  7198. return $this->decisionQueue[$queueOffset];
  7199. }
  7200. public function validOffset($queueOffset)
  7201. {
  7202. return $queueOffset >= 0 && $queueOffset < count($this->decisionQueue);
  7203. }
  7204. public function lastReason()
  7205. {
  7206. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_REASON];
  7207. }
  7208. public function lastLiteral()
  7209. {
  7210. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_LITERAL];
  7211. }
  7212. public function reset()
  7213. {
  7214. while ($decision = array_pop($this->decisionQueue)) {
  7215. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  7216. }
  7217. }
  7218. public function resetToOffset($offset)
  7219. {
  7220. while (count($this->decisionQueue) > $offset + 1) {
  7221. $decision = array_pop($this->decisionQueue);
  7222. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  7223. }
  7224. }
  7225. public function revertLast()
  7226. {
  7227. $this->decisionMap[abs($this->lastLiteral())] = 0;
  7228. array_pop($this->decisionQueue);
  7229. }
  7230. public function count()
  7231. {
  7232. return count($this->decisionQueue);
  7233. }
  7234. public function rewind()
  7235. {
  7236. end($this->decisionQueue);
  7237. }
  7238. public function current()
  7239. {
  7240. return current($this->decisionQueue);
  7241. }
  7242. public function key()
  7243. {
  7244. return key($this->decisionQueue);
  7245. }
  7246. public function next()
  7247. {
  7248. return prev($this->decisionQueue);
  7249. }
  7250. public function valid()
  7251. {
  7252. return false !== current($this->decisionQueue);
  7253. }
  7254. public function isEmpty()
  7255. {
  7256. return count($this->decisionQueue) === 0;
  7257. }
  7258. protected function addDecision($literal, $level)
  7259. {
  7260. $packageId = abs($literal);
  7261. $previousDecision = isset($this->decisionMap[$packageId]) ? $this->decisionMap[$packageId] : null;
  7262. if ($previousDecision != 0) {
  7263. $literalString = $this->pool->literalToString($literal);
  7264. $package = $this->pool->literalToPackage($literal);
  7265. throw new SolverBugException(
  7266. "Trying to decide $literalString on level $level, even though $package was previously decided as ".(int) $previousDecision."."
  7267. );
  7268. }
  7269. if ($literal > 0) {
  7270. $this->decisionMap[$packageId] = $level;
  7271. } else {
  7272. $this->decisionMap[$packageId] = -$level;
  7273. }
  7274. }
  7275. }
  7276. <?php
  7277. namespace Composer\DependencyResolver;
  7278. use Composer\Package\PackageInterface;
  7279. use Composer\Package\AliasPackage;
  7280. use Composer\Package\BasePackage;
  7281. use Composer\Semver\Constraint\Constraint;
  7282. class DefaultPolicy implements PolicyInterface
  7283. {
  7284. private $preferStable;
  7285. private $preferLowest;
  7286. public function __construct($preferStable = false, $preferLowest = false)
  7287. {
  7288. $this->preferStable = $preferStable;
  7289. $this->preferLowest = $preferLowest;
  7290. }
  7291. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator)
  7292. {
  7293. if ($this->preferStable && ($stabA = $a->getStability()) !== ($stabB = $b->getStability())) {
  7294. return BasePackage::$stabilities[$stabA] < BasePackage::$stabilities[$stabB];
  7295. }
  7296. $constraint = new Constraint($operator, $b->getVersion());
  7297. $version = new Constraint('==', $a->getVersion());
  7298. return $constraint->matchSpecific($version, true);
  7299. }
  7300. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package, $mustMatchName = false)
  7301. {
  7302. $packages = array();
  7303. foreach ($pool->whatProvides($package->getName(), null, $mustMatchName) as $candidate) {
  7304. if ($candidate !== $package) {
  7305. $packages[] = $candidate;
  7306. }
  7307. }
  7308. return $packages;
  7309. }
  7310. public function getPriority(Pool $pool, PackageInterface $package)
  7311. {
  7312. return $pool->getPriority($package->getRepository());
  7313. }
  7314. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null)
  7315. {
  7316. $packages = $this->groupLiteralsByNamePreferInstalled($pool, $installedMap, $literals);
  7317. foreach ($packages as &$literals) {
  7318. $policy = $this;
  7319. usort($literals, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  7320. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage, true);
  7321. });
  7322. }
  7323. foreach ($packages as &$literals) {
  7324. $literals = $this->pruneToHighestPriorityOrInstalled($pool, $installedMap, $literals);
  7325. $literals = $this->pruneToBestVersion($pool, $literals);
  7326. $literals = $this->pruneRemoteAliases($pool, $literals);
  7327. }
  7328. $selected = call_user_func_array('array_merge', $packages);
  7329. usort($selected, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  7330. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage);
  7331. });
  7332. return $selected;
  7333. }
  7334. protected function groupLiteralsByNamePreferInstalled(Pool $pool, array $installedMap, $literals)
  7335. {
  7336. $packages = array();
  7337. foreach ($literals as $literal) {
  7338. $packageName = $pool->literalToPackage($literal)->getName();
  7339. if (!isset($packages[$packageName])) {
  7340. $packages[$packageName] = array();
  7341. }
  7342. if (isset($installedMap[abs($literal)])) {
  7343. array_unshift($packages[$packageName], $literal);
  7344. } else {
  7345. $packages[$packageName][] = $literal;
  7346. }
  7347. }
  7348. return $packages;
  7349. }
  7350. public function compareByPriorityPreferInstalled(Pool $pool, array $installedMap, PackageInterface $a, PackageInterface $b, $requiredPackage = null, $ignoreReplace = false)
  7351. {
  7352. if ($a->getRepository() === $b->getRepository()) {
  7353. if ($a->getName() === $b->getName()) {
  7354. $aAliased = $a instanceof AliasPackage;
  7355. $bAliased = $b instanceof AliasPackage;
  7356. if ($aAliased && !$bAliased) {
  7357. return -1;
  7358. }
  7359. if (!$aAliased && $bAliased) {
  7360. return 1;
  7361. }
  7362. }
  7363. if (!$ignoreReplace) {
  7364. if ($this->replaces($a, $b)) {
  7365. return 1;
  7366. }
  7367. if ($this->replaces($b, $a)) {
  7368. return -1;
  7369. }
  7370. if ($requiredPackage && false !== ($pos = strpos($requiredPackage, '/'))) {
  7371. $requiredVendor = substr($requiredPackage, 0, $pos);
  7372. $aIsSameVendor = substr($a->getName(), 0, $pos) === $requiredVendor;
  7373. $bIsSameVendor = substr($b->getName(), 0, $pos) === $requiredVendor;
  7374. if ($bIsSameVendor !== $aIsSameVendor) {
  7375. return $aIsSameVendor ? -1 : 1;
  7376. }
  7377. }
  7378. }
  7379. if ($a->id === $b->id) {
  7380. return 0;
  7381. }
  7382. return ($a->id < $b->id) ? -1 : 1;
  7383. }
  7384. if (isset($installedMap[$a->id])) {
  7385. return -1;
  7386. }
  7387. if (isset($installedMap[$b->id])) {
  7388. return 1;
  7389. }
  7390. return ($this->getPriority($pool, $a) > $this->getPriority($pool, $b)) ? -1 : 1;
  7391. }
  7392. protected function replaces(PackageInterface $source, PackageInterface $target)
  7393. {
  7394. foreach ($source->getReplaces() as $link) {
  7395. if ($link->getTarget() === $target->getName()
  7396. ) {
  7397. return true;
  7398. }
  7399. }
  7400. return false;
  7401. }
  7402. protected function pruneToBestVersion(Pool $pool, $literals)
  7403. {
  7404. $operator = $this->preferLowest ? '<' : '>';
  7405. $bestLiterals = array($literals[0]);
  7406. $bestPackage = $pool->literalToPackage($literals[0]);
  7407. foreach ($literals as $i => $literal) {
  7408. if (0 === $i) {
  7409. continue;
  7410. }
  7411. $package = $pool->literalToPackage($literal);
  7412. if ($this->versionCompare($package, $bestPackage, $operator)) {
  7413. $bestPackage = $package;
  7414. $bestLiterals = array($literal);
  7415. } elseif ($this->versionCompare($package, $bestPackage, '==')) {
  7416. $bestLiterals[] = $literal;
  7417. }
  7418. }
  7419. return $bestLiterals;
  7420. }
  7421. protected function pruneToHighestPriorityOrInstalled(Pool $pool, array $installedMap, array $literals)
  7422. {
  7423. $selected = array();
  7424. $priority = null;
  7425. foreach ($literals as $literal) {
  7426. $package = $pool->literalToPackage($literal);
  7427. if (isset($installedMap[$package->id])) {
  7428. $selected[] = $literal;
  7429. continue;
  7430. }
  7431. if (null === $priority) {
  7432. $priority = $this->getPriority($pool, $package);
  7433. }
  7434. if ($this->getPriority($pool, $package) != $priority) {
  7435. break;
  7436. }
  7437. $selected[] = $literal;
  7438. }
  7439. return $selected;
  7440. }
  7441. protected function pruneRemoteAliases(Pool $pool, array $literals)
  7442. {
  7443. $hasLocalAlias = false;
  7444. foreach ($literals as $literal) {
  7445. $package = $pool->literalToPackage($literal);
  7446. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  7447. $hasLocalAlias = true;
  7448. break;
  7449. }
  7450. }
  7451. if (!$hasLocalAlias) {
  7452. return $literals;
  7453. }
  7454. $selected = array();
  7455. foreach ($literals as $literal) {
  7456. $package = $pool->literalToPackage($literal);
  7457. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  7458. $selected[] = $literal;
  7459. }
  7460. }
  7461. return $selected;
  7462. }
  7463. }
  7464. <?php
  7465. namespace Composer\DependencyResolver;
  7466. use Composer\Package\PackageInterface;
  7467. use Composer\Package\Link;
  7468. class GenericRule extends Rule
  7469. {
  7470. protected $literals;
  7471. public function __construct(array $literals, $reason, $reasonData, $job = null)
  7472. {
  7473. parent::__construct($reason, $reasonData, $job);
  7474. sort($literals);
  7475. $this->literals = $literals;
  7476. }
  7477. public function getLiterals()
  7478. {
  7479. return $this->literals;
  7480. }
  7481. public function getHash()
  7482. {
  7483. $data = unpack('ihash', md5(implode(',', $this->literals), true));
  7484. return $data['hash'];
  7485. }
  7486. public function equals(Rule $rule)
  7487. {
  7488. return $this->literals === $rule->getLiterals();
  7489. }
  7490. public function isAssertion()
  7491. {
  7492. return 1 === count($this->literals);
  7493. }
  7494. public function __toString()
  7495. {
  7496. $result = ($this->isDisabled()) ? 'disabled(' : '(';
  7497. foreach ($this->literals as $i => $literal) {
  7498. if ($i != 0) {
  7499. $result .= '|';
  7500. }
  7501. $result .= $literal;
  7502. }
  7503. $result .= ')';
  7504. return $result;
  7505. }
  7506. }
  7507. <?php
  7508. namespace Composer\DependencyResolver\Operation;
  7509. use Composer\Package\PackageInterface;
  7510. class InstallOperation extends SolverOperation
  7511. {
  7512. protected $package;
  7513. public function __construct(PackageInterface $package, $reason = null)
  7514. {
  7515. parent::__construct($reason);
  7516. $this->package = $package;
  7517. }
  7518. public function getPackage()
  7519. {
  7520. return $this->package;
  7521. }
  7522. public function getJobType()
  7523. {
  7524. return 'install';
  7525. }
  7526. public function __toString()
  7527. {
  7528. return 'Installing '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  7529. }
  7530. }
  7531. <?php
  7532. namespace Composer\DependencyResolver\Operation;
  7533. use Composer\Package\AliasPackage;
  7534. use Composer\Package\PackageInterface;
  7535. class MarkAliasInstalledOperation extends SolverOperation
  7536. {
  7537. protected $package;
  7538. public function __construct(AliasPackage $package, $reason = null)
  7539. {
  7540. parent::__construct($reason);
  7541. $this->package = $package;
  7542. }
  7543. public function getPackage()
  7544. {
  7545. return $this->package;
  7546. }
  7547. public function getJobType()
  7548. {
  7549. return 'markAliasInstalled';
  7550. }
  7551. public function __toString()
  7552. {
  7553. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as installed, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  7554. }
  7555. }
  7556. <?php
  7557. namespace Composer\DependencyResolver\Operation;
  7558. use Composer\Package\AliasPackage;
  7559. use Composer\Package\PackageInterface;
  7560. class MarkAliasUninstalledOperation extends SolverOperation
  7561. {
  7562. protected $package;
  7563. public function __construct(AliasPackage $package, $reason = null)
  7564. {
  7565. parent::__construct($reason);
  7566. $this->package = $package;
  7567. }
  7568. public function getPackage()
  7569. {
  7570. return $this->package;
  7571. }
  7572. public function getJobType()
  7573. {
  7574. return 'markAliasUninstalled';
  7575. }
  7576. public function __toString()
  7577. {
  7578. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as uninstalled, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  7579. }
  7580. }
  7581. <?php
  7582. namespace Composer\DependencyResolver\Operation;
  7583. interface OperationInterface
  7584. {
  7585. public function getJobType();
  7586. public function getReason();
  7587. public function __toString();
  7588. }
  7589. <?php
  7590. namespace Composer\DependencyResolver\Operation;
  7591. use Composer\Package\PackageInterface;
  7592. abstract class SolverOperation implements OperationInterface
  7593. {
  7594. protected $reason;
  7595. public function __construct($reason = null)
  7596. {
  7597. $this->reason = $reason;
  7598. }
  7599. public function getReason()
  7600. {
  7601. return $this->reason;
  7602. }
  7603. protected function formatVersion(PackageInterface $package)
  7604. {
  7605. return $package->getFullPrettyVersion();
  7606. }
  7607. }
  7608. <?php
  7609. namespace Composer\DependencyResolver\Operation;
  7610. use Composer\Package\PackageInterface;
  7611. class UninstallOperation extends SolverOperation
  7612. {
  7613. protected $package;
  7614. public function __construct(PackageInterface $package, $reason = null)
  7615. {
  7616. parent::__construct($reason);
  7617. $this->package = $package;
  7618. }
  7619. public function getPackage()
  7620. {
  7621. return $this->package;
  7622. }
  7623. public function getJobType()
  7624. {
  7625. return 'uninstall';
  7626. }
  7627. public function __toString()
  7628. {
  7629. return 'Uninstalling '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  7630. }
  7631. }
  7632. <?php
  7633. namespace Composer\DependencyResolver\Operation;
  7634. use Composer\Package\PackageInterface;
  7635. class UpdateOperation extends SolverOperation
  7636. {
  7637. protected $initialPackage;
  7638. protected $targetPackage;
  7639. public function __construct(PackageInterface $initial, PackageInterface $target, $reason = null)
  7640. {
  7641. parent::__construct($reason);
  7642. $this->initialPackage = $initial;
  7643. $this->targetPackage = $target;
  7644. }
  7645. public function getInitialPackage()
  7646. {
  7647. return $this->initialPackage;
  7648. }
  7649. public function getTargetPackage()
  7650. {
  7651. return $this->targetPackage;
  7652. }
  7653. public function getJobType()
  7654. {
  7655. return 'update';
  7656. }
  7657. public function __toString()
  7658. {
  7659. return 'Updating '.$this->initialPackage->getPrettyName().' ('.$this->formatVersion($this->initialPackage).') to '.
  7660. $this->targetPackage->getPrettyName(). ' ('.$this->formatVersion($this->targetPackage).')';
  7661. }
  7662. }
  7663. <?php
  7664. namespace Composer\DependencyResolver;
  7665. use Composer\Package\PackageInterface;
  7666. interface PolicyInterface
  7667. {
  7668. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator);
  7669. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package);
  7670. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null);
  7671. }
  7672. <?php
  7673. namespace Composer\DependencyResolver;
  7674. use Composer\Package\BasePackage;
  7675. use Composer\Package\AliasPackage;
  7676. use Composer\Package\Version\VersionParser;
  7677. use Composer\Semver\Constraint\ConstraintInterface;
  7678. use Composer\Semver\Constraint\Constraint;
  7679. use Composer\Semver\Constraint\EmptyConstraint;
  7680. use Composer\Repository\RepositoryInterface;
  7681. use Composer\Repository\CompositeRepository;
  7682. use Composer\Repository\ComposerRepository;
  7683. use Composer\Repository\InstalledRepositoryInterface;
  7684. use Composer\Repository\PlatformRepository;
  7685. use Composer\Package\PackageInterface;
  7686. class Pool implements \Countable
  7687. {
  7688. const MATCH_NAME = -1;
  7689. const MATCH_NONE = 0;
  7690. const MATCH = 1;
  7691. const MATCH_PROVIDE = 2;
  7692. const MATCH_REPLACE = 3;
  7693. const MATCH_FILTERED = 4;
  7694. protected $repositories = array();
  7695. protected $providerRepos = array();
  7696. protected $packages = array();
  7697. protected $packageByName = array();
  7698. protected $packageByExactName = array();
  7699. protected $acceptableStabilities;
  7700. protected $stabilityFlags;
  7701. protected $versionParser;
  7702. protected $providerCache = array();
  7703. protected $filterRequires;
  7704. protected $whitelist = null;
  7705. protected $id = 1;
  7706. public function __construct($minimumStability = 'stable', array $stabilityFlags = array(), array $filterRequires = array())
  7707. {
  7708. $this->versionParser = new VersionParser;
  7709. $this->acceptableStabilities = array();
  7710. foreach (BasePackage::$stabilities as $stability => $value) {
  7711. if ($value <= BasePackage::$stabilities[$minimumStability]) {
  7712. $this->acceptableStabilities[$stability] = $value;
  7713. }
  7714. }
  7715. $this->stabilityFlags = $stabilityFlags;
  7716. $this->filterRequires = $filterRequires;
  7717. foreach ($filterRequires as $name => $constraint) {
  7718. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  7719. unset($this->filterRequires[$name]);
  7720. }
  7721. }
  7722. }
  7723. public function setWhitelist($whitelist)
  7724. {
  7725. $this->whitelist = $whitelist;
  7726. $this->providerCache = array();
  7727. }
  7728. public function addRepository(RepositoryInterface $repo, $rootAliases = array())
  7729. {
  7730. if ($repo instanceof CompositeRepository) {
  7731. $repos = $repo->getRepositories();
  7732. } else {
  7733. $repos = array($repo);
  7734. }
  7735. foreach ($repos as $repo) {
  7736. $this->repositories[] = $repo;
  7737. $exempt = $repo instanceof PlatformRepository || $repo instanceof InstalledRepositoryInterface;
  7738. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  7739. $this->providerRepos[] = $repo;
  7740. $repo->setRootAliases($rootAliases);
  7741. $repo->resetPackageIds();
  7742. } else {
  7743. foreach ($repo->getPackages() as $package) {
  7744. $names = $package->getNames();
  7745. $stability = $package->getStability();
  7746. if ($exempt || $this->isPackageAcceptable($names, $stability)) {
  7747. $package->setId($this->id++);
  7748. $this->packages[] = $package;
  7749. $this->packageByExactName[$package->getName()][$package->id] = $package;
  7750. foreach ($names as $provided) {
  7751. $this->packageByName[$provided][] = $package;
  7752. }
  7753. $name = $package->getName();
  7754. if (isset($rootAliases[$name][$package->getVersion()])) {
  7755. $alias = $rootAliases[$name][$package->getVersion()];
  7756. if ($package instanceof AliasPackage) {
  7757. $package = $package->getAliasOf();
  7758. }
  7759. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  7760. $aliasPackage->setRootPackageAlias(true);
  7761. $aliasPackage->setId($this->id++);
  7762. $package->getRepository()->addPackage($aliasPackage);
  7763. $this->packages[] = $aliasPackage;
  7764. $this->packageByExactName[$aliasPackage->getName()][$aliasPackage->id] = $aliasPackage;
  7765. foreach ($aliasPackage->getNames() as $name) {
  7766. $this->packageByName[$name][] = $aliasPackage;
  7767. }
  7768. }
  7769. }
  7770. }
  7771. }
  7772. }
  7773. }
  7774. public function getPriority(RepositoryInterface $repo)
  7775. {
  7776. $priority = array_search($repo, $this->repositories, true);
  7777. if (false === $priority) {
  7778. throw new \RuntimeException("Could not determine repository priority. The repository was not registered in the pool.");
  7779. }
  7780. return -$priority;
  7781. }
  7782. public function packageById($id)
  7783. {
  7784. return $this->packages[$id - 1];
  7785. }
  7786. public function count()
  7787. {
  7788. return count($this->packages);
  7789. }
  7790. public function whatProvides($name, ConstraintInterface $constraint = null, $mustMatchName = false, $bypassFilters = false)
  7791. {
  7792. if ($bypassFilters) {
  7793. return $this->computeWhatProvides($name, $constraint, $mustMatchName, true);
  7794. }
  7795. $key = ((int) $mustMatchName).$constraint;
  7796. if (isset($this->providerCache[$name][$key])) {
  7797. return $this->providerCache[$name][$key];
  7798. }
  7799. return $this->providerCache[$name][$key] = $this->computeWhatProvides($name, $constraint, $mustMatchName, $bypassFilters);
  7800. }
  7801. private function computeWhatProvides($name, $constraint, $mustMatchName = false, $bypassFilters = false)
  7802. {
  7803. $candidates = array();
  7804. foreach ($this->providerRepos as $repo) {
  7805. foreach ($repo->whatProvides($this, $name, $bypassFilters) as $candidate) {
  7806. $candidates[] = $candidate;
  7807. if ($candidate->id < 1) {
  7808. $candidate->setId($this->id++);
  7809. $this->packages[$this->id - 2] = $candidate;
  7810. }
  7811. }
  7812. }
  7813. if ($mustMatchName) {
  7814. $candidates = array_filter($candidates, function ($candidate) use ($name) {
  7815. return $candidate->getName() == $name;
  7816. });
  7817. if (isset($this->packageByExactName[$name])) {
  7818. $candidates = array_merge($candidates, $this->packageByExactName[$name]);
  7819. }
  7820. } elseif (isset($this->packageByName[$name])) {
  7821. $candidates = array_merge($candidates, $this->packageByName[$name]);
  7822. }
  7823. $matches = $provideMatches = array();
  7824. $nameMatch = false;
  7825. foreach ($candidates as $candidate) {
  7826. $aliasOfCandidate = null;
  7827. if ($candidate instanceof AliasPackage) {
  7828. $aliasOfCandidate = $candidate->getAliasOf();
  7829. }
  7830. if ($this->whitelist !== null && !$bypassFilters && (
  7831. (!($candidate instanceof AliasPackage) && !isset($this->whitelist[$candidate->id])) ||
  7832. ($candidate instanceof AliasPackage && !isset($this->whitelist[$aliasOfCandidate->id]))
  7833. )) {
  7834. continue;
  7835. }
  7836. switch ($this->match($candidate, $name, $constraint, $bypassFilters)) {
  7837. case self::MATCH_NONE:
  7838. break;
  7839. case self::MATCH_NAME:
  7840. $nameMatch = true;
  7841. break;
  7842. case self::MATCH:
  7843. $nameMatch = true;
  7844. $matches[] = $candidate;
  7845. break;
  7846. case self::MATCH_PROVIDE:
  7847. $provideMatches[] = $candidate;
  7848. break;
  7849. case self::MATCH_REPLACE:
  7850. $matches[] = $candidate;
  7851. break;
  7852. case self::MATCH_FILTERED:
  7853. break;
  7854. default:
  7855. throw new \UnexpectedValueException('Unexpected match type');
  7856. }
  7857. }
  7858. if ($nameMatch) {
  7859. return $matches;
  7860. }
  7861. return array_merge($matches, $provideMatches);
  7862. }
  7863. public function literalToPackage($literal)
  7864. {
  7865. $packageId = abs($literal);
  7866. return $this->packageById($packageId);
  7867. }
  7868. public function literalToPrettyString($literal, $installedMap)
  7869. {
  7870. $package = $this->literalToPackage($literal);
  7871. if (isset($installedMap[$package->id])) {
  7872. $prefix = ($literal > 0 ? 'keep' : 'remove');
  7873. } else {
  7874. $prefix = ($literal > 0 ? 'install' : 'don\'t install');
  7875. }
  7876. return $prefix.' '.$package->getPrettyString();
  7877. }
  7878. public function isPackageAcceptable($name, $stability)
  7879. {
  7880. foreach ((array) $name as $n) {
  7881. if (!isset($this->stabilityFlags[$n]) && isset($this->acceptableStabilities[$stability])) {
  7882. return true;
  7883. }
  7884. if (isset($this->stabilityFlags[$n]) && BasePackage::$stabilities[$stability] <= $this->stabilityFlags[$n]) {
  7885. return true;
  7886. }
  7887. }
  7888. return false;
  7889. }
  7890. private function match($candidate, $name, ConstraintInterface $constraint = null, $bypassFilters)
  7891. {
  7892. $candidateName = $candidate->getName();
  7893. $candidateVersion = $candidate->getVersion();
  7894. $isDev = $candidate->getStability() === 'dev';
  7895. $isAlias = $candidate instanceof AliasPackage;
  7896. if (!$bypassFilters && !$isDev && !$isAlias && isset($this->filterRequires[$name])) {
  7897. $requireFilter = $this->filterRequires[$name];
  7898. } else {
  7899. $requireFilter = new EmptyConstraint;
  7900. }
  7901. if ($candidateName === $name) {
  7902. $pkgConstraint = new Constraint('==', $candidateVersion);
  7903. if ($constraint === null || $constraint->matches($pkgConstraint)) {
  7904. return $requireFilter->matches($pkgConstraint) ? self::MATCH : self::MATCH_FILTERED;
  7905. }
  7906. return self::MATCH_NAME;
  7907. }
  7908. $provides = $candidate->getProvides();
  7909. $replaces = $candidate->getReplaces();
  7910. if (isset($replaces[0]) || isset($provides[0])) {
  7911. foreach ($provides as $link) {
  7912. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  7913. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  7914. }
  7915. }
  7916. foreach ($replaces as $link) {
  7917. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  7918. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  7919. }
  7920. }
  7921. return self::MATCH_NONE;
  7922. }
  7923. if (isset($provides[$name]) && ($constraint === null || $constraint->matches($provides[$name]->getConstraint()))) {
  7924. return $requireFilter->matches($provides[$name]->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  7925. }
  7926. if (isset($replaces[$name]) && ($constraint === null || $constraint->matches($replaces[$name]->getConstraint()))) {
  7927. return $requireFilter->matches($replaces[$name]->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  7928. }
  7929. return self::MATCH_NONE;
  7930. }
  7931. }
  7932. <?php
  7933. namespace Composer\DependencyResolver;
  7934. use Composer\Package\CompletePackageInterface;
  7935. class Problem
  7936. {
  7937. protected $reasonSeen;
  7938. protected $reasons = array();
  7939. protected $section = 0;
  7940. protected $pool;
  7941. public function __construct(Pool $pool)
  7942. {
  7943. $this->pool = $pool;
  7944. }
  7945. public function addRule(Rule $rule)
  7946. {
  7947. $this->addReason(spl_object_hash($rule), array(
  7948. 'rule' => $rule,
  7949. 'job' => $rule->getJob(),
  7950. ));
  7951. }
  7952. public function getReasons()
  7953. {
  7954. return $this->reasons;
  7955. }
  7956. public function getPrettyString(array $installedMap = array())
  7957. {
  7958. $reasons = call_user_func_array('array_merge', array_reverse($this->reasons));
  7959. if (count($reasons) === 1) {
  7960. reset($reasons);
  7961. $reason = current($reasons);
  7962. $rule = $reason['rule'];
  7963. $job = $reason['job'];
  7964. if (isset($job['constraint'])) {
  7965. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  7966. } else {
  7967. $packages = array();
  7968. }
  7969. if ($job && $job['cmd'] === 'install' && empty($packages)) {
  7970. if ($job['packageName'] === 'php' || $job['packageName'] === 'php-64bit' || $job['packageName'] === 'hhvm') {
  7971. $version = phpversion();
  7972. $available = $this->pool->whatProvides($job['packageName']);
  7973. if (count($available)) {
  7974. $firstAvailable = reset($available);
  7975. $version = $firstAvailable->getPrettyVersion();
  7976. $extra = $firstAvailable->getExtra();
  7977. if ($firstAvailable instanceof CompletePackageInterface && isset($extra['config.platform']) && $extra['config.platform'] === true) {
  7978. $version .= '; ' . $firstAvailable->getDescription();
  7979. }
  7980. }
  7981. $msg = "\n - This package requires ".$job['packageName'].$this->constraintToText($job['constraint']).' but ';
  7982. if (defined('HHVM_VERSION')) {
  7983. return $msg . 'your HHVM version does not satisfy that requirement.';
  7984. }
  7985. if ($job['packageName'] === 'hhvm') {
  7986. return $msg . 'you are running this with PHP and not HHVM.';
  7987. }
  7988. return $msg . 'your PHP version ('. $version .') does not satisfy that requirement.';
  7989. }
  7990. if (0 === stripos($job['packageName'], 'ext-')) {
  7991. if (false !== strpos($job['packageName'], ' ')) {
  7992. return "\n - The requested PHP extension ".$job['packageName'].' should be required as '.str_replace(' ', '-', $job['packageName']).'.';
  7993. }
  7994. $ext = substr($job['packageName'], 4);
  7995. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  7996. return "\n - The requested PHP extension ".$job['packageName'].$this->constraintToText($job['constraint']).' '.$error.'. Install or enable PHP\'s '.$ext.' extension.';
  7997. }
  7998. if (0 === stripos($job['packageName'], 'lib-')) {
  7999. if (strtolower($job['packageName']) === 'lib-icu') {
  8000. $error = extension_loaded('intl') ? 'has the wrong version installed, try upgrading the intl extension.' : 'is missing from your system, make sure the intl extension is loaded.';
  8001. return "\n - The requested linked library ".$job['packageName'].$this->constraintToText($job['constraint']).' '.$error;
  8002. }
  8003. return "\n - The requested linked library ".$job['packageName'].$this->constraintToText($job['constraint']).' has the wrong version installed or is missing from your system, make sure to load the extension providing it.';
  8004. }
  8005. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $job['packageName'])) {
  8006. $illegalChars = preg_replace('{[A-Za-z0-9_./-]+}', '', $job['packageName']);
  8007. return "\n - The requested package ".$job['packageName'].' could not be found, it looks like its name is invalid, "'.$illegalChars.'" is not allowed in package names.';
  8008. }
  8009. if ($providers = $this->pool->whatProvides($job['packageName'], $job['constraint'], true, true)) {
  8010. return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' is satisfiable by '.$this->getPackageList($providers).' but these conflict with your requirements or minimum-stability.';
  8011. }
  8012. if ($providers = $this->pool->whatProvides($job['packageName'], null, true, true)) {
  8013. return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' exists as '.$this->getPackageList($providers).' but these are rejected by your constraint.';
  8014. }
  8015. return "\n - The requested package ".$job['packageName'].' could not be found in any version, there may be a typo in the package name.';
  8016. }
  8017. }
  8018. $messages = array();
  8019. foreach ($reasons as $reason) {
  8020. $rule = $reason['rule'];
  8021. $job = $reason['job'];
  8022. if ($job) {
  8023. $messages[] = $this->jobToText($job);
  8024. } elseif ($rule) {
  8025. if ($rule instanceof Rule) {
  8026. $messages[] = $rule->getPrettyString($this->pool, $installedMap);
  8027. }
  8028. }
  8029. }
  8030. return "\n - ".implode("\n - ", $messages);
  8031. }
  8032. protected function addReason($id, $reason)
  8033. {
  8034. if (!isset($this->reasonSeen[$id])) {
  8035. $this->reasonSeen[$id] = true;
  8036. $this->reasons[$this->section][] = $reason;
  8037. }
  8038. }
  8039. public function nextSection()
  8040. {
  8041. $this->section++;
  8042. }
  8043. protected function jobToText($job)
  8044. {
  8045. switch ($job['cmd']) {
  8046. case 'install':
  8047. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8048. if (!$packages) {
  8049. return 'No package found to satisfy install request for '.$job['packageName'].$this->constraintToText($job['constraint']);
  8050. }
  8051. return 'Installation request for '.$job['packageName'].$this->constraintToText($job['constraint']).' -> satisfiable by '.$this->getPackageList($packages).'.';
  8052. case 'update':
  8053. return 'Update request for '.$job['packageName'].$this->constraintToText($job['constraint']).'.';
  8054. case 'remove':
  8055. return 'Removal request for '.$job['packageName'].$this->constraintToText($job['constraint']).'';
  8056. }
  8057. if (isset($job['constraint'])) {
  8058. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8059. } else {
  8060. $packages = array();
  8061. }
  8062. return 'Job(cmd='.$job['cmd'].', target='.$job['packageName'].', packages=['.$this->getPackageList($packages).'])';
  8063. }
  8064. protected function getPackageList($packages)
  8065. {
  8066. $prepared = array();
  8067. foreach ($packages as $package) {
  8068. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  8069. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  8070. }
  8071. foreach ($prepared as $name => $package) {
  8072. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  8073. }
  8074. return implode(', ', $prepared);
  8075. }
  8076. protected function constraintToText($constraint)
  8077. {
  8078. return ($constraint) ? ' '.$constraint->getPrettyString() : '';
  8079. }
  8080. }
  8081. <?php
  8082. namespace Composer\DependencyResolver;
  8083. use Composer\Semver\Constraint\ConstraintInterface;
  8084. class Request
  8085. {
  8086. protected $jobs;
  8087. public function __construct()
  8088. {
  8089. $this->jobs = array();
  8090. }
  8091. public function install($packageName, ConstraintInterface $constraint = null)
  8092. {
  8093. $this->addJob($packageName, 'install', $constraint);
  8094. }
  8095. public function update($packageName, ConstraintInterface $constraint = null)
  8096. {
  8097. $this->addJob($packageName, 'update', $constraint);
  8098. }
  8099. public function remove($packageName, ConstraintInterface $constraint = null)
  8100. {
  8101. $this->addJob($packageName, 'remove', $constraint);
  8102. }
  8103. public function fix($packageName, ConstraintInterface $constraint = null)
  8104. {
  8105. $this->addJob($packageName, 'install', $constraint, true);
  8106. }
  8107. protected function addJob($packageName, $cmd, ConstraintInterface $constraint = null, $fixed = false)
  8108. {
  8109. $packageName = strtolower($packageName);
  8110. $this->jobs[] = array(
  8111. 'cmd' => $cmd,
  8112. 'packageName' => $packageName,
  8113. 'constraint' => $constraint,
  8114. 'fixed' => $fixed,
  8115. );
  8116. }
  8117. public function updateAll()
  8118. {
  8119. $this->jobs[] = array('cmd' => 'update-all');
  8120. }
  8121. public function getJobs()
  8122. {
  8123. return $this->jobs;
  8124. }
  8125. }
  8126. <?php
  8127. namespace Composer\DependencyResolver;
  8128. use Composer\Package\CompletePackage;
  8129. use Composer\Package\Link;
  8130. use Composer\Package\PackageInterface;
  8131. abstract class Rule
  8132. {
  8133. const RULE_INTERNAL_ALLOW_UPDATE = 1;
  8134. const RULE_JOB_INSTALL = 2;
  8135. const RULE_JOB_REMOVE = 3;
  8136. const RULE_PACKAGE_CONFLICT = 6;
  8137. const RULE_PACKAGE_REQUIRES = 7;
  8138. const RULE_PACKAGE_OBSOLETES = 8;
  8139. const RULE_INSTALLED_PACKAGE_OBSOLETES = 9;
  8140. const RULE_PACKAGE_SAME_NAME = 10;
  8141. const RULE_PACKAGE_IMPLICIT_OBSOLETES = 11;
  8142. const RULE_LEARNED = 12;
  8143. const RULE_PACKAGE_ALIAS = 13;
  8144. const BITFIELD_TYPE = 0;
  8145. const BITFIELD_REASON = 8;
  8146. const BITFIELD_DISABLED = 16;
  8147. protected $bitfield;
  8148. protected $reasonData;
  8149. public function __construct($reason, $reasonData, $job = null)
  8150. {
  8151. $this->reasonData = $reasonData;
  8152. if ($job) {
  8153. $this->job = $job;
  8154. }
  8155. $this->bitfield = (0 << self::BITFIELD_DISABLED) |
  8156. ($reason << self::BITFIELD_REASON) |
  8157. (255 << self::BITFIELD_TYPE);
  8158. }
  8159. abstract public function getLiterals();
  8160. abstract public function getHash();
  8161. public function getJob()
  8162. {
  8163. return isset($this->job) ? $this->job : null;
  8164. }
  8165. abstract public function equals(Rule $rule);
  8166. public function getReason()
  8167. {
  8168. return ($this->bitfield & (255 << self::BITFIELD_REASON)) >> self::BITFIELD_REASON;
  8169. }
  8170. public function getReasonData()
  8171. {
  8172. return $this->reasonData;
  8173. }
  8174. public function getRequiredPackage()
  8175. {
  8176. if ($this->getReason() === self::RULE_JOB_INSTALL) {
  8177. return $this->reasonData;
  8178. }
  8179. if ($this->getReason() === self::RULE_PACKAGE_REQUIRES) {
  8180. return $this->reasonData->getTarget();
  8181. }
  8182. }
  8183. public function setType($type)
  8184. {
  8185. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_TYPE)) | ((255 & $type) << self::BITFIELD_TYPE);
  8186. }
  8187. public function getType()
  8188. {
  8189. return ($this->bitfield & (255 << self::BITFIELD_TYPE)) >> self::BITFIELD_TYPE;
  8190. }
  8191. public function disable()
  8192. {
  8193. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_DISABLED)) | (1 << self::BITFIELD_DISABLED);
  8194. }
  8195. public function enable()
  8196. {
  8197. $this->bitfield = $this->bitfield & ~(255 << self::BITFIELD_DISABLED);
  8198. }
  8199. public function isDisabled()
  8200. {
  8201. return (bool) (($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  8202. }
  8203. public function isEnabled()
  8204. {
  8205. return !(($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  8206. }
  8207. abstract public function isAssertion();
  8208. public function getPrettyString(Pool $pool, array $installedMap = array())
  8209. {
  8210. $literals = $this->getLiterals();
  8211. $ruleText = '';
  8212. foreach ($literals as $i => $literal) {
  8213. if ($i != 0) {
  8214. $ruleText .= '|';
  8215. }
  8216. $ruleText .= $pool->literalToPrettyString($literal, $installedMap);
  8217. }
  8218. switch ($this->getReason()) {
  8219. case self::RULE_INTERNAL_ALLOW_UPDATE:
  8220. return $ruleText;
  8221. case self::RULE_JOB_INSTALL:
  8222. return "Install command rule ($ruleText)";
  8223. case self::RULE_JOB_REMOVE:
  8224. return "Remove command rule ($ruleText)";
  8225. case self::RULE_PACKAGE_CONFLICT:
  8226. $package1 = $pool->literalToPackage($literals[0]);
  8227. $package2 = $pool->literalToPackage($literals[1]);
  8228. return $package1->getPrettyString().' conflicts with '.$this->formatPackagesUnique($pool, array($package2)).'.';
  8229. case self::RULE_PACKAGE_REQUIRES:
  8230. $sourceLiteral = array_shift($literals);
  8231. $sourcePackage = $pool->literalToPackage($sourceLiteral);
  8232. $requires = array();
  8233. foreach ($literals as $literal) {
  8234. $requires[] = $pool->literalToPackage($literal);
  8235. }
  8236. $text = $this->reasonData->getPrettyString($sourcePackage);
  8237. if ($requires) {
  8238. $text .= ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $requires) . '.';
  8239. } else {
  8240. $targetName = $this->reasonData->getTarget();
  8241. if ($targetName === 'php' || $targetName === 'php-64bit' || $targetName === 'hhvm') {
  8242. if (defined('HHVM_VERSION')) {
  8243. return $text . ' -> your HHVM version does not satisfy that requirement.';
  8244. }
  8245. if ($targetName === 'hhvm') {
  8246. return $text . ' -> you are running this with PHP and not HHVM.';
  8247. }
  8248. $packages = $pool->whatProvides($targetName);
  8249. $package = count($packages) ? current($packages) : phpversion();
  8250. if (!($package instanceof CompletePackage)) {
  8251. return $text . ' -> your PHP version ('.phpversion().') does not satisfy that requirement.';
  8252. }
  8253. $extra = $package->getExtra();
  8254. if (!empty($extra['config.platform'])) {
  8255. $text .= ' -> your PHP version ('.phpversion().') overridden by "config.platform.php" version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  8256. } else {
  8257. $text .= ' -> your PHP version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  8258. }
  8259. return $text;
  8260. }
  8261. if (0 === strpos($targetName, 'ext-')) {
  8262. $ext = substr($targetName, 4);
  8263. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  8264. return $text . ' -> the requested PHP extension '.$ext.' '.$error.'.';
  8265. }
  8266. if (0 === strpos($targetName, 'lib-')) {
  8267. $lib = substr($targetName, 4);
  8268. return $text . ' -> the requested linked library '.$lib.' has the wrong version installed or is missing from your system, make sure to have the extension providing it.';
  8269. }
  8270. if ($providers = $pool->whatProvides($targetName, $this->reasonData->getConstraint(), true, true)) {
  8271. return $text . ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $providers) .' but these conflict with your requirements or minimum-stability.';
  8272. }
  8273. return $text . ' -> no matching package found.';
  8274. }
  8275. return $text;
  8276. case self::RULE_PACKAGE_OBSOLETES:
  8277. return $ruleText;
  8278. case self::RULE_INSTALLED_PACKAGE_OBSOLETES:
  8279. return $ruleText;
  8280. case self::RULE_PACKAGE_SAME_NAME:
  8281. return 'Can only install one of: ' . $this->formatPackagesUnique($pool, $literals) . '.';
  8282. case self::RULE_PACKAGE_IMPLICIT_OBSOLETES:
  8283. return $ruleText;
  8284. case self::RULE_LEARNED:
  8285. return 'Conclusion: '.$ruleText;
  8286. case self::RULE_PACKAGE_ALIAS:
  8287. return $ruleText;
  8288. default:
  8289. return '('.$ruleText.')';
  8290. }
  8291. }
  8292. protected function formatPackagesUnique($pool, array $packages)
  8293. {
  8294. $prepared = array();
  8295. foreach ($packages as $package) {
  8296. if (!is_object($package)) {
  8297. $package = $pool->literalToPackage($package);
  8298. }
  8299. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  8300. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  8301. }
  8302. foreach ($prepared as $name => $package) {
  8303. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  8304. }
  8305. return implode(', ', $prepared);
  8306. }
  8307. }
  8308. <?php
  8309. namespace Composer\DependencyResolver;
  8310. use Composer\Package\PackageInterface;
  8311. use Composer\Package\Link;
  8312. class Rule2Literals extends Rule
  8313. {
  8314. protected $literal1;
  8315. protected $literal2;
  8316. public function __construct($literal1, $literal2, $reason, $reasonData, $job = null)
  8317. {
  8318. parent::__construct($reason, $reasonData, $job);
  8319. if ($literal1 < $literal2) {
  8320. $this->literal1 = $literal1;
  8321. $this->literal2 = $literal2;
  8322. } else {
  8323. $this->literal1 = $literal2;
  8324. $this->literal2 = $literal1;
  8325. }
  8326. }
  8327. public function getLiterals()
  8328. {
  8329. return array($this->literal1, $this->literal2);
  8330. }
  8331. public function getHash()
  8332. {
  8333. $data = unpack('ihash', md5($this->literal1.','.$this->literal2, true));
  8334. return $data['hash'];
  8335. }
  8336. public function equals(Rule $rule)
  8337. {
  8338. $literals = $rule->getLiterals();
  8339. if (2 != count($literals)) {
  8340. return false;
  8341. }
  8342. if ($this->literal1 !== $literals[0]) {
  8343. return false;
  8344. }
  8345. if ($this->literal2 !== $literals[1]) {
  8346. return false;
  8347. }
  8348. return true;
  8349. }
  8350. public function isAssertion()
  8351. {
  8352. return false;
  8353. }
  8354. public function __toString()
  8355. {
  8356. $result = ($this->isDisabled()) ? 'disabled(' : '(';
  8357. $result .= $this->literal1 . '|' . $this->literal2 . ')';
  8358. return $result;
  8359. }
  8360. }
  8361. <?php
  8362. namespace Composer\DependencyResolver;
  8363. class RuleSet implements \IteratorAggregate, \Countable
  8364. {
  8365. const TYPE_PACKAGE = 0;
  8366. const TYPE_JOB = 1;
  8367. const TYPE_LEARNED = 4;
  8368. public $ruleById;
  8369. protected static $types = array(
  8370. 255 => 'UNKNOWN',
  8371. self::TYPE_PACKAGE => 'PACKAGE',
  8372. self::TYPE_JOB => 'JOB',
  8373. self::TYPE_LEARNED => 'LEARNED',
  8374. );
  8375. protected $rules;
  8376. protected $nextRuleId;
  8377. protected $rulesByHash;
  8378. public function __construct()
  8379. {
  8380. $this->nextRuleId = 0;
  8381. foreach ($this->getTypes() as $type) {
  8382. $this->rules[$type] = array();
  8383. }
  8384. $this->rulesByHash = array();
  8385. }
  8386. public function add(Rule $rule, $type)
  8387. {
  8388. if (!isset(self::$types[$type])) {
  8389. throw new \OutOfBoundsException('Unknown rule type: ' . $type);
  8390. }
  8391. $hash = $rule->getHash();
  8392. if (isset($this->rulesByHash[$hash])) {
  8393. $potentialDuplicates = $this->rulesByHash[$hash];
  8394. if (is_array($potentialDuplicates)) {
  8395. foreach ($potentialDuplicates as $potentialDuplicate) {
  8396. if ($rule->equals($potentialDuplicate)) {
  8397. return;
  8398. }
  8399. }
  8400. } else {
  8401. if ($rule->equals($potentialDuplicates)) {
  8402. return;
  8403. }
  8404. }
  8405. }
  8406. if (!isset($this->rules[$type])) {
  8407. $this->rules[$type] = array();
  8408. }
  8409. $this->rules[$type][] = $rule;
  8410. $this->ruleById[$this->nextRuleId] = $rule;
  8411. $rule->setType($type);
  8412. $this->nextRuleId++;
  8413. if (!isset($this->rulesByHash[$hash])) {
  8414. $this->rulesByHash[$hash] = $rule;
  8415. } elseif (is_array($this->rulesByHash[$hash])) {
  8416. $this->rulesByHash[$hash][] = $rule;
  8417. } else {
  8418. $originalRule = $this->rulesByHash[$hash];
  8419. $this->rulesByHash[$hash] = array($originalRule, $rule);
  8420. }
  8421. }
  8422. public function count()
  8423. {
  8424. return $this->nextRuleId;
  8425. }
  8426. public function ruleById($id)
  8427. {
  8428. return $this->ruleById[$id];
  8429. }
  8430. public function getRules()
  8431. {
  8432. return $this->rules;
  8433. }
  8434. public function getIterator()
  8435. {
  8436. return new RuleSetIterator($this->getRules());
  8437. }
  8438. public function getIteratorFor($types)
  8439. {
  8440. if (!is_array($types)) {
  8441. $types = array($types);
  8442. }
  8443. $allRules = $this->getRules();
  8444. $rules = array();
  8445. foreach ($types as $type) {
  8446. $rules[$type] = $allRules[$type];
  8447. }
  8448. return new RuleSetIterator($rules);
  8449. }
  8450. public function getIteratorWithout($types)
  8451. {
  8452. if (!is_array($types)) {
  8453. $types = array($types);
  8454. }
  8455. $rules = $this->getRules();
  8456. foreach ($types as $type) {
  8457. unset($rules[$type]);
  8458. }
  8459. return new RuleSetIterator($rules);
  8460. }
  8461. public function getTypes()
  8462. {
  8463. $types = self::$types;
  8464. unset($types[255]);
  8465. return array_keys($types);
  8466. }
  8467. public function getPrettyString(Pool $pool = null)
  8468. {
  8469. $string = "\n";
  8470. foreach ($this->rules as $type => $rules) {
  8471. $string .= str_pad(self::$types[$type], 8, ' ') . ": ";
  8472. foreach ($rules as $rule) {
  8473. $string .= ($pool ? $rule->getPrettyString($pool) : $rule)."\n";
  8474. }
  8475. $string .= "\n\n";
  8476. }
  8477. return $string;
  8478. }
  8479. public function __toString()
  8480. {
  8481. return $this->getPrettyString(null);
  8482. }
  8483. }
  8484. <?php
  8485. namespace Composer\DependencyResolver;
  8486. use Composer\Package\PackageInterface;
  8487. use Composer\Package\AliasPackage;
  8488. use Composer\Repository\PlatformRepository;
  8489. class RuleSetGenerator
  8490. {
  8491. protected $policy;
  8492. protected $pool;
  8493. protected $rules;
  8494. protected $jobs;
  8495. protected $installedMap;
  8496. protected $whitelistedMap;
  8497. protected $addedMap;
  8498. public function __construct(PolicyInterface $policy, Pool $pool)
  8499. {
  8500. $this->policy = $policy;
  8501. $this->pool = $pool;
  8502. }
  8503. protected function createRequireRule(PackageInterface $package, array $providers, $reason, $reasonData = null)
  8504. {
  8505. $literals = array(-$package->id);
  8506. foreach ($providers as $provider) {
  8507. if ($provider === $package) {
  8508. return null;
  8509. }
  8510. $literals[] = $provider->id;
  8511. }
  8512. return new GenericRule($literals, $reason, $reasonData);
  8513. }
  8514. protected function createInstallOneOfRule(array $packages, $reason, $job)
  8515. {
  8516. $literals = array();
  8517. foreach ($packages as $package) {
  8518. $literals[] = $package->id;
  8519. }
  8520. return new GenericRule($literals, $reason, $job['packageName'], $job);
  8521. }
  8522. protected function createRemoveRule(PackageInterface $package, $reason, $job)
  8523. {
  8524. return new GenericRule(array(-$package->id), $reason, $job['packageName'], $job);
  8525. }
  8526. protected function createRule2Literals(PackageInterface $issuer, PackageInterface $provider, $reason, $reasonData = null)
  8527. {
  8528. if ($issuer === $provider) {
  8529. return null;
  8530. }
  8531. return new Rule2Literals(-$issuer->id, -$provider->id, $reason, $reasonData);
  8532. }
  8533. private function addRule($type, Rule $newRule = null)
  8534. {
  8535. if (!$newRule) {
  8536. return;
  8537. }
  8538. $this->rules->add($newRule, $type);
  8539. }
  8540. protected function whitelistFromPackage(PackageInterface $package)
  8541. {
  8542. $workQueue = new \SplQueue;
  8543. $workQueue->enqueue($package);
  8544. while (!$workQueue->isEmpty()) {
  8545. $package = $workQueue->dequeue();
  8546. if (isset($this->whitelistedMap[$package->id])) {
  8547. continue;
  8548. }
  8549. $this->whitelistedMap[$package->id] = true;
  8550. foreach ($package->getRequires() as $link) {
  8551. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint(), true);
  8552. foreach ($possibleRequires as $require) {
  8553. $workQueue->enqueue($require);
  8554. }
  8555. }
  8556. $obsoleteProviders = $this->pool->whatProvides($package->getName(), null, true);
  8557. foreach ($obsoleteProviders as $provider) {
  8558. if ($provider === $package) {
  8559. continue;
  8560. }
  8561. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  8562. $workQueue->enqueue($provider);
  8563. }
  8564. }
  8565. }
  8566. }
  8567. protected function addRulesForPackage(PackageInterface $package, $ignorePlatformReqs)
  8568. {
  8569. $workQueue = new \SplQueue;
  8570. $workQueue->enqueue($package);
  8571. while (!$workQueue->isEmpty()) {
  8572. $package = $workQueue->dequeue();
  8573. if (isset($this->addedMap[$package->id])) {
  8574. continue;
  8575. }
  8576. $this->addedMap[$package->id] = true;
  8577. foreach ($package->getRequires() as $link) {
  8578. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  8579. continue;
  8580. }
  8581. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  8582. $this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createRequireRule($package, $possibleRequires, Rule::RULE_PACKAGE_REQUIRES, $link));
  8583. foreach ($possibleRequires as $require) {
  8584. $workQueue->enqueue($require);
  8585. }
  8586. }
  8587. foreach ($package->getConflicts() as $link) {
  8588. $possibleConflicts = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  8589. foreach ($possibleConflicts as $conflict) {
  8590. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $conflict, Rule::RULE_PACKAGE_CONFLICT, $link));
  8591. }
  8592. }
  8593. $isInstalled = (isset($this->installedMap[$package->id]));
  8594. foreach ($package->getReplaces() as $link) {
  8595. $obsoleteProviders = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  8596. foreach ($obsoleteProviders as $provider) {
  8597. if ($provider === $package) {
  8598. continue;
  8599. }
  8600. if (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  8601. $reason = ($isInstalled) ? Rule::RULE_INSTALLED_PACKAGE_OBSOLETES : Rule::RULE_PACKAGE_OBSOLETES;
  8602. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $provider, $reason, $link));
  8603. }
  8604. }
  8605. }
  8606. $obsoleteProviders = $this->pool->whatProvides($package->getName(), null);
  8607. foreach ($obsoleteProviders as $provider) {
  8608. if ($provider === $package) {
  8609. continue;
  8610. }
  8611. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  8612. $this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createRequireRule($package, array($provider), Rule::RULE_PACKAGE_ALIAS, $package));
  8613. } elseif (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  8614. $reason = ($package->getName() == $provider->getName()) ? Rule::RULE_PACKAGE_SAME_NAME : Rule::RULE_PACKAGE_IMPLICIT_OBSOLETES;
  8615. $this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createRule2Literals($package, $provider, $reason, $package));
  8616. }
  8617. }
  8618. }
  8619. }
  8620. protected function obsoleteImpossibleForAlias($package, $provider)
  8621. {
  8622. $packageIsAlias = $package instanceof AliasPackage;
  8623. $providerIsAlias = $provider instanceof AliasPackage;
  8624. $impossible = (
  8625. ($packageIsAlias && $package->getAliasOf() === $provider) ||
  8626. ($providerIsAlias && $provider->getAliasOf() === $package) ||
  8627. ($packageIsAlias && $providerIsAlias && $provider->getAliasOf() === $package->getAliasOf())
  8628. );
  8629. return $impossible;
  8630. }
  8631. protected function whitelistFromJobs()
  8632. {
  8633. foreach ($this->jobs as $job) {
  8634. switch ($job['cmd']) {
  8635. case 'install':
  8636. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint'], true);
  8637. foreach ($packages as $package) {
  8638. $this->whitelistFromPackage($package);
  8639. }
  8640. break;
  8641. }
  8642. }
  8643. }
  8644. protected function addRulesForJobs($ignorePlatformReqs)
  8645. {
  8646. foreach ($this->jobs as $job) {
  8647. switch ($job['cmd']) {
  8648. case 'install':
  8649. if (!$job['fixed'] && $ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  8650. break;
  8651. }
  8652. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8653. if ($packages) {
  8654. foreach ($packages as $package) {
  8655. if (!isset($this->installedMap[$package->id])) {
  8656. $this->addRulesForPackage($package, $ignorePlatformReqs);
  8657. }
  8658. }
  8659. $rule = $this->createInstallOneOfRule($packages, Rule::RULE_JOB_INSTALL, $job);
  8660. $this->addRule(RuleSet::TYPE_JOB, $rule);
  8661. }
  8662. break;
  8663. case 'remove':
  8664. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8665. foreach ($packages as $package) {
  8666. $rule = $this->createRemoveRule($package, Rule::RULE_JOB_REMOVE, $job);
  8667. $this->addRule(RuleSet::TYPE_JOB, $rule);
  8668. }
  8669. break;
  8670. }
  8671. }
  8672. }
  8673. public function getRulesFor($jobs, $installedMap, $ignorePlatformReqs = false)
  8674. {
  8675. $this->jobs = $jobs;
  8676. $this->rules = new RuleSet;
  8677. $this->installedMap = $installedMap;
  8678. $this->whitelistedMap = array();
  8679. foreach ($this->installedMap as $package) {
  8680. $this->whitelistFromPackage($package);
  8681. }
  8682. $this->whitelistFromJobs();
  8683. $this->pool->setWhitelist($this->whitelistedMap);
  8684. $this->addedMap = array();
  8685. foreach ($this->installedMap as $package) {
  8686. $this->addRulesForPackage($package, $ignorePlatformReqs);
  8687. }
  8688. $this->addRulesForJobs($ignorePlatformReqs);
  8689. return $this->rules;
  8690. }
  8691. }
  8692. <?php
  8693. namespace Composer\DependencyResolver;
  8694. class RuleSetIterator implements \Iterator
  8695. {
  8696. protected $rules;
  8697. protected $types;
  8698. protected $currentOffset;
  8699. protected $currentType;
  8700. protected $currentTypeOffset;
  8701. public function __construct(array $rules)
  8702. {
  8703. $this->rules = $rules;
  8704. $this->types = array_keys($rules);
  8705. sort($this->types);
  8706. $this->rewind();
  8707. }
  8708. public function current()
  8709. {
  8710. return $this->rules[$this->currentType][$this->currentOffset];
  8711. }
  8712. public function key()
  8713. {
  8714. return $this->currentType;
  8715. }
  8716. public function next()
  8717. {
  8718. $this->currentOffset++;
  8719. if (!isset($this->rules[$this->currentType])) {
  8720. return;
  8721. }
  8722. if ($this->currentOffset >= count($this->rules[$this->currentType])) {
  8723. $this->currentOffset = 0;
  8724. do {
  8725. $this->currentTypeOffset++;
  8726. if (!isset($this->types[$this->currentTypeOffset])) {
  8727. $this->currentType = -1;
  8728. break;
  8729. }
  8730. $this->currentType = $this->types[$this->currentTypeOffset];
  8731. } while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
  8732. }
  8733. }
  8734. public function rewind()
  8735. {
  8736. $this->currentOffset = 0;
  8737. $this->currentTypeOffset = -1;
  8738. $this->currentType = -1;
  8739. do {
  8740. $this->currentTypeOffset++;
  8741. if (!isset($this->types[$this->currentTypeOffset])) {
  8742. $this->currentType = -1;
  8743. break;
  8744. }
  8745. $this->currentType = $this->types[$this->currentTypeOffset];
  8746. } while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
  8747. }
  8748. public function valid()
  8749. {
  8750. return isset($this->rules[$this->currentType])
  8751. && isset($this->rules[$this->currentType][$this->currentOffset]);
  8752. }
  8753. }
  8754. <?php
  8755. namespace Composer\DependencyResolver;
  8756. class RuleWatchChain extends \SplDoublyLinkedList
  8757. {
  8758. protected $offset = 0;
  8759. public function seek($offset)
  8760. {
  8761. $this->rewind();
  8762. for ($i = 0; $i < $offset; $i++, $this->next());
  8763. }
  8764. public function remove()
  8765. {
  8766. $offset = $this->key();
  8767. $this->offsetUnset($offset);
  8768. $this->seek($offset);
  8769. }
  8770. }
  8771. <?php
  8772. namespace Composer\DependencyResolver;
  8773. class RuleWatchGraph
  8774. {
  8775. protected $watchChains = array();
  8776. public function insert(RuleWatchNode $node)
  8777. {
  8778. if ($node->getRule()->isAssertion()) {
  8779. return;
  8780. }
  8781. foreach (array($node->watch1, $node->watch2) as $literal) {
  8782. if (!isset($this->watchChains[$literal])) {
  8783. $this->watchChains[$literal] = new RuleWatchChain;
  8784. }
  8785. $this->watchChains[$literal]->unshift($node);
  8786. }
  8787. }
  8788. public function propagateLiteral($decidedLiteral, $level, $decisions)
  8789. {
  8790. $literal = -$decidedLiteral;
  8791. if (!isset($this->watchChains[$literal])) {
  8792. return null;
  8793. }
  8794. $chain = $this->watchChains[$literal];
  8795. $chain->rewind();
  8796. while ($chain->valid()) {
  8797. $node = $chain->current();
  8798. $otherWatch = $node->getOtherWatch($literal);
  8799. if (!$node->getRule()->isDisabled() && !$decisions->satisfy($otherWatch)) {
  8800. $ruleLiterals = $node->getRule()->getLiterals();
  8801. $alternativeLiterals = array_filter($ruleLiterals, function ($ruleLiteral) use ($literal, $otherWatch, $decisions) {
  8802. return $literal !== $ruleLiteral &&
  8803. $otherWatch !== $ruleLiteral &&
  8804. !$decisions->conflict($ruleLiteral);
  8805. });
  8806. if ($alternativeLiterals) {
  8807. reset($alternativeLiterals);
  8808. $this->moveWatch($literal, current($alternativeLiterals), $node);
  8809. continue;
  8810. }
  8811. if ($decisions->conflict($otherWatch)) {
  8812. return $node->getRule();
  8813. }
  8814. $decisions->decide($otherWatch, $level, $node->getRule());
  8815. }
  8816. $chain->next();
  8817. }
  8818. return null;
  8819. }
  8820. protected function moveWatch($fromLiteral, $toLiteral, $node)
  8821. {
  8822. if (!isset($this->watchChains[$toLiteral])) {
  8823. $this->watchChains[$toLiteral] = new RuleWatchChain;
  8824. }
  8825. $node->moveWatch($fromLiteral, $toLiteral);
  8826. $this->watchChains[$fromLiteral]->remove();
  8827. $this->watchChains[$toLiteral]->unshift($node);
  8828. }
  8829. }
  8830. <?php
  8831. namespace Composer\DependencyResolver;
  8832. class RuleWatchNode
  8833. {
  8834. public $watch1;
  8835. public $watch2;
  8836. protected $rule;
  8837. public function __construct($rule)
  8838. {
  8839. $this->rule = $rule;
  8840. $literals = $rule->getLiterals();
  8841. $this->watch1 = count($literals) > 0 ? $literals[0] : 0;
  8842. $this->watch2 = count($literals) > 1 ? $literals[1] : 0;
  8843. }
  8844. public function watch2OnHighest(Decisions $decisions)
  8845. {
  8846. $literals = $this->rule->getLiterals();
  8847. if (count($literals) < 3) {
  8848. return;
  8849. }
  8850. $watchLevel = 0;
  8851. foreach ($literals as $literal) {
  8852. $level = $decisions->decisionLevel($literal);
  8853. if ($level > $watchLevel) {
  8854. $this->watch2 = $literal;
  8855. $watchLevel = $level;
  8856. }
  8857. }
  8858. }
  8859. public function getRule()
  8860. {
  8861. return $this->rule;
  8862. }
  8863. public function getOtherWatch($literal)
  8864. {
  8865. if ($this->watch1 == $literal) {
  8866. return $this->watch2;
  8867. }
  8868. return $this->watch1;
  8869. }
  8870. public function moveWatch($from, $to)
  8871. {
  8872. if ($this->watch1 == $from) {
  8873. $this->watch1 = $to;
  8874. } else {
  8875. $this->watch2 = $to;
  8876. }
  8877. }
  8878. }
  8879. <?php
  8880. namespace Composer\DependencyResolver;
  8881. use Composer\IO\IOInterface;
  8882. use Composer\Repository\RepositoryInterface;
  8883. use Composer\Repository\PlatformRepository;
  8884. class Solver
  8885. {
  8886. const BRANCH_LITERALS = 0;
  8887. const BRANCH_LEVEL = 1;
  8888. protected $policy;
  8889. protected $pool;
  8890. protected $installed;
  8891. protected $rules;
  8892. protected $ruleSetGenerator;
  8893. protected $jobs;
  8894. protected $updateMap = array();
  8895. protected $watchGraph;
  8896. protected $decisions;
  8897. protected $installedMap;
  8898. protected $propagateIndex;
  8899. protected $branches = array();
  8900. protected $problems = array();
  8901. protected $learnedPool = array();
  8902. protected $learnedWhy = array();
  8903. protected $io;
  8904. public function __construct(PolicyInterface $policy, Pool $pool, RepositoryInterface $installed, IOInterface $io)
  8905. {
  8906. $this->io = $io;
  8907. $this->policy = $policy;
  8908. $this->pool = $pool;
  8909. $this->installed = $installed;
  8910. $this->ruleSetGenerator = new RuleSetGenerator($policy, $pool);
  8911. }
  8912. public function getRuleSetSize()
  8913. {
  8914. return count($this->rules);
  8915. }
  8916. private function makeAssertionRuleDecisions()
  8917. {
  8918. $decisionStart = count($this->decisions) - 1;
  8919. $rulesCount = count($this->rules);
  8920. for ($ruleIndex = 0; $ruleIndex < $rulesCount; $ruleIndex++) {
  8921. $rule = $this->rules->ruleById[$ruleIndex];
  8922. if (!$rule->isAssertion() || $rule->isDisabled()) {
  8923. continue;
  8924. }
  8925. $literals = $rule->getLiterals();
  8926. $literal = $literals[0];
  8927. if (!$this->decisions->decided(abs($literal))) {
  8928. $this->decisions->decide($literal, 1, $rule);
  8929. continue;
  8930. }
  8931. if ($this->decisions->satisfy($literal)) {
  8932. continue;
  8933. }
  8934. if (RuleSet::TYPE_LEARNED === $rule->getType()) {
  8935. $rule->disable();
  8936. continue;
  8937. }
  8938. $conflict = $this->decisions->decisionRule($literal);
  8939. if ($conflict && RuleSet::TYPE_PACKAGE === $conflict->getType()) {
  8940. $problem = new Problem($this->pool);
  8941. $problem->addRule($rule);
  8942. $problem->addRule($conflict);
  8943. $this->disableProblem($rule);
  8944. $this->problems[] = $problem;
  8945. continue;
  8946. }
  8947. $problem = new Problem($this->pool);
  8948. $problem->addRule($rule);
  8949. $problem->addRule($conflict);
  8950. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_JOB) as $assertRule) {
  8951. if ($assertRule->isDisabled() || !$assertRule->isAssertion()) {
  8952. continue;
  8953. }
  8954. $assertRuleLiterals = $assertRule->getLiterals();
  8955. $assertRuleLiteral = $assertRuleLiterals[0];
  8956. if (abs($literal) !== abs($assertRuleLiteral)) {
  8957. continue;
  8958. }
  8959. $problem->addRule($assertRule);
  8960. $this->disableProblem($assertRule);
  8961. }
  8962. $this->problems[] = $problem;
  8963. $this->decisions->resetToOffset($decisionStart);
  8964. $ruleIndex = -1;
  8965. }
  8966. }
  8967. protected function setupInstalledMap()
  8968. {
  8969. $this->installedMap = array();
  8970. foreach ($this->installed->getPackages() as $package) {
  8971. $this->installedMap[$package->id] = $package;
  8972. }
  8973. }
  8974. protected function checkForRootRequireProblems($ignorePlatformReqs)
  8975. {
  8976. foreach ($this->jobs as $job) {
  8977. switch ($job['cmd']) {
  8978. case 'update':
  8979. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8980. foreach ($packages as $package) {
  8981. if (isset($this->installedMap[$package->id])) {
  8982. $this->updateMap[$package->id] = true;
  8983. }
  8984. }
  8985. break;
  8986. case 'update-all':
  8987. foreach ($this->installedMap as $package) {
  8988. $this->updateMap[$package->id] = true;
  8989. }
  8990. break;
  8991. case 'install':
  8992. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  8993. break;
  8994. }
  8995. if (!$this->pool->whatProvides($job['packageName'], $job['constraint'])) {
  8996. $problem = new Problem($this->pool);
  8997. $problem->addRule(new GenericRule(array(), null, null, $job));
  8998. $this->problems[] = $problem;
  8999. }
  9000. break;
  9001. }
  9002. }
  9003. }
  9004. public function solve(Request $request, $ignorePlatformReqs = false)
  9005. {
  9006. $this->jobs = $request->getJobs();
  9007. $this->setupInstalledMap();
  9008. $this->rules = $this->ruleSetGenerator->getRulesFor($this->jobs, $this->installedMap, $ignorePlatformReqs);
  9009. $this->checkForRootRequireProblems($ignorePlatformReqs);
  9010. $this->decisions = new Decisions($this->pool);
  9011. $this->watchGraph = new RuleWatchGraph;
  9012. foreach ($this->rules as $rule) {
  9013. $this->watchGraph->insert(new RuleWatchNode($rule));
  9014. }
  9015. $this->makeAssertionRuleDecisions();
  9016. $this->io->writeError('Resolving dependencies through SAT', true, IOInterface::DEBUG);
  9017. $before = microtime(true);
  9018. $this->runSat(true);
  9019. $this->io->writeError(sprintf('Dependency resolution completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERBOSE);
  9020. foreach ($this->installedMap as $packageId => $void) {
  9021. if ($this->decisions->undecided($packageId)) {
  9022. $this->decisions->decide(-$packageId, 1, null);
  9023. }
  9024. }
  9025. if ($this->problems) {
  9026. throw new SolverProblemsException($this->problems, $this->installedMap);
  9027. }
  9028. $transaction = new Transaction($this->policy, $this->pool, $this->installedMap, $this->decisions);
  9029. return $transaction->getOperations();
  9030. }
  9031. protected function propagate($level)
  9032. {
  9033. while ($this->decisions->validOffset($this->propagateIndex)) {
  9034. $decision = $this->decisions->atOffset($this->propagateIndex);
  9035. $conflict = $this->watchGraph->propagateLiteral(
  9036. $decision[Decisions::DECISION_LITERAL],
  9037. $level,
  9038. $this->decisions
  9039. );
  9040. $this->propagateIndex++;
  9041. if ($conflict) {
  9042. return $conflict;
  9043. }
  9044. }
  9045. return null;
  9046. }
  9047. private function revert($level)
  9048. {
  9049. while (!$this->decisions->isEmpty()) {
  9050. $literal = $this->decisions->lastLiteral();
  9051. if ($this->decisions->undecided($literal)) {
  9052. break;
  9053. }
  9054. $decisionLevel = $this->decisions->decisionLevel($literal);
  9055. if ($decisionLevel <= $level) {
  9056. break;
  9057. }
  9058. $this->decisions->revertLast();
  9059. $this->propagateIndex = count($this->decisions);
  9060. }
  9061. while (!empty($this->branches) && $this->branches[count($this->branches) - 1][self::BRANCH_LEVEL] >= $level) {
  9062. array_pop($this->branches);
  9063. }
  9064. }
  9065. private function setPropagateLearn($level, $literal, $disableRules, Rule $rule)
  9066. {
  9067. $level++;
  9068. $this->decisions->decide($literal, $level, $rule);
  9069. while (true) {
  9070. $rule = $this->propagate($level);
  9071. if (!$rule) {
  9072. break;
  9073. }
  9074. if ($level == 1) {
  9075. return $this->analyzeUnsolvable($rule, $disableRules);
  9076. }
  9077. list($learnLiteral, $newLevel, $newRule, $why) = $this->analyze($level, $rule);
  9078. if ($newLevel <= 0 || $newLevel >= $level) {
  9079. throw new SolverBugException(
  9080. "Trying to revert to invalid level ".(int) $newLevel." from level ".(int) $level."."
  9081. );
  9082. } elseif (!$newRule) {
  9083. throw new SolverBugException(
  9084. "No rule was learned from analyzing $rule at level $level."
  9085. );
  9086. }
  9087. $level = $newLevel;
  9088. $this->revert($level);
  9089. $this->rules->add($newRule, RuleSet::TYPE_LEARNED);
  9090. $this->learnedWhy[spl_object_hash($newRule)] = $why;
  9091. $ruleNode = new RuleWatchNode($newRule);
  9092. $ruleNode->watch2OnHighest($this->decisions);
  9093. $this->watchGraph->insert($ruleNode);
  9094. $this->decisions->decide($learnLiteral, $level, $newRule);
  9095. }
  9096. return $level;
  9097. }
  9098. private function selectAndInstall($level, array $decisionQueue, $disableRules, Rule $rule)
  9099. {
  9100. $literals = $this->policy->selectPreferredPackages($this->pool, $this->installedMap, $decisionQueue, $rule->getRequiredPackage());
  9101. $selectedLiteral = array_shift($literals);
  9102. if (count($literals)) {
  9103. $this->branches[] = array($literals, $level);
  9104. }
  9105. return $this->setPropagateLearn($level, $selectedLiteral, $disableRules, $rule);
  9106. }
  9107. protected function analyze($level, Rule $rule)
  9108. {
  9109. $analyzedRule = $rule;
  9110. $ruleLevel = 1;
  9111. $num = 0;
  9112. $l1num = 0;
  9113. $seen = array();
  9114. $learnedLiterals = array(null);
  9115. $decisionId = count($this->decisions);
  9116. $this->learnedPool[] = array();
  9117. while (true) {
  9118. $this->learnedPool[count($this->learnedPool) - 1][] = $rule;
  9119. foreach ($rule->getLiterals() as $literal) {
  9120. if ($this->decisions->satisfy($literal)) {
  9121. continue;
  9122. }
  9123. if (isset($seen[abs($literal)])) {
  9124. continue;
  9125. }
  9126. $seen[abs($literal)] = true;
  9127. $l = $this->decisions->decisionLevel($literal);
  9128. if (1 === $l) {
  9129. $l1num++;
  9130. } elseif ($level === $l) {
  9131. $num++;
  9132. } else {
  9133. $learnedLiterals[] = $literal;
  9134. if ($l > $ruleLevel) {
  9135. $ruleLevel = $l;
  9136. }
  9137. }
  9138. }
  9139. $l1retry = true;
  9140. while ($l1retry) {
  9141. $l1retry = false;
  9142. if (!$num && !--$l1num) {
  9143. break 2;
  9144. }
  9145. while (true) {
  9146. if ($decisionId <= 0) {
  9147. throw new SolverBugException(
  9148. "Reached invalid decision id $decisionId while looking through $rule for a literal present in the analyzed rule $analyzedRule."
  9149. );
  9150. }
  9151. $decisionId--;
  9152. $decision = $this->decisions->atOffset($decisionId);
  9153. $literal = $decision[Decisions::DECISION_LITERAL];
  9154. if (isset($seen[abs($literal)])) {
  9155. break;
  9156. }
  9157. }
  9158. unset($seen[abs($literal)]);
  9159. if ($num && 0 === --$num) {
  9160. $learnedLiterals[0] = -abs($literal);
  9161. if (!$l1num) {
  9162. break 2;
  9163. }
  9164. foreach ($learnedLiterals as $i => $learnedLiteral) {
  9165. if ($i !== 0) {
  9166. unset($seen[abs($learnedLiteral)]);
  9167. }
  9168. }
  9169. $l1num++;
  9170. $l1retry = true;
  9171. }
  9172. }
  9173. $decision = $this->decisions->atOffset($decisionId);
  9174. $rule = $decision[Decisions::DECISION_REASON];
  9175. }
  9176. $why = count($this->learnedPool) - 1;
  9177. if (!$learnedLiterals[0]) {
  9178. throw new SolverBugException(
  9179. "Did not find a learnable literal in analyzed rule $analyzedRule."
  9180. );
  9181. }
  9182. $newRule = new GenericRule($learnedLiterals, Rule::RULE_LEARNED, $why);
  9183. return array($learnedLiterals[0], $ruleLevel, $newRule, $why);
  9184. }
  9185. private function analyzeUnsolvableRule(Problem $problem, Rule $conflictRule)
  9186. {
  9187. $why = spl_object_hash($conflictRule);
  9188. if ($conflictRule->getType() == RuleSet::TYPE_LEARNED) {
  9189. $learnedWhy = $this->learnedWhy[$why];
  9190. $problemRules = $this->learnedPool[$learnedWhy];
  9191. foreach ($problemRules as $problemRule) {
  9192. $this->analyzeUnsolvableRule($problem, $problemRule);
  9193. }
  9194. return;
  9195. }
  9196. if ($conflictRule->getType() == RuleSet::TYPE_PACKAGE) {
  9197. return;
  9198. }
  9199. $problem->nextSection();
  9200. $problem->addRule($conflictRule);
  9201. }
  9202. private function analyzeUnsolvable(Rule $conflictRule, $disableRules)
  9203. {
  9204. $problem = new Problem($this->pool);
  9205. $problem->addRule($conflictRule);
  9206. $this->analyzeUnsolvableRule($problem, $conflictRule);
  9207. $this->problems[] = $problem;
  9208. $seen = array();
  9209. $literals = $conflictRule->getLiterals();
  9210. foreach ($literals as $literal) {
  9211. if ($this->decisions->satisfy($literal)) {
  9212. continue;
  9213. }
  9214. $seen[abs($literal)] = true;
  9215. }
  9216. foreach ($this->decisions as $decision) {
  9217. $literal = $decision[Decisions::DECISION_LITERAL];
  9218. if (!isset($seen[abs($literal)])) {
  9219. continue;
  9220. }
  9221. $why = $decision[Decisions::DECISION_REASON];
  9222. $problem->addRule($why);
  9223. $this->analyzeUnsolvableRule($problem, $why);
  9224. $literals = $why->getLiterals();
  9225. foreach ($literals as $literal) {
  9226. if ($this->decisions->satisfy($literal)) {
  9227. continue;
  9228. }
  9229. $seen[abs($literal)] = true;
  9230. }
  9231. }
  9232. if ($disableRules) {
  9233. foreach ($this->problems[count($this->problems) - 1] as $reason) {
  9234. $this->disableProblem($reason['rule']);
  9235. }
  9236. $this->resetSolver();
  9237. return 1;
  9238. }
  9239. return 0;
  9240. }
  9241. private function disableProblem(Rule $why)
  9242. {
  9243. $job = $why->getJob();
  9244. if (!$job) {
  9245. $why->disable();
  9246. return;
  9247. }
  9248. foreach ($this->rules as $rule) {
  9249. if ($job === $rule->getJob()) {
  9250. $rule->disable();
  9251. }
  9252. }
  9253. }
  9254. private function resetSolver()
  9255. {
  9256. $this->decisions->reset();
  9257. $this->propagateIndex = 0;
  9258. $this->branches = array();
  9259. $this->enableDisableLearnedRules();
  9260. $this->makeAssertionRuleDecisions();
  9261. }
  9262. private function enableDisableLearnedRules()
  9263. {
  9264. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_LEARNED) as $rule) {
  9265. $why = $this->learnedWhy[spl_object_hash($rule)];
  9266. $problemRules = $this->learnedPool[$why];
  9267. $foundDisabled = false;
  9268. foreach ($problemRules as $problemRule) {
  9269. if ($problemRule->isDisabled()) {
  9270. $foundDisabled = true;
  9271. break;
  9272. }
  9273. }
  9274. if ($foundDisabled && $rule->isEnabled()) {
  9275. $rule->disable();
  9276. } elseif (!$foundDisabled && $rule->isDisabled()) {
  9277. $rule->enable();
  9278. }
  9279. }
  9280. }
  9281. private function runSat($disableRules = true)
  9282. {
  9283. $this->propagateIndex = 0;
  9284. $decisionQueue = array();
  9285. $decisionSupplementQueue = array();
  9286. $disableRules = array();
  9287. $level = 1;
  9288. $systemLevel = $level + 1;
  9289. $installedPos = 0;
  9290. while (true) {
  9291. if (1 === $level) {
  9292. $conflictRule = $this->propagate($level);
  9293. if (null !== $conflictRule) {
  9294. if ($this->analyzeUnsolvable($conflictRule, $disableRules)) {
  9295. continue;
  9296. }
  9297. return;
  9298. }
  9299. }
  9300. if ($level < $systemLevel) {
  9301. $iterator = $this->rules->getIteratorFor(RuleSet::TYPE_JOB);
  9302. foreach ($iterator as $rule) {
  9303. if ($rule->isEnabled()) {
  9304. $decisionQueue = array();
  9305. $noneSatisfied = true;
  9306. foreach ($rule->getLiterals() as $literal) {
  9307. if ($this->decisions->satisfy($literal)) {
  9308. $noneSatisfied = false;
  9309. break;
  9310. }
  9311. if ($literal > 0 && $this->decisions->undecided($literal)) {
  9312. $decisionQueue[] = $literal;
  9313. }
  9314. }
  9315. if ($noneSatisfied && count($decisionQueue)) {
  9316. if (count($this->installed) != count($this->updateMap)) {
  9317. $prunedQueue = array();
  9318. foreach ($decisionQueue as $literal) {
  9319. if (isset($this->installedMap[abs($literal)])) {
  9320. $prunedQueue[] = $literal;
  9321. if (isset($this->updateMap[abs($literal)])) {
  9322. $prunedQueue = $decisionQueue;
  9323. break;
  9324. }
  9325. }
  9326. }
  9327. $decisionQueue = $prunedQueue;
  9328. }
  9329. }
  9330. if ($noneSatisfied && count($decisionQueue)) {
  9331. $oLevel = $level;
  9332. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  9333. if (0 === $level) {
  9334. return;
  9335. }
  9336. if ($level <= $oLevel) {
  9337. break;
  9338. }
  9339. }
  9340. }
  9341. }
  9342. $systemLevel = $level + 1;
  9343. $iterator->next();
  9344. if ($iterator->valid()) {
  9345. continue;
  9346. }
  9347. }
  9348. if ($level < $systemLevel) {
  9349. $systemLevel = $level;
  9350. }
  9351. $rulesCount = count($this->rules);
  9352. for ($i = 0, $n = 0; $n < $rulesCount; $i++, $n++) {
  9353. if ($i == $rulesCount) {
  9354. $i = 0;
  9355. }
  9356. $rule = $this->rules->ruleById[$i];
  9357. $literals = $rule->getLiterals();
  9358. if ($rule->isDisabled()) {
  9359. continue;
  9360. }
  9361. $decisionQueue = array();
  9362. foreach ($literals as $literal) {
  9363. if ($literal <= 0) {
  9364. if (!$this->decisions->decidedInstall(abs($literal))) {
  9365. continue 2;
  9366. }
  9367. } else {
  9368. if ($this->decisions->decidedInstall(abs($literal))) {
  9369. continue 2;
  9370. }
  9371. if ($this->decisions->undecided(abs($literal))) {
  9372. $decisionQueue[] = $literal;
  9373. }
  9374. }
  9375. }
  9376. if (count($decisionQueue) < 2) {
  9377. continue;
  9378. }
  9379. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  9380. if (0 === $level) {
  9381. return;
  9382. }
  9383. $rulesCount = count($this->rules);
  9384. $n = -1;
  9385. }
  9386. if ($level < $systemLevel) {
  9387. continue;
  9388. }
  9389. if (count($this->branches)) {
  9390. $lastLiteral = null;
  9391. $lastLevel = null;
  9392. $lastBranchIndex = 0;
  9393. $lastBranchOffset = 0;
  9394. for ($i = count($this->branches) - 1; $i >= 0; $i--) {
  9395. list($literals, $l) = $this->branches[$i];
  9396. foreach ($literals as $offset => $literal) {
  9397. if ($literal && $literal > 0 && $this->decisions->decisionLevel($literal) > $l + 1) {
  9398. $lastLiteral = $literal;
  9399. $lastBranchIndex = $i;
  9400. $lastBranchOffset = $offset;
  9401. $lastLevel = $l;
  9402. }
  9403. }
  9404. }
  9405. if ($lastLiteral) {
  9406. unset($this->branches[$lastBranchIndex][self::BRANCH_LITERALS][$lastBranchOffset]);
  9407. $level = $lastLevel;
  9408. $this->revert($level);
  9409. $why = $this->decisions->lastReason();
  9410. $level = $this->setPropagateLearn($level, $lastLiteral, $disableRules, $why);
  9411. if ($level == 0) {
  9412. return;
  9413. }
  9414. continue;
  9415. }
  9416. }
  9417. break;
  9418. }
  9419. }
  9420. }
  9421. <?php
  9422. namespace Composer\DependencyResolver;
  9423. class SolverBugException extends \RuntimeException
  9424. {
  9425. public function __construct($message)
  9426. {
  9427. parent::__construct(
  9428. $message."\nThis exception was most likely caused by a bug in Composer.\n".
  9429. "Please report the command you ran, the exact error you received, and your composer.json on https://github.com/composer/composer/issues - thank you!\n");
  9430. }
  9431. }
  9432. <?php
  9433. namespace Composer\DependencyResolver;
  9434. use Composer\Util\IniHelper;
  9435. class SolverProblemsException extends \RuntimeException
  9436. {
  9437. protected $problems;
  9438. protected $installedMap;
  9439. public function __construct(array $problems, array $installedMap)
  9440. {
  9441. $this->problems = $problems;
  9442. $this->installedMap = $installedMap;
  9443. parent::__construct($this->createMessage(), 2);
  9444. }
  9445. protected function createMessage()
  9446. {
  9447. $text = "\n";
  9448. $hasExtensionProblems = false;
  9449. foreach ($this->problems as $i => $problem) {
  9450. $text .= " Problem ".($i + 1).$problem->getPrettyString($this->installedMap)."\n";
  9451. if (!$hasExtensionProblems && $this->hasExtensionProblems($problem->getReasons())) {
  9452. $hasExtensionProblems = true;
  9453. }
  9454. }
  9455. if (strpos($text, 'could not be found') || strpos($text, 'no matching package found')) {
  9456. $text .= "\nPotential causes:\n - A typo in the package name\n - The package is not available in a stable-enough version according to your minimum-stability setting\n see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.\n - It's a private package and you forgot to add a custom repository to find it\n\nRead <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.";
  9457. }
  9458. if ($hasExtensionProblems) {
  9459. $text .= $this->createExtensionHint();
  9460. }
  9461. return $text;
  9462. }
  9463. public function getProblems()
  9464. {
  9465. return $this->problems;
  9466. }
  9467. private function createExtensionHint()
  9468. {
  9469. $paths = IniHelper::getAll();
  9470. if (count($paths) === 1 && empty($paths[0])) {
  9471. return '';
  9472. }
  9473. $text = "\n To enable extensions, verify that they are enabled in your .ini files:\n - ";
  9474. $text .= implode("\n - ", $paths);
  9475. $text .= "\n You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.";
  9476. return $text;
  9477. }
  9478. private function hasExtensionProblems(array $reasonSets)
  9479. {
  9480. foreach ($reasonSets as $reasonSet) {
  9481. foreach ($reasonSet as $reason) {
  9482. if (isset($reason["rule"]) && 0 === strpos($reason["rule"]->getRequiredPackage(), 'ext-')) {
  9483. return true;
  9484. }
  9485. }
  9486. }
  9487. return false;
  9488. }
  9489. }
  9490. <?php
  9491. namespace Composer\DependencyResolver;
  9492. use Composer\Package\AliasPackage;
  9493. class Transaction
  9494. {
  9495. protected $policy;
  9496. protected $pool;
  9497. protected $installedMap;
  9498. protected $decisions;
  9499. protected $transaction;
  9500. public function __construct($policy, $pool, $installedMap, $decisions)
  9501. {
  9502. $this->policy = $policy;
  9503. $this->pool = $pool;
  9504. $this->installedMap = $installedMap;
  9505. $this->decisions = $decisions;
  9506. $this->transaction = array();
  9507. }
  9508. public function getOperations()
  9509. {
  9510. $installMeansUpdateMap = $this->findUpdates();
  9511. $updateMap = array();
  9512. $installMap = array();
  9513. $uninstallMap = array();
  9514. foreach ($this->decisions as $i => $decision) {
  9515. $literal = $decision[Decisions::DECISION_LITERAL];
  9516. $reason = $decision[Decisions::DECISION_REASON];
  9517. $package = $this->pool->literalToPackage($literal);
  9518. if (($literal > 0) == (isset($this->installedMap[$package->id]))) {
  9519. continue;
  9520. }
  9521. if ($literal > 0) {
  9522. if (isset($installMeansUpdateMap[abs($literal)]) && !$package instanceof AliasPackage) {
  9523. $source = $installMeansUpdateMap[abs($literal)];
  9524. $updateMap[$package->id] = array(
  9525. 'package' => $package,
  9526. 'source' => $source,
  9527. 'reason' => $reason,
  9528. );
  9529. unset($installMeansUpdateMap[abs($literal)]);
  9530. $ignoreRemove[$source->id] = true;
  9531. } else {
  9532. $installMap[$package->id] = array(
  9533. 'package' => $package,
  9534. 'reason' => $reason,
  9535. );
  9536. }
  9537. }
  9538. }
  9539. foreach ($this->decisions as $i => $decision) {
  9540. $literal = $decision[Decisions::DECISION_LITERAL];
  9541. $reason = $decision[Decisions::DECISION_REASON];
  9542. $package = $this->pool->literalToPackage($literal);
  9543. if ($literal <= 0 &&
  9544. isset($this->installedMap[$package->id]) &&
  9545. !isset($ignoreRemove[$package->id])) {
  9546. $uninstallMap[$package->id] = array(
  9547. 'package' => $package,
  9548. 'reason' => $reason,
  9549. );
  9550. }
  9551. }
  9552. $this->transactionFromMaps($installMap, $updateMap, $uninstallMap);
  9553. return $this->transaction;
  9554. }
  9555. protected function transactionFromMaps($installMap, $updateMap, $uninstallMap)
  9556. {
  9557. $queue = array_map(
  9558. function ($operation) {
  9559. return $operation['package'];
  9560. },
  9561. $this->findRootPackages($installMap, $updateMap)
  9562. );
  9563. $visited = array();
  9564. while (!empty($queue)) {
  9565. $package = array_pop($queue);
  9566. $packageId = $package->id;
  9567. if (!isset($visited[$packageId])) {
  9568. $queue[] = $package;
  9569. if ($package instanceof AliasPackage) {
  9570. $queue[] = $package->getAliasOf();
  9571. } else {
  9572. foreach ($package->getRequires() as $link) {
  9573. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  9574. foreach ($possibleRequires as $require) {
  9575. $queue[] = $require;
  9576. }
  9577. }
  9578. }
  9579. $visited[$package->id] = true;
  9580. } else {
  9581. if (isset($installMap[$packageId])) {
  9582. $this->install(
  9583. $installMap[$packageId]['package'],
  9584. $installMap[$packageId]['reason']
  9585. );
  9586. unset($installMap[$packageId]);
  9587. }
  9588. if (isset($updateMap[$packageId])) {
  9589. $this->update(
  9590. $updateMap[$packageId]['source'],
  9591. $updateMap[$packageId]['package'],
  9592. $updateMap[$packageId]['reason']
  9593. );
  9594. unset($updateMap[$packageId]);
  9595. }
  9596. }
  9597. }
  9598. foreach ($uninstallMap as $uninstall) {
  9599. $this->uninstall($uninstall['package'], $uninstall['reason']);
  9600. }
  9601. }
  9602. protected function findRootPackages($installMap, $updateMap)
  9603. {
  9604. $packages = $installMap + $updateMap;
  9605. $roots = $packages;
  9606. foreach ($packages as $packageId => $operation) {
  9607. $package = $operation['package'];
  9608. if (!isset($roots[$packageId])) {
  9609. continue;
  9610. }
  9611. foreach ($package->getRequires() as $link) {
  9612. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  9613. foreach ($possibleRequires as $require) {
  9614. if ($require !== $package) {
  9615. unset($roots[$require->id]);
  9616. }
  9617. }
  9618. }
  9619. }
  9620. return $roots;
  9621. }
  9622. protected function findUpdates()
  9623. {
  9624. $installMeansUpdateMap = array();
  9625. foreach ($this->decisions as $i => $decision) {
  9626. $literal = $decision[Decisions::DECISION_LITERAL];
  9627. $package = $this->pool->literalToPackage($literal);
  9628. if ($package instanceof AliasPackage) {
  9629. continue;
  9630. }
  9631. if ($literal <= 0 && isset($this->installedMap[$package->id])) {
  9632. $updates = $this->policy->findUpdatePackages($this->pool, $this->installedMap, $package);
  9633. $literals = array($package->id);
  9634. foreach ($updates as $update) {
  9635. $literals[] = $update->id;
  9636. }
  9637. foreach ($literals as $updateLiteral) {
  9638. if ($updateLiteral !== $literal) {
  9639. $installMeansUpdateMap[abs($updateLiteral)] = $package;
  9640. }
  9641. }
  9642. }
  9643. }
  9644. return $installMeansUpdateMap;
  9645. }
  9646. protected function install($package, $reason)
  9647. {
  9648. if ($package instanceof AliasPackage) {
  9649. return $this->markAliasInstalled($package, $reason);
  9650. }
  9651. $this->transaction[] = new Operation\InstallOperation($package, $reason);
  9652. }
  9653. protected function update($from, $to, $reason)
  9654. {
  9655. $this->transaction[] = new Operation\UpdateOperation($from, $to, $reason);
  9656. }
  9657. protected function uninstall($package, $reason)
  9658. {
  9659. if ($package instanceof AliasPackage) {
  9660. return $this->markAliasUninstalled($package, $reason);
  9661. }
  9662. $this->transaction[] = new Operation\UninstallOperation($package, $reason);
  9663. }
  9664. protected function markAliasInstalled($package, $reason)
  9665. {
  9666. $this->transaction[] = new Operation\MarkAliasInstalledOperation($package, $reason);
  9667. }
  9668. protected function markAliasUninstalled($package, $reason)
  9669. {
  9670. $this->transaction[] = new Operation\MarkAliasUninstalledOperation($package, $reason);
  9671. }
  9672. }
  9673. <?php
  9674. namespace Composer\Downloader;
  9675. use Composer\Package\PackageInterface;
  9676. use Symfony\Component\Finder\Finder;
  9677. use Composer\IO\IOInterface;
  9678. abstract class ArchiveDownloader extends FileDownloader
  9679. {
  9680. public function download(PackageInterface $package, $path, $output = true)
  9681. {
  9682. $temporaryDir = $this->config->get('vendor-dir').'/composer/'.substr(md5(uniqid('', true)), 0, 8);
  9683. $retries = 3;
  9684. while ($retries--) {
  9685. $fileName = parent::download($package, $path, $output);
  9686. $this->io->writeError(' Extracting archive', false, IOInterface::VERBOSE);
  9687. try {
  9688. $this->filesystem->ensureDirectoryExists($temporaryDir);
  9689. try {
  9690. $this->extract($fileName, $temporaryDir);
  9691. } catch (\Exception $e) {
  9692. parent::clearLastCacheWrite($package);
  9693. throw $e;
  9694. }
  9695. $this->filesystem->unlink($fileName);
  9696. $contentDir = $this->getFolderContent($temporaryDir);
  9697. if (1 === count($contentDir) && is_dir(reset($contentDir))) {
  9698. $contentDir = $this->getFolderContent((string) reset($contentDir));
  9699. }
  9700. foreach ($contentDir as $file) {
  9701. $file = (string) $file;
  9702. $this->filesystem->rename($file, $path . '/' . basename($file));
  9703. }
  9704. $this->filesystem->removeDirectory($temporaryDir);
  9705. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir').'/composer/')) {
  9706. $this->filesystem->removeDirectory($this->config->get('vendor-dir').'/composer/');
  9707. }
  9708. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir'))) {
  9709. $this->filesystem->removeDirectory($this->config->get('vendor-dir'));
  9710. }
  9711. } catch (\Exception $e) {
  9712. $this->filesystem->removeDirectory($path);
  9713. $this->filesystem->removeDirectory($temporaryDir);
  9714. if ($retries && $e instanceof \UnexpectedValueException && class_exists('ZipArchive') && $e->getCode() === \ZipArchive::ER_NOZIP) {
  9715. $this->io->writeError('');
  9716. if ($this->io->isDebug()) {
  9717. $this->io->writeError(' Invalid zip file ('.$e->getMessage().'), retrying...');
  9718. } else {
  9719. $this->io->writeError(' Invalid zip file, retrying...');
  9720. }
  9721. usleep(500000);
  9722. continue;
  9723. }
  9724. throw $e;
  9725. }
  9726. break;
  9727. }
  9728. }
  9729. protected function getFileName(PackageInterface $package, $path)
  9730. {
  9731. return rtrim($path.'/'.md5($path.spl_object_hash($package)).'.'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_EXTENSION), '.');
  9732. }
  9733. abstract protected function extract($file, $path);
  9734. private function getFolderContent($dir)
  9735. {
  9736. $finder = Finder::create()
  9737. ->ignoreVCS(false)
  9738. ->ignoreDotFiles(false)
  9739. ->notName('.DS_Store')
  9740. ->depth(0)
  9741. ->in($dir);
  9742. return iterator_to_array($finder);
  9743. }
  9744. }
  9745. <?php
  9746. namespace Composer\Downloader;
  9747. use Composer\Package\PackageInterface;
  9748. interface ChangeReportInterface
  9749. {
  9750. public function getLocalChanges(PackageInterface $package, $path);
  9751. }
  9752. <?php
  9753. namespace Composer\Downloader;
  9754. use Composer\Package\PackageInterface;
  9755. use Composer\IO\IOInterface;
  9756. use Composer\Util\Filesystem;
  9757. class DownloadManager
  9758. {
  9759. private $io;
  9760. private $preferDist = false;
  9761. private $preferSource = false;
  9762. private $packagePreferences = array();
  9763. private $filesystem;
  9764. private $downloaders = array();
  9765. public function __construct(IOInterface $io, $preferSource = false, Filesystem $filesystem = null)
  9766. {
  9767. $this->io = $io;
  9768. $this->preferSource = $preferSource;
  9769. $this->filesystem = $filesystem ?: new Filesystem();
  9770. }
  9771. public function setPreferSource($preferSource)
  9772. {
  9773. $this->preferSource = $preferSource;
  9774. return $this;
  9775. }
  9776. public function setPreferDist($preferDist)
  9777. {
  9778. $this->preferDist = $preferDist;
  9779. return $this;
  9780. }
  9781. public function setPreferences(array $preferences)
  9782. {
  9783. $this->packagePreferences = $preferences;
  9784. return $this;
  9785. }
  9786. public function setOutputProgress($outputProgress)
  9787. {
  9788. foreach ($this->downloaders as $downloader) {
  9789. $downloader->setOutputProgress($outputProgress);
  9790. }
  9791. return $this;
  9792. }
  9793. public function setDownloader($type, DownloaderInterface $downloader)
  9794. {
  9795. $type = strtolower($type);
  9796. $this->downloaders[$type] = $downloader;
  9797. return $this;
  9798. }
  9799. public function getDownloader($type)
  9800. {
  9801. $type = strtolower($type);
  9802. if (!isset($this->downloaders[$type])) {
  9803. throw new \InvalidArgumentException(sprintf('Unknown downloader type: %s. Available types: %s.', $type, implode(', ', array_keys($this->downloaders))));
  9804. }
  9805. return $this->downloaders[$type];
  9806. }
  9807. public function getDownloaderForInstalledPackage(PackageInterface $package)
  9808. {
  9809. $installationSource = $package->getInstallationSource();
  9810. if ('metapackage' === $package->getType()) {
  9811. return;
  9812. }
  9813. if ('dist' === $installationSource) {
  9814. $downloader = $this->getDownloader($package->getDistType());
  9815. } elseif ('source' === $installationSource) {
  9816. $downloader = $this->getDownloader($package->getSourceType());
  9817. } else {
  9818. throw new \InvalidArgumentException(
  9819. 'Package '.$package.' seems not been installed properly'
  9820. );
  9821. }
  9822. if ($installationSource !== $downloader->getInstallationSource()) {
  9823. throw new \LogicException(sprintf(
  9824. 'Downloader "%s" is a %s type downloader and can not be used to download %s for package %s',
  9825. get_class($downloader), $downloader->getInstallationSource(), $installationSource, $package
  9826. ));
  9827. }
  9828. return $downloader;
  9829. }
  9830. public function download(PackageInterface $package, $targetDir, $preferSource = null)
  9831. {
  9832. $preferSource = null !== $preferSource ? $preferSource : $this->preferSource;
  9833. $sourceType = $package->getSourceType();
  9834. $distType = $package->getDistType();
  9835. $sources = array();
  9836. if ($sourceType) {
  9837. $sources[] = 'source';
  9838. }
  9839. if ($distType) {
  9840. $sources[] = 'dist';
  9841. }
  9842. if (empty($sources)) {
  9843. throw new \InvalidArgumentException('Package '.$package.' must have a source or dist specified');
  9844. }
  9845. if (!$preferSource && ($this->preferDist || 'dist' === $this->resolvePackageInstallPreference($package))) {
  9846. $sources = array_reverse($sources);
  9847. }
  9848. $this->filesystem->ensureDirectoryExists($targetDir);
  9849. foreach ($sources as $i => $source) {
  9850. if (isset($e)) {
  9851. $this->io->writeError(' <warning>Now trying to download from ' . $source . '</warning>');
  9852. }
  9853. $package->setInstallationSource($source);
  9854. try {
  9855. $downloader = $this->getDownloaderForInstalledPackage($package);
  9856. if ($downloader) {
  9857. $downloader->download($package, $targetDir);
  9858. }
  9859. break;
  9860. } catch (\RuntimeException $e) {
  9861. if ($i === count($sources) - 1) {
  9862. throw $e;
  9863. }
  9864. $this->io->writeError(
  9865. ' <warning>Failed to download '.
  9866. $package->getPrettyName().
  9867. ' from ' . $source . ': '.
  9868. $e->getMessage().'</warning>'
  9869. );
  9870. }
  9871. }
  9872. }
  9873. public function update(PackageInterface $initial, PackageInterface $target, $targetDir)
  9874. {
  9875. $downloader = $this->getDownloaderForInstalledPackage($initial);
  9876. if (!$downloader) {
  9877. return;
  9878. }
  9879. $installationSource = $initial->getInstallationSource();
  9880. if ('dist' === $installationSource) {
  9881. $initialType = $initial->getDistType();
  9882. $targetType = $target->getDistType();
  9883. } else {
  9884. $initialType = $initial->getSourceType();
  9885. $targetType = $target->getSourceType();
  9886. }
  9887. if ($target->isDev() && 'dist' === $installationSource) {
  9888. $downloader->remove($initial, $targetDir);
  9889. $this->download($target, $targetDir);
  9890. return;
  9891. }
  9892. if ($initialType === $targetType) {
  9893. $target->setInstallationSource($installationSource);
  9894. try {
  9895. $downloader->update($initial, $target, $targetDir);
  9896. return;
  9897. } catch (\RuntimeException $e) {
  9898. if (!$this->io->isInteractive()) {
  9899. throw $e;
  9900. }
  9901. $this->io->writeError('<error> Update failed ('.$e->getMessage().')</error>');
  9902. if (!$this->io->askConfirmation(' Would you like to try reinstalling the package instead [<comment>yes</comment>]? ', true)) {
  9903. throw $e;
  9904. }
  9905. }
  9906. }
  9907. $downloader->remove($initial, $targetDir);
  9908. $this->download($target, $targetDir, 'source' === $installationSource);
  9909. }
  9910. public function remove(PackageInterface $package, $targetDir)
  9911. {
  9912. $downloader = $this->getDownloaderForInstalledPackage($package);
  9913. if ($downloader) {
  9914. $downloader->remove($package, $targetDir);
  9915. }
  9916. }
  9917. protected function resolvePackageInstallPreference(PackageInterface $package)
  9918. {
  9919. foreach ($this->packagePreferences as $pattern => $preference) {
  9920. $pattern = '{^'.str_replace('\\*', '.*', preg_quote($pattern)).'$}i';
  9921. if (preg_match($pattern, $package->getName())) {
  9922. if ('dist' === $preference || (!$package->isDev() && 'auto' === $preference)) {
  9923. return 'dist';
  9924. }
  9925. return 'source';
  9926. }
  9927. }
  9928. return $package->isDev() ? 'source' : 'dist';
  9929. }
  9930. }
  9931. <?php
  9932. namespace Composer\Downloader;
  9933. use Composer\Package\PackageInterface;
  9934. interface DownloaderInterface
  9935. {
  9936. public function getInstallationSource();
  9937. public function download(PackageInterface $package, $path);
  9938. public function update(PackageInterface $initial, PackageInterface $target, $path);
  9939. public function remove(PackageInterface $package, $path);
  9940. public function setOutputProgress($outputProgress);
  9941. }
  9942. <?php
  9943. namespace Composer\Downloader;
  9944. use Composer\Package\PackageInterface;
  9945. interface DvcsDownloaderInterface
  9946. {
  9947. public function getUnpushedChanges(PackageInterface $package, $path);
  9948. }
  9949. <?php
  9950. namespace Composer\Downloader;
  9951. use Composer\Config;
  9952. use Composer\Cache;
  9953. use Composer\Factory;
  9954. use Composer\IO\IOInterface;
  9955. use Composer\Package\PackageInterface;
  9956. use Composer\Plugin\PluginEvents;
  9957. use Composer\Plugin\PreFileDownloadEvent;
  9958. use Composer\EventDispatcher\EventDispatcher;
  9959. use Composer\Util\Filesystem;
  9960. use Composer\Util\RemoteFilesystem;
  9961. use Composer\Util\Url as UrlUtil;
  9962. class FileDownloader implements DownloaderInterface
  9963. {
  9964. protected $io;
  9965. protected $config;
  9966. protected $rfs;
  9967. protected $filesystem;
  9968. protected $cache;
  9969. protected $outputProgress = true;
  9970. private $lastCacheWrites = array();
  9971. private $eventDispatcher;
  9972. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, RemoteFilesystem $rfs = null, Filesystem $filesystem = null)
  9973. {
  9974. $this->io = $io;
  9975. $this->config = $config;
  9976. $this->eventDispatcher = $eventDispatcher;
  9977. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  9978. $this->filesystem = $filesystem ?: new Filesystem();
  9979. $this->cache = $cache;
  9980. if ($this->cache && $this->cache->gcIsNecessary()) {
  9981. $this->cache->gc($config->get('cache-files-ttl'), $config->get('cache-files-maxsize'));
  9982. }
  9983. }
  9984. public function getInstallationSource()
  9985. {
  9986. return 'dist';
  9987. }
  9988. public function download(PackageInterface $package, $path, $output = true)
  9989. {
  9990. if (!$package->getDistUrl()) {
  9991. throw new \InvalidArgumentException('The given package is missing url information');
  9992. }
  9993. if ($output) {
  9994. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  9995. }
  9996. $urls = $package->getDistUrls();
  9997. while ($url = array_shift($urls)) {
  9998. try {
  9999. $fileName = $this->doDownload($package, $path, $url);
  10000. break;
  10001. } catch (\Exception $e) {
  10002. if ($this->io->isDebug()) {
  10003. $this->io->writeError('');
  10004. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getCode().': '.$e->getMessage());
  10005. } elseif (count($urls)) {
  10006. $this->io->writeError('');
  10007. $this->io->writeError(' Failed, trying the next URL ('.$e->getCode().': '.$e->getMessage().')', false);
  10008. }
  10009. if (!count($urls)) {
  10010. throw $e;
  10011. }
  10012. }
  10013. }
  10014. if ($output) {
  10015. $this->io->writeError('');
  10016. }
  10017. return $fileName;
  10018. }
  10019. protected function doDownload(PackageInterface $package, $path, $url)
  10020. {
  10021. $this->filesystem->emptyDirectory($path);
  10022. $fileName = $this->getFileName($package, $path);
  10023. $processedUrl = $this->processUrl($package, $url);
  10024. $hostname = parse_url($processedUrl, PHP_URL_HOST);
  10025. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $processedUrl);
  10026. if ($this->eventDispatcher) {
  10027. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  10028. }
  10029. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  10030. try {
  10031. $checksum = $package->getDistSha1Checksum();
  10032. $cacheKey = $this->getCacheKey($package, $processedUrl);
  10033. if (!$this->cache || ($checksum && $checksum !== $this->cache->sha1($cacheKey)) || !$this->cache->copyTo($cacheKey, $fileName)) {
  10034. if (!$this->outputProgress) {
  10035. $this->io->writeError('Downloading', false);
  10036. }
  10037. $retries = 3;
  10038. while ($retries--) {
  10039. try {
  10040. $rfs->copy($hostname, $processedUrl, $fileName, $this->outputProgress, $package->getTransportOptions());
  10041. break;
  10042. } catch (TransportException $e) {
  10043. if ((0 !== $e->getCode() && !in_array($e->getCode(), array(500, 502, 503, 504))) || !$retries) {
  10044. throw $e;
  10045. }
  10046. $this->io->writeError('');
  10047. $this->io->writeError(' Download failed, retrying...', true, IOInterface::VERBOSE);
  10048. usleep(500000);
  10049. }
  10050. }
  10051. if (!$this->outputProgress) {
  10052. $this->io->writeError(' (<comment>100%</comment>)', false);
  10053. }
  10054. if ($this->cache) {
  10055. $this->lastCacheWrites[$package->getName()] = $cacheKey;
  10056. $this->cache->copyFrom($cacheKey, $fileName);
  10057. }
  10058. } else {
  10059. $this->io->writeError('Loading from cache', false);
  10060. }
  10061. if (!file_exists($fileName)) {
  10062. throw new \UnexpectedValueException($url.' could not be saved to '.$fileName.', make sure the'
  10063. .' directory is writable and you have internet connectivity');
  10064. }
  10065. if ($checksum && hash_file('sha1', $fileName) !== $checksum) {
  10066. throw new \UnexpectedValueException('The checksum verification of the file failed (downloaded from '.$url.')');
  10067. }
  10068. } catch (\Exception $e) {
  10069. $this->filesystem->removeDirectory($path);
  10070. $this->clearLastCacheWrite($package);
  10071. throw $e;
  10072. }
  10073. return $fileName;
  10074. }
  10075. public function setOutputProgress($outputProgress)
  10076. {
  10077. $this->outputProgress = $outputProgress;
  10078. return $this;
  10079. }
  10080. protected function clearLastCacheWrite(PackageInterface $package)
  10081. {
  10082. if ($this->cache && isset($this->lastCacheWrites[$package->getName()])) {
  10083. $this->cache->remove($this->lastCacheWrites[$package->getName()]);
  10084. unset($this->lastCacheWrites[$package->getName()]);
  10085. }
  10086. }
  10087. public function update(PackageInterface $initial, PackageInterface $target, $path)
  10088. {
  10089. $name = $target->getName();
  10090. $from = $initial->getPrettyVersion();
  10091. $to = $target->getPrettyVersion();
  10092. $this->io->writeError(" - Updating <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  10093. $this->remove($initial, $path, false);
  10094. $this->download($target, $path, false);
  10095. $this->io->writeError('');
  10096. }
  10097. public function remove(PackageInterface $package, $path, $output = true)
  10098. {
  10099. if ($output) {
  10100. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  10101. }
  10102. if (!$this->filesystem->removeDirectory($path)) {
  10103. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  10104. }
  10105. }
  10106. protected function getFileName(PackageInterface $package, $path)
  10107. {
  10108. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  10109. }
  10110. protected function processUrl(PackageInterface $package, $url)
  10111. {
  10112. if (!extension_loaded('openssl') && 0 === strpos($url, 'https:')) {
  10113. throw new \RuntimeException('You must enable the openssl extension to download files via https');
  10114. }
  10115. if ($package->getDistReference()) {
  10116. $url = UrlUtil::updateDistReference($this->config, $url, $package->getDistReference());
  10117. }
  10118. return $url;
  10119. }
  10120. private function getCacheKey(PackageInterface $package, $processedUrl)
  10121. {
  10122. $cacheKey = sha1($processedUrl);
  10123. return $package->getName().'/'.$cacheKey.'.'.$package->getDistType();
  10124. }
  10125. }
  10126. <?php
  10127. namespace Composer\Downloader;
  10128. class FilesystemException extends \Exception
  10129. {
  10130. public function __construct($message = '', $code = 0, \Exception $previous = null)
  10131. {
  10132. parent::__construct("Filesystem exception: \n".$message, $code, $previous);
  10133. }
  10134. }
  10135. <?php
  10136. namespace Composer\Downloader;
  10137. use Composer\Package\PackageInterface;
  10138. use Composer\Util\ProcessExecutor;
  10139. class FossilDownloader extends VcsDownloader
  10140. {
  10141. public function doDownload(PackageInterface $package, $path, $url)
  10142. {
  10143. $this->config->prohibitUrlByConfig($url, $this->io);
  10144. $url = ProcessExecutor::escape($url);
  10145. $ref = ProcessExecutor::escape($package->getSourceReference());
  10146. $repoFile = $path . '.fossil';
  10147. $this->io->writeError("Cloning ".$package->getSourceReference());
  10148. $command = sprintf('fossil clone %s %s', $url, ProcessExecutor::escape($repoFile));
  10149. if (0 !== $this->process->execute($command, $ignoredOutput)) {
  10150. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10151. }
  10152. $command = sprintf('fossil open %s --nested', ProcessExecutor::escape($repoFile));
  10153. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10154. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10155. }
  10156. $command = sprintf('fossil update %s', $ref);
  10157. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10158. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10159. }
  10160. }
  10161. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10162. {
  10163. $this->config->prohibitUrlByConfig($url, $this->io);
  10164. $url = ProcessExecutor::escape($url);
  10165. $ref = ProcessExecutor::escape($target->getSourceReference());
  10166. $this->io->writeError(" Updating to ".$target->getSourceReference());
  10167. if (!$this->hasMetadataRepository($path)) {
  10168. throw new \RuntimeException('The .fslckout file is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10169. }
  10170. $command = sprintf('fossil pull && fossil up %s', $ref);
  10171. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10172. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10173. }
  10174. }
  10175. public function getLocalChanges(PackageInterface $package, $path)
  10176. {
  10177. if (!$this->hasMetadataRepository($path)) {
  10178. return null;
  10179. }
  10180. $this->process->execute('fossil changes', $output, realpath($path));
  10181. return trim($output) ?: null;
  10182. }
  10183. protected function getCommitLogs($fromReference, $toReference, $path)
  10184. {
  10185. $command = sprintf('fossil timeline -t ci -W 0 -n 0 before %s', ProcessExecutor::escape($toReference));
  10186. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  10187. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10188. }
  10189. $log = '';
  10190. $match = '/\d\d:\d\d:\d\d\s+\[' . $toReference . '\]/';
  10191. foreach ($this->process->splitLines($output) as $line) {
  10192. if (preg_match($match, $line)) {
  10193. break;
  10194. }
  10195. $log .= $line;
  10196. }
  10197. return $log;
  10198. }
  10199. protected function hasMetadataRepository($path)
  10200. {
  10201. return is_file($path . '/.fslckout') || is_file($path . '/_FOSSIL_');
  10202. }
  10203. }
  10204. <?php
  10205. namespace Composer\Downloader;
  10206. use Composer\Config;
  10207. use Composer\IO\IOInterface;
  10208. use Composer\Package\PackageInterface;
  10209. use Composer\Util\Filesystem;
  10210. use Composer\Util\Git as GitUtil;
  10211. use Composer\Util\Platform;
  10212. use Composer\Util\ProcessExecutor;
  10213. class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
  10214. {
  10215. private $hasStashedChanges = false;
  10216. private $hasDiscardedChanges = false;
  10217. private $gitUtil;
  10218. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  10219. {
  10220. parent::__construct($io, $config, $process, $fs);
  10221. $this->gitUtil = new GitUtil($this->io, $this->config, $this->process, $this->filesystem);
  10222. }
  10223. public function doDownload(PackageInterface $package, $path, $url)
  10224. {
  10225. GitUtil::cleanEnv();
  10226. $path = $this->normalizePath($path);
  10227. $cachePath = $this->config->get('cache-vcs-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $url).'/';
  10228. $ref = $package->getSourceReference();
  10229. $flag = Platform::isWindows() ? '/D ' : '';
  10230. $gitVersion = $this->gitUtil->getVersion();
  10231. $msg = "Cloning ".$this->getShortHash($ref);
  10232. $command = 'git clone --no-checkout %url% %path% && cd '.$flag.'%path% && git remote add composer %url% && git fetch composer';
  10233. if ($gitVersion && version_compare($gitVersion, '2.3.0-rc0', '>=')) {
  10234. $this->io->writeError('', true, IOInterface::DEBUG);
  10235. $this->io->writeError(sprintf(' Cloning to cache at %s', ProcessExecutor::escape($cachePath)), true, IOInterface::DEBUG);
  10236. try {
  10237. $this->gitUtil->fetchRefOrSyncMirror($url, $cachePath, $ref);
  10238. if (is_dir($cachePath)) {
  10239. $command =
  10240. 'git clone --no-checkout %cachePath% %path% --dissociate --reference %cachePath% '
  10241. . '&& cd '.$flag.'%path% '
  10242. . '&& git remote set-url origin %url% && git remote add composer %url%';
  10243. $msg = "Cloning ".$this->getShortHash($ref).' from cache';
  10244. }
  10245. } catch (\RuntimeException $e) {
  10246. }
  10247. }
  10248. $this->io->writeError($msg);
  10249. $commandCallable = function ($url) use ($path, $command, $cachePath) {
  10250. return str_replace(
  10251. array('%url%', '%path%', '%cachePath%'),
  10252. array(
  10253. ProcessExecutor::escape($url),
  10254. ProcessExecutor::escape($path),
  10255. ProcessExecutor::escape($cachePath),
  10256. ),
  10257. $command
  10258. );
  10259. };
  10260. $this->gitUtil->runCommand($commandCallable, $url, $path, true);
  10261. if ($url !== $package->getSourceUrl()) {
  10262. $this->updateOriginUrl($path, $package->getSourceUrl());
  10263. } else {
  10264. $this->setPushUrl($path, $url);
  10265. }
  10266. if ($newRef = $this->updateToCommit($path, $ref, $package->getPrettyVersion(), $package->getReleaseDate())) {
  10267. if ($package->getDistReference() === $package->getSourceReference()) {
  10268. $package->setDistReference($newRef);
  10269. }
  10270. $package->setSourceReference($newRef);
  10271. }
  10272. }
  10273. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10274. {
  10275. GitUtil::cleanEnv();
  10276. if (!$this->hasMetadataRepository($path)) {
  10277. throw new \RuntimeException('The .git directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10278. }
  10279. $updateOriginUrl = false;
  10280. if (
  10281. 0 === $this->process->execute('git remote -v', $output, $path)
  10282. && preg_match('{^origin\s+(?P<url>\S+)}m', $output, $originMatch)
  10283. && preg_match('{^composer\s+(?P<url>\S+)}m', $output, $composerMatch)
  10284. ) {
  10285. if ($originMatch['url'] === $composerMatch['url'] && $composerMatch['url'] !== $target->getSourceUrl()) {
  10286. $updateOriginUrl = true;
  10287. }
  10288. }
  10289. $ref = $target->getSourceReference();
  10290. $this->io->writeError(" Checking out ".$this->getShortHash($ref));
  10291. $command = 'git remote set-url composer %s && git rev-parse --quiet --verify %s || (git fetch composer && git fetch --tags composer)';
  10292. $commandCallable = function ($url) use ($command, $ref) {
  10293. return sprintf($command, ProcessExecutor::escape($url), ProcessExecutor::escape($ref.'^{commit}'));
  10294. };
  10295. $this->gitUtil->runCommand($commandCallable, $url, $path);
  10296. if ($newRef = $this->updateToCommit($path, $ref, $target->getPrettyVersion(), $target->getReleaseDate())) {
  10297. if ($target->getDistReference() === $target->getSourceReference()) {
  10298. $target->setDistReference($newRef);
  10299. }
  10300. $target->setSourceReference($newRef);
  10301. }
  10302. if ($updateOriginUrl) {
  10303. $this->updateOriginUrl($path, $target->getSourceUrl());
  10304. }
  10305. }
  10306. public function getLocalChanges(PackageInterface $package, $path)
  10307. {
  10308. GitUtil::cleanEnv();
  10309. if (!$this->hasMetadataRepository($path)) {
  10310. return;
  10311. }
  10312. $command = 'git status --porcelain --untracked-files=no';
  10313. if (0 !== $this->process->execute($command, $output, $path)) {
  10314. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10315. }
  10316. return trim($output) ?: null;
  10317. }
  10318. public function getUnpushedChanges(PackageInterface $package, $path)
  10319. {
  10320. GitUtil::cleanEnv();
  10321. $path = $this->normalizePath($path);
  10322. if (!$this->hasMetadataRepository($path)) {
  10323. return;
  10324. }
  10325. $command = 'git show-ref --head -d';
  10326. if (0 !== $this->process->execute($command, $output, $path)) {
  10327. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10328. }
  10329. $refs = trim($output);
  10330. if (!preg_match('{^([a-f0-9]+) HEAD$}mi', $refs, $match)) {
  10331. return;
  10332. }
  10333. $headRef = $match[1];
  10334. if (!preg_match_all('{^'.$headRef.' refs/heads/(.+)$}mi', $refs, $matches)) {
  10335. return;
  10336. }
  10337. $branch = $matches[1][0];
  10338. $unpushedChanges = null;
  10339. for ($i = 0; $i <= 1; $i++) {
  10340. foreach ($matches[1] as $candidate) {
  10341. if (preg_match('{^[a-f0-9]+ refs/remotes/((?:composer|origin)/'.preg_quote($candidate).')$}mi', $refs, $match)) {
  10342. $branch = $candidate;
  10343. $remoteBranch = $match[1];
  10344. break;
  10345. }
  10346. }
  10347. if (!isset($remoteBranch)) {
  10348. $unpushedChanges = 'Branch ' . $branch . ' could not be found on the origin remote and appears to be unpushed';
  10349. } else {
  10350. $command = sprintf('git diff --name-status %s...%s --', $remoteBranch, $branch);
  10351. if (0 !== $this->process->execute($command, $output, $path)) {
  10352. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10353. }
  10354. $unpushedChanges = trim($output) ?: null;
  10355. }
  10356. if ($unpushedChanges && $i === 0) {
  10357. $this->process->execute('git fetch composer && git fetch origin', $output, $path);
  10358. }
  10359. if (!$unpushedChanges) {
  10360. break;
  10361. }
  10362. }
  10363. return $unpushedChanges;
  10364. }
  10365. protected function cleanChanges(PackageInterface $package, $path, $update)
  10366. {
  10367. GitUtil::cleanEnv();
  10368. $path = $this->normalizePath($path);
  10369. $unpushed = $this->getUnpushedChanges($package, $path);
  10370. if ($unpushed && ($this->io->isInteractive() || $this->config->get('discard-changes') !== true)) {
  10371. throw new \RuntimeException('Source directory ' . $path . ' has unpushed changes on the current branch: '."\n".$unpushed);
  10372. }
  10373. if (!$changes = $this->getLocalChanges($package, $path)) {
  10374. return;
  10375. }
  10376. if (!$this->io->isInteractive()) {
  10377. $discardChanges = $this->config->get('discard-changes');
  10378. if (true === $discardChanges) {
  10379. return $this->discardChanges($path);
  10380. }
  10381. if ('stash' === $discardChanges) {
  10382. if (!$update) {
  10383. return parent::cleanChanges($package, $path, $update);
  10384. }
  10385. return $this->stashChanges($path);
  10386. }
  10387. return parent::cleanChanges($package, $path, $update);
  10388. }
  10389. $changes = array_map(function ($elem) {
  10390. return ' '.$elem;
  10391. }, preg_split('{\s*\r?\n\s*}', $changes));
  10392. $this->io->writeError(' <error>The package has modified files:</error>');
  10393. $this->io->writeError(array_slice($changes, 0, 10));
  10394. if (count($changes) > 10) {
  10395. $this->io->writeError(' <info>' . (count($changes) - 10) . ' more files modified, choose "v" to view the full list</info>');
  10396. }
  10397. while (true) {
  10398. switch ($this->io->ask(' <info>Discard changes [y,n,v,d,'.($update ? 's,' : '').'?]?</info> ', '?')) {
  10399. case 'y':
  10400. $this->discardChanges($path);
  10401. break 2;
  10402. case 's':
  10403. if (!$update) {
  10404. goto help;
  10405. }
  10406. $this->stashChanges($path);
  10407. break 2;
  10408. case 'n':
  10409. throw new \RuntimeException('Update aborted');
  10410. case 'v':
  10411. $this->io->writeError($changes);
  10412. break;
  10413. case 'd':
  10414. $this->viewDiff($path);
  10415. break;
  10416. case '?':
  10417. default:
  10418. help:
  10419. $this->io->writeError(array(
  10420. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  10421. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  10422. ' v - view modified files',
  10423. ' d - view local modifications (diff)',
  10424. ));
  10425. if ($update) {
  10426. $this->io->writeError(' s - stash changes and try to reapply them after the update');
  10427. }
  10428. $this->io->writeError(' ? - print help');
  10429. break;
  10430. }
  10431. }
  10432. }
  10433. protected function reapplyChanges($path)
  10434. {
  10435. $path = $this->normalizePath($path);
  10436. if ($this->hasStashedChanges) {
  10437. $this->hasStashedChanges = false;
  10438. $this->io->writeError(' <info>Re-applying stashed changes</info>');
  10439. if (0 !== $this->process->execute('git stash pop', $output, $path)) {
  10440. throw new \RuntimeException("Failed to apply stashed changes:\n\n".$this->process->getErrorOutput());
  10441. }
  10442. }
  10443. $this->hasDiscardedChanges = false;
  10444. }
  10445. protected function updateToCommit($path, $reference, $branch, $date)
  10446. {
  10447. $force = $this->hasDiscardedChanges || $this->hasStashedChanges ? '-f ' : '';
  10448. $template = 'git checkout '.$force.'%s -- && git reset --hard %1$s --';
  10449. $branch = preg_replace('{(?:^dev-|(?:\.x)?-dev$)}i', '', $branch);
  10450. $branches = null;
  10451. if (0 === $this->process->execute('git branch -r', $output, $path)) {
  10452. $branches = $output;
  10453. }
  10454. $gitRef = $reference;
  10455. if (!preg_match('{^[a-f0-9]{40}$}', $reference)
  10456. && $branches
  10457. && preg_match('{^\s+composer/'.preg_quote($reference).'$}m', $branches)
  10458. ) {
  10459. $command = sprintf('git checkout '.$force.'-B %s %s -- && git reset --hard %2$s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$reference));
  10460. if (0 === $this->process->execute($command, $output, $path)) {
  10461. return;
  10462. }
  10463. }
  10464. if (preg_match('{^[a-f0-9]{40}$}', $reference)) {
  10465. if (!preg_match('{^\s+composer/'.preg_quote($branch).'$}m', $branches) && preg_match('{^\s+composer/v'.preg_quote($branch).'$}m', $branches)) {
  10466. $branch = 'v' . $branch;
  10467. }
  10468. $command = sprintf('git checkout %s --', ProcessExecutor::escape($branch));
  10469. $fallbackCommand = sprintf('git checkout '.$force.'-B %s %s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$branch));
  10470. if (0 === $this->process->execute($command, $output, $path)
  10471. || 0 === $this->process->execute($fallbackCommand, $output, $path)
  10472. ) {
  10473. $command = sprintf('git reset --hard %s --', ProcessExecutor::escape($reference));
  10474. if (0 === $this->process->execute($command, $output, $path)) {
  10475. return;
  10476. }
  10477. }
  10478. }
  10479. $command = sprintf($template, ProcessExecutor::escape($gitRef));
  10480. if (0 === $this->process->execute($command, $output, $path)) {
  10481. return;
  10482. }
  10483. if (false !== strpos($this->process->getErrorOutput(), $reference)) {
  10484. $this->io->writeError(' <warning>'.$reference.' is gone (history was rewritten?)</warning>');
  10485. }
  10486. throw new \RuntimeException(GitUtil::sanitizeUrl('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()));
  10487. }
  10488. protected function updateOriginUrl($path, $url)
  10489. {
  10490. $this->process->execute(sprintf('git remote set-url origin %s', ProcessExecutor::escape($url)), $output, $path);
  10491. $this->setPushUrl($path, $url);
  10492. }
  10493. protected function setPushUrl($path, $url)
  10494. {
  10495. if (preg_match('{^(?:https?|git)://'.GitUtil::getGitHubDomainsRegex($this->config).'/([^/]+)/([^/]+?)(?:\.git)?$}', $url, $match)) {
  10496. $protocols = $this->config->get('github-protocols');
  10497. $pushUrl = 'git@'.$match[1].':'.$match[2].'/'.$match[3].'.git';
  10498. if (!in_array('ssh', $protocols, true)) {
  10499. $pushUrl = 'https://' . $match[1] . '/'.$match[2].'/'.$match[3].'.git';
  10500. }
  10501. $cmd = sprintf('git remote set-url --push origin %s', ProcessExecutor::escape($pushUrl));
  10502. $this->process->execute($cmd, $ignoredOutput, $path);
  10503. }
  10504. }
  10505. protected function getCommitLogs($fromReference, $toReference, $path)
  10506. {
  10507. $path = $this->normalizePath($path);
  10508. $command = sprintf('git log %s..%s --pretty=format:"%%h - %%an: %%s"', ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
  10509. if (0 !== $this->process->execute($command, $output, $path)) {
  10510. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10511. }
  10512. return $output;
  10513. }
  10514. protected function discardChanges($path)
  10515. {
  10516. $path = $this->normalizePath($path);
  10517. if (0 !== $this->process->execute('git reset --hard', $output, $path)) {
  10518. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  10519. }
  10520. $this->hasDiscardedChanges = true;
  10521. }
  10522. protected function stashChanges($path)
  10523. {
  10524. $path = $this->normalizePath($path);
  10525. if (0 !== $this->process->execute('git stash --include-untracked', $output, $path)) {
  10526. throw new \RuntimeException("Could not stash changes\n\n:".$this->process->getErrorOutput());
  10527. }
  10528. $this->hasStashedChanges = true;
  10529. }
  10530. protected function viewDiff($path)
  10531. {
  10532. $path = $this->normalizePath($path);
  10533. if (0 !== $this->process->execute('git diff HEAD', $output, $path)) {
  10534. throw new \RuntimeException("Could not view diff\n\n:".$this->process->getErrorOutput());
  10535. }
  10536. $this->io->writeError($output);
  10537. }
  10538. protected function normalizePath($path)
  10539. {
  10540. if (Platform::isWindows() && strlen($path) > 0) {
  10541. $basePath = $path;
  10542. $removed = array();
  10543. while (!is_dir($basePath) && $basePath !== '\\') {
  10544. array_unshift($removed, basename($basePath));
  10545. $basePath = dirname($basePath);
  10546. }
  10547. if ($basePath === '\\') {
  10548. return $path;
  10549. }
  10550. $path = rtrim(realpath($basePath) . '/' . implode('/', $removed), '/');
  10551. }
  10552. return $path;
  10553. }
  10554. protected function hasMetadataRepository($path)
  10555. {
  10556. $path = $this->normalizePath($path);
  10557. return is_dir($path.'/.git');
  10558. }
  10559. protected function getShortHash($reference)
  10560. {
  10561. if (!$this->io->isVerbose() && preg_match('{^[0-9a-f]{40}$}', $reference)) {
  10562. return substr($reference, 0, 10);
  10563. }
  10564. return $reference;
  10565. }
  10566. }
  10567. <?php
  10568. namespace Composer\Downloader;
  10569. use Composer\Config;
  10570. use Composer\Cache;
  10571. use Composer\EventDispatcher\EventDispatcher;
  10572. use Composer\Package\PackageInterface;
  10573. use Composer\Util\Platform;
  10574. use Composer\Util\ProcessExecutor;
  10575. use Composer\Util\RemoteFilesystem;
  10576. use Composer\IO\IOInterface;
  10577. class GzipDownloader extends ArchiveDownloader
  10578. {
  10579. protected $process;
  10580. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  10581. {
  10582. $this->process = $process ?: new ProcessExecutor($io);
  10583. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  10584. }
  10585. protected function extract($file, $path)
  10586. {
  10587. $targetFilepath = $path . DIRECTORY_SEPARATOR . basename(substr($file, 0, -3));
  10588. if (!Platform::isWindows()) {
  10589. $command = 'gzip -cd ' . ProcessExecutor::escape($file) . ' > ' . ProcessExecutor::escape($targetFilepath);
  10590. if (0 === $this->process->execute($command, $ignoredOutput)) {
  10591. return;
  10592. }
  10593. if (extension_loaded('zlib')) {
  10594. $this->extractUsingExt($file, $targetFilepath);
  10595. return;
  10596. }
  10597. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  10598. throw new \RuntimeException($processError);
  10599. }
  10600. $this->extractUsingExt($file, $targetFilepath);
  10601. }
  10602. protected function getFileName(PackageInterface $package, $path)
  10603. {
  10604. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  10605. }
  10606. private function extractUsingExt($file, $targetFilepath)
  10607. {
  10608. $archiveFile = gzopen($file, 'rb');
  10609. $targetFile = fopen($targetFilepath, 'wb');
  10610. while ($string = gzread($archiveFile, 4096)) {
  10611. fwrite($targetFile, $string, Platform::strlen($string));
  10612. }
  10613. gzclose($archiveFile);
  10614. fclose($targetFile);
  10615. }
  10616. }
  10617. <?php
  10618. namespace Composer\Downloader;
  10619. use Composer\Package\PackageInterface;
  10620. use Composer\Util\ProcessExecutor;
  10621. class HgDownloader extends VcsDownloader
  10622. {
  10623. public function doDownload(PackageInterface $package, $path, $url)
  10624. {
  10625. $this->config->prohibitUrlByConfig($url, $this->io);
  10626. $url = ProcessExecutor::escape($url);
  10627. $ref = ProcessExecutor::escape($package->getSourceReference());
  10628. $this->io->writeError("Cloning ".$package->getSourceReference());
  10629. $command = sprintf('hg clone %s %s', $url, ProcessExecutor::escape($path));
  10630. if (0 !== $this->process->execute($command, $ignoredOutput)) {
  10631. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10632. }
  10633. $command = sprintf('hg up %s', $ref);
  10634. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10635. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10636. }
  10637. }
  10638. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10639. {
  10640. $this->config->prohibitUrlByConfig($url, $this->io);
  10641. $url = ProcessExecutor::escape($url);
  10642. $ref = ProcessExecutor::escape($target->getSourceReference());
  10643. $this->io->writeError(" Updating to ".$target->getSourceReference());
  10644. if (!$this->hasMetadataRepository($path)) {
  10645. throw new \RuntimeException('The .hg directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10646. }
  10647. $command = sprintf('hg pull %s && hg up %s', $url, $ref);
  10648. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10649. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10650. }
  10651. }
  10652. public function getLocalChanges(PackageInterface $package, $path)
  10653. {
  10654. if (!is_dir($path.'/.hg')) {
  10655. return null;
  10656. }
  10657. $this->process->execute('hg st', $output, realpath($path));
  10658. return trim($output) ?: null;
  10659. }
  10660. protected function getCommitLogs($fromReference, $toReference, $path)
  10661. {
  10662. $command = sprintf('hg log -r %s:%s --style compact', ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
  10663. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  10664. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10665. }
  10666. return $output;
  10667. }
  10668. protected function hasMetadataRepository($path)
  10669. {
  10670. return is_dir($path . '/.hg');
  10671. }
  10672. }
  10673. <?php
  10674. namespace Composer\Downloader;
  10675. use Composer\Package\Archiver\ArchivableFilesFinder;
  10676. use Composer\Package\Dumper\ArrayDumper;
  10677. use Composer\Package\PackageInterface;
  10678. use Composer\Package\Version\VersionGuesser;
  10679. use Composer\Package\Version\VersionParser;
  10680. use Composer\Util\Platform;
  10681. use Composer\Util\ProcessExecutor;
  10682. use Composer\Util\Filesystem as ComposerFilesystem;
  10683. use Symfony\Component\Filesystem\Exception\IOException;
  10684. use Symfony\Component\Filesystem\Filesystem;
  10685. class PathDownloader extends FileDownloader implements VcsCapableDownloaderInterface
  10686. {
  10687. const STRATEGY_SYMLINK = 10;
  10688. const STRATEGY_MIRROR = 20;
  10689. public function download(PackageInterface $package, $path, $output = true)
  10690. {
  10691. $url = $package->getDistUrl();
  10692. $realUrl = realpath($url);
  10693. if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
  10694. throw new \RuntimeException(sprintf(
  10695. 'Source path "%s" is not found for package %s', $url, $package->getName()
  10696. ));
  10697. }
  10698. if (strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) {
  10699. throw new \RuntimeException(sprintf(
  10700. 'Package %s cannot install to "%s" inside its source at "%s"',
  10701. $package->getName(), realpath($path), $realUrl
  10702. ));
  10703. }
  10704. $transportOptions = $package->getTransportOptions() + array('symlink' => null);
  10705. $currentStrategy = self::STRATEGY_SYMLINK;
  10706. $allowedStrategies = array(self::STRATEGY_SYMLINK, self::STRATEGY_MIRROR);
  10707. $mirrorPathRepos = getenv('COMPOSER_MIRROR_PATH_REPOS');
  10708. if ($mirrorPathRepos) {
  10709. $currentStrategy = self::STRATEGY_MIRROR;
  10710. }
  10711. if (true === $transportOptions['symlink']) {
  10712. $currentStrategy = self::STRATEGY_SYMLINK;
  10713. $allowedStrategies = array(self::STRATEGY_SYMLINK);
  10714. } elseif (false === $transportOptions['symlink']) {
  10715. $currentStrategy = self::STRATEGY_MIRROR;
  10716. $allowedStrategies = array(self::STRATEGY_MIRROR);
  10717. }
  10718. $fileSystem = new Filesystem();
  10719. $this->filesystem->removeDirectory($path);
  10720. if ($output) {
  10721. $this->io->writeError(sprintf(
  10722. ' - Installing <info>%s</info> (<comment>%s</comment>): ',
  10723. $package->getName(),
  10724. $package->getFullPrettyVersion()
  10725. ), false);
  10726. }
  10727. $isFallback = false;
  10728. if (self::STRATEGY_SYMLINK == $currentStrategy) {
  10729. try {
  10730. if (Platform::isWindows()) {
  10731. $this->io->writeError(sprintf('Junctioning from %s', $url), false);
  10732. $this->filesystem->junction($realUrl, $path);
  10733. } else {
  10734. $absolutePath = $path;
  10735. if (!$this->filesystem->isAbsolutePath($absolutePath)) {
  10736. $absolutePath = getcwd() . DIRECTORY_SEPARATOR . $path;
  10737. }
  10738. $shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl);
  10739. $path = rtrim($path, "/");
  10740. $this->io->writeError(sprintf('Symlinking from %s', $url), false);
  10741. $fileSystem->symlink($shortestPath, $path);
  10742. }
  10743. } catch (IOException $e) {
  10744. if (in_array(self::STRATEGY_MIRROR, $allowedStrategies)) {
  10745. $this->io->writeError('');
  10746. $this->io->writeError(' <error>Symlink failed, fallback to use mirroring!</error>');
  10747. $currentStrategy = self::STRATEGY_MIRROR;
  10748. $isFallback = true;
  10749. } else {
  10750. throw new \RuntimeException(sprintf('Symlink from "%s" to "%s" failed!', $realUrl, $path));
  10751. }
  10752. }
  10753. }
  10754. if (self::STRATEGY_MIRROR == $currentStrategy) {
  10755. $fs = new ComposerFilesystem();
  10756. $realUrl = $fs->normalizePath($realUrl);
  10757. $this->io->writeError(sprintf('%sMirroring from %s', $isFallback ? ' ' : '', $url), false);
  10758. $iterator = new ArchivableFilesFinder($realUrl, array());
  10759. $fileSystem->mirror($realUrl, $path, $iterator);
  10760. }
  10761. $this->io->writeError('');
  10762. }
  10763. public function remove(PackageInterface $package, $path, $output = true)
  10764. {
  10765. if (Platform::isWindows() && $this->filesystem->isJunction($path)) {
  10766. if ($output) {
  10767. $this->io->writeError(" - Removing junction for <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  10768. }
  10769. if (!$this->filesystem->removeJunction($path)) {
  10770. $this->io->writeError(" <warn>Could not remove junction at " . $path . " - is another process locking it?</warn>");
  10771. throw new \RuntimeException('Could not reliably remove junction for package ' . $package->getName());
  10772. }
  10773. } else {
  10774. parent::remove($package, $path, $output);
  10775. }
  10776. }
  10777. public function getVcsReference(PackageInterface $package, $path)
  10778. {
  10779. $parser = new VersionParser;
  10780. $guesser = new VersionGuesser($this->config, new ProcessExecutor($this->io), $parser);
  10781. $dumper = new ArrayDumper;
  10782. $packageConfig = $dumper->dump($package);
  10783. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  10784. return $packageVersion['commit'];
  10785. }
  10786. }
  10787. }
  10788. <?php
  10789. namespace Composer\Downloader;
  10790. use Composer\Util\Filesystem;
  10791. class PearPackageExtractor
  10792. {
  10793. private static $rolesWithoutPackageNamePrefix = array('php', 'script', 'www');
  10794. private $filesystem;
  10795. private $file;
  10796. public function __construct($file)
  10797. {
  10798. if (!is_file($file)) {
  10799. throw new \UnexpectedValueException('PEAR package file is not found at '.$file);
  10800. }
  10801. $this->filesystem = new Filesystem();
  10802. $this->file = $file;
  10803. }
  10804. public function extractTo($target, array $roles = array('php' => '/', 'script' => '/bin'), $vars = array())
  10805. {
  10806. $extractionPath = $target.'/tarball';
  10807. try {
  10808. $archive = new \PharData($this->file);
  10809. $archive->extractTo($extractionPath, null, true);
  10810. if (!is_file($this->combine($extractionPath, '/package.xml'))) {
  10811. throw new \RuntimeException('Invalid PEAR package. It must contain package.xml file.');
  10812. }
  10813. $fileCopyActions = $this->buildCopyActions($extractionPath, $roles, $vars);
  10814. $this->copyFiles($fileCopyActions, $extractionPath, $target, $roles, $vars);
  10815. $this->filesystem->removeDirectory($extractionPath);
  10816. } catch (\Exception $exception) {
  10817. throw new \UnexpectedValueException(sprintf('Failed to extract PEAR package %s to %s. Reason: %s', $this->file, $target, $exception->getMessage()), 0, $exception);
  10818. }
  10819. }
  10820. private function copyFiles($files, $source, $target, $roles, $vars)
  10821. {
  10822. foreach ($files as $file) {
  10823. $from = $this->combine($source, $file['from']);
  10824. $to = $this->combine($target, $roles[$file['role']]);
  10825. $to = $this->combine($to, $file['to']);
  10826. $tasks = $file['tasks'];
  10827. $this->copyFile($from, $to, $tasks, $vars);
  10828. }
  10829. }
  10830. private function copyFile($from, $to, $tasks, $vars)
  10831. {
  10832. if (!is_file($from)) {
  10833. throw new \RuntimeException('Invalid PEAR package. package.xml defines file that is not located inside tarball.');
  10834. }
  10835. $this->filesystem->ensureDirectoryExists(dirname($to));
  10836. if (0 == count($tasks)) {
  10837. $copied = copy($from, $to);
  10838. } else {
  10839. $content = file_get_contents($from);
  10840. $replacements = array();
  10841. foreach ($tasks as $task) {
  10842. $pattern = $task['from'];
  10843. $varName = $task['to'];
  10844. if (isset($vars[$varName])) {
  10845. if ($varName === 'php_bin' && false === strpos($to, '.bat')) {
  10846. $replacements[$pattern] = preg_replace('{\.bat$}', '', $vars[$varName]);
  10847. } else {
  10848. $replacements[$pattern] = $vars[$varName];
  10849. }
  10850. }
  10851. }
  10852. $content = strtr($content, $replacements);
  10853. $copied = file_put_contents($to, $content);
  10854. }
  10855. if (false === $copied) {
  10856. throw new \RuntimeException(sprintf('Failed to copy %s to %s', $from, $to));
  10857. }
  10858. }
  10859. private function buildCopyActions($source, array $roles, $vars)
  10860. {
  10861. $package = simplexml_load_string(file_get_contents($this->combine($source, 'package.xml')));
  10862. if (false === $package) {
  10863. throw new \RuntimeException('Package definition file is not valid.');
  10864. }
  10865. $packageSchemaVersion = $package['version'];
  10866. if ('1.0' == $packageSchemaVersion) {
  10867. $children = $package->release->filelist->children();
  10868. $packageName = (string) $package->name;
  10869. $packageVersion = (string) $package->release->version;
  10870. $sourceDir = $packageName . '-' . $packageVersion;
  10871. $result = $this->buildSourceList10($children, $roles, $sourceDir, '', null, $packageName);
  10872. } elseif ('2.0' == $packageSchemaVersion || '2.1' == $packageSchemaVersion) {
  10873. $children = $package->contents->children();
  10874. $packageName = (string) $package->name;
  10875. $packageVersion = (string) $package->version->release;
  10876. $sourceDir = $packageName . '-' . $packageVersion;
  10877. $result = $this->buildSourceList20($children, $roles, $sourceDir, '', null, $packageName);
  10878. $namespaces = $package->getNamespaces();
  10879. $package->registerXPathNamespace('ns', $namespaces['']);
  10880. $releaseNodes = $package->xpath('ns:phprelease');
  10881. $this->applyRelease($result, $releaseNodes, $vars);
  10882. } else {
  10883. throw new \RuntimeException('Unsupported schema version of package definition file.');
  10884. }
  10885. return $result;
  10886. }
  10887. private function applyRelease(&$actions, $releaseNodes, $vars)
  10888. {
  10889. foreach ($releaseNodes as $releaseNode) {
  10890. $requiredOs = $releaseNode->installconditions && $releaseNode->installconditions->os && $releaseNode->installconditions->os->name ? (string) $releaseNode->installconditions->os->name : '';
  10891. if ($requiredOs && $vars['os'] != $requiredOs) {
  10892. continue;
  10893. }
  10894. if ($releaseNode->filelist) {
  10895. foreach ($releaseNode->filelist->children() as $action) {
  10896. if ('install' == $action->getName()) {
  10897. $name = (string) $action['name'];
  10898. $as = (string) $action['as'];
  10899. if (isset($actions[$name])) {
  10900. $actions[$name]['to'] = $as;
  10901. }
  10902. } elseif ('ignore' == $action->getName()) {
  10903. $name = (string) $action['name'];
  10904. unset($actions[$name]);
  10905. } else {
  10906. }
  10907. }
  10908. }
  10909. break;
  10910. }
  10911. }
  10912. private function buildSourceList10($children, $targetRoles, $source, $target, $role, $packageName)
  10913. {
  10914. $result = array();
  10915. foreach ($children as $child) {
  10916. if ($child->getName() == 'dir') {
  10917. $dirSource = $this->combine($source, (string) $child['name']);
  10918. $dirTarget = $child['baseinstalldir'] ?: $target;
  10919. $dirRole = $child['role'] ?: $role;
  10920. $dirFiles = $this->buildSourceList10($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  10921. $result = array_merge($result, $dirFiles);
  10922. } elseif ($child->getName() == 'file') {
  10923. $fileRole = (string) $child['role'] ?: $role;
  10924. if (isset($targetRoles[$fileRole])) {
  10925. $fileName = (string) ($child['name'] ?: $child[0]);
  10926. $fileSource = $this->combine($source, $fileName);
  10927. $fileTarget = $this->combine((string) $child['baseinstalldir'] ?: $target, $fileName);
  10928. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  10929. $fileTarget = $packageName . '/' . $fileTarget;
  10930. }
  10931. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => array());
  10932. }
  10933. }
  10934. }
  10935. return $result;
  10936. }
  10937. private function buildSourceList20($children, $targetRoles, $source, $target, $role, $packageName)
  10938. {
  10939. $result = array();
  10940. foreach ($children as $child) {
  10941. if ('dir' == $child->getName()) {
  10942. $dirSource = $this->combine($source, $child['name']);
  10943. $dirTarget = $child['baseinstalldir'] ?: $target;
  10944. $dirRole = $child['role'] ?: $role;
  10945. $dirFiles = $this->buildSourceList20($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  10946. $result = array_merge($result, $dirFiles);
  10947. } elseif ('file' == $child->getName()) {
  10948. $fileRole = (string) $child['role'] ?: $role;
  10949. if (isset($targetRoles[$fileRole])) {
  10950. $fileSource = $this->combine($source, (string) $child['name']);
  10951. $fileTarget = $this->combine((string) ($child['baseinstalldir'] ?: $target), (string) $child['name']);
  10952. $fileTasks = array();
  10953. foreach ($child->children('http://pear.php.net/dtd/tasks-1.0') as $taskNode) {
  10954. if ('replace' == $taskNode->getName()) {
  10955. $fileTasks[] = array('from' => (string) $taskNode->attributes()->from, 'to' => (string) $taskNode->attributes()->to);
  10956. }
  10957. }
  10958. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  10959. $fileTarget = $packageName . '/' . $fileTarget;
  10960. }
  10961. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => $fileTasks);
  10962. }
  10963. }
  10964. }
  10965. return $result;
  10966. }
  10967. private function combine($left, $right)
  10968. {
  10969. return rtrim($left, '/') . '/' . ltrim($right, '/');
  10970. }
  10971. }
  10972. <?php
  10973. namespace Composer\Downloader;
  10974. use Composer\Package\PackageInterface;
  10975. use Composer\Repository\VcsRepository;
  10976. use Composer\Util\Perforce;
  10977. class PerforceDownloader extends VcsDownloader
  10978. {
  10979. protected $perforce;
  10980. public function doDownload(PackageInterface $package, $path, $url)
  10981. {
  10982. $ref = $package->getSourceReference();
  10983. $label = $this->getLabelFromSourceReference($ref);
  10984. $this->io->writeError('Cloning ' . $ref);
  10985. $this->initPerforce($package, $path, $url);
  10986. $this->perforce->setStream($ref);
  10987. $this->perforce->p4Login();
  10988. $this->perforce->writeP4ClientSpec();
  10989. $this->perforce->connectClient();
  10990. $this->perforce->syncCodeBase($label);
  10991. $this->perforce->cleanupClientSpec();
  10992. }
  10993. private function getLabelFromSourceReference($ref)
  10994. {
  10995. $pos = strpos($ref, '@');
  10996. if (false !== $pos) {
  10997. return substr($ref, $pos + 1);
  10998. }
  10999. return null;
  11000. }
  11001. public function initPerforce(PackageInterface $package, $path, $url)
  11002. {
  11003. if (!empty($this->perforce)) {
  11004. $this->perforce->initializePath($path);
  11005. return;
  11006. }
  11007. $repository = $package->getRepository();
  11008. $repoConfig = null;
  11009. if ($repository instanceof VcsRepository) {
  11010. $repoConfig = $this->getRepoConfig($repository);
  11011. }
  11012. $this->perforce = Perforce::create($repoConfig, $url, $path, $this->process, $this->io);
  11013. }
  11014. private function getRepoConfig(VcsRepository $repository)
  11015. {
  11016. return $repository->getRepoConfig();
  11017. }
  11018. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11019. {
  11020. $this->doDownload($target, $path, $url);
  11021. }
  11022. public function getLocalChanges(PackageInterface $package, $path)
  11023. {
  11024. $this->io->writeError('Perforce driver does not check for local changes before overriding', true);
  11025. return;
  11026. }
  11027. protected function getCommitLogs($fromReference, $toReference, $path)
  11028. {
  11029. return $this->perforce->getCommitLogs($fromReference, $toReference);
  11030. }
  11031. public function setPerforce($perforce)
  11032. {
  11033. $this->perforce = $perforce;
  11034. }
  11035. protected function hasMetadataRepository($path)
  11036. {
  11037. return true;
  11038. }
  11039. }
  11040. <?php
  11041. namespace Composer\Downloader;
  11042. class PharDownloader extends ArchiveDownloader
  11043. {
  11044. protected function extract($file, $path)
  11045. {
  11046. $archive = new \Phar($file);
  11047. $archive->extractTo($path, null, true);
  11048. }
  11049. }
  11050. <?php
  11051. namespace Composer\Downloader;
  11052. use Composer\Config;
  11053. use Composer\Cache;
  11054. use Composer\EventDispatcher\EventDispatcher;
  11055. use Composer\Util\IniHelper;
  11056. use Composer\Util\Platform;
  11057. use Composer\Util\ProcessExecutor;
  11058. use Composer\Util\RemoteFilesystem;
  11059. use Composer\IO\IOInterface;
  11060. use RarArchive;
  11061. class RarDownloader extends ArchiveDownloader
  11062. {
  11063. protected $process;
  11064. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11065. {
  11066. $this->process = $process ?: new ProcessExecutor($io);
  11067. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11068. }
  11069. protected function extract($file, $path)
  11070. {
  11071. $processError = null;
  11072. if (!Platform::isWindows()) {
  11073. $command = 'unrar x ' . ProcessExecutor::escape($file) . ' ' . ProcessExecutor::escape($path) . ' >/dev/null && chmod -R u+w ' . ProcessExecutor::escape($path);
  11074. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11075. return;
  11076. }
  11077. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  11078. }
  11079. if (!class_exists('RarArchive')) {
  11080. $iniMessage = IniHelper::getMessage();
  11081. $error = "Could not decompress the archive, enable the PHP rar extension or install unrar.\n"
  11082. . $iniMessage . "\n" . $processError;
  11083. if (!Platform::isWindows()) {
  11084. $error = "Could not decompress the archive, enable the PHP rar extension.\n" . $iniMessage;
  11085. }
  11086. throw new \RuntimeException($error);
  11087. }
  11088. $rarArchive = RarArchive::open($file);
  11089. if (false === $rarArchive) {
  11090. throw new \UnexpectedValueException('Could not open RAR archive: ' . $file);
  11091. }
  11092. $entries = $rarArchive->getEntries();
  11093. if (false === $entries) {
  11094. throw new \RuntimeException('Could not retrieve RAR archive entries');
  11095. }
  11096. foreach ($entries as $entry) {
  11097. if (false === $entry->extract($path)) {
  11098. throw new \RuntimeException('Could not extract entry');
  11099. }
  11100. }
  11101. $rarArchive->close();
  11102. }
  11103. }
  11104. <?php
  11105. namespace Composer\Downloader;
  11106. use Composer\Package\PackageInterface;
  11107. use Composer\Util\Svn as SvnUtil;
  11108. use Composer\Repository\VcsRepository;
  11109. use Composer\Util\ProcessExecutor;
  11110. class SvnDownloader extends VcsDownloader
  11111. {
  11112. protected $cacheCredentials = true;
  11113. public function doDownload(PackageInterface $package, $path, $url)
  11114. {
  11115. SvnUtil::cleanEnv();
  11116. $ref = $package->getSourceReference();
  11117. $repo = $package->getRepository();
  11118. if ($repo instanceof VcsRepository) {
  11119. $repoConfig = $repo->getRepoConfig();
  11120. if (array_key_exists('svn-cache-credentials', $repoConfig)) {
  11121. $this->cacheCredentials = (bool) $repoConfig['svn-cache-credentials'];
  11122. }
  11123. }
  11124. $this->io->writeError(" Checking out ".$package->getSourceReference());
  11125. $this->execute($url, "svn co", sprintf("%s/%s", $url, $ref), null, $path);
  11126. }
  11127. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11128. {
  11129. SvnUtil::cleanEnv();
  11130. $ref = $target->getSourceReference();
  11131. if (!$this->hasMetadataRepository($path)) {
  11132. throw new \RuntimeException('The .svn directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  11133. }
  11134. $util = new SvnUtil($url, $this->io, $this->config);
  11135. $flags = "";
  11136. if (version_compare($util->binaryVersion(), '1.7.0', '>=')) {
  11137. $flags .= ' --ignore-ancestry';
  11138. }
  11139. $this->io->writeError(" Checking out " . $ref);
  11140. $this->execute($url, "svn switch" . $flags, sprintf("%s/%s", $url, $ref), $path);
  11141. }
  11142. public function getLocalChanges(PackageInterface $package, $path)
  11143. {
  11144. if (!$this->hasMetadataRepository($path)) {
  11145. return null;
  11146. }
  11147. $this->process->execute('svn status --ignore-externals', $output, $path);
  11148. return preg_match('{^ *[^X ] +}m', $output) ? $output : null;
  11149. }
  11150. protected function execute($baseUrl, $command, $url, $cwd = null, $path = null)
  11151. {
  11152. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  11153. $util->setCacheCredentials($this->cacheCredentials);
  11154. try {
  11155. return $util->execute($command, $url, $cwd, $path, $this->io->isVerbose());
  11156. } catch (\RuntimeException $e) {
  11157. throw new \RuntimeException(
  11158. 'Package could not be downloaded, '.$e->getMessage()
  11159. );
  11160. }
  11161. }
  11162. protected function cleanChanges(PackageInterface $package, $path, $update)
  11163. {
  11164. if (!$changes = $this->getLocalChanges($package, $path)) {
  11165. return;
  11166. }
  11167. if (!$this->io->isInteractive()) {
  11168. if (true === $this->config->get('discard-changes')) {
  11169. return $this->discardChanges($path);
  11170. }
  11171. return parent::cleanChanges($package, $path, $update);
  11172. }
  11173. $changes = array_map(function ($elem) {
  11174. return ' '.$elem;
  11175. }, preg_split('{\s*\r?\n\s*}', $changes));
  11176. $countChanges = count($changes);
  11177. $this->io->writeError(sprintf(' <error>The package has modified file%s:</error>', $countChanges === 1 ? '' : 's'));
  11178. $this->io->writeError(array_slice($changes, 0, 10));
  11179. if ($countChanges > 10) {
  11180. $remaingChanges = $countChanges - 10;
  11181. $this->io->writeError(
  11182. sprintf(
  11183. ' <info>'.$remaingChanges.' more file%s modified, choose "v" to view the full list</info>',
  11184. $remaingChanges === 1 ? '' : 's'
  11185. )
  11186. );
  11187. }
  11188. while (true) {
  11189. switch ($this->io->ask(' <info>Discard changes [y,n,v,?]?</info> ', '?')) {
  11190. case 'y':
  11191. $this->discardChanges($path);
  11192. break 2;
  11193. case 'n':
  11194. throw new \RuntimeException('Update aborted');
  11195. case 'v':
  11196. $this->io->writeError($changes);
  11197. break;
  11198. case '?':
  11199. default:
  11200. $this->io->writeError(array(
  11201. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  11202. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  11203. ' v - view modified files',
  11204. ' ? - print help',
  11205. ));
  11206. break;
  11207. }
  11208. }
  11209. }
  11210. protected function getCommitLogs($fromReference, $toReference, $path)
  11211. {
  11212. if (preg_match('{.*@(\d+)$}', $fromReference) && preg_match('{.*@(\d+)$}', $toReference)) {
  11213. $command = sprintf('svn info --non-interactive --xml %s', ProcessExecutor::escape($path));
  11214. if (0 !== $this->process->execute($command, $output, $path)) {
  11215. throw new \RuntimeException(
  11216. 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()
  11217. );
  11218. }
  11219. $urlPattern = '#<url>(.*)</url>#';
  11220. if (preg_match($urlPattern, $output, $matches)) {
  11221. $baseUrl = $matches[1];
  11222. } else {
  11223. throw new \RuntimeException(
  11224. 'Unable to determine svn url for path '. $path
  11225. );
  11226. }
  11227. $fromRevision = preg_replace('{.*@(\d+)$}', '$1', $fromReference);
  11228. $toRevision = preg_replace('{.*@(\d+)$}', '$1', $toReference);
  11229. $command = sprintf('svn log -r%s:%s --incremental', ProcessExecutor::escape($fromRevision), ProcessExecutor::escape($toRevision));
  11230. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  11231. $util->setCacheCredentials($this->cacheCredentials);
  11232. try {
  11233. return $util->executeLocal($command, $path, null, $this->io->isVerbose());
  11234. } catch (\RuntimeException $e) {
  11235. throw new \RuntimeException(
  11236. 'Failed to execute ' . $command . "\n\n".$e->getMessage()
  11237. );
  11238. }
  11239. }
  11240. return "Could not retrieve changes between $fromReference and $toReference due to missing revision information";
  11241. }
  11242. protected function discardChanges($path)
  11243. {
  11244. if (0 !== $this->process->execute('svn revert -R .', $output, $path)) {
  11245. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  11246. }
  11247. }
  11248. protected function hasMetadataRepository($path)
  11249. {
  11250. return is_dir($path.'/.svn');
  11251. }
  11252. }
  11253. <?php
  11254. namespace Composer\Downloader;
  11255. class TarDownloader extends ArchiveDownloader
  11256. {
  11257. protected function extract($file, $path)
  11258. {
  11259. $archive = new \PharData($file);
  11260. $archive->extractTo($path, null, true);
  11261. }
  11262. }
  11263. <?php
  11264. namespace Composer\Downloader;
  11265. class TransportException extends \RuntimeException
  11266. {
  11267. protected $headers;
  11268. protected $response;
  11269. protected $statusCode;
  11270. public function setHeaders($headers)
  11271. {
  11272. $this->headers = $headers;
  11273. }
  11274. public function getHeaders()
  11275. {
  11276. return $this->headers;
  11277. }
  11278. public function setResponse($response)
  11279. {
  11280. $this->response = $response;
  11281. }
  11282. public function getResponse()
  11283. {
  11284. return $this->response;
  11285. }
  11286. public function setStatusCode($statusCode)
  11287. {
  11288. $this->statusCode = $statusCode;
  11289. }
  11290. public function getStatusCode()
  11291. {
  11292. return $this->statusCode;
  11293. }
  11294. }
  11295. <?php
  11296. namespace Composer\Downloader;
  11297. use Composer\Package\PackageInterface;
  11298. interface VcsCapableDownloaderInterface
  11299. {
  11300. public function getVcsReference(PackageInterface $package, $path);
  11301. }
  11302. <?php
  11303. namespace Composer\Downloader;
  11304. use Composer\Config;
  11305. use Composer\Package\Dumper\ArrayDumper;
  11306. use Composer\Package\PackageInterface;
  11307. use Composer\Package\Version\VersionGuesser;
  11308. use Composer\Package\Version\VersionParser;
  11309. use Composer\Util\ProcessExecutor;
  11310. use Composer\IO\IOInterface;
  11311. use Composer\Util\Filesystem;
  11312. abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterface, VcsCapableDownloaderInterface
  11313. {
  11314. protected $io;
  11315. protected $config;
  11316. protected $process;
  11317. protected $filesystem;
  11318. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  11319. {
  11320. $this->io = $io;
  11321. $this->config = $config;
  11322. $this->process = $process ?: new ProcessExecutor($io);
  11323. $this->filesystem = $fs ?: new Filesystem($this->process);
  11324. }
  11325. public function getInstallationSource()
  11326. {
  11327. return 'source';
  11328. }
  11329. public function download(PackageInterface $package, $path)
  11330. {
  11331. if (!$package->getSourceReference()) {
  11332. throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
  11333. }
  11334. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  11335. $this->filesystem->emptyDirectory($path);
  11336. $urls = $package->getSourceUrls();
  11337. while ($url = array_shift($urls)) {
  11338. try {
  11339. if (Filesystem::isLocalPath($url)) {
  11340. $needle = 'file://';
  11341. $isFileProtocol = false;
  11342. if (0 === strpos($url, $needle)) {
  11343. $url = substr($url, strlen($needle));
  11344. $isFileProtocol = true;
  11345. }
  11346. if (false !== strpos($url, '%')) {
  11347. $url = rawurldecode($url);
  11348. }
  11349. $url = realpath($url);
  11350. if ($isFileProtocol) {
  11351. $url = $needle . $url;
  11352. }
  11353. }
  11354. $this->doDownload($package, $path, $url);
  11355. break;
  11356. } catch (\Exception $e) {
  11357. if ($e instanceof \PHPUnit_Framework_Exception) {
  11358. throw $e;
  11359. }
  11360. if ($this->io->isDebug()) {
  11361. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getMessage());
  11362. } elseif (count($urls)) {
  11363. $this->io->writeError(' Failed, trying the next URL');
  11364. }
  11365. if (!count($urls)) {
  11366. throw $e;
  11367. }
  11368. }
  11369. }
  11370. }
  11371. public function update(PackageInterface $initial, PackageInterface $target, $path)
  11372. {
  11373. if (!$target->getSourceReference()) {
  11374. throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information');
  11375. }
  11376. $name = $target->getName();
  11377. if ($initial->getPrettyVersion() == $target->getPrettyVersion()) {
  11378. if ($target->getSourceType() === 'svn') {
  11379. $from = $initial->getSourceReference();
  11380. $to = $target->getSourceReference();
  11381. } else {
  11382. $from = substr($initial->getSourceReference(), 0, 7);
  11383. $to = substr($target->getSourceReference(), 0, 7);
  11384. }
  11385. $name .= ' '.$initial->getPrettyVersion();
  11386. } else {
  11387. $from = $initial->getFullPrettyVersion();
  11388. $to = $target->getFullPrettyVersion();
  11389. }
  11390. $this->io->writeError(" - Updating <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  11391. $this->cleanChanges($initial, $path, true);
  11392. $urls = $target->getSourceUrls();
  11393. $exception = null;
  11394. while ($url = array_shift($urls)) {
  11395. try {
  11396. if (Filesystem::isLocalPath($url)) {
  11397. $url = realpath($url);
  11398. }
  11399. $this->doUpdate($initial, $target, $path, $url);
  11400. $exception = null;
  11401. break;
  11402. } catch (\Exception $exception) {
  11403. if ($exception instanceof \PHPUnit_Framework_Exception) {
  11404. throw $exception;
  11405. }
  11406. if ($this->io->isDebug()) {
  11407. $this->io->writeError('Failed: ['.get_class($exception).'] '.$exception->getMessage());
  11408. } elseif (count($urls)) {
  11409. $this->io->writeError(' Failed, trying the next URL');
  11410. }
  11411. }
  11412. }
  11413. $this->reapplyChanges($path);
  11414. if (!$exception && $this->io->isVerbose() && $this->hasMetadataRepository($path)) {
  11415. $message = 'Pulling in changes:';
  11416. $logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
  11417. if (!trim($logs)) {
  11418. $message = 'Rolling back changes:';
  11419. $logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
  11420. }
  11421. if (trim($logs)) {
  11422. $logs = implode("\n", array_map(function ($line) {
  11423. return ' ' . $line;
  11424. }, explode("\n", $logs)));
  11425. $logs = str_replace('<', '\<', $logs);
  11426. $this->io->writeError(' '.$message);
  11427. $this->io->writeError($logs);
  11428. }
  11429. }
  11430. if (!$urls && $exception) {
  11431. throw $exception;
  11432. }
  11433. }
  11434. public function remove(PackageInterface $package, $path)
  11435. {
  11436. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
  11437. $this->cleanChanges($package, $path, false);
  11438. if (!$this->filesystem->removeDirectory($path)) {
  11439. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  11440. }
  11441. }
  11442. public function setOutputProgress($outputProgress)
  11443. {
  11444. return $this;
  11445. }
  11446. public function getVcsReference(PackageInterface $package, $path)
  11447. {
  11448. $parser = new VersionParser;
  11449. $guesser = new VersionGuesser($this->config, $this->process, $parser);
  11450. $dumper = new ArrayDumper;
  11451. $packageConfig = $dumper->dump($package);
  11452. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  11453. return $packageVersion['commit'];
  11454. }
  11455. }
  11456. protected function cleanChanges(PackageInterface $package, $path, $update)
  11457. {
  11458. if (null !== $this->getLocalChanges($package, $path)) {
  11459. throw new \RuntimeException('Source directory ' . $path . ' has uncommitted changes.');
  11460. }
  11461. }
  11462. protected function reapplyChanges($path)
  11463. {
  11464. }
  11465. abstract protected function doDownload(PackageInterface $package, $path, $url);
  11466. abstract protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url);
  11467. abstract protected function getCommitLogs($fromReference, $toReference, $path);
  11468. abstract protected function hasMetadataRepository($path);
  11469. }
  11470. <?php
  11471. namespace Composer\Downloader;
  11472. use Composer\Config;
  11473. use Composer\Cache;
  11474. use Composer\EventDispatcher\EventDispatcher;
  11475. use Composer\Package\PackageInterface;
  11476. use Composer\Util\ProcessExecutor;
  11477. use Composer\Util\RemoteFilesystem;
  11478. use Composer\IO\IOInterface;
  11479. class XzDownloader extends ArchiveDownloader
  11480. {
  11481. protected $process;
  11482. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11483. {
  11484. $this->process = $process ?: new ProcessExecutor($io);
  11485. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11486. }
  11487. protected function extract($file, $path)
  11488. {
  11489. $command = 'tar -xJf ' . ProcessExecutor::escape($file) . ' -C ' . ProcessExecutor::escape($path);
  11490. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11491. return;
  11492. }
  11493. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  11494. throw new \RuntimeException($processError);
  11495. }
  11496. protected function getFileName(PackageInterface $package, $path)
  11497. {
  11498. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  11499. }
  11500. }
  11501. <?php
  11502. namespace Composer\Downloader;
  11503. use Composer\Config;
  11504. use Composer\Cache;
  11505. use Composer\EventDispatcher\EventDispatcher;
  11506. use Composer\Package\PackageInterface;
  11507. use Composer\Util\IniHelper;
  11508. use Composer\Util\Platform;
  11509. use Composer\Util\ProcessExecutor;
  11510. use Composer\Util\RemoteFilesystem;
  11511. use Composer\IO\IOInterface;
  11512. use Symfony\Component\Process\ExecutableFinder;
  11513. use ZipArchive;
  11514. class ZipDownloader extends ArchiveDownloader
  11515. {
  11516. protected static $hasSystemUnzip;
  11517. private static $hasZipArchive;
  11518. private static $isWindows;
  11519. protected $process;
  11520. private $zipArchiveObject;
  11521. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11522. {
  11523. $this->process = $process ?: new ProcessExecutor($io);
  11524. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11525. }
  11526. public function download(PackageInterface $package, $path, $output = true)
  11527. {
  11528. if (null === self::$hasSystemUnzip) {
  11529. $finder = new ExecutableFinder;
  11530. self::$hasSystemUnzip = (bool) $finder->find('unzip');
  11531. }
  11532. if (null === self::$hasZipArchive) {
  11533. self::$hasZipArchive = class_exists('ZipArchive');
  11534. }
  11535. if (null === self::$isWindows) {
  11536. self::$isWindows = Platform::isWindows();
  11537. }
  11538. if (!self::$hasZipArchive && !self::$hasSystemUnzip) {
  11539. $iniMessage = IniHelper::getMessage();
  11540. $error = "The zip extension and unzip command are both missing, skipping.\n" . $iniMessage;
  11541. throw new \RuntimeException($error);
  11542. }
  11543. return parent::download($package, $path, $output);
  11544. }
  11545. protected function extractWithSystemUnzip($file, $path, $isLastChance)
  11546. {
  11547. if (!self::$hasZipArchive) {
  11548. $isLastChance = true;
  11549. }
  11550. if (!self::$hasSystemUnzip && !$isLastChance) {
  11551. return $this->extractWithZipArchive($file, $path, true);
  11552. }
  11553. $processError = null;
  11554. $overwrite = $isLastChance ? '-o' : '';
  11555. $command = 'unzip -qq '.$overwrite.' '.ProcessExecutor::escape($file).' -d '.ProcessExecutor::escape($path);
  11556. try {
  11557. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11558. return true;
  11559. }
  11560. $processError = new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11561. } catch (\Exception $e) {
  11562. $processError = $e;
  11563. }
  11564. if ($isLastChance) {
  11565. throw $processError;
  11566. }
  11567. $this->io->writeError(' '.$processError->getMessage());
  11568. $this->io->writeError(' The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)');
  11569. $this->io->writeError(' Unzip with unzip command failed, falling back to ZipArchive class');
  11570. return $this->extractWithZipArchive($file, $path, true);
  11571. }
  11572. protected function extractWithZipArchive($file, $path, $isLastChance)
  11573. {
  11574. if (!self::$hasSystemUnzip) {
  11575. $isLastChance = true;
  11576. }
  11577. if (!self::$hasZipArchive && !$isLastChance) {
  11578. return $this->extractWithSystemUnzip($file, $path, true);
  11579. }
  11580. $processError = null;
  11581. $zipArchive = $this->zipArchiveObject ?: new ZipArchive();
  11582. try {
  11583. if (true === ($retval = $zipArchive->open($file))) {
  11584. $extractResult = $zipArchive->extractTo($path);
  11585. if (true === $extractResult) {
  11586. $zipArchive->close();
  11587. return true;
  11588. }
  11589. $processError = new \RuntimeException(rtrim("There was an error extracting the ZIP file, it is either corrupted or using an invalid format.\n"));
  11590. } else {
  11591. $processError = new \UnexpectedValueException(rtrim($this->getErrorMessage($retval, $file)."\n"), $retval);
  11592. }
  11593. } catch (\ErrorException $e) {
  11594. $processError = new \RuntimeException('The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems): '.$e->getMessage(), 0, $e);
  11595. } catch (\Exception $e) {
  11596. $processError = $e;
  11597. }
  11598. if ($isLastChance) {
  11599. throw $processError;
  11600. }
  11601. $this->io->writeError(' '.$processError->getMessage());
  11602. $this->io->writeError(' Unzip with ZipArchive class failed, falling back to unzip command');
  11603. return $this->extractWithSystemUnzip($file, $path, true);
  11604. }
  11605. public function extract($file, $path)
  11606. {
  11607. if (self::$isWindows) {
  11608. $this->extractWithZipArchive($file, $path, false);
  11609. } else {
  11610. $this->extractWithSystemUnzip($file, $path, false);
  11611. }
  11612. }
  11613. protected function getErrorMessage($retval, $file)
  11614. {
  11615. switch ($retval) {
  11616. case ZipArchive::ER_EXISTS:
  11617. return sprintf("File '%s' already exists.", $file);
  11618. case ZipArchive::ER_INCONS:
  11619. return sprintf("Zip archive '%s' is inconsistent.", $file);
  11620. case ZipArchive::ER_INVAL:
  11621. return sprintf("Invalid argument (%s)", $file);
  11622. case ZipArchive::ER_MEMORY:
  11623. return sprintf("Malloc failure (%s)", $file);
  11624. case ZipArchive::ER_NOENT:
  11625. return sprintf("No such zip file: '%s'", $file);
  11626. case ZipArchive::ER_NOZIP:
  11627. return sprintf("'%s' is not a zip archive.", $file);
  11628. case ZipArchive::ER_OPEN:
  11629. return sprintf("Can't open zip file: %s", $file);
  11630. case ZipArchive::ER_READ:
  11631. return sprintf("Zip read error (%s)", $file);
  11632. case ZipArchive::ER_SEEK:
  11633. return sprintf("Zip seek error (%s)", $file);
  11634. default:
  11635. return sprintf("'%s' is not a valid zip archive, got error code: %s", $file, $retval);
  11636. }
  11637. }
  11638. }
  11639. <?php
  11640. namespace Composer\EventDispatcher;
  11641. class Event
  11642. {
  11643. protected $name;
  11644. protected $args;
  11645. protected $flags;
  11646. private $propagationStopped = false;
  11647. public function __construct($name, array $args = array(), array $flags = array())
  11648. {
  11649. $this->name = $name;
  11650. $this->args = $args;
  11651. $this->flags = $flags;
  11652. }
  11653. public function getName()
  11654. {
  11655. return $this->name;
  11656. }
  11657. public function getArguments()
  11658. {
  11659. return $this->args;
  11660. }
  11661. public function getFlags()
  11662. {
  11663. return $this->flags;
  11664. }
  11665. public function isPropagationStopped()
  11666. {
  11667. return $this->propagationStopped;
  11668. }
  11669. public function stopPropagation()
  11670. {
  11671. $this->propagationStopped = true;
  11672. }
  11673. }
  11674. <?php
  11675. namespace Composer\EventDispatcher;
  11676. use Composer\DependencyResolver\PolicyInterface;
  11677. use Composer\DependencyResolver\Pool;
  11678. use Composer\DependencyResolver\Request;
  11679. use Composer\Installer\InstallerEvent;
  11680. use Composer\IO\IOInterface;
  11681. use Composer\Composer;
  11682. use Composer\DependencyResolver\Operation\OperationInterface;
  11683. use Composer\Repository\CompositeRepository;
  11684. use Composer\Script;
  11685. use Composer\Installer\PackageEvent;
  11686. use Composer\Installer\BinaryInstaller;
  11687. use Composer\Util\ProcessExecutor;
  11688. use Composer\Script\Event as ScriptEvent;
  11689. use Symfony\Component\Process\PhpExecutableFinder;
  11690. class EventDispatcher
  11691. {
  11692. protected $composer;
  11693. protected $io;
  11694. protected $loader;
  11695. protected $process;
  11696. protected $listeners;
  11697. private $eventStack;
  11698. public function __construct(Composer $composer, IOInterface $io, ProcessExecutor $process = null)
  11699. {
  11700. $this->composer = $composer;
  11701. $this->io = $io;
  11702. $this->process = $process ?: new ProcessExecutor($io);
  11703. $this->eventStack = array();
  11704. }
  11705. public function dispatch($eventName, Event $event = null)
  11706. {
  11707. if (null === $event) {
  11708. $event = new Event($eventName);
  11709. }
  11710. return $this->doDispatch($event);
  11711. }
  11712. public function dispatchScript($eventName, $devMode = false, $additionalArgs = array(), $flags = array())
  11713. {
  11714. return $this->doDispatch(new Script\Event($eventName, $this->composer, $this->io, $devMode, $additionalArgs, $flags));
  11715. }
  11716. public function dispatchPackageEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  11717. {
  11718. return $this->doDispatch(new PackageEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations, $operation));
  11719. }
  11720. public function dispatchInstallerEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  11721. {
  11722. return $this->doDispatch(new InstallerEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations));
  11723. }
  11724. protected function doDispatch(Event $event)
  11725. {
  11726. $pathStr = 'PATH';
  11727. if (!isset($_SERVER[$pathStr]) && isset($_SERVER['Path'])) {
  11728. $pathStr = 'Path';
  11729. }
  11730. $binDir = $this->composer->getConfig()->get('bin-dir');
  11731. if (is_dir($binDir)) {
  11732. $binDir = realpath($binDir);
  11733. if (isset($_SERVER[$pathStr]) && !preg_match('{(^|'.PATH_SEPARATOR.')'.preg_quote($binDir).'($|'.PATH_SEPARATOR.')}', $_SERVER[$pathStr])) {
  11734. $_SERVER[$pathStr] = $binDir.PATH_SEPARATOR.getenv($pathStr);
  11735. putenv($pathStr.'='.$_SERVER[$pathStr]);
  11736. }
  11737. }
  11738. $listeners = $this->getListeners($event);
  11739. $this->pushEvent($event);
  11740. $return = 0;
  11741. foreach ($listeners as $callable) {
  11742. if (!is_string($callable)) {
  11743. if (!is_callable($callable)) {
  11744. $className = is_object($callable[0]) ? get_class($callable[0]) : $callable[0];
  11745. throw new \RuntimeException('Subscriber '.$className.'::'.$callable[1].' for event '.$event->getName().' is not callable, make sure the function is defined and public');
  11746. }
  11747. $event = $this->checkListenerExpectedEvent($callable, $event);
  11748. $return = false === call_user_func($callable, $event) ? 1 : 0;
  11749. } elseif ($this->isComposerScript($callable)) {
  11750. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $callable), true, IOInterface::VERBOSE);
  11751. $scriptName = substr($callable, 1);
  11752. $args = $event->getArguments();
  11753. $flags = $event->getFlags();
  11754. if (substr($callable, 0, 10) === '@composer ') {
  11755. $exec = $this->getPhpExecCommand() . ' ' . ProcessExecutor::escape(getenv('COMPOSER_BINARY')) . substr($callable, 9);
  11756. if (0 !== ($exitCode = $this->process->execute($exec))) {
  11757. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  11758. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  11759. }
  11760. } else {
  11761. if (!$this->getListeners(new Event($scriptName))) {
  11762. $this->io->writeError(sprintf('<warning>You made a reference to a non-existent script %s</warning>', $callable), true, IOInterface::QUIET);
  11763. }
  11764. try {
  11765. $return = $this->dispatch($scriptName, new Script\Event($scriptName, $event->getComposer(), $event->getIO(), $event->isDevMode(), $args, $flags));
  11766. } catch (ScriptExecutionException $e) {
  11767. $this->io->writeError(sprintf('<error>Script %s was called via %s</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  11768. throw $e;
  11769. }
  11770. }
  11771. } elseif ($this->isPhpScript($callable)) {
  11772. $className = substr($callable, 0, strpos($callable, '::'));
  11773. $methodName = substr($callable, strpos($callable, '::') + 2);
  11774. if (!class_exists($className)) {
  11775. $this->io->writeError('<warning>Class '.$className.' is not autoloadable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  11776. continue;
  11777. }
  11778. if (!is_callable($callable)) {
  11779. $this->io->writeError('<warning>Method '.$callable.' is not callable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  11780. continue;
  11781. }
  11782. try {
  11783. $return = false === $this->executeEventPhpScript($className, $methodName, $event) ? 1 : 0;
  11784. } catch (\Exception $e) {
  11785. $message = "Script %s handling the %s event terminated with an exception";
  11786. $this->io->writeError('<error>'.sprintf($message, $callable, $event->getName()).'</error>', true, IOInterface::QUIET);
  11787. throw $e;
  11788. }
  11789. } else {
  11790. $args = implode(' ', array_map(array('Composer\Util\ProcessExecutor', 'escape'), $event->getArguments()));
  11791. $exec = $callable . ($args === '' ? '' : ' '.$args);
  11792. if ($this->io->isVerbose()) {
  11793. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $exec));
  11794. } else {
  11795. $this->io->writeError(sprintf('> %s', $exec));
  11796. }
  11797. $possibleLocalBinaries = $this->composer->getPackage()->getBinaries();
  11798. if ($possibleLocalBinaries) {
  11799. foreach ($possibleLocalBinaries as $localExec) {
  11800. if (preg_match('{\b'.preg_quote($callable).'$}', $localExec)) {
  11801. $caller = BinaryInstaller::determineBinaryCaller($localExec);
  11802. $exec = preg_replace('{^'.preg_quote($callable).'}', $caller . ' ' . $localExec, $exec);
  11803. break;
  11804. }
  11805. }
  11806. }
  11807. if (substr($exec, 0, 5) === '@php ') {
  11808. $exec = $this->getPhpExecCommand() . ' ' . substr($exec, 5);
  11809. }
  11810. if (0 !== ($exitCode = $this->process->execute($exec))) {
  11811. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  11812. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  11813. }
  11814. }
  11815. if ($event->isPropagationStopped()) {
  11816. break;
  11817. }
  11818. }
  11819. $this->popEvent();
  11820. return $return;
  11821. }
  11822. protected function getPhpExecCommand()
  11823. {
  11824. $finder = new PhpExecutableFinder();
  11825. $phpPath = $finder->find();
  11826. if (!$phpPath) {
  11827. throw new \RuntimeException('Failed to locate PHP binary to execute '.$scriptName);
  11828. }
  11829. $allowUrlFOpenFlag = ' -d allow_url_fopen=' . ProcessExecutor::escape(ini_get('allow_url_fopen'));
  11830. $disableFunctionsFlag = ' -d disable_functions=' . ProcessExecutor::escape(ini_get('disable_functions'));
  11831. $memoryLimitFlag = ' -d memory_limit=' . ProcessExecutor::escape(ini_get('memory_limit'));
  11832. return ProcessExecutor::escape($phpPath) . $allowUrlFOpenFlag . $disableFunctionsFlag . $memoryLimitFlag;
  11833. }
  11834. protected function executeEventPhpScript($className, $methodName, Event $event)
  11835. {
  11836. $event = $this->checkListenerExpectedEvent(array($className, $methodName), $event);
  11837. if ($this->io->isVerbose()) {
  11838. $this->io->writeError(sprintf('> %s: %s::%s', $event->getName(), $className, $methodName));
  11839. } else {
  11840. $this->io->writeError(sprintf('> %s::%s', $className, $methodName));
  11841. }
  11842. return $className::$methodName($event);
  11843. }
  11844. protected function checkListenerExpectedEvent($target, Event $event)
  11845. {
  11846. if (in_array($event->getName(), array(
  11847. 'init',
  11848. 'command',
  11849. 'pre-file-download',
  11850. ), true)) {
  11851. return $event;
  11852. }
  11853. try {
  11854. $reflected = new \ReflectionParameter($target, 0);
  11855. } catch (\Exception $e) {
  11856. return $event;
  11857. }
  11858. $typehint = $reflected->getClass();
  11859. if (!$typehint instanceof \ReflectionClass) {
  11860. return $event;
  11861. }
  11862. $expected = $typehint->getName();
  11863. if (!$event instanceof $expected && $expected === 'Composer\Script\CommandEvent') {
  11864. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  11865. $event = new \Composer\Script\CommandEvent(
  11866. $event->getName(), $event->getComposer(), $event->getIO(), $event->isDevMode(), $event->getArguments()
  11867. );
  11868. }
  11869. if (!$event instanceof $expected && $expected === 'Composer\Script\PackageEvent') {
  11870. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  11871. $event = new \Composer\Script\PackageEvent(
  11872. $event->getName(), $event->getComposer(), $event->getIO(), $event->isDevMode(),
  11873. $event->getPolicy(), $event->getPool(), $event->getInstalledRepo(), $event->getRequest(),
  11874. $event->getOperations(), $event->getOperation()
  11875. );
  11876. }
  11877. if (!$event instanceof $expected && $expected === 'Composer\Script\Event') {
  11878. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  11879. $event = new \Composer\Script\Event(
  11880. $event->getName(), $event->getComposer(), $event->getIO(), $event->isDevMode(),
  11881. $event->getArguments(), $event->getFlags()
  11882. );
  11883. }
  11884. return $event;
  11885. }
  11886. private function serializeCallback($cb)
  11887. {
  11888. if (is_array($cb) && count($cb) === 2) {
  11889. if (is_object($cb[0])) {
  11890. $cb[0] = get_class($cb[0]);
  11891. }
  11892. if (is_string($cb[0]) && is_string($cb[1])) {
  11893. $cb = implode('::', $cb);
  11894. }
  11895. }
  11896. if (is_string($cb)) {
  11897. return $cb;
  11898. }
  11899. return var_export($cb, true);
  11900. }
  11901. public function addListener($eventName, $listener, $priority = 0)
  11902. {
  11903. $this->listeners[$eventName][$priority][] = $listener;
  11904. }
  11905. public function addSubscriber(EventSubscriberInterface $subscriber)
  11906. {
  11907. foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
  11908. if (is_string($params)) {
  11909. $this->addListener($eventName, array($subscriber, $params));
  11910. } elseif (is_string($params[0])) {
  11911. $this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0);
  11912. } else {
  11913. foreach ($params as $listener) {
  11914. $this->addListener($eventName, array($subscriber, $listener[0]), isset($listener[1]) ? $listener[1] : 0);
  11915. }
  11916. }
  11917. }
  11918. }
  11919. protected function getListeners(Event $event)
  11920. {
  11921. $scriptListeners = $this->getScriptListeners($event);
  11922. if (!isset($this->listeners[$event->getName()][0])) {
  11923. $this->listeners[$event->getName()][0] = array();
  11924. }
  11925. krsort($this->listeners[$event->getName()]);
  11926. $listeners = $this->listeners;
  11927. $listeners[$event->getName()][0] = array_merge($listeners[$event->getName()][0], $scriptListeners);
  11928. return call_user_func_array('array_merge', $listeners[$event->getName()]);
  11929. }
  11930. public function hasEventListeners(Event $event)
  11931. {
  11932. $listeners = $this->getListeners($event);
  11933. return count($listeners) > 0;
  11934. }
  11935. protected function getScriptListeners(Event $event)
  11936. {
  11937. $package = $this->composer->getPackage();
  11938. $scripts = $package->getScripts();
  11939. if (empty($scripts[$event->getName()])) {
  11940. return array();
  11941. }
  11942. if ($this->loader) {
  11943. $this->loader->unregister();
  11944. }
  11945. $generator = $this->composer->getAutoloadGenerator();
  11946. if ($event instanceof ScriptEvent) {
  11947. $generator->setDevMode($event->isDevMode());
  11948. }
  11949. $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
  11950. $packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
  11951. $map = $generator->parseAutoloads($packageMap, $package);
  11952. $this->loader = $generator->createLoader($map);
  11953. $this->loader->register();
  11954. return $scripts[$event->getName()];
  11955. }
  11956. protected function isPhpScript($callable)
  11957. {
  11958. return false === strpos($callable, ' ') && false !== strpos($callable, '::');
  11959. }
  11960. protected function isComposerScript($callable)
  11961. {
  11962. return '@' === substr($callable, 0, 1) && '@php ' !== substr($callable, 0, 5);
  11963. }
  11964. protected function pushEvent(Event $event)
  11965. {
  11966. $eventName = $event->getName();
  11967. if (in_array($eventName, $this->eventStack)) {
  11968. throw new \RuntimeException(sprintf("Circular call to script handler '%s' detected", $eventName));
  11969. }
  11970. return array_push($this->eventStack, $eventName);
  11971. }
  11972. protected function popEvent()
  11973. {
  11974. return array_pop($this->eventStack);
  11975. }
  11976. }
  11977. <?php
  11978. namespace Composer\EventDispatcher;
  11979. interface EventSubscriberInterface
  11980. {
  11981. public static function getSubscribedEvents();
  11982. }
  11983. <?php
  11984. namespace Composer\EventDispatcher;
  11985. class ScriptExecutionException extends \RuntimeException
  11986. {
  11987. }
  11988. <?php
  11989. namespace Composer\Exception;
  11990. class NoSslException extends \RuntimeException
  11991. {
  11992. }
  11993. <?php
  11994. namespace Composer;
  11995. use Composer\Config\JsonConfigSource;
  11996. use Composer\Json\JsonFile;
  11997. use Composer\IO\IOInterface;
  11998. use Composer\Package\Archiver;
  11999. use Composer\Package\Version\VersionGuesser;
  12000. use Composer\Repository\RepositoryManager;
  12001. use Composer\Repository\RepositoryFactory;
  12002. use Composer\Repository\WritableRepositoryInterface;
  12003. use Composer\Util\Filesystem;
  12004. use Composer\Util\Platform;
  12005. use Composer\Util\ProcessExecutor;
  12006. use Composer\Util\RemoteFilesystem;
  12007. use Composer\Util\Silencer;
  12008. use Composer\Plugin\PluginEvents;
  12009. use Composer\EventDispatcher\Event;
  12010. use Seld\JsonLint\DuplicateKeyException;
  12011. use Symfony\Component\Console\Formatter\OutputFormatter;
  12012. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  12013. use Symfony\Component\Console\Output\ConsoleOutput;
  12014. use Composer\EventDispatcher\EventDispatcher;
  12015. use Composer\Autoload\AutoloadGenerator;
  12016. use Composer\Package\Version\VersionParser;
  12017. use Composer\Downloader\TransportException;
  12018. use Seld\JsonLint\JsonParser;
  12019. class Factory
  12020. {
  12021. protected static function getHomeDir()
  12022. {
  12023. $home = getenv('COMPOSER_HOME');
  12024. if ($home) {
  12025. return $home;
  12026. }
  12027. if (Platform::isWindows()) {
  12028. if (!getenv('APPDATA')) {
  12029. throw new \RuntimeException('The APPDATA or COMPOSER_HOME environment variable must be set for composer to run correctly');
  12030. }
  12031. return rtrim(strtr(getenv('APPDATA'), '\\', '/'), '/') . '/Composer';
  12032. }
  12033. $userDir = self::getUserDir();
  12034. if (is_dir($userDir . '/.composer')) {
  12035. return $userDir . '/.composer';
  12036. }
  12037. if (self::useXdg()) {
  12038. $xdgConfig = getenv('XDG_CONFIG_HOME') ?: $userDir . '/.config';
  12039. return $xdgConfig . '/composer';
  12040. }
  12041. return $userDir . '/.composer';
  12042. }
  12043. protected static function getCacheDir($home)
  12044. {
  12045. $cacheDir = getenv('COMPOSER_CACHE_DIR');
  12046. if ($cacheDir) {
  12047. return $cacheDir;
  12048. }
  12049. $homeEnv = getenv('COMPOSER_HOME');
  12050. if ($homeEnv) {
  12051. return $homeEnv . '/cache';
  12052. }
  12053. if (Platform::isWindows()) {
  12054. if ($cacheDir = getenv('LOCALAPPDATA')) {
  12055. $cacheDir .= '/Composer';
  12056. } else {
  12057. $cacheDir = $home . '/cache';
  12058. }
  12059. return rtrim(strtr($cacheDir, '\\', '/'), '/');
  12060. }
  12061. $userDir = self::getUserDir();
  12062. if ($home === $userDir . '/.composer' && is_dir($home . '/cache')) {
  12063. return $home . '/cache';
  12064. }
  12065. if (self::useXdg()) {
  12066. $xdgCache = getenv('XDG_CACHE_HOME') ?: $userDir . '/.cache';
  12067. return $xdgCache . '/composer';
  12068. }
  12069. return $home . '/cache';
  12070. }
  12071. protected static function getDataDir($home)
  12072. {
  12073. $homeEnv = getenv('COMPOSER_HOME');
  12074. if ($homeEnv) {
  12075. return $homeEnv;
  12076. }
  12077. if (Platform::isWindows()) {
  12078. return strtr($home, '\\', '/');
  12079. }
  12080. $userDir = self::getUserDir();
  12081. if ($home !== $userDir . '/.composer' && self::useXdg()) {
  12082. $xdgData = getenv('XDG_DATA_HOME') ?: $userDir . '/.local/share';
  12083. return $xdgData . '/composer';
  12084. }
  12085. return $home;
  12086. }
  12087. public static function createConfig(IOInterface $io = null, $cwd = null)
  12088. {
  12089. $cwd = $cwd ?: getcwd();
  12090. $config = new Config(true, $cwd);
  12091. $home = self::getHomeDir();
  12092. $config->merge(array('config' => array(
  12093. 'home' => $home,
  12094. 'cache-dir' => self::getCacheDir($home),
  12095. 'data-dir' => self::getDataDir($home),
  12096. )));
  12097. $htaccessProtect = (bool) $config->get('htaccess-protect');
  12098. if ($htaccessProtect) {
  12099. $dirs = array($config->get('home'), $config->get('cache-dir'), $config->get('data-dir'));
  12100. foreach ($dirs as $dir) {
  12101. if (!file_exists($dir . '/.htaccess')) {
  12102. if (!is_dir($dir)) {
  12103. Silencer::call('mkdir', $dir, 0777, true);
  12104. }
  12105. Silencer::call('file_put_contents', $dir . '/.htaccess', 'Deny from all');
  12106. }
  12107. }
  12108. }
  12109. $file = new JsonFile($config->get('home').'/config.json');
  12110. if ($file->exists()) {
  12111. if ($io && $io->isDebug()) {
  12112. $io->writeError('Loading config file ' . $file->getPath());
  12113. }
  12114. $config->merge($file->read());
  12115. }
  12116. $config->setConfigSource(new JsonConfigSource($file));
  12117. $file = new JsonFile($config->get('home').'/auth.json');
  12118. if ($file->exists()) {
  12119. if ($io && $io->isDebug()) {
  12120. $io->writeError('Loading config file ' . $file->getPath());
  12121. }
  12122. $config->merge(array('config' => $file->read()));
  12123. }
  12124. $config->setAuthConfigSource(new JsonConfigSource($file, true));
  12125. if ($composerAuthEnv = getenv('COMPOSER_AUTH')) {
  12126. $authData = json_decode($composerAuthEnv, true);
  12127. if (null === $authData) {
  12128. throw new \UnexpectedValueException('COMPOSER_AUTH environment variable is malformed, should be a valid JSON object');
  12129. }
  12130. if ($io && $io->isDebug()) {
  12131. $io->writeError('Loading auth config from COMPOSER_AUTH');
  12132. }
  12133. $config->merge(array('config' => $authData));
  12134. }
  12135. return $config;
  12136. }
  12137. public static function getComposerFile()
  12138. {
  12139. return trim(getenv('COMPOSER')) ?: './composer.json';
  12140. }
  12141. public static function createAdditionalStyles()
  12142. {
  12143. return array(
  12144. 'highlight' => new OutputFormatterStyle('red'),
  12145. 'warning' => new OutputFormatterStyle('black', 'yellow'),
  12146. );
  12147. }
  12148. public static function createOutput()
  12149. {
  12150. $styles = self::createAdditionalStyles();
  12151. $formatter = new OutputFormatter(false, $styles);
  12152. return new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter);
  12153. }
  12154. public static function createDefaultRepositories(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  12155. {
  12156. return RepositoryFactory::defaultRepos($io, $config, $rm);
  12157. }
  12158. public function createComposer(IOInterface $io, $localConfig = null, $disablePlugins = false, $cwd = null, $fullLoad = true)
  12159. {
  12160. $cwd = $cwd ?: getcwd();
  12161. if (null === $localConfig) {
  12162. $localConfig = static::getComposerFile();
  12163. }
  12164. if (is_string($localConfig)) {
  12165. $composerFile = $localConfig;
  12166. $file = new JsonFile($localConfig, null, $io);
  12167. if (!$file->exists()) {
  12168. if ($localConfig === './composer.json' || $localConfig === 'composer.json') {
  12169. $message = 'Composer could not find a composer.json file in '.$cwd;
  12170. } else {
  12171. $message = 'Composer could not find the config file: '.$localConfig;
  12172. }
  12173. $instructions = 'To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section';
  12174. throw new \InvalidArgumentException($message.PHP_EOL.$instructions);
  12175. }
  12176. $file->validateSchema(JsonFile::LAX_SCHEMA);
  12177. $jsonParser = new JsonParser;
  12178. try {
  12179. $jsonParser->parse(file_get_contents($localConfig), JsonParser::DETECT_KEY_CONFLICTS);
  12180. } catch (DuplicateKeyException $e) {
  12181. $details = $e->getDetails();
  12182. $io->writeError('<warning>Key '.$details['key'].' is a duplicate in '.$localConfig.' at line '.$details['line'].'</warning>');
  12183. }
  12184. $localConfig = $file->read();
  12185. }
  12186. $config = static::createConfig($io, $cwd);
  12187. $config->merge($localConfig);
  12188. if (isset($composerFile)) {
  12189. $io->writeError('Loading config file ' . $composerFile, true, IOInterface::DEBUG);
  12190. $config->setConfigSource(new JsonConfigSource(new JsonFile(realpath($composerFile), null, $io)));
  12191. $localAuthFile = new JsonFile(dirname(realpath($composerFile)) . '/auth.json', null, $io);
  12192. if ($localAuthFile->exists()) {
  12193. $io->writeError('Loading config file ' . $localAuthFile->getPath(), true, IOInterface::DEBUG);
  12194. $config->merge(array('config' => $localAuthFile->read()));
  12195. $config->setAuthConfigSource(new JsonConfigSource($localAuthFile, true));
  12196. }
  12197. }
  12198. $vendorDir = $config->get('vendor-dir');
  12199. $composer = new Composer();
  12200. $composer->setConfig($config);
  12201. if ($fullLoad) {
  12202. $io->loadConfiguration($config);
  12203. }
  12204. $rfs = self::createRemoteFilesystem($io, $config);
  12205. $dispatcher = new EventDispatcher($composer, $io);
  12206. $composer->setEventDispatcher($dispatcher);
  12207. $rm = RepositoryFactory::manager($io, $config, $dispatcher, $rfs);
  12208. $composer->setRepositoryManager($rm);
  12209. $this->addLocalRepository($io, $rm, $vendorDir);
  12210. if (!$fullLoad && !isset($localConfig['version'])) {
  12211. $localConfig['version'] = '1.0.0';
  12212. }
  12213. $parser = new VersionParser;
  12214. $guesser = new VersionGuesser($config, new ProcessExecutor($io), $parser);
  12215. $loader = new Package\Loader\RootPackageLoader($rm, $config, $parser, $guesser);
  12216. $package = $loader->load($localConfig, 'Composer\Package\RootPackage', $cwd);
  12217. $composer->setPackage($package);
  12218. $im = $this->createInstallationManager();
  12219. $composer->setInstallationManager($im);
  12220. if ($fullLoad) {
  12221. $dm = $this->createDownloadManager($io, $config, $dispatcher, $rfs);
  12222. $composer->setDownloadManager($dm);
  12223. $generator = new AutoloadGenerator($dispatcher, $io);
  12224. $composer->setAutoloadGenerator($generator);
  12225. $am = $this->createArchiveManager($config, $dm);
  12226. $composer->setArchiveManager($am);
  12227. }
  12228. $this->createDefaultInstallers($im, $composer, $io);
  12229. if ($fullLoad) {
  12230. $globalComposer = null;
  12231. if (realpath($config->get('home')) !== $cwd) {
  12232. $globalComposer = $this->createGlobalComposer($io, $config, $disablePlugins);
  12233. }
  12234. $pm = $this->createPluginManager($io, $composer, $globalComposer, $disablePlugins);
  12235. $composer->setPluginManager($pm);
  12236. $pm->loadInstalledPlugins();
  12237. }
  12238. if ($fullLoad && isset($composerFile)) {
  12239. $lockFile = "json" === pathinfo($composerFile, PATHINFO_EXTENSION)
  12240. ? substr($composerFile, 0, -4).'lock'
  12241. : $composerFile . '.lock';
  12242. $locker = new Package\Locker($io, new JsonFile($lockFile, null, $io), $rm, $im, file_get_contents($composerFile));
  12243. $composer->setLocker($locker);
  12244. }
  12245. if ($fullLoad) {
  12246. $initEvent = new Event(PluginEvents::INIT);
  12247. $composer->getEventDispatcher()->dispatch($initEvent->getName(), $initEvent);
  12248. if ($rm->getLocalRepository()) {
  12249. $this->purgePackages($rm->getLocalRepository(), $im);
  12250. }
  12251. }
  12252. return $composer;
  12253. }
  12254. public static function createGlobal(IOInterface $io, $disablePlugins = false)
  12255. {
  12256. $factory = new static();
  12257. return $factory->createGlobalComposer($io, static::createConfig($io), $disablePlugins, true);
  12258. }
  12259. protected function addLocalRepository(IOInterface $io, RepositoryManager $rm, $vendorDir)
  12260. {
  12261. $rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed.json', null, $io)));
  12262. }
  12263. protected function createGlobalComposer(IOInterface $io, Config $config, $disablePlugins, $fullLoad = false)
  12264. {
  12265. $composer = null;
  12266. try {
  12267. $composer = $this->createComposer($io, $config->get('home') . '/composer.json', $disablePlugins, $config->get('home'), $fullLoad);
  12268. } catch (\Exception $e) {
  12269. $io->writeError('Failed to initialize global composer: '.$e->getMessage(), true, IOInterface::DEBUG);
  12270. }
  12271. return $composer;
  12272. }
  12273. public function createDownloadManager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  12274. {
  12275. $cache = null;
  12276. if ($config->get('cache-files-ttl') > 0) {
  12277. $cache = new Cache($io, $config->get('cache-files-dir'), 'a-z0-9_./');
  12278. }
  12279. $dm = new Downloader\DownloadManager($io);
  12280. switch ($preferred = $config->get('preferred-install')) {
  12281. case 'dist':
  12282. $dm->setPreferDist(true);
  12283. break;
  12284. case 'source':
  12285. $dm->setPreferSource(true);
  12286. break;
  12287. case 'auto':
  12288. default:
  12289. break;
  12290. }
  12291. if (is_array($preferred)) {
  12292. $dm->setPreferences($preferred);
  12293. }
  12294. $executor = new ProcessExecutor($io);
  12295. $fs = new Filesystem($executor);
  12296. $dm->setDownloader('git', new Downloader\GitDownloader($io, $config, $executor, $fs));
  12297. $dm->setDownloader('svn', new Downloader\SvnDownloader($io, $config, $executor, $fs));
  12298. $dm->setDownloader('fossil', new Downloader\FossilDownloader($io, $config, $executor, $fs));
  12299. $dm->setDownloader('hg', new Downloader\HgDownloader($io, $config, $executor, $fs));
  12300. $dm->setDownloader('perforce', new Downloader\PerforceDownloader($io, $config));
  12301. $dm->setDownloader('zip', new Downloader\ZipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12302. $dm->setDownloader('rar', new Downloader\RarDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12303. $dm->setDownloader('tar', new Downloader\TarDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12304. $dm->setDownloader('gzip', new Downloader\GzipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12305. $dm->setDownloader('xz', new Downloader\XzDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12306. $dm->setDownloader('phar', new Downloader\PharDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12307. $dm->setDownloader('file', new Downloader\FileDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12308. $dm->setDownloader('path', new Downloader\PathDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12309. return $dm;
  12310. }
  12311. public function createArchiveManager(Config $config, Downloader\DownloadManager $dm = null)
  12312. {
  12313. if (null === $dm) {
  12314. $io = new IO\NullIO();
  12315. $io->loadConfiguration($config);
  12316. $dm = $this->createDownloadManager($io, $config);
  12317. }
  12318. $am = new Archiver\ArchiveManager($dm);
  12319. $am->addArchiver(new Archiver\ZipArchiver);
  12320. $am->addArchiver(new Archiver\PharArchiver);
  12321. return $am;
  12322. }
  12323. protected function createPluginManager(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  12324. {
  12325. return new Plugin\PluginManager($io, $composer, $globalComposer, $disablePlugins);
  12326. }
  12327. protected function createInstallationManager()
  12328. {
  12329. return new Installer\InstallationManager();
  12330. }
  12331. protected function createDefaultInstallers(Installer\InstallationManager $im, Composer $composer, IOInterface $io)
  12332. {
  12333. $im->addInstaller(new Installer\LibraryInstaller($io, $composer, null));
  12334. $im->addInstaller(new Installer\PearInstaller($io, $composer, 'pear-library'));
  12335. $im->addInstaller(new Installer\PluginInstaller($io, $composer));
  12336. $im->addInstaller(new Installer\MetapackageInstaller($io));
  12337. }
  12338. protected function purgePackages(WritableRepositoryInterface $repo, Installer\InstallationManager $im)
  12339. {
  12340. foreach ($repo->getPackages() as $package) {
  12341. if (!$im->isPackageInstalled($repo, $package)) {
  12342. $repo->removePackage($package);
  12343. }
  12344. }
  12345. }
  12346. public static function create(IOInterface $io, $config = null, $disablePlugins = false)
  12347. {
  12348. $factory = new static();
  12349. return $factory->createComposer($io, $config, $disablePlugins);
  12350. }
  12351. public static function createRemoteFilesystem(IOInterface $io, Config $config = null, $options = array())
  12352. {
  12353. static $warned = false;
  12354. $disableTls = false;
  12355. if ($config && $config->get('disable-tls') === true) {
  12356. if (!$warned) {
  12357. $io->write('<warning>You are running Composer with SSL/TLS protection disabled.</warning>');
  12358. }
  12359. $warned = true;
  12360. $disableTls = true;
  12361. } elseif (!extension_loaded('openssl')) {
  12362. throw new Exception\NoSslException('The openssl extension is required for SSL/TLS protection but is not available. '
  12363. . 'If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the \'disable-tls\' option to true.');
  12364. }
  12365. $remoteFilesystemOptions = array();
  12366. if ($disableTls === false) {
  12367. if ($config && $config->get('cafile')) {
  12368. $remoteFilesystemOptions['ssl']['cafile'] = $config->get('cafile');
  12369. }
  12370. if ($config && $config->get('capath')) {
  12371. $remoteFilesystemOptions['ssl']['capath'] = $config->get('capath');
  12372. }
  12373. $remoteFilesystemOptions = array_replace_recursive($remoteFilesystemOptions, $options);
  12374. }
  12375. try {
  12376. $remoteFilesystem = new RemoteFilesystem($io, $config, $remoteFilesystemOptions, $disableTls);
  12377. } catch (TransportException $e) {
  12378. if (false !== strpos($e->getMessage(), 'cafile')) {
  12379. $io->write('<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>');
  12380. $io->write('<error>A valid CA certificate file is required for SSL/TLS protection.</error>');
  12381. if (PHP_VERSION_ID < 50600) {
  12382. $io->write('<error>It is recommended you upgrade to PHP 5.6+ which can detect your system CA file automatically.</error>');
  12383. }
  12384. $io->write('<error>You can disable this error, at your own risk, by setting the \'disable-tls\' option to true.</error>');
  12385. }
  12386. throw $e;
  12387. }
  12388. return $remoteFilesystem;
  12389. }
  12390. private static function useXdg()
  12391. {
  12392. foreach (array_keys($_SERVER) as $key) {
  12393. if (substr($key, 0, 4) === 'XDG_') {
  12394. return true;
  12395. }
  12396. }
  12397. return false;
  12398. }
  12399. private static function getUserDir()
  12400. {
  12401. $home = getenv('HOME');
  12402. if (!$home) {
  12403. throw new \RuntimeException('The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly');
  12404. }
  12405. return rtrim(strtr($home, '\\', '/'), '/');
  12406. }
  12407. }
  12408. <?php
  12409. namespace Composer\IO;
  12410. use Composer\Config;
  12411. use Composer\Util\ProcessExecutor;
  12412. use Psr\Log\LoggerInterface;
  12413. use Psr\Log\LogLevel;
  12414. abstract class BaseIO implements IOInterface, LoggerInterface
  12415. {
  12416. protected $authentications = array();
  12417. public function getAuthentications()
  12418. {
  12419. return $this->authentications;
  12420. }
  12421. public function hasAuthentication($repositoryName)
  12422. {
  12423. return isset($this->authentications[$repositoryName]);
  12424. }
  12425. public function getAuthentication($repositoryName)
  12426. {
  12427. if (isset($this->authentications[$repositoryName])) {
  12428. return $this->authentications[$repositoryName];
  12429. }
  12430. return array('username' => null, 'password' => null);
  12431. }
  12432. public function setAuthentication($repositoryName, $username, $password = null)
  12433. {
  12434. $this->authentications[$repositoryName] = array('username' => $username, 'password' => $password);
  12435. }
  12436. protected function checkAndSetAuthentication($repositoryName, $username, $password = null)
  12437. {
  12438. if ($this->hasAuthentication($repositoryName)) {
  12439. $auth = $this->getAuthentication($repositoryName);
  12440. if ($auth['username'] === $username && $auth['password'] === $password) {
  12441. return;
  12442. }
  12443. $this->writeError(
  12444. sprintf(
  12445. "<warning>Warning: You should avoid overwriting already defined auth settings for %s.</warning>",
  12446. $repositoryName
  12447. )
  12448. );
  12449. }
  12450. $this->setAuthentication($repositoryName, $username, $password);
  12451. }
  12452. public function loadConfiguration(Config $config)
  12453. {
  12454. $bitbucketOauth = $config->get('bitbucket-oauth') ?: array();
  12455. $githubOauth = $config->get('github-oauth') ?: array();
  12456. $gitlabOauth = $config->get('gitlab-oauth') ?: array();
  12457. $gitlabToken = $config->get('gitlab-token') ?: array();
  12458. $httpBasic = $config->get('http-basic') ?: array();
  12459. foreach ($bitbucketOauth as $domain => $cred) {
  12460. $this->checkAndSetAuthentication($domain, $cred['consumer-key'], $cred['consumer-secret']);
  12461. }
  12462. foreach ($githubOauth as $domain => $token) {
  12463. if (!preg_match('{^[.a-z0-9]+$}', $token)) {
  12464. throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
  12465. }
  12466. $this->checkAndSetAuthentication($domain, $token, 'x-oauth-basic');
  12467. }
  12468. foreach ($gitlabOauth as $domain => $token) {
  12469. $this->checkAndSetAuthentication($domain, $token, 'oauth2');
  12470. }
  12471. foreach ($gitlabToken as $domain => $token) {
  12472. $this->checkAndSetAuthentication($domain, $token, 'private-token');
  12473. }
  12474. foreach ($httpBasic as $domain => $cred) {
  12475. $this->checkAndSetAuthentication($domain, $cred['username'], $cred['password']);
  12476. }
  12477. ProcessExecutor::setTimeout((int) $config->get('process-timeout'));
  12478. }
  12479. public function emergency($message, array $context = array())
  12480. {
  12481. return $this->log(LogLevel::EMERGENCY, $message, $context);
  12482. }
  12483. public function alert($message, array $context = array())
  12484. {
  12485. return $this->log(LogLevel::ALERT, $message, $context);
  12486. }
  12487. public function critical($message, array $context = array())
  12488. {
  12489. return $this->log(LogLevel::CRITICAL, $message, $context);
  12490. }
  12491. public function error($message, array $context = array())
  12492. {
  12493. return $this->log(LogLevel::ERROR, $message, $context);
  12494. }
  12495. public function warning($message, array $context = array())
  12496. {
  12497. return $this->log(LogLevel::WARNING, $message, $context);
  12498. }
  12499. public function notice($message, array $context = array())
  12500. {
  12501. return $this->log(LogLevel::NOTICE, $message, $context);
  12502. }
  12503. public function info($message, array $context = array())
  12504. {
  12505. return $this->log(LogLevel::INFO, $message, $context);
  12506. }
  12507. public function debug($message, array $context = array())
  12508. {
  12509. return $this->log(LogLevel::DEBUG, $message, $context);
  12510. }
  12511. public function log($level, $message, array $context = array())
  12512. {
  12513. if (in_array($level, array(LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR))) {
  12514. $this->writeError('<error>'.$message.'</error>', true, self::NORMAL);
  12515. } elseif ($level === LogLevel::WARNING) {
  12516. $this->writeError('<warning>'.$message.'</warning>', true, self::NORMAL);
  12517. } elseif ($level === LogLevel::NOTICE) {
  12518. $this->writeError('<info>'.$message.'</info>', true, self::VERBOSE);
  12519. } elseif ($level === LogLevel::INFO) {
  12520. $this->writeError('<info>'.$message.'</info>', true, self::VERY_VERBOSE);
  12521. } else {
  12522. $this->writeError($message, true, self::DEBUG);
  12523. }
  12524. }
  12525. }
  12526. <?php
  12527. namespace Composer\IO;
  12528. use Symfony\Component\Console\Output\StreamOutput;
  12529. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  12530. use Symfony\Component\Console\Input\StringInput;
  12531. use Symfony\Component\Console\Helper\HelperSet;
  12532. class BufferIO extends ConsoleIO
  12533. {
  12534. public function __construct($input = '', $verbosity = StreamOutput::VERBOSITY_NORMAL, OutputFormatterInterface $formatter = null)
  12535. {
  12536. $input = new StringInput($input);
  12537. $input->setInteractive(false);
  12538. $output = new StreamOutput(fopen('php://memory', 'rw'), $verbosity, $formatter ? $formatter->isDecorated() : false, $formatter);
  12539. parent::__construct($input, $output, new HelperSet(array()));
  12540. }
  12541. public function getOutput()
  12542. {
  12543. fseek($this->output->getStream(), 0);
  12544. $output = stream_get_contents($this->output->getStream());
  12545. $output = preg_replace_callback("{(?<=^|\n|\x08)(.+?)(\x08+)}", function ($matches) {
  12546. $pre = strip_tags($matches[1]);
  12547. if (strlen($pre) === strlen($matches[2])) {
  12548. return '';
  12549. }
  12550. return rtrim($matches[1])."\n";
  12551. }, $output);
  12552. return $output;
  12553. }
  12554. }
  12555. <?php
  12556. namespace Composer\IO;
  12557. use Composer\Question\StrictConfirmationQuestion;
  12558. use Symfony\Component\Console\Helper\HelperSet;
  12559. use Symfony\Component\Console\Input\InputInterface;
  12560. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  12561. use Symfony\Component\Console\Output\OutputInterface;
  12562. use Symfony\Component\Console\Question\ChoiceQuestion;
  12563. use Symfony\Component\Console\Question\Question;
  12564. class ConsoleIO extends BaseIO
  12565. {
  12566. protected $input;
  12567. protected $output;
  12568. protected $helperSet;
  12569. protected $lastMessage;
  12570. protected $lastMessageErr;
  12571. private $startTime;
  12572. private $verbosityMap;
  12573. public function __construct(InputInterface $input, OutputInterface $output, HelperSet $helperSet)
  12574. {
  12575. $this->input = $input;
  12576. $this->output = $output;
  12577. $this->helperSet = $helperSet;
  12578. $this->verbosityMap = array(
  12579. self::QUIET => OutputInterface::VERBOSITY_QUIET,
  12580. self::NORMAL => OutputInterface::VERBOSITY_NORMAL,
  12581. self::VERBOSE => OutputInterface::VERBOSITY_VERBOSE,
  12582. self::VERY_VERBOSE => OutputInterface::VERBOSITY_VERY_VERBOSE,
  12583. self::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  12584. );
  12585. }
  12586. public function enableDebugging($startTime)
  12587. {
  12588. $this->startTime = $startTime;
  12589. }
  12590. public function isInteractive()
  12591. {
  12592. return $this->input->isInteractive();
  12593. }
  12594. public function isDecorated()
  12595. {
  12596. return $this->output->isDecorated();
  12597. }
  12598. public function isVerbose()
  12599. {
  12600. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE;
  12601. }
  12602. public function isVeryVerbose()
  12603. {
  12604. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE;
  12605. }
  12606. public function isDebug()
  12607. {
  12608. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG;
  12609. }
  12610. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  12611. {
  12612. $this->doWrite($messages, $newline, false, $verbosity);
  12613. }
  12614. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  12615. {
  12616. $this->doWrite($messages, $newline, true, $verbosity);
  12617. }
  12618. private function doWrite($messages, $newline, $stderr, $verbosity)
  12619. {
  12620. $sfVerbosity = $this->verbosityMap[$verbosity];
  12621. if ($sfVerbosity > $this->output->getVerbosity()) {
  12622. return;
  12623. }
  12624. if (OutputInterface::VERBOSITY_QUIET === 0) {
  12625. $sfVerbosity = OutputInterface::OUTPUT_NORMAL;
  12626. }
  12627. if (null !== $this->startTime) {
  12628. $memoryUsage = memory_get_usage() / 1024 / 1024;
  12629. $timeSpent = microtime(true) - $this->startTime;
  12630. $messages = array_map(function ($message) use ($memoryUsage, $timeSpent) {
  12631. return sprintf('[%.1fMB/%.2fs] %s', $memoryUsage, $timeSpent, $message);
  12632. }, (array) $messages);
  12633. }
  12634. if (true === $stderr && $this->output instanceof ConsoleOutputInterface) {
  12635. $this->output->getErrorOutput()->write($messages, $newline, $sfVerbosity);
  12636. $this->lastMessageErr = implode($newline ? "\n" : '', (array) $messages);
  12637. return;
  12638. }
  12639. $this->output->write($messages, $newline, $sfVerbosity);
  12640. $this->lastMessage = implode($newline ? "\n" : '', (array) $messages);
  12641. }
  12642. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  12643. {
  12644. $this->doOverwrite($messages, $newline, $size, false, $verbosity);
  12645. }
  12646. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  12647. {
  12648. $this->doOverwrite($messages, $newline, $size, true, $verbosity);
  12649. }
  12650. private function doOverwrite($messages, $newline, $size, $stderr, $verbosity)
  12651. {
  12652. $messages = implode($newline ? "\n" : '', (array) $messages);
  12653. if (!isset($size)) {
  12654. $size = strlen(strip_tags($stderr ? $this->lastMessageErr : $this->lastMessage));
  12655. }
  12656. $this->doWrite(str_repeat("\x08", $size), false, $stderr, $verbosity);
  12657. $this->doWrite($messages, false, $stderr, $verbosity);
  12658. $fill = $size - strlen(strip_tags($messages));
  12659. if ($fill > 0) {
  12660. $this->doWrite(str_repeat(' ', $fill), false, $stderr, $verbosity);
  12661. $this->doWrite(str_repeat("\x08", $fill), false, $stderr, $verbosity);
  12662. }
  12663. if ($newline) {
  12664. $this->doWrite('', true, $stderr, $verbosity);
  12665. }
  12666. if ($stderr) {
  12667. $this->lastMessageErr = $messages;
  12668. } else {
  12669. $this->lastMessage = $messages;
  12670. }
  12671. }
  12672. public function ask($question, $default = null)
  12673. {
  12674. $helper = $this->helperSet->get('question');
  12675. $question = new Question($question, $default);
  12676. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  12677. }
  12678. public function askConfirmation($question, $default = true)
  12679. {
  12680. $helper = $this->helperSet->get('question');
  12681. $question = new StrictConfirmationQuestion($question, $default);
  12682. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  12683. }
  12684. public function askAndValidate($question, $validator, $attempts = null, $default = null)
  12685. {
  12686. $helper = $this->helperSet->get('question');
  12687. $question = new Question($question, $default);
  12688. $question->setValidator($validator);
  12689. $question->setMaxAttempts($attempts);
  12690. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  12691. }
  12692. public function askAndHideAnswer($question)
  12693. {
  12694. $this->writeError($question, false);
  12695. return \Seld\CliPrompt\CliPrompt::hiddenPrompt(true);
  12696. }
  12697. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  12698. {
  12699. $helper = $this->helperSet->get('question');
  12700. $question = new ChoiceQuestion($question, $choices, $default);
  12701. $question->setMaxAttempts($attempts ?: null);
  12702. $question->setErrorMessage($errorMessage);
  12703. $question->setMultiselect($multiselect);
  12704. $result = $helper->ask($this->input, $this->getErrorOutput(), $question);
  12705. if (!is_array($result)) {
  12706. return (string) array_search($result, $choices, true);
  12707. }
  12708. $results = array();
  12709. foreach ($choices as $index => $choice) {
  12710. if (in_array($choice, $result, true)) {
  12711. $results[] = (string) $index;
  12712. }
  12713. }
  12714. return $results;
  12715. }
  12716. private function getErrorOutput()
  12717. {
  12718. if ($this->output instanceof ConsoleOutputInterface) {
  12719. return $this->output->getErrorOutput();
  12720. }
  12721. return $this->output;
  12722. }
  12723. }
  12724. <?php
  12725. namespace Composer\IO;
  12726. use Composer\Config;
  12727. interface IOInterface
  12728. {
  12729. const QUIET = 1;
  12730. const NORMAL = 2;
  12731. const VERBOSE = 4;
  12732. const VERY_VERBOSE = 8;
  12733. const DEBUG = 16;
  12734. public function isInteractive();
  12735. public function isVerbose();
  12736. public function isVeryVerbose();
  12737. public function isDebug();
  12738. public function isDecorated();
  12739. public function write($messages, $newline = true, $verbosity = self::NORMAL);
  12740. public function writeError($messages, $newline = true, $verbosity = self::NORMAL);
  12741. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  12742. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  12743. public function ask($question, $default = null);
  12744. public function askConfirmation($question, $default = true);
  12745. public function askAndValidate($question, $validator, $attempts = null, $default = null);
  12746. public function askAndHideAnswer($question);
  12747. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false);
  12748. public function getAuthentications();
  12749. public function hasAuthentication($repositoryName);
  12750. public function getAuthentication($repositoryName);
  12751. public function setAuthentication($repositoryName, $username, $password = null);
  12752. public function loadConfiguration(Config $config);
  12753. }
  12754. <?php
  12755. namespace Composer\IO;
  12756. class NullIO extends BaseIO
  12757. {
  12758. public function isInteractive()
  12759. {
  12760. return false;
  12761. }
  12762. public function isVerbose()
  12763. {
  12764. return false;
  12765. }
  12766. public function isVeryVerbose()
  12767. {
  12768. return false;
  12769. }
  12770. public function isDebug()
  12771. {
  12772. return false;
  12773. }
  12774. public function isDecorated()
  12775. {
  12776. return false;
  12777. }
  12778. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  12779. {
  12780. }
  12781. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  12782. {
  12783. }
  12784. public function overwrite($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  12785. {
  12786. }
  12787. public function overwriteError($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  12788. {
  12789. }
  12790. public function ask($question, $default = null)
  12791. {
  12792. return $default;
  12793. }
  12794. public function askConfirmation($question, $default = true)
  12795. {
  12796. return $default;
  12797. }
  12798. public function askAndValidate($question, $validator, $attempts = false, $default = null)
  12799. {
  12800. return $default;
  12801. }
  12802. public function askAndHideAnswer($question)
  12803. {
  12804. return null;
  12805. }
  12806. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  12807. {
  12808. return $default;
  12809. }
  12810. }
  12811. <?php
  12812. namespace Composer;
  12813. use Composer\Autoload\AutoloadGenerator;
  12814. use Composer\DependencyResolver\DefaultPolicy;
  12815. use Composer\DependencyResolver\Operation\UpdateOperation;
  12816. use Composer\DependencyResolver\Operation\InstallOperation;
  12817. use Composer\DependencyResolver\Operation\UninstallOperation;
  12818. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  12819. use Composer\DependencyResolver\Operation\OperationInterface;
  12820. use Composer\DependencyResolver\PolicyInterface;
  12821. use Composer\DependencyResolver\Pool;
  12822. use Composer\DependencyResolver\Request;
  12823. use Composer\DependencyResolver\Rule;
  12824. use Composer\DependencyResolver\Solver;
  12825. use Composer\DependencyResolver\SolverProblemsException;
  12826. use Composer\Downloader\DownloadManager;
  12827. use Composer\EventDispatcher\EventDispatcher;
  12828. use Composer\Installer\InstallationManager;
  12829. use Composer\Installer\InstallerEvents;
  12830. use Composer\Installer\NoopInstaller;
  12831. use Composer\Installer\SuggestedPackagesReporter;
  12832. use Composer\IO\IOInterface;
  12833. use Composer\Package\AliasPackage;
  12834. use Composer\Package\CompletePackage;
  12835. use Composer\Package\Link;
  12836. use Composer\Package\Loader\ArrayLoader;
  12837. use Composer\Package\Dumper\ArrayDumper;
  12838. use Composer\Semver\Constraint\Constraint;
  12839. use Composer\Package\Locker;
  12840. use Composer\Package\PackageInterface;
  12841. use Composer\Package\RootPackageInterface;
  12842. use Composer\Repository\CompositeRepository;
  12843. use Composer\Repository\InstalledArrayRepository;
  12844. use Composer\Repository\PlatformRepository;
  12845. use Composer\Repository\RepositoryInterface;
  12846. use Composer\Repository\RepositoryManager;
  12847. use Composer\Repository\WritableRepositoryInterface;
  12848. use Composer\Script\ScriptEvents;
  12849. class Installer
  12850. {
  12851. protected $io;
  12852. protected $config;
  12853. protected $package;
  12854. protected $downloadManager;
  12855. protected $repositoryManager;
  12856. protected $locker;
  12857. protected $installationManager;
  12858. protected $eventDispatcher;
  12859. protected $autoloadGenerator;
  12860. protected $preferSource = false;
  12861. protected $preferDist = false;
  12862. protected $optimizeAutoloader = false;
  12863. protected $classMapAuthoritative = false;
  12864. protected $apcuAutoloader = false;
  12865. protected $devMode = false;
  12866. protected $dryRun = false;
  12867. protected $verbose = false;
  12868. protected $update = false;
  12869. protected $dumpAutoloader = true;
  12870. protected $runScripts = true;
  12871. protected $ignorePlatformReqs = false;
  12872. protected $preferStable = false;
  12873. protected $preferLowest = false;
  12874. protected $skipSuggest = false;
  12875. protected $writeLock = true;
  12876. protected $executeOperations = true;
  12877. protected $updateWhitelist = null;
  12878. protected $whitelistDependencies = false;
  12879. protected $whitelistAllDependencies = false;
  12880. protected $suggestedPackagesReporter;
  12881. protected $additionalInstalledRepository;
  12882. public function __construct(IOInterface $io, Config $config, RootPackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator)
  12883. {
  12884. $this->io = $io;
  12885. $this->config = $config;
  12886. $this->package = $package;
  12887. $this->downloadManager = $downloadManager;
  12888. $this->repositoryManager = $repositoryManager;
  12889. $this->locker = $locker;
  12890. $this->installationManager = $installationManager;
  12891. $this->eventDispatcher = $eventDispatcher;
  12892. $this->autoloadGenerator = $autoloadGenerator;
  12893. }
  12894. public function run()
  12895. {
  12896. gc_collect_cycles();
  12897. gc_disable();
  12898. if (!$this->update && !$this->locker->isLocked()) {
  12899. $this->update = true;
  12900. }
  12901. if ($this->dryRun) {
  12902. $this->verbose = true;
  12903. $this->runScripts = false;
  12904. $this->executeOperations = false;
  12905. $this->writeLock = false;
  12906. $this->dumpAutoloader = false;
  12907. $this->installationManager->addInstaller(new NoopInstaller);
  12908. $this->mockLocalRepositories($this->repositoryManager);
  12909. }
  12910. if ($this->runScripts) {
  12911. $devMode = (int) $this->devMode;
  12912. putenv("COMPOSER_DEV_MODE=$devMode");
  12913. $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
  12914. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  12915. }
  12916. $this->downloadManager->setPreferSource($this->preferSource);
  12917. $this->downloadManager->setPreferDist($this->preferDist);
  12918. $localRepo = $this->repositoryManager->getLocalRepository();
  12919. if ($this->update) {
  12920. $platformOverrides = $this->config->get('platform') ?: array();
  12921. } else {
  12922. $platformOverrides = $this->locker->getPlatformOverrides();
  12923. }
  12924. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  12925. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  12926. $aliases = $this->getRootAliases();
  12927. $this->aliasPlatformPackages($platformRepo, $aliases);
  12928. if (!$this->suggestedPackagesReporter) {
  12929. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($this->io);
  12930. }
  12931. try {
  12932. list($res, $devPackages) = $this->doInstall($localRepo, $installedRepo, $platformRepo, $aliases);
  12933. if ($res !== 0) {
  12934. return $res;
  12935. }
  12936. } catch (\Exception $e) {
  12937. if ($this->executeOperations) {
  12938. $this->installationManager->notifyInstalls($this->io);
  12939. }
  12940. throw $e;
  12941. }
  12942. if ($this->executeOperations) {
  12943. $this->installationManager->notifyInstalls($this->io);
  12944. }
  12945. if ($this->devMode && !$this->skipSuggest) {
  12946. $this->suggestedPackagesReporter->output($installedRepo);
  12947. }
  12948. foreach ($localRepo->getPackages() as $package) {
  12949. if (!$package instanceof CompletePackage || !$package->isAbandoned()) {
  12950. continue;
  12951. }
  12952. $replacement = (is_string($package->getReplacementPackage()))
  12953. ? 'Use ' . $package->getReplacementPackage() . ' instead'
  12954. : 'No replacement was suggested';
  12955. $this->io->writeError(
  12956. sprintf(
  12957. "<warning>Package %s is abandoned, you should avoid using it. %s.</warning>",
  12958. $package->getPrettyName(),
  12959. $replacement
  12960. )
  12961. );
  12962. }
  12963. if ($this->update && $this->writeLock) {
  12964. $localRepo->reload();
  12965. $platformReqs = $this->extractPlatformRequirements($this->package->getRequires());
  12966. $platformDevReqs = $this->extractPlatformRequirements($this->package->getDevRequires());
  12967. $updatedLock = $this->locker->setLockData(
  12968. array_diff($localRepo->getCanonicalPackages(), $devPackages),
  12969. $devPackages,
  12970. $platformReqs,
  12971. $platformDevReqs,
  12972. $aliases,
  12973. $this->package->getMinimumStability(),
  12974. $this->package->getStabilityFlags(),
  12975. $this->preferStable || $this->package->getPreferStable(),
  12976. $this->preferLowest,
  12977. $this->config->get('platform') ?: array()
  12978. );
  12979. if ($updatedLock) {
  12980. $this->io->writeError('<info>Writing lock file</info>');
  12981. }
  12982. }
  12983. if ($this->dumpAutoloader) {
  12984. if ($this->optimizeAutoloader) {
  12985. $this->io->writeError('<info>Generating optimized autoload files</info>');
  12986. } else {
  12987. $this->io->writeError('<info>Generating autoload files</info>');
  12988. }
  12989. $this->autoloadGenerator->setDevMode($this->devMode);
  12990. $this->autoloadGenerator->setClassMapAuthoritative($this->classMapAuthoritative);
  12991. $this->autoloadGenerator->setApcu($this->apcuAutoloader);
  12992. $this->autoloadGenerator->setRunScripts($this->runScripts);
  12993. $this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
  12994. }
  12995. if ($this->executeOperations) {
  12996. foreach ($localRepo->getPackages() as $package) {
  12997. $this->installationManager->ensureBinariesPresence($package);
  12998. }
  12999. $vendorDir = $this->config->get('vendor-dir');
  13000. if (is_dir($vendorDir)) {
  13001. @touch($vendorDir);
  13002. }
  13003. }
  13004. if ($this->runScripts) {
  13005. $eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
  13006. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  13007. }
  13008. if (!defined('HHVM_VERSION')) {
  13009. gc_enable();
  13010. }
  13011. return 0;
  13012. }
  13013. protected function doInstall($localRepo, $installedRepo, $platformRepo, $aliases)
  13014. {
  13015. $lockedRepository = null;
  13016. $repositories = null;
  13017. if (!$this->update || (!empty($this->updateWhitelist) && $this->locker->isLocked())) {
  13018. try {
  13019. $lockedRepository = $this->locker->getLockedRepository($this->devMode);
  13020. } catch (\RuntimeException $e) {
  13021. if ($this->package->getDevRequires()) {
  13022. throw $e;
  13023. }
  13024. $lockedRepository = $this->locker->getLockedRepository();
  13025. }
  13026. }
  13027. $this->whitelistUpdateDependencies(
  13028. $lockedRepository ?: $localRepo,
  13029. $this->package->getRequires(),
  13030. $this->package->getDevRequires()
  13031. );
  13032. $this->io->writeError('<info>Loading composer repositories with package information</info>');
  13033. $policy = $this->createPolicy();
  13034. $pool = $this->createPool($this->update ? null : $lockedRepository);
  13035. $pool->addRepository($installedRepo, $aliases);
  13036. if ($this->update) {
  13037. $repositories = $this->repositoryManager->getRepositories();
  13038. foreach ($repositories as $repository) {
  13039. $pool->addRepository($repository, $aliases);
  13040. }
  13041. }
  13042. if ($lockedRepository) {
  13043. $pool->addRepository($lockedRepository, $aliases);
  13044. }
  13045. $request = $this->createRequest($this->package, $platformRepo);
  13046. if ($this->update) {
  13047. $removedUnstablePackages = array();
  13048. foreach ($localRepo->getPackages() as $package) {
  13049. if (
  13050. !$pool->isPackageAcceptable($package->getNames(), $package->getStability())
  13051. && $this->installationManager->isPackageInstalled($localRepo, $package)
  13052. ) {
  13053. $removedUnstablePackages[$package->getName()] = true;
  13054. $request->remove($package->getName(), new Constraint('=', $package->getVersion()));
  13055. }
  13056. }
  13057. $this->io->writeError('<info>Updating dependencies'.($this->devMode ? ' (including require-dev)' : '').'</info>');
  13058. $request->updateAll();
  13059. $links = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  13060. foreach ($links as $link) {
  13061. $request->install($link->getTarget(), $link->getConstraint());
  13062. }
  13063. if ($this->updateWhitelist) {
  13064. $currentPackages = $this->getCurrentPackages($installedRepo);
  13065. $candidates = array();
  13066. foreach ($links as $link) {
  13067. $candidates[$link->getTarget()] = true;
  13068. $rootRequires[$link->getTarget()] = $link;
  13069. }
  13070. foreach ($currentPackages as $package) {
  13071. $candidates[$package->getName()] = true;
  13072. }
  13073. foreach ($candidates as $candidate => $dummy) {
  13074. foreach ($currentPackages as $curPackage) {
  13075. if ($curPackage->getName() === $candidate) {
  13076. if (!$this->isUpdateable($curPackage) && !isset($removedUnstablePackages[$curPackage->getName()])) {
  13077. $constraint = new Constraint('=', $curPackage->getVersion());
  13078. $description = $this->locker->isLocked() ? '(locked at' : '(installed at';
  13079. $requiredAt = isset($rootRequires[$candidate]) ? ', required as ' . $rootRequires[$candidate]->getPrettyConstraint() : '';
  13080. $constraint->setPrettyString($description . ' ' . $curPackage->getPrettyVersion() . $requiredAt . ')');
  13081. $request->install($curPackage->getName(), $constraint);
  13082. }
  13083. break;
  13084. }
  13085. }
  13086. }
  13087. }
  13088. } else {
  13089. $this->io->writeError('<info>Installing dependencies'.($this->devMode ? ' (including require-dev)' : '').' from lock file</info>');
  13090. if (!$this->locker->isFresh()) {
  13091. $this->io->writeError('<warning>Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.</warning>', true, IOInterface::QUIET);
  13092. }
  13093. foreach ($lockedRepository->getPackages() as $package) {
  13094. $version = $package->getVersion();
  13095. if (isset($aliases[$package->getName()][$version])) {
  13096. $version = $aliases[$package->getName()][$version]['alias_normalized'];
  13097. }
  13098. $constraint = new Constraint('=', $version);
  13099. $constraint->setPrettyString($package->getPrettyVersion());
  13100. $request->install($package->getName(), $constraint);
  13101. }
  13102. foreach ($this->locker->getPlatformRequirements($this->devMode) as $link) {
  13103. $request->install($link->getTarget(), $link->getConstraint());
  13104. }
  13105. }
  13106. $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-links');
  13107. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request);
  13108. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  13109. try {
  13110. $operations = $solver->solve($request, $this->ignorePlatformReqs);
  13111. } catch (SolverProblemsException $e) {
  13112. $this->io->writeError('<error>Your requirements could not be resolved to an installable set of packages.</error>', true, IOInterface::QUIET);
  13113. $this->io->writeError($e->getMessage());
  13114. if ($this->update && !$this->devMode) {
  13115. $this->io->writeError('<warning>Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.</warning>', true, IOInterface::QUIET);
  13116. }
  13117. return array(max(1, $e->getCode()), array());
  13118. }
  13119. $operations = $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-updates', $operations);
  13120. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request, $operations);
  13121. $this->io->writeError("Analyzed ".count($pool)." packages to resolve dependencies", true, IOInterface::VERBOSE);
  13122. $this->io->writeError("Analyzed ".$solver->getRuleSetSize()." rules to resolve dependencies", true, IOInterface::VERBOSE);
  13123. if (!$operations) {
  13124. $this->io->writeError('Nothing to install or update');
  13125. }
  13126. $operations = $this->movePluginsToFront($operations);
  13127. $operations = $this->moveUninstallsToFront($operations);
  13128. if ($this->update) {
  13129. $devPackages = $this->extractDevPackages($operations, $localRepo, $platformRepo, $aliases);
  13130. if (!$this->devMode) {
  13131. $operations = $this->filterDevPackageOperations($devPackages, $operations, $localRepo);
  13132. }
  13133. } else {
  13134. $devPackages = null;
  13135. }
  13136. if ($operations) {
  13137. $installs = $updates = $uninstalls = array();
  13138. foreach ($operations as $operation) {
  13139. if ($operation instanceof InstallOperation) {
  13140. $installs[] = $operation->getPackage()->getPrettyName().':'.$operation->getPackage()->getFullPrettyVersion();
  13141. } elseif ($operation instanceof UpdateOperation) {
  13142. $updates[] = $operation->getTargetPackage()->getPrettyName().':'.$operation->getTargetPackage()->getFullPrettyVersion();
  13143. } elseif ($operation instanceof UninstallOperation) {
  13144. $uninstalls[] = $operation->getPackage()->getPrettyName();
  13145. }
  13146. }
  13147. $this->io->writeError(
  13148. sprintf("<info>Package operations: %d install%s, %d update%s, %d removal%s</info>",
  13149. count($installs),
  13150. 1 === count($installs) ? '' : 's',
  13151. count($updates),
  13152. 1 === count($updates) ? '' : 's',
  13153. count($uninstalls),
  13154. 1 === count($uninstalls) ? '' : 's')
  13155. );
  13156. if ($installs) {
  13157. $this->io->writeError("Installs: ".implode(', ', $installs), true, IOInterface::VERBOSE);
  13158. }
  13159. if ($updates) {
  13160. $this->io->writeError("Updates: ".implode(', ', $updates), true, IOInterface::VERBOSE);
  13161. }
  13162. if ($uninstalls) {
  13163. $this->io->writeError("Removals: ".implode(', ', $uninstalls), true, IOInterface::VERBOSE);
  13164. }
  13165. }
  13166. foreach ($operations as $operation) {
  13167. if ('install' === $operation->getJobType()) {
  13168. $this->suggestedPackagesReporter->addSuggestionsFromPackage($operation->getPackage());
  13169. }
  13170. if ($this->update) {
  13171. $package = null;
  13172. if ('update' === $operation->getJobType()) {
  13173. $package = $operation->getTargetPackage();
  13174. } elseif ('install' === $operation->getJobType()) {
  13175. $package = $operation->getPackage();
  13176. }
  13177. if ($package && $package->isDev()) {
  13178. $references = $this->package->getReferences();
  13179. if (isset($references[$package->getName()])) {
  13180. $this->updateInstallReferences($package, $references[$package->getName()]);
  13181. }
  13182. }
  13183. if ('update' === $operation->getJobType()
  13184. && $operation->getTargetPackage()->isDev()
  13185. && $operation->getTargetPackage()->getVersion() === $operation->getInitialPackage()->getVersion()
  13186. && (!$operation->getTargetPackage()->getSourceReference() || $operation->getTargetPackage()->getSourceReference() === $operation->getInitialPackage()->getSourceReference())
  13187. && (!$operation->getTargetPackage()->getDistReference() || $operation->getTargetPackage()->getDistReference() === $operation->getInitialPackage()->getDistReference())
  13188. ) {
  13189. $this->io->writeError(' - Skipping update of '. $operation->getTargetPackage()->getPrettyName().' to the same reference-locked version', true, IOInterface::DEBUG);
  13190. $this->io->writeError('', true, IOInterface::DEBUG);
  13191. continue;
  13192. }
  13193. }
  13194. $event = 'Composer\Installer\PackageEvents::PRE_PACKAGE_'.strtoupper($operation->getJobType());
  13195. if (defined($event) && $this->runScripts) {
  13196. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  13197. }
  13198. if (!$this->executeOperations && false === strpos($operation->getJobType(), 'Alias')) {
  13199. $this->io->writeError(' - ' . $operation);
  13200. } elseif ($this->io->isDebug() && false !== strpos($operation->getJobType(), 'Alias')) {
  13201. $this->io->writeError(' - ' . $operation);
  13202. }
  13203. $this->installationManager->execute($localRepo, $operation);
  13204. if ($this->verbose && $this->io->isVeryVerbose() && in_array($operation->getJobType(), array('install', 'update'))) {
  13205. $reason = $operation->getReason();
  13206. if ($reason instanceof Rule) {
  13207. switch ($reason->getReason()) {
  13208. case Rule::RULE_JOB_INSTALL:
  13209. $this->io->writeError(' REASON: Required by the root package: '.$reason->getPrettyString($pool));
  13210. $this->io->writeError('');
  13211. break;
  13212. case Rule::RULE_PACKAGE_REQUIRES:
  13213. $this->io->writeError(' REASON: '.$reason->getPrettyString($pool));
  13214. $this->io->writeError('');
  13215. break;
  13216. }
  13217. }
  13218. }
  13219. $event = 'Composer\Installer\PackageEvents::POST_PACKAGE_'.strtoupper($operation->getJobType());
  13220. if (defined($event) && $this->runScripts) {
  13221. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  13222. }
  13223. if ($this->executeOperations || $this->writeLock) {
  13224. $localRepo->write();
  13225. }
  13226. }
  13227. if ($this->executeOperations) {
  13228. $this->processPackageUrls($pool, $policy, $localRepo, $repositories);
  13229. $localRepo->write();
  13230. }
  13231. return array(0, $devPackages);
  13232. }
  13233. private function extractDevPackages(array $operations, RepositoryInterface $localRepo, PlatformRepository $platformRepo, array $aliases)
  13234. {
  13235. if (!$this->package->getDevRequires()) {
  13236. return array();
  13237. }
  13238. $tempLocalRepo = clone $localRepo;
  13239. foreach ($operations as $operation) {
  13240. switch ($operation->getJobType()) {
  13241. case 'install':
  13242. case 'markAliasInstalled':
  13243. if (!$tempLocalRepo->hasPackage($operation->getPackage())) {
  13244. $tempLocalRepo->addPackage(clone $operation->getPackage());
  13245. }
  13246. break;
  13247. case 'uninstall':
  13248. case 'markAliasUninstalled':
  13249. $tempLocalRepo->removePackage($operation->getPackage());
  13250. break;
  13251. case 'update':
  13252. $tempLocalRepo->removePackage($operation->getInitialPackage());
  13253. if (!$tempLocalRepo->hasPackage($operation->getTargetPackage())) {
  13254. $tempLocalRepo->addPackage(clone $operation->getTargetPackage());
  13255. }
  13256. break;
  13257. default:
  13258. throw new \LogicException('Unknown type: '.$operation->getJobType());
  13259. }
  13260. }
  13261. $localRepo = new InstalledArrayRepository(array());
  13262. $loader = new ArrayLoader(null, true);
  13263. $dumper = new ArrayDumper();
  13264. foreach ($tempLocalRepo->getCanonicalPackages() as $pkg) {
  13265. $localRepo->addPackage($loader->load($dumper->dump($pkg)));
  13266. }
  13267. unset($tempLocalRepo, $loader, $dumper);
  13268. $policy = $this->createPolicy();
  13269. $pool = $this->createPool();
  13270. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  13271. $pool->addRepository($installedRepo, $aliases);
  13272. $request = $this->createRequest($this->package, $platformRepo);
  13273. $request->updateAll();
  13274. foreach ($this->package->getRequires() as $link) {
  13275. $request->install($link->getTarget(), $link->getConstraint());
  13276. }
  13277. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request);
  13278. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  13279. $ops = $solver->solve($request, $this->ignorePlatformReqs);
  13280. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request, $ops);
  13281. $devPackages = array();
  13282. foreach ($ops as $op) {
  13283. if ($op->getJobType() === 'uninstall') {
  13284. $devPackages[] = $op->getPackage();
  13285. }
  13286. }
  13287. return $devPackages;
  13288. }
  13289. private function filterDevPackageOperations(array $devPackages, array $operations, RepositoryInterface $localRepo)
  13290. {
  13291. $finalOps = array();
  13292. $packagesToSkip = array();
  13293. foreach ($devPackages as $pkg) {
  13294. $packagesToSkip[$pkg->getName()] = true;
  13295. if ($installedDevPkg = $localRepo->findPackage($pkg->getName(), '*')) {
  13296. if ($installedDevPkg instanceof AliasPackage) {
  13297. $finalOps[] = new MarkAliasUninstalledOperation($installedDevPkg, 'non-dev install removing it');
  13298. $installedDevPkg = $installedDevPkg->getAliasOf();
  13299. }
  13300. $finalOps[] = new UninstallOperation($installedDevPkg, 'non-dev install removing it');
  13301. }
  13302. }
  13303. foreach ($operations as $op) {
  13304. $package = $op->getJobType() === 'update' ? $op->getTargetPackage() : $op->getPackage();
  13305. if (isset($packagesToSkip[$package->getName()])) {
  13306. continue;
  13307. }
  13308. $finalOps[] = $op;
  13309. }
  13310. return $finalOps;
  13311. }
  13312. private function movePluginsToFront(array $operations)
  13313. {
  13314. $pluginsNoDeps = array();
  13315. $pluginsWithDeps = array();
  13316. $pluginRequires = array();
  13317. foreach (array_reverse($operations, true) as $idx => $op) {
  13318. if ($op instanceof InstallOperation) {
  13319. $package = $op->getPackage();
  13320. } elseif ($op instanceof UpdateOperation) {
  13321. $package = $op->getTargetPackage();
  13322. } else {
  13323. continue;
  13324. }
  13325. $isPlugin = $package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer';
  13326. if ($isPlugin || count(array_intersect($package->getNames(), $pluginRequires))) {
  13327. $requires = array_filter(array_keys($package->getRequires()), function ($req) {
  13328. return $req !== 'composer-plugin-api' && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req);
  13329. });
  13330. if ($isPlugin && !count($requires)) {
  13331. array_unshift($pluginsNoDeps, $op);
  13332. } else {
  13333. $pluginRequires = array_merge($pluginRequires, $requires);
  13334. array_unshift($pluginsWithDeps, $op);
  13335. }
  13336. unset($operations[$idx]);
  13337. }
  13338. }
  13339. return array_merge($pluginsNoDeps, $pluginsWithDeps, $operations);
  13340. }
  13341. private function moveUninstallsToFront(array $operations)
  13342. {
  13343. $uninstOps = array();
  13344. foreach ($operations as $idx => $op) {
  13345. if ($op instanceof UninstallOperation) {
  13346. $uninstOps[] = $op;
  13347. unset($operations[$idx]);
  13348. }
  13349. }
  13350. return array_merge($uninstOps, $operations);
  13351. }
  13352. private function createInstalledRepo(RepositoryInterface $localRepo, PlatformRepository $platformRepo)
  13353. {
  13354. $installedRootPackage = clone $this->package;
  13355. $installedRootPackage->setRequires(array());
  13356. $installedRootPackage->setDevRequires(array());
  13357. $repos = array(
  13358. $localRepo,
  13359. new InstalledArrayRepository(array($installedRootPackage)),
  13360. $platformRepo,
  13361. );
  13362. $installedRepo = new CompositeRepository($repos);
  13363. if ($this->additionalInstalledRepository) {
  13364. $installedRepo->addRepository($this->additionalInstalledRepository);
  13365. }
  13366. return $installedRepo;
  13367. }
  13368. private function createPool(RepositoryInterface $lockedRepository = null)
  13369. {
  13370. if ($this->update) {
  13371. $minimumStability = $this->package->getMinimumStability();
  13372. $stabilityFlags = $this->package->getStabilityFlags();
  13373. $requires = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  13374. } else {
  13375. $minimumStability = $this->locker->getMinimumStability();
  13376. $stabilityFlags = $this->locker->getStabilityFlags();
  13377. $requires = array();
  13378. foreach ($lockedRepository->getPackages() as $package) {
  13379. $constraint = new Constraint('=', $package->getVersion());
  13380. $constraint->setPrettyString($package->getPrettyVersion());
  13381. $requires[$package->getName()] = $constraint;
  13382. }
  13383. }
  13384. $rootConstraints = array();
  13385. foreach ($requires as $req => $constraint) {
  13386. if ($this->ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req)) {
  13387. continue;
  13388. }
  13389. if ($constraint instanceof Link) {
  13390. $rootConstraints[$req] = $constraint->getConstraint();
  13391. } else {
  13392. $rootConstraints[$req] = $constraint;
  13393. }
  13394. }
  13395. return new Pool($minimumStability, $stabilityFlags, $rootConstraints);
  13396. }
  13397. private function createPolicy()
  13398. {
  13399. $preferStable = null;
  13400. $preferLowest = null;
  13401. if (!$this->update) {
  13402. $preferStable = $this->locker->getPreferStable();
  13403. $preferLowest = $this->locker->getPreferLowest();
  13404. }
  13405. if (null === $preferStable) {
  13406. $preferStable = $this->preferStable || $this->package->getPreferStable();
  13407. }
  13408. if (null === $preferLowest) {
  13409. $preferLowest = $this->preferLowest;
  13410. }
  13411. return new DefaultPolicy($preferStable, $preferLowest);
  13412. }
  13413. private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo)
  13414. {
  13415. $request = new Request();
  13416. $constraint = new Constraint('=', $rootPackage->getVersion());
  13417. $constraint->setPrettyString($rootPackage->getPrettyVersion());
  13418. $request->install($rootPackage->getName(), $constraint);
  13419. $fixedPackages = $platformRepo->getPackages();
  13420. if ($this->additionalInstalledRepository) {
  13421. $additionalFixedPackages = $this->additionalInstalledRepository->getPackages();
  13422. $fixedPackages = array_merge($fixedPackages, $additionalFixedPackages);
  13423. }
  13424. $provided = $rootPackage->getProvides();
  13425. foreach ($fixedPackages as $package) {
  13426. $constraint = new Constraint('=', $package->getVersion());
  13427. $constraint->setPrettyString($package->getPrettyVersion());
  13428. if ($package->getRepository() !== $platformRepo
  13429. || !isset($provided[$package->getName()])
  13430. || !$provided[$package->getName()]->getConstraint()->matches($constraint)
  13431. ) {
  13432. $request->fix($package->getName(), $constraint);
  13433. }
  13434. }
  13435. return $request;
  13436. }
  13437. private function processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, $task, array $operations = null)
  13438. {
  13439. if ($task === 'force-updates' && null === $operations) {
  13440. throw new \InvalidArgumentException('Missing operations argument');
  13441. }
  13442. if ($task === 'force-links') {
  13443. $operations = array();
  13444. }
  13445. if ($this->update && $this->updateWhitelist) {
  13446. $currentPackages = $this->getCurrentPackages($installedRepo);
  13447. }
  13448. foreach ($localRepo->getCanonicalPackages() as $package) {
  13449. if (!$package->isDev()) {
  13450. continue;
  13451. }
  13452. foreach ($operations as $operation) {
  13453. if (('update' === $operation->getJobType() && $operation->getInitialPackage()->equals($package))
  13454. || ('uninstall' === $operation->getJobType() && $operation->getPackage()->equals($package))
  13455. ) {
  13456. continue 2;
  13457. }
  13458. }
  13459. if ($this->update) {
  13460. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  13461. foreach ($currentPackages as $curPackage) {
  13462. if ($curPackage->isDev() && $curPackage->getName() === $package->getName() && $curPackage->getVersion() === $package->getVersion()) {
  13463. if ($task === 'force-links') {
  13464. $package->setRequires($curPackage->getRequires());
  13465. $package->setConflicts($curPackage->getConflicts());
  13466. $package->setProvides($curPackage->getProvides());
  13467. $package->setReplaces($curPackage->getReplaces());
  13468. } elseif ($task === 'force-updates') {
  13469. if (($curPackage->getSourceReference() && $curPackage->getSourceReference() !== $package->getSourceReference())
  13470. || ($curPackage->getDistReference() && $curPackage->getDistReference() !== $package->getDistReference())
  13471. ) {
  13472. $operations[] = new UpdateOperation($package, $curPackage);
  13473. }
  13474. }
  13475. break;
  13476. }
  13477. }
  13478. continue;
  13479. }
  13480. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  13481. foreach ($matches as $index => $match) {
  13482. if (!in_array($match->getRepository(), $repositories, true)) {
  13483. unset($matches[$index]);
  13484. continue;
  13485. }
  13486. if ($match->getName() !== $package->getName()) {
  13487. unset($matches[$index]);
  13488. continue;
  13489. }
  13490. $matches[$index] = $match->getId();
  13491. }
  13492. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  13493. $newPackage = $pool->literalToPackage($matches[0]);
  13494. if ($task === 'force-links' && $newPackage) {
  13495. $package->setRequires($newPackage->getRequires());
  13496. $package->setConflicts($newPackage->getConflicts());
  13497. $package->setProvides($newPackage->getProvides());
  13498. $package->setReplaces($newPackage->getReplaces());
  13499. }
  13500. if ($task === 'force-updates' && $newPackage && (
  13501. (($newPackage->getSourceReference() && $newPackage->getSourceReference() !== $package->getSourceReference())
  13502. || ($newPackage->getDistReference() && $newPackage->getDistReference() !== $package->getDistReference())
  13503. )
  13504. )) {
  13505. $operations[] = new UpdateOperation($package, $newPackage);
  13506. continue;
  13507. }
  13508. }
  13509. if ($task === 'force-updates') {
  13510. $references = $this->package->getReferences();
  13511. if (isset($references[$package->getName()]) && $references[$package->getName()] !== $package->getSourceReference()) {
  13512. $operations[] = new UpdateOperation($package, clone $package);
  13513. }
  13514. }
  13515. } else {
  13516. foreach ($lockedRepository->findPackages($package->getName()) as $lockedPackage) {
  13517. if ($lockedPackage->isDev() && $lockedPackage->getVersion() === $package->getVersion()) {
  13518. if ($task === 'force-links') {
  13519. $package->setRequires($lockedPackage->getRequires());
  13520. $package->setConflicts($lockedPackage->getConflicts());
  13521. $package->setProvides($lockedPackage->getProvides());
  13522. $package->setReplaces($lockedPackage->getReplaces());
  13523. } elseif ($task === 'force-updates') {
  13524. if (($lockedPackage->getSourceReference() && $lockedPackage->getSourceReference() !== $package->getSourceReference())
  13525. || ($lockedPackage->getDistReference() && $lockedPackage->getDistReference() !== $package->getDistReference())
  13526. ) {
  13527. $operations[] = new UpdateOperation($package, $lockedPackage);
  13528. }
  13529. }
  13530. break;
  13531. }
  13532. }
  13533. }
  13534. }
  13535. return $operations;
  13536. }
  13537. private function getCurrentPackages($installedRepo)
  13538. {
  13539. if ($this->locker->isLocked()) {
  13540. try {
  13541. return $this->locker->getLockedRepository(true)->getPackages();
  13542. } catch (\RuntimeException $e) {
  13543. return $this->locker->getLockedRepository()->getPackages();
  13544. }
  13545. }
  13546. return $installedRepo->getPackages();
  13547. }
  13548. private function getRootAliases()
  13549. {
  13550. if ($this->update) {
  13551. $aliases = $this->package->getAliases();
  13552. } else {
  13553. $aliases = $this->locker->getAliases();
  13554. }
  13555. $normalizedAliases = array();
  13556. foreach ($aliases as $alias) {
  13557. $normalizedAliases[$alias['package']][$alias['version']] = array(
  13558. 'alias' => $alias['alias'],
  13559. 'alias_normalized' => $alias['alias_normalized'],
  13560. );
  13561. }
  13562. return $normalizedAliases;
  13563. }
  13564. private function processPackageUrls($pool, $policy, $localRepo, $repositories)
  13565. {
  13566. if (!$this->update) {
  13567. return;
  13568. }
  13569. $rootRefs = $this->package->getReferences();
  13570. foreach ($localRepo->getCanonicalPackages() as $package) {
  13571. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  13572. foreach ($matches as $index => $match) {
  13573. if (!in_array($match->getRepository(), $repositories, true)) {
  13574. unset($matches[$index]);
  13575. continue;
  13576. }
  13577. if ($match->getName() !== $package->getName()) {
  13578. unset($matches[$index]);
  13579. continue;
  13580. }
  13581. $matches[$index] = $match->getId();
  13582. }
  13583. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  13584. $newPackage = $pool->literalToPackage($matches[0]);
  13585. $sourceUrl = $package->getSourceUrl();
  13586. $newSourceUrl = $newPackage->getSourceUrl();
  13587. $newReference = $newPackage->getSourceReference();
  13588. if ($package->isDev() && isset($rootRefs[$package->getName()]) && $package->getSourceReference() === $rootRefs[$package->getName()]) {
  13589. $newReference = $rootRefs[$package->getName()];
  13590. }
  13591. $this->updatePackageUrl($package, $newSourceUrl, $newPackage->getSourceType(), $newReference, $newPackage->getDistUrl());
  13592. if ($package instanceof CompletePackage && $newPackage instanceof CompletePackage) {
  13593. $package->setAbandoned($newPackage->getReplacementPackage() ?: $newPackage->isAbandoned());
  13594. }
  13595. $package->setDistMirrors($newPackage->getDistMirrors());
  13596. $package->setSourceMirrors($newPackage->getSourceMirrors());
  13597. }
  13598. }
  13599. }
  13600. private function updatePackageUrl(PackageInterface $package, $sourceUrl, $sourceType, $sourceReference, $distUrl)
  13601. {
  13602. $oldSourceRef = $package->getSourceReference();
  13603. if ($package->getSourceUrl() !== $sourceUrl) {
  13604. $package->setSourceType($sourceType);
  13605. $package->setSourceUrl($sourceUrl);
  13606. $package->setSourceReference($sourceReference);
  13607. }
  13608. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $distUrl)) {
  13609. $package->setDistUrl($distUrl);
  13610. $this->updateInstallReferences($package, $sourceReference);
  13611. }
  13612. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  13613. $this->updateInstallReferences($package, $oldSourceRef);
  13614. }
  13615. }
  13616. private function updateInstallReferences(PackageInterface $package, $reference)
  13617. {
  13618. if (!$reference) {
  13619. return;
  13620. }
  13621. $package->setSourceReference($reference);
  13622. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $package->getDistUrl())) {
  13623. $package->setDistReference($reference);
  13624. $package->setDistUrl(preg_replace('{(?<=/|sha=)[a-f0-9]{40}(?=/|$)}i', $reference, $package->getDistUrl()));
  13625. } elseif ($package->getDistReference()) {
  13626. $package->setDistReference($reference);
  13627. }
  13628. }
  13629. private function aliasPlatformPackages(PlatformRepository $platformRepo, $aliases)
  13630. {
  13631. foreach ($aliases as $package => $versions) {
  13632. foreach ($versions as $version => $alias) {
  13633. $packages = $platformRepo->findPackages($package, $version);
  13634. foreach ($packages as $package) {
  13635. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  13636. $aliasPackage->setRootPackageAlias(true);
  13637. $platformRepo->addPackage($aliasPackage);
  13638. }
  13639. }
  13640. }
  13641. }
  13642. private function isUpdateable(PackageInterface $package)
  13643. {
  13644. if (!$this->updateWhitelist) {
  13645. throw new \LogicException('isUpdateable should only be called when a whitelist is present');
  13646. }
  13647. foreach ($this->updateWhitelist as $whiteListedPattern => $void) {
  13648. $patternRegexp = $this->packageNameToRegexp($whiteListedPattern);
  13649. if (preg_match($patternRegexp, $package->getName())) {
  13650. return true;
  13651. }
  13652. }
  13653. return false;
  13654. }
  13655. private function packageNameToRegexp($whiteListedPattern)
  13656. {
  13657. $cleanedWhiteListedPattern = str_replace('\\*', '.*', preg_quote($whiteListedPattern));
  13658. return "{^" . $cleanedWhiteListedPattern . "$}i";
  13659. }
  13660. private function extractPlatformRequirements($links)
  13661. {
  13662. $platformReqs = array();
  13663. foreach ($links as $link) {
  13664. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  13665. $platformReqs[$link->getTarget()] = $link->getPrettyConstraint();
  13666. }
  13667. }
  13668. return $platformReqs;
  13669. }
  13670. private function whitelistUpdateDependencies($localOrLockRepo, array $rootRequires, array $rootDevRequires)
  13671. {
  13672. if (!$this->updateWhitelist) {
  13673. return;
  13674. }
  13675. $rootRequires = array_merge($rootRequires, $rootDevRequires);
  13676. $requiredPackageNames = array();
  13677. foreach ($rootRequires as $require) {
  13678. $requiredPackageNames[] = $require->getTarget();
  13679. }
  13680. $skipPackages = array();
  13681. if (!$this->whitelistAllDependencies) {
  13682. foreach ($rootRequires as $require) {
  13683. $skipPackages[$require->getTarget()] = true;
  13684. }
  13685. }
  13686. $pool = new Pool('dev');
  13687. $pool->addRepository($localOrLockRepo);
  13688. $seen = array();
  13689. $rootRequiredPackageNames = array_keys($rootRequires);
  13690. foreach ($this->updateWhitelist as $packageName => $void) {
  13691. $packageQueue = new \SplQueue;
  13692. $depPackages = $pool->whatProvides($packageName);
  13693. $nameMatchesRequiredPackage = in_array($packageName, $requiredPackageNames, true);
  13694. if (!$nameMatchesRequiredPackage) {
  13695. $whitelistPatternRegexp = $this->packageNameToRegexp($packageName);
  13696. foreach ($rootRequiredPackageNames as $rootRequiredPackageName) {
  13697. if (preg_match($whitelistPatternRegexp, $rootRequiredPackageName)) {
  13698. $nameMatchesRequiredPackage = true;
  13699. break;
  13700. }
  13701. }
  13702. }
  13703. if (count($depPackages) == 0 && !$nameMatchesRequiredPackage && !in_array($packageName, array('nothing', 'lock', 'mirrors'))) {
  13704. $this->io->writeError('<warning>Package "' . $packageName . '" listed for update is not installed. Ignoring.</warning>');
  13705. }
  13706. foreach ($depPackages as $depPackage) {
  13707. $packageQueue->enqueue($depPackage);
  13708. }
  13709. while (!$packageQueue->isEmpty()) {
  13710. $package = $packageQueue->dequeue();
  13711. if (isset($seen[$package->getId()])) {
  13712. continue;
  13713. }
  13714. $seen[$package->getId()] = true;
  13715. $this->updateWhitelist[$package->getName()] = true;
  13716. if (!$this->whitelistDependencies && !$this->whitelistAllDependencies) {
  13717. continue;
  13718. }
  13719. $requires = $package->getRequires();
  13720. foreach ($requires as $require) {
  13721. $requirePackages = $pool->whatProvides($require->getTarget());
  13722. foreach ($requirePackages as $requirePackage) {
  13723. if (isset($this->updateWhitelist[$requirePackage->getName()])) {
  13724. continue;
  13725. }
  13726. if (isset($skipPackages[$requirePackage->getName()])) {
  13727. $this->io->writeError('<warning>Dependency "' . $requirePackage->getName() . '" is also a root requirement, but is not explicitly whitelisted. Ignoring.</warning>');
  13728. continue;
  13729. }
  13730. $packageQueue->enqueue($requirePackage);
  13731. }
  13732. }
  13733. }
  13734. }
  13735. }
  13736. private function mockLocalRepositories(RepositoryManager $rm)
  13737. {
  13738. $packages = array();
  13739. foreach ($rm->getLocalRepository()->getPackages() as $package) {
  13740. $packages[(string) $package] = clone $package;
  13741. }
  13742. foreach ($packages as $key => $package) {
  13743. if ($package instanceof AliasPackage) {
  13744. $alias = (string) $package->getAliasOf();
  13745. $packages[$key] = new AliasPackage($packages[$alias], $package->getVersion(), $package->getPrettyVersion());
  13746. }
  13747. }
  13748. $rm->setLocalRepository(
  13749. new InstalledArrayRepository($packages)
  13750. );
  13751. }
  13752. public static function create(IOInterface $io, Composer $composer)
  13753. {
  13754. return new static(
  13755. $io,
  13756. $composer->getConfig(),
  13757. $composer->getPackage(),
  13758. $composer->getDownloadManager(),
  13759. $composer->getRepositoryManager(),
  13760. $composer->getLocker(),
  13761. $composer->getInstallationManager(),
  13762. $composer->getEventDispatcher(),
  13763. $composer->getAutoloadGenerator()
  13764. );
  13765. }
  13766. public function setAdditionalInstalledRepository(RepositoryInterface $additionalInstalledRepository)
  13767. {
  13768. $this->additionalInstalledRepository = $additionalInstalledRepository;
  13769. return $this;
  13770. }
  13771. public function setDryRun($dryRun = true)
  13772. {
  13773. $this->dryRun = (bool) $dryRun;
  13774. return $this;
  13775. }
  13776. public function isDryRun()
  13777. {
  13778. return $this->dryRun;
  13779. }
  13780. public function setPreferSource($preferSource = true)
  13781. {
  13782. $this->preferSource = (bool) $preferSource;
  13783. return $this;
  13784. }
  13785. public function setPreferDist($preferDist = true)
  13786. {
  13787. $this->preferDist = (bool) $preferDist;
  13788. return $this;
  13789. }
  13790. public function setOptimizeAutoloader($optimizeAutoloader = false)
  13791. {
  13792. $this->optimizeAutoloader = (bool) $optimizeAutoloader;
  13793. if (!$this->optimizeAutoloader) {
  13794. $this->setClassMapAuthoritative(false);
  13795. }
  13796. return $this;
  13797. }
  13798. public function setClassMapAuthoritative($classMapAuthoritative = false)
  13799. {
  13800. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  13801. if ($this->classMapAuthoritative) {
  13802. $this->setOptimizeAutoloader(true);
  13803. }
  13804. return $this;
  13805. }
  13806. public function setApcuAutoloader($apcuAutoloader = false)
  13807. {
  13808. $this->apcuAutoloader = (bool) $apcuAutoloader;
  13809. return $this;
  13810. }
  13811. public function setUpdate($update = true)
  13812. {
  13813. $this->update = (bool) $update;
  13814. return $this;
  13815. }
  13816. public function setDevMode($devMode = true)
  13817. {
  13818. $this->devMode = (bool) $devMode;
  13819. return $this;
  13820. }
  13821. public function setDumpAutoloader($dumpAutoloader = true)
  13822. {
  13823. $this->dumpAutoloader = (bool) $dumpAutoloader;
  13824. return $this;
  13825. }
  13826. public function setRunScripts($runScripts = true)
  13827. {
  13828. $this->runScripts = (bool) $runScripts;
  13829. return $this;
  13830. }
  13831. public function setConfig(Config $config)
  13832. {
  13833. $this->config = $config;
  13834. return $this;
  13835. }
  13836. public function setVerbose($verbose = true)
  13837. {
  13838. $this->verbose = (bool) $verbose;
  13839. return $this;
  13840. }
  13841. public function isVerbose()
  13842. {
  13843. return $this->verbose;
  13844. }
  13845. public function setIgnorePlatformRequirements($ignorePlatformReqs = false)
  13846. {
  13847. $this->ignorePlatformReqs = (bool) $ignorePlatformReqs;
  13848. return $this;
  13849. }
  13850. public function setUpdateWhitelist(array $packages)
  13851. {
  13852. $this->updateWhitelist = array_flip(array_map('strtolower', $packages));
  13853. return $this;
  13854. }
  13855. public function setWhitelistDependencies($updateDependencies = true)
  13856. {
  13857. return $this->setWhitelistTransitiveDependencies($updateDependencies);
  13858. }
  13859. public function setWhitelistTransitiveDependencies($updateTransitiveDependencies = true)
  13860. {
  13861. $this->whitelistDependencies = (bool) $updateTransitiveDependencies;
  13862. return $this;
  13863. }
  13864. public function setWhitelistAllDependencies($updateAllDependencies = true)
  13865. {
  13866. $this->whitelistAllDependencies = (bool) $updateAllDependencies;
  13867. return $this;
  13868. }
  13869. public function setPreferStable($preferStable = true)
  13870. {
  13871. $this->preferStable = (bool) $preferStable;
  13872. return $this;
  13873. }
  13874. public function setPreferLowest($preferLowest = true)
  13875. {
  13876. $this->preferLowest = (bool) $preferLowest;
  13877. return $this;
  13878. }
  13879. public function setWriteLock($writeLock = true)
  13880. {
  13881. $this->writeLock = (bool) $writeLock;
  13882. return $this;
  13883. }
  13884. public function setExecuteOperations($executeOperations = true)
  13885. {
  13886. $this->executeOperations = (bool) $executeOperations;
  13887. return $this;
  13888. }
  13889. public function setSkipSuggest($skipSuggest = true)
  13890. {
  13891. $this->skipSuggest = (bool) $skipSuggest;
  13892. return $this;
  13893. }
  13894. public function disablePlugins()
  13895. {
  13896. $this->installationManager->disablePlugins();
  13897. return $this;
  13898. }
  13899. public function setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter)
  13900. {
  13901. $this->suggestedPackagesReporter = $suggestedPackagesReporter;
  13902. return $this;
  13903. }
  13904. }
  13905. <?php
  13906. namespace Composer\Installer;
  13907. use Composer\IO\IOInterface;
  13908. use Composer\Package\PackageInterface;
  13909. use Composer\Util\Filesystem;
  13910. use Composer\Util\Platform;
  13911. use Composer\Util\ProcessExecutor;
  13912. use Composer\Util\Silencer;
  13913. class BinaryInstaller
  13914. {
  13915. protected $binDir;
  13916. protected $binCompat;
  13917. protected $io;
  13918. protected $filesystem;
  13919. public function __construct(IOInterface $io, $binDir, $binCompat, Filesystem $filesystem = null)
  13920. {
  13921. $this->binDir = $binDir;
  13922. $this->binCompat = $binCompat;
  13923. $this->io = $io;
  13924. $this->filesystem = $filesystem ?: new Filesystem();
  13925. }
  13926. public function installBinaries(PackageInterface $package, $installPath, $warnOnOverwrite = true)
  13927. {
  13928. $binaries = $this->getBinaries($package);
  13929. if (!$binaries) {
  13930. return;
  13931. }
  13932. foreach ($binaries as $bin) {
  13933. $binPath = $installPath.'/'.$bin;
  13934. if (!file_exists($binPath)) {
  13935. $this->io->writeError(' <warning>Skipped installation of bin '.$bin.' for package '.$package->getName().': file not found in package</warning>');
  13936. continue;
  13937. }
  13938. $binPath = realpath($binPath);
  13939. $this->initializeBinDir();
  13940. $link = $this->binDir.'/'.basename($bin);
  13941. if (file_exists($link)) {
  13942. if (is_link($link)) {
  13943. Silencer::call('chmod', $link, 0777 & ~umask());
  13944. }
  13945. if ($warnOnOverwrite) {
  13946. $this->io->writeError(' Skipped installation of bin '.$bin.' for package '.$package->getName().': name conflicts with an existing file');
  13947. }
  13948. continue;
  13949. }
  13950. if ($this->binCompat === "auto") {
  13951. if (Platform::isWindows()) {
  13952. $this->installFullBinaries($binPath, $link, $bin, $package);
  13953. } else {
  13954. $this->installSymlinkBinaries($binPath, $link);
  13955. }
  13956. } elseif ($this->binCompat === "full") {
  13957. $this->installFullBinaries($binPath, $link, $bin, $package);
  13958. }
  13959. Silencer::call('chmod', $link, 0777 & ~umask());
  13960. }
  13961. }
  13962. public function removeBinaries(PackageInterface $package)
  13963. {
  13964. $this->initializeBinDir();
  13965. $binaries = $this->getBinaries($package);
  13966. if (!$binaries) {
  13967. return;
  13968. }
  13969. foreach ($binaries as $bin) {
  13970. $link = $this->binDir.'/'.basename($bin);
  13971. if (is_link($link) || file_exists($link)) {
  13972. $this->filesystem->unlink($link);
  13973. }
  13974. if (file_exists($link.'.bat')) {
  13975. $this->filesystem->unlink($link.'.bat');
  13976. }
  13977. }
  13978. if ((is_dir($this->binDir)) && ($this->filesystem->isDirEmpty($this->binDir))) {
  13979. Silencer::call('rmdir', $this->binDir);
  13980. }
  13981. }
  13982. public static function determineBinaryCaller($bin)
  13983. {
  13984. if ('.bat' === substr($bin, -4) || '.exe' === substr($bin, -4)) {
  13985. return 'call';
  13986. }
  13987. $handle = fopen($bin, 'r');
  13988. $line = fgets($handle);
  13989. fclose($handle);
  13990. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  13991. return trim($match[1]);
  13992. }
  13993. return 'php';
  13994. }
  13995. protected function getBinaries(PackageInterface $package)
  13996. {
  13997. return $package->getBinaries();
  13998. }
  13999. protected function installFullBinaries($binPath, $link, $bin, PackageInterface $package)
  14000. {
  14001. if ('.bat' !== substr($binPath, -4)) {
  14002. $this->installUnixyProxyBinaries($binPath, $link);
  14003. @chmod($link, 0777 & ~umask());
  14004. $link .= '.bat';
  14005. if (file_exists($link)) {
  14006. $this->io->writeError(' Skipped installation of bin '.$bin.'.bat proxy for package '.$package->getName().': a .bat proxy was already installed');
  14007. }
  14008. }
  14009. if (!file_exists($link)) {
  14010. file_put_contents($link, $this->generateWindowsProxyCode($binPath, $link));
  14011. }
  14012. }
  14013. protected function installSymlinkBinaries($binPath, $link)
  14014. {
  14015. if (!$this->filesystem->relativeSymlink($binPath, $link)) {
  14016. $this->installUnixyProxyBinaries($binPath, $link);
  14017. }
  14018. }
  14019. protected function installUnixyProxyBinaries($binPath, $link)
  14020. {
  14021. file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
  14022. }
  14023. protected function initializeBinDir()
  14024. {
  14025. $this->filesystem->ensureDirectoryExists($this->binDir);
  14026. $this->binDir = realpath($this->binDir);
  14027. }
  14028. protected function generateWindowsProxyCode($bin, $link)
  14029. {
  14030. $binPath = $this->filesystem->findShortestPath($link, $bin);
  14031. $caller = self::determineBinaryCaller($bin);
  14032. return "@ECHO OFF\r\n".
  14033. "setlocal DISABLEDELAYEDEXPANSION\r\n".
  14034. "SET BIN_TARGET=%~dp0/".trim(ProcessExecutor::escape($binPath), '"\'')."\r\n".
  14035. "{$caller} \"%BIN_TARGET%\" %*\r\n";
  14036. }
  14037. protected function generateUnixyProxyCode($bin, $link)
  14038. {
  14039. $binPath = $this->filesystem->findShortestPath($link, $bin);
  14040. $binDir = ProcessExecutor::escape(dirname($binPath));
  14041. $binFile = basename($binPath);
  14042. $proxyCode = <<<PROXY
  14043. #!/usr/bin/env sh
  14044. dir=\$(cd "\${0%[/\\\\]*}" > /dev/null; cd $binDir && pwd)
  14045. if [ -d /proc/cygdrive ] && [[ \$(which php) == \$(readlink -n /proc/cygdrive)/* ]]; then
  14046. # We are in Cgywin using Windows php, so the path must be translated
  14047. dir=\$(cygpath -m "\$dir");
  14048. fi
  14049. "\${dir}/$binFile" "\$@"
  14050. PROXY;
  14051. return $proxyCode;
  14052. }
  14053. }
  14054. <?php
  14055. namespace Composer\Installer;
  14056. use Composer\Package\PackageInterface;
  14057. interface BinaryPresenceInterface
  14058. {
  14059. public function ensureBinariesPresence(PackageInterface $package);
  14060. }
  14061. <?php
  14062. namespace Composer\Installer;
  14063. use Composer\IO\IOInterface;
  14064. use Composer\Package\PackageInterface;
  14065. use Composer\Package\AliasPackage;
  14066. use Composer\Repository\RepositoryInterface;
  14067. use Composer\Repository\InstalledRepositoryInterface;
  14068. use Composer\DependencyResolver\Operation\OperationInterface;
  14069. use Composer\DependencyResolver\Operation\InstallOperation;
  14070. use Composer\DependencyResolver\Operation\UpdateOperation;
  14071. use Composer\DependencyResolver\Operation\UninstallOperation;
  14072. use Composer\DependencyResolver\Operation\MarkAliasInstalledOperation;
  14073. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  14074. use Composer\Util\StreamContextFactory;
  14075. class InstallationManager
  14076. {
  14077. private $installers = array();
  14078. private $cache = array();
  14079. private $notifiablePackages = array();
  14080. public function reset()
  14081. {
  14082. $this->notifiablePackages = array();
  14083. }
  14084. public function addInstaller(InstallerInterface $installer)
  14085. {
  14086. array_unshift($this->installers, $installer);
  14087. $this->cache = array();
  14088. }
  14089. public function removeInstaller(InstallerInterface $installer)
  14090. {
  14091. if (false !== ($key = array_search($installer, $this->installers, true))) {
  14092. array_splice($this->installers, $key, 1);
  14093. $this->cache = array();
  14094. }
  14095. }
  14096. public function disablePlugins()
  14097. {
  14098. foreach ($this->installers as $i => $installer) {
  14099. if (!$installer instanceof PluginInstaller) {
  14100. continue;
  14101. }
  14102. unset($this->installers[$i]);
  14103. }
  14104. }
  14105. public function getInstaller($type)
  14106. {
  14107. $type = strtolower($type);
  14108. if (isset($this->cache[$type])) {
  14109. return $this->cache[$type];
  14110. }
  14111. foreach ($this->installers as $installer) {
  14112. if ($installer->supports($type)) {
  14113. return $this->cache[$type] = $installer;
  14114. }
  14115. }
  14116. throw new \InvalidArgumentException('Unknown installer type: '.$type);
  14117. }
  14118. public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14119. {
  14120. if ($package instanceof AliasPackage) {
  14121. return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
  14122. }
  14123. return $this->getInstaller($package->getType())->isInstalled($repo, $package);
  14124. }
  14125. public function ensureBinariesPresence(PackageInterface $package)
  14126. {
  14127. try {
  14128. $installer = $this->getInstaller($package->getType());
  14129. } catch (\InvalidArgumentException $e) {
  14130. return;
  14131. }
  14132. if ($installer instanceof BinaryPresenceInterface) {
  14133. $installer->ensureBinariesPresence($package);
  14134. }
  14135. }
  14136. public function execute(RepositoryInterface $repo, OperationInterface $operation)
  14137. {
  14138. $method = $operation->getJobType();
  14139. $this->$method($repo, $operation);
  14140. }
  14141. public function install(RepositoryInterface $repo, InstallOperation $operation)
  14142. {
  14143. $package = $operation->getPackage();
  14144. $installer = $this->getInstaller($package->getType());
  14145. $installer->install($repo, $package);
  14146. $this->markForNotification($package);
  14147. }
  14148. public function update(RepositoryInterface $repo, UpdateOperation $operation)
  14149. {
  14150. $initial = $operation->getInitialPackage();
  14151. $target = $operation->getTargetPackage();
  14152. $initialType = $initial->getType();
  14153. $targetType = $target->getType();
  14154. if ($initialType === $targetType) {
  14155. $installer = $this->getInstaller($initialType);
  14156. $installer->update($repo, $initial, $target);
  14157. $this->markForNotification($target);
  14158. } else {
  14159. $this->getInstaller($initialType)->uninstall($repo, $initial);
  14160. $this->getInstaller($targetType)->install($repo, $target);
  14161. }
  14162. }
  14163. public function uninstall(RepositoryInterface $repo, UninstallOperation $operation)
  14164. {
  14165. $package = $operation->getPackage();
  14166. $installer = $this->getInstaller($package->getType());
  14167. $installer->uninstall($repo, $package);
  14168. }
  14169. public function markAliasInstalled(RepositoryInterface $repo, MarkAliasInstalledOperation $operation)
  14170. {
  14171. $package = $operation->getPackage();
  14172. if (!$repo->hasPackage($package)) {
  14173. $repo->addPackage(clone $package);
  14174. }
  14175. }
  14176. public function markAliasUninstalled(RepositoryInterface $repo, MarkAliasUninstalledOperation $operation)
  14177. {
  14178. $package = $operation->getPackage();
  14179. $repo->removePackage($package);
  14180. }
  14181. public function getInstallPath(PackageInterface $package)
  14182. {
  14183. $installer = $this->getInstaller($package->getType());
  14184. return $installer->getInstallPath($package);
  14185. }
  14186. public function notifyInstalls(IOInterface $io)
  14187. {
  14188. foreach ($this->notifiablePackages as $repoUrl => $packages) {
  14189. $repositoryName = parse_url($repoUrl, PHP_URL_HOST);
  14190. if ($io->hasAuthentication($repositoryName)) {
  14191. $auth = $io->getAuthentication($repositoryName);
  14192. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  14193. $authHeader = 'Authorization: Basic '.$authStr;
  14194. }
  14195. if (strpos($repoUrl, '%package%')) {
  14196. foreach ($packages as $package) {
  14197. $url = str_replace('%package%', $package->getPrettyName(), $repoUrl);
  14198. $params = array(
  14199. 'version' => $package->getPrettyVersion(),
  14200. 'version_normalized' => $package->getVersion(),
  14201. );
  14202. $opts = array('http' =>
  14203. array(
  14204. 'method' => 'POST',
  14205. 'header' => array('Content-type: application/x-www-form-urlencoded'),
  14206. 'content' => http_build_query($params, '', '&'),
  14207. 'timeout' => 3,
  14208. ),
  14209. );
  14210. if (isset($authHeader)) {
  14211. $opts['http']['header'][] = $authHeader;
  14212. }
  14213. $context = StreamContextFactory::getContext($url, $opts);
  14214. @file_get_contents($url, false, $context);
  14215. }
  14216. continue;
  14217. }
  14218. $postData = array('downloads' => array());
  14219. foreach ($packages as $package) {
  14220. $postData['downloads'][] = array(
  14221. 'name' => $package->getPrettyName(),
  14222. 'version' => $package->getVersion(),
  14223. );
  14224. }
  14225. $opts = array('http' =>
  14226. array(
  14227. 'method' => 'POST',
  14228. 'header' => array('Content-Type: application/json'),
  14229. 'content' => json_encode($postData),
  14230. 'timeout' => 6,
  14231. ),
  14232. );
  14233. if (isset($authHeader)) {
  14234. $opts['http']['header'][] = $authHeader;
  14235. }
  14236. $context = StreamContextFactory::getContext($repoUrl, $opts);
  14237. @file_get_contents($repoUrl, false, $context);
  14238. }
  14239. $this->reset();
  14240. }
  14241. private function markForNotification(PackageInterface $package)
  14242. {
  14243. if ($package->getNotificationUrl()) {
  14244. $this->notifiablePackages[$package->getNotificationUrl()][$package->getName()] = $package;
  14245. }
  14246. }
  14247. }
  14248. <?php
  14249. namespace Composer\Installer;
  14250. use Composer\Composer;
  14251. use Composer\DependencyResolver\PolicyInterface;
  14252. use Composer\DependencyResolver\Operation\OperationInterface;
  14253. use Composer\DependencyResolver\Pool;
  14254. use Composer\DependencyResolver\Request;
  14255. use Composer\EventDispatcher\Event;
  14256. use Composer\IO\IOInterface;
  14257. use Composer\Repository\CompositeRepository;
  14258. class InstallerEvent extends Event
  14259. {
  14260. private $composer;
  14261. private $io;
  14262. private $devMode;
  14263. private $policy;
  14264. private $pool;
  14265. private $installedRepo;
  14266. private $request;
  14267. private $operations;
  14268. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  14269. {
  14270. parent::__construct($eventName);
  14271. $this->composer = $composer;
  14272. $this->io = $io;
  14273. $this->devMode = $devMode;
  14274. $this->policy = $policy;
  14275. $this->pool = $pool;
  14276. $this->installedRepo = $installedRepo;
  14277. $this->request = $request;
  14278. $this->operations = $operations;
  14279. }
  14280. public function getComposer()
  14281. {
  14282. return $this->composer;
  14283. }
  14284. public function getIO()
  14285. {
  14286. return $this->io;
  14287. }
  14288. public function isDevMode()
  14289. {
  14290. return $this->devMode;
  14291. }
  14292. public function getPolicy()
  14293. {
  14294. return $this->policy;
  14295. }
  14296. public function getPool()
  14297. {
  14298. return $this->pool;
  14299. }
  14300. public function getInstalledRepo()
  14301. {
  14302. return $this->installedRepo;
  14303. }
  14304. public function getRequest()
  14305. {
  14306. return $this->request;
  14307. }
  14308. public function getOperations()
  14309. {
  14310. return $this->operations;
  14311. }
  14312. }
  14313. <?php
  14314. namespace Composer\Installer;
  14315. class InstallerEvents
  14316. {
  14317. const PRE_DEPENDENCIES_SOLVING = 'pre-dependencies-solving';
  14318. const POST_DEPENDENCIES_SOLVING = 'post-dependencies-solving';
  14319. }
  14320. <?php
  14321. namespace Composer\Installer;
  14322. use Composer\Package\PackageInterface;
  14323. use Composer\Repository\InstalledRepositoryInterface;
  14324. use InvalidArgumentException;
  14325. interface InstallerInterface
  14326. {
  14327. public function supports($packageType);
  14328. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package);
  14329. public function install(InstalledRepositoryInterface $repo, PackageInterface $package);
  14330. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target);
  14331. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package);
  14332. public function getInstallPath(PackageInterface $package);
  14333. }
  14334. <?php
  14335. namespace Composer\Installer;
  14336. use Composer\Composer;
  14337. use Composer\IO\IOInterface;
  14338. use Composer\Repository\InstalledRepositoryInterface;
  14339. use Composer\Package\PackageInterface;
  14340. use Composer\Util\Filesystem;
  14341. use Composer\Util\Silencer;
  14342. use Composer\Util\Platform;
  14343. class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
  14344. {
  14345. protected $composer;
  14346. protected $vendorDir;
  14347. protected $binDir;
  14348. protected $downloadManager;
  14349. protected $io;
  14350. protected $type;
  14351. protected $filesystem;
  14352. protected $binCompat;
  14353. protected $binaryInstaller;
  14354. public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null, BinaryInstaller $binaryInstaller = null)
  14355. {
  14356. $this->composer = $composer;
  14357. $this->downloadManager = $composer->getDownloadManager();
  14358. $this->io = $io;
  14359. $this->type = $type;
  14360. $this->filesystem = $filesystem ?: new Filesystem();
  14361. $this->vendorDir = rtrim($composer->getConfig()->get('vendor-dir'), '/');
  14362. $this->binaryInstaller = $binaryInstaller ?: new BinaryInstaller($this->io, rtrim($composer->getConfig()->get('bin-dir'), '/'), $composer->getConfig()->get('bin-compat'), $this->filesystem);
  14363. }
  14364. public function supports($packageType)
  14365. {
  14366. return $packageType === $this->type || null === $this->type;
  14367. }
  14368. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14369. {
  14370. if (!$repo->hasPackage($package)) {
  14371. return false;
  14372. }
  14373. $installPath = $this->getInstallPath($package);
  14374. if (is_readable($installPath)) {
  14375. return true;
  14376. }
  14377. return (Platform::isWindows() && $this->filesystem->isJunction($installPath)) || is_link($installPath);
  14378. }
  14379. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14380. {
  14381. $this->initializeVendorDir();
  14382. $downloadPath = $this->getInstallPath($package);
  14383. if (!is_readable($downloadPath) && $repo->hasPackage($package)) {
  14384. $this->binaryInstaller->removeBinaries($package);
  14385. }
  14386. $this->installCode($package);
  14387. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package));
  14388. if (!$repo->hasPackage($package)) {
  14389. $repo->addPackage(clone $package);
  14390. }
  14391. }
  14392. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14393. {
  14394. if (!$repo->hasPackage($initial)) {
  14395. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  14396. }
  14397. $this->initializeVendorDir();
  14398. $this->binaryInstaller->removeBinaries($initial);
  14399. $this->updateCode($initial, $target);
  14400. $this->binaryInstaller->installBinaries($target, $this->getInstallPath($target));
  14401. $repo->removePackage($initial);
  14402. if (!$repo->hasPackage($target)) {
  14403. $repo->addPackage(clone $target);
  14404. }
  14405. }
  14406. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  14407. {
  14408. if (!$repo->hasPackage($package)) {
  14409. throw new \InvalidArgumentException('Package is not installed: '.$package);
  14410. }
  14411. $this->removeCode($package);
  14412. $this->binaryInstaller->removeBinaries($package);
  14413. $repo->removePackage($package);
  14414. $downloadPath = $this->getPackageBasePath($package);
  14415. if (strpos($package->getName(), '/')) {
  14416. $packageVendorDir = dirname($downloadPath);
  14417. if (is_dir($packageVendorDir) && $this->filesystem->isDirEmpty($packageVendorDir)) {
  14418. Silencer::call('rmdir', $packageVendorDir);
  14419. }
  14420. }
  14421. }
  14422. public function getInstallPath(PackageInterface $package)
  14423. {
  14424. $this->initializeVendorDir();
  14425. $basePath = ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
  14426. $targetDir = $package->getTargetDir();
  14427. return $basePath . ($targetDir ? '/'.$targetDir : '');
  14428. }
  14429. public function ensureBinariesPresence(PackageInterface $package)
  14430. {
  14431. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package), false);
  14432. }
  14433. protected function getPackageBasePath(PackageInterface $package)
  14434. {
  14435. $installPath = $this->getInstallPath($package);
  14436. $targetDir = $package->getTargetDir();
  14437. if ($targetDir) {
  14438. return preg_replace('{/*'.str_replace('/', '/+', preg_quote($targetDir)).'/?$}', '', $installPath);
  14439. }
  14440. return $installPath;
  14441. }
  14442. protected function installCode(PackageInterface $package)
  14443. {
  14444. $downloadPath = $this->getInstallPath($package);
  14445. $this->downloadManager->download($package, $downloadPath);
  14446. }
  14447. protected function updateCode(PackageInterface $initial, PackageInterface $target)
  14448. {
  14449. $initialDownloadPath = $this->getInstallPath($initial);
  14450. $targetDownloadPath = $this->getInstallPath($target);
  14451. if ($targetDownloadPath !== $initialDownloadPath) {
  14452. if (substr($initialDownloadPath, 0, strlen($targetDownloadPath)) === $targetDownloadPath
  14453. || substr($targetDownloadPath, 0, strlen($initialDownloadPath)) === $initialDownloadPath
  14454. ) {
  14455. $this->removeCode($initial);
  14456. $this->installCode($target);
  14457. return;
  14458. }
  14459. $this->filesystem->rename($initialDownloadPath, $targetDownloadPath);
  14460. }
  14461. $this->downloadManager->update($initial, $target, $targetDownloadPath);
  14462. }
  14463. protected function removeCode(PackageInterface $package)
  14464. {
  14465. $downloadPath = $this->getPackageBasePath($package);
  14466. $this->downloadManager->remove($package, $downloadPath);
  14467. }
  14468. protected function initializeVendorDir()
  14469. {
  14470. $this->filesystem->ensureDirectoryExists($this->vendorDir);
  14471. $this->vendorDir = realpath($this->vendorDir);
  14472. }
  14473. }
  14474. <?php
  14475. namespace Composer\Installer;
  14476. use Composer\Repository\InstalledRepositoryInterface;
  14477. use Composer\Package\PackageInterface;
  14478. class MetapackageInstaller implements InstallerInterface
  14479. {
  14480. public function supports($packageType)
  14481. {
  14482. return $packageType === 'metapackage';
  14483. }
  14484. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14485. {
  14486. return $repo->hasPackage($package);
  14487. }
  14488. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14489. {
  14490. $repo->addPackage(clone $package);
  14491. }
  14492. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14493. {
  14494. if (!$repo->hasPackage($initial)) {
  14495. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  14496. }
  14497. $repo->removePackage($initial);
  14498. $repo->addPackage(clone $target);
  14499. }
  14500. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  14501. {
  14502. if (!$repo->hasPackage($package)) {
  14503. throw new \InvalidArgumentException('Package is not installed: '.$package);
  14504. }
  14505. $repo->removePackage($package);
  14506. }
  14507. public function getInstallPath(PackageInterface $package)
  14508. {
  14509. return '';
  14510. }
  14511. }
  14512. <?php
  14513. namespace Composer\Installer;
  14514. use Composer\Repository\InstalledRepositoryInterface;
  14515. use Composer\Package\PackageInterface;
  14516. class NoopInstaller implements InstallerInterface
  14517. {
  14518. public function supports($packageType)
  14519. {
  14520. return true;
  14521. }
  14522. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14523. {
  14524. return $repo->hasPackage($package);
  14525. }
  14526. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14527. {
  14528. if (!$repo->hasPackage($package)) {
  14529. $repo->addPackage(clone $package);
  14530. }
  14531. }
  14532. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14533. {
  14534. if (!$repo->hasPackage($initial)) {
  14535. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  14536. }
  14537. $repo->removePackage($initial);
  14538. if (!$repo->hasPackage($target)) {
  14539. $repo->addPackage(clone $target);
  14540. }
  14541. }
  14542. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  14543. {
  14544. if (!$repo->hasPackage($package)) {
  14545. throw new \InvalidArgumentException('Package is not installed: '.$package);
  14546. }
  14547. $repo->removePackage($package);
  14548. }
  14549. public function getInstallPath(PackageInterface $package)
  14550. {
  14551. $targetDir = $package->getTargetDir();
  14552. return $package->getPrettyName() . ($targetDir ? '/'.$targetDir : '');
  14553. }
  14554. }
  14555. <?php
  14556. namespace Composer\Installer;
  14557. use Composer\Composer;
  14558. use Composer\IO\IOInterface;
  14559. use Composer\DependencyResolver\Operation\OperationInterface;
  14560. use Composer\DependencyResolver\PolicyInterface;
  14561. use Composer\DependencyResolver\Pool;
  14562. use Composer\DependencyResolver\Request;
  14563. use Composer\Repository\CompositeRepository;
  14564. class PackageEvent extends InstallerEvent
  14565. {
  14566. private $operation;
  14567. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  14568. {
  14569. parent::__construct($eventName, $composer, $io, $devMode, $policy, $pool, $installedRepo, $request, $operations);
  14570. $this->operation = $operation;
  14571. }
  14572. public function getOperation()
  14573. {
  14574. return $this->operation;
  14575. }
  14576. }
  14577. <?php
  14578. namespace Composer\Installer;
  14579. class PackageEvents
  14580. {
  14581. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  14582. const POST_PACKAGE_INSTALL = 'post-package-install';
  14583. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  14584. const POST_PACKAGE_UPDATE = 'post-package-update';
  14585. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  14586. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  14587. }
  14588. <?php
  14589. namespace Composer\Installer;
  14590. use Composer\IO\IOInterface;
  14591. use Composer\Package\PackageInterface;
  14592. use Composer\Util\Filesystem;
  14593. use Composer\Util\ProcessExecutor;
  14594. class PearBinaryInstaller extends BinaryInstaller
  14595. {
  14596. private $installer;
  14597. private $vendorDir;
  14598. public function __construct(IOInterface $io, $binDir, $vendorDir, $binCompat, Filesystem $filesystem, PearInstaller $installer)
  14599. {
  14600. parent::__construct($io, $binDir, $binCompat, $filesystem);
  14601. $this->installer = $installer;
  14602. $this->vendorDir = $vendorDir;
  14603. }
  14604. protected function getBinaries(PackageInterface $package)
  14605. {
  14606. $binariesPath = $this->installer->getInstallPath($package) . '/bin/';
  14607. $binaries = array();
  14608. if (file_exists($binariesPath)) {
  14609. foreach (new \FilesystemIterator($binariesPath, \FilesystemIterator::KEY_AS_FILENAME | \FilesystemIterator::CURRENT_AS_FILEINFO) as $fileName => $value) {
  14610. if (!$value->isDir()) {
  14611. $binaries[] = 'bin/'.$fileName;
  14612. }
  14613. }
  14614. }
  14615. return $binaries;
  14616. }
  14617. protected function initializeBinDir()
  14618. {
  14619. parent::initializeBinDir();
  14620. file_put_contents($this->binDir.'/composer-php', $this->generateUnixyPhpProxyCode());
  14621. @chmod($this->binDir.'/composer-php', 0777 & ~umask());
  14622. file_put_contents($this->binDir.'/composer-php.bat', $this->generateWindowsPhpProxyCode());
  14623. @chmod($this->binDir.'/composer-php.bat', 0777 & ~umask());
  14624. }
  14625. protected function generateWindowsProxyCode($bin, $link)
  14626. {
  14627. $binPath = $this->filesystem->findShortestPath($link, $bin);
  14628. if ('.bat' === substr($bin, -4)) {
  14629. $caller = 'call';
  14630. } else {
  14631. $handle = fopen($bin, 'r');
  14632. $line = fgets($handle);
  14633. fclose($handle);
  14634. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  14635. $caller = trim($match[1]);
  14636. } else {
  14637. $caller = 'php';
  14638. }
  14639. if ($caller === 'php') {
  14640. return "@echo off\r\n".
  14641. "pushd .\r\n".
  14642. "cd %~dp0\r\n".
  14643. "set PHP_PROXY=%CD%\\composer-php.bat\r\n".
  14644. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  14645. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  14646. "popd\r\n".
  14647. "%PHP_PROXY% \"%BIN_TARGET%\" %*\r\n";
  14648. }
  14649. }
  14650. return "@echo off\r\n".
  14651. "pushd .\r\n".
  14652. "cd %~dp0\r\n".
  14653. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  14654. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  14655. "popd\r\n".
  14656. $caller." \"%BIN_TARGET%\" %*\r\n";
  14657. }
  14658. private function generateWindowsPhpProxyCode()
  14659. {
  14660. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  14661. return
  14662. "@echo off\r\n" .
  14663. "setlocal enabledelayedexpansion\r\n" .
  14664. "set BIN_DIR=%~dp0\r\n" .
  14665. "set VENDOR_DIR=%BIN_DIR%\\".$binToVendor."\r\n" .
  14666. "set DIRS=.\r\n" .
  14667. "FOR /D %%V IN (%VENDOR_DIR%\\*) DO (\r\n" .
  14668. " FOR /D %%P IN (%%V\\*) DO (\r\n" .
  14669. " set DIRS=!DIRS!;%%~fP\r\n" .
  14670. " )\r\n" .
  14671. ")\r\n" .
  14672. "php.exe -d include_path=!DIRS! %*\r\n";
  14673. }
  14674. private function generateUnixyPhpProxyCode()
  14675. {
  14676. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  14677. return
  14678. "#!/usr/bin/env sh\n".
  14679. "SRC_DIR=`pwd`\n".
  14680. "BIN_DIR=`dirname $0`\n".
  14681. "VENDOR_DIR=\$BIN_DIR/".escapeshellarg($binToVendor)."\n".
  14682. "DIRS=\"\"\n".
  14683. "for vendor in \$VENDOR_DIR/*; do\n".
  14684. " if [ -d \"\$vendor\" ]; then\n".
  14685. " for package in \$vendor/*; do\n".
  14686. " if [ -d \"\$package\" ]; then\n".
  14687. " DIRS=\"\${DIRS}:\${package}\"\n".
  14688. " fi\n".
  14689. " done\n".
  14690. " fi\n".
  14691. "done\n".
  14692. "php -d include_path=\".\$DIRS\" $@\n";
  14693. }
  14694. }
  14695. <?php
  14696. namespace Composer\Installer;
  14697. use Composer\IO\IOInterface;
  14698. use Composer\Composer;
  14699. use Composer\Downloader\PearPackageExtractor;
  14700. use Composer\Repository\InstalledRepositoryInterface;
  14701. use Composer\Package\PackageInterface;
  14702. use Composer\Util\Platform;
  14703. use Composer\Util\Filesystem;
  14704. class PearInstaller extends LibraryInstaller
  14705. {
  14706. public function __construct(IOInterface $io, Composer $composer, $type = 'pear-library')
  14707. {
  14708. $filesystem = new Filesystem();
  14709. $binaryInstaller = new PearBinaryInstaller($io, rtrim($composer->getConfig()->get('bin-dir'), '/'), rtrim($composer->getConfig()->get('vendor-dir'), '/'), $composer->getConfig()->get('bin-compat'), $filesystem, $this);
  14710. parent::__construct($io, $composer, $type, $filesystem, $binaryInstaller);
  14711. }
  14712. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14713. {
  14714. $this->uninstall($repo, $initial);
  14715. $this->install($repo, $target);
  14716. }
  14717. protected function installCode(PackageInterface $package)
  14718. {
  14719. parent::installCode($package);
  14720. $isWindows = Platform::isWindows();
  14721. $php_bin = $this->binDir . ($isWindows ? '/composer-php.bat' : '/composer-php');
  14722. if (!$isWindows) {
  14723. $php_bin = '/usr/bin/env ' . $php_bin;
  14724. }
  14725. $installPath = $this->getInstallPath($package);
  14726. $vars = array(
  14727. 'os' => $isWindows ? 'windows' : 'linux',
  14728. 'php_bin' => $php_bin,
  14729. 'pear_php' => $installPath,
  14730. 'php_dir' => $installPath,
  14731. 'bin_dir' => $installPath . '/bin',
  14732. 'data_dir' => $installPath . '/data',
  14733. 'version' => $package->getPrettyVersion(),
  14734. );
  14735. $packageArchive = $this->getInstallPath($package).'/'.pathinfo($package->getDistUrl(), PATHINFO_BASENAME);
  14736. $pearExtractor = new PearPackageExtractor($packageArchive);
  14737. $pearExtractor->extractTo($this->getInstallPath($package), array('php' => '/', 'script' => '/bin', 'data' => '/data'), $vars);
  14738. $this->io->writeError(' Cleaning up', true, IOInterface::VERBOSE);
  14739. $this->filesystem->unlink($packageArchive);
  14740. }
  14741. }
  14742. <?php
  14743. namespace Composer\Installer;
  14744. use Composer\Composer;
  14745. use Composer\IO\IOInterface;
  14746. use Composer\Repository\InstalledRepositoryInterface;
  14747. use Composer\Package\PackageInterface;
  14748. class PluginInstaller extends LibraryInstaller
  14749. {
  14750. private $installationManager;
  14751. public function __construct(IOInterface $io, Composer $composer, $type = 'library')
  14752. {
  14753. parent::__construct($io, $composer, 'composer-plugin');
  14754. $this->installationManager = $composer->getInstallationManager();
  14755. }
  14756. public function supports($packageType)
  14757. {
  14758. return $packageType === 'composer-plugin' || $packageType === 'composer-installer';
  14759. }
  14760. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14761. {
  14762. $extra = $package->getExtra();
  14763. if (empty($extra['class'])) {
  14764. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  14765. }
  14766. parent::install($repo, $package);
  14767. try {
  14768. $this->composer->getPluginManager()->registerPackage($package, true);
  14769. } catch (\Exception $e) {
  14770. $this->io->writeError('Plugin installation failed, rolling back');
  14771. parent::uninstall($repo, $package);
  14772. throw $e;
  14773. }
  14774. }
  14775. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14776. {
  14777. $extra = $target->getExtra();
  14778. if (empty($extra['class'])) {
  14779. throw new \UnexpectedValueException('Error while installing '.$target->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  14780. }
  14781. parent::update($repo, $initial, $target);
  14782. $this->composer->getPluginManager()->registerPackage($target, true);
  14783. }
  14784. }
  14785. <?php
  14786. namespace Composer\Installer;
  14787. use Composer\Package\PackageInterface;
  14788. use Composer\Downloader\DownloadManager;
  14789. use Composer\Repository\InstalledRepositoryInterface;
  14790. use Composer\Util\Filesystem;
  14791. class ProjectInstaller implements InstallerInterface
  14792. {
  14793. private $installPath;
  14794. private $downloadManager;
  14795. private $filesystem;
  14796. public function __construct($installPath, DownloadManager $dm)
  14797. {
  14798. $this->installPath = rtrim(strtr($installPath, '\\', '/'), '/').'/';
  14799. $this->downloadManager = $dm;
  14800. $this->filesystem = new Filesystem;
  14801. }
  14802. public function supports($packageType)
  14803. {
  14804. return true;
  14805. }
  14806. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14807. {
  14808. return false;
  14809. }
  14810. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14811. {
  14812. $installPath = $this->installPath;
  14813. if (file_exists($installPath) && !$this->filesystem->isDirEmpty($installPath)) {
  14814. throw new \InvalidArgumentException("Project directory $installPath is not empty.");
  14815. }
  14816. if (!is_dir($installPath)) {
  14817. mkdir($installPath, 0777, true);
  14818. }
  14819. $this->downloadManager->download($package, $installPath);
  14820. }
  14821. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14822. {
  14823. throw new \InvalidArgumentException("not supported");
  14824. }
  14825. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  14826. {
  14827. throw new \InvalidArgumentException("not supported");
  14828. }
  14829. public function getInstallPath(PackageInterface $package)
  14830. {
  14831. return $this->installPath;
  14832. }
  14833. }
  14834. <?php
  14835. namespace Composer\Installer;
  14836. use Composer\IO\IOInterface;
  14837. use Composer\Package\PackageInterface;
  14838. use Composer\Repository\RepositoryInterface;
  14839. use Symfony\Component\Console\Formatter\OutputFormatter;
  14840. class SuggestedPackagesReporter
  14841. {
  14842. protected $suggestedPackages = array();
  14843. private $io;
  14844. public function __construct(IOInterface $io)
  14845. {
  14846. $this->io = $io;
  14847. }
  14848. public function getPackages()
  14849. {
  14850. return $this->suggestedPackages;
  14851. }
  14852. public function addPackage($source, $target, $reason)
  14853. {
  14854. $this->suggestedPackages[] = array(
  14855. 'source' => $source,
  14856. 'target' => $target,
  14857. 'reason' => $reason,
  14858. );
  14859. return $this;
  14860. }
  14861. public function addSuggestionsFromPackage(PackageInterface $package)
  14862. {
  14863. $source = $package->getPrettyName();
  14864. foreach ($package->getSuggests() as $target => $reason) {
  14865. $this->addPackage(
  14866. $source,
  14867. $target,
  14868. $reason
  14869. );
  14870. }
  14871. return $this;
  14872. }
  14873. public function output(RepositoryInterface $installedRepo = null)
  14874. {
  14875. $suggestedPackages = $this->getPackages();
  14876. $installedPackages = array();
  14877. if (null !== $installedRepo && ! empty($suggestedPackages)) {
  14878. foreach ($installedRepo->getPackages() as $package) {
  14879. $installedPackages = array_merge(
  14880. $installedPackages,
  14881. $package->getNames()
  14882. );
  14883. }
  14884. }
  14885. foreach ($suggestedPackages as $suggestion) {
  14886. if (in_array($suggestion['target'], $installedPackages)) {
  14887. continue;
  14888. }
  14889. $this->io->writeError(sprintf(
  14890. '%s suggests installing %s (%s)',
  14891. $suggestion['source'],
  14892. $this->escapeOutput($suggestion['target']),
  14893. $this->escapeOutput($suggestion['reason'])
  14894. ));
  14895. }
  14896. return $this;
  14897. }
  14898. private function escapeOutput($string)
  14899. {
  14900. return OutputFormatter::escape(
  14901. $this->removeControlCharacters($string)
  14902. );
  14903. }
  14904. private function removeControlCharacters($string)
  14905. {
  14906. return preg_replace(
  14907. '/[[:cntrl:]]/',
  14908. '',
  14909. str_replace("\n", ' ', $string)
  14910. );
  14911. }
  14912. }
  14913. <?php
  14914. namespace Composer\Json;
  14915. use JsonSchema\Validator;
  14916. use Seld\JsonLint\JsonParser;
  14917. use Seld\JsonLint\ParsingException;
  14918. use Composer\Util\RemoteFilesystem;
  14919. use Composer\IO\IOInterface;
  14920. use Composer\Downloader\TransportException;
  14921. class JsonFile
  14922. {
  14923. const LAX_SCHEMA = 1;
  14924. const STRICT_SCHEMA = 2;
  14925. const JSON_UNESCAPED_SLASHES = 64;
  14926. const JSON_PRETTY_PRINT = 128;
  14927. const JSON_UNESCAPED_UNICODE = 256;
  14928. private $path;
  14929. private $rfs;
  14930. private $io;
  14931. public function __construct($path, RemoteFilesystem $rfs = null, IOInterface $io = null)
  14932. {
  14933. $this->path = $path;
  14934. if (null === $rfs && preg_match('{^https?://}i', $path)) {
  14935. throw new \InvalidArgumentException('http urls require a RemoteFilesystem instance to be passed');
  14936. }
  14937. $this->rfs = $rfs;
  14938. $this->io = $io;
  14939. }
  14940. public function getPath()
  14941. {
  14942. return $this->path;
  14943. }
  14944. public function exists()
  14945. {
  14946. return is_file($this->path);
  14947. }
  14948. public function read()
  14949. {
  14950. try {
  14951. if ($this->rfs) {
  14952. $json = $this->rfs->getContents($this->path, $this->path, false);
  14953. } else {
  14954. if ($this->io && $this->io->isDebug()) {
  14955. $this->io->writeError('Reading ' . $this->path);
  14956. }
  14957. $json = file_get_contents($this->path);
  14958. }
  14959. } catch (TransportException $e) {
  14960. throw new \RuntimeException($e->getMessage(), 0, $e);
  14961. } catch (\Exception $e) {
  14962. throw new \RuntimeException('Could not read '.$this->path."\n\n".$e->getMessage());
  14963. }
  14964. return static::parseJson($json, $this->path);
  14965. }
  14966. public function write(array $hash, $options = 448)
  14967. {
  14968. $dir = dirname($this->path);
  14969. if (!is_dir($dir)) {
  14970. if (file_exists($dir)) {
  14971. throw new \UnexpectedValueException(
  14972. $dir.' exists and is not a directory.'
  14973. );
  14974. }
  14975. if (!@mkdir($dir, 0777, true)) {
  14976. throw new \UnexpectedValueException(
  14977. $dir.' does not exist and could not be created.'
  14978. );
  14979. }
  14980. }
  14981. $retries = 3;
  14982. while ($retries--) {
  14983. try {
  14984. file_put_contents($this->path, static::encode($hash, $options). ($options & self::JSON_PRETTY_PRINT ? "\n" : ''));
  14985. break;
  14986. } catch (\Exception $e) {
  14987. if ($retries) {
  14988. usleep(500000);
  14989. continue;
  14990. }
  14991. throw $e;
  14992. }
  14993. }
  14994. }
  14995. public function validateSchema($schema = self::STRICT_SCHEMA)
  14996. {
  14997. $content = file_get_contents($this->path);
  14998. $data = json_decode($content);
  14999. if (null === $data && 'null' !== $content) {
  15000. self::validateSyntax($content, $this->path);
  15001. }
  15002. $schemaFile = __DIR__ . '/../../../res/composer-schema.json';
  15003. if (false === strpos($schemaFile, '://')) {
  15004. $schemaFile = 'file://' . $schemaFile;
  15005. }
  15006. $schemaData = (object) array('$ref' => $schemaFile);
  15007. if ($schema === self::LAX_SCHEMA) {
  15008. $schemaData->additionalProperties = true;
  15009. $schemaData->required = array();
  15010. }
  15011. $validator = new Validator();
  15012. $validator->check($data, $schemaData);
  15013. if (!$validator->isValid()) {
  15014. $errors = array();
  15015. foreach ((array) $validator->getErrors() as $error) {
  15016. $errors[] = ($error['property'] ? $error['property'].' : ' : '').$error['message'];
  15017. }
  15018. throw new JsonValidationException('"'.$this->path.'" does not match the expected JSON schema', $errors);
  15019. }
  15020. return true;
  15021. }
  15022. public static function encode($data, $options = 448)
  15023. {
  15024. if (PHP_VERSION_ID >= 50400) {
  15025. $json = json_encode($data, $options);
  15026. if (false === $json) {
  15027. self::throwEncodeError(json_last_error());
  15028. }
  15029. if (PHP_VERSION_ID < 50428 || (PHP_VERSION_ID >= 50500 && PHP_VERSION_ID < 50512) || (defined('JSON_C_VERSION') && version_compare(phpversion('json'), '1.3.6', '<'))) {
  15030. $json = preg_replace('/\[\s+\]/', '[]', $json);
  15031. $json = preg_replace('/\{\s+\}/', '{}', $json);
  15032. }
  15033. return $json;
  15034. }
  15035. $json = json_encode($data);
  15036. if (false === $json) {
  15037. self::throwEncodeError(json_last_error());
  15038. }
  15039. $prettyPrint = (bool) ($options & self::JSON_PRETTY_PRINT);
  15040. $unescapeUnicode = (bool) ($options & self::JSON_UNESCAPED_UNICODE);
  15041. $unescapeSlashes = (bool) ($options & self::JSON_UNESCAPED_SLASHES);
  15042. if (!$prettyPrint && !$unescapeUnicode && !$unescapeSlashes) {
  15043. return $json;
  15044. }
  15045. return JsonFormatter::format($json, $unescapeUnicode, $unescapeSlashes);
  15046. }
  15047. private static function throwEncodeError($code)
  15048. {
  15049. switch ($code) {
  15050. case JSON_ERROR_DEPTH:
  15051. $msg = 'Maximum stack depth exceeded';
  15052. break;
  15053. case JSON_ERROR_STATE_MISMATCH:
  15054. $msg = 'Underflow or the modes mismatch';
  15055. break;
  15056. case JSON_ERROR_CTRL_CHAR:
  15057. $msg = 'Unexpected control character found';
  15058. break;
  15059. case JSON_ERROR_UTF8:
  15060. $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  15061. break;
  15062. default:
  15063. $msg = 'Unknown error';
  15064. }
  15065. throw new \RuntimeException('JSON encoding failed: '.$msg);
  15066. }
  15067. public static function parseJson($json, $file = null)
  15068. {
  15069. if (null === $json) {
  15070. return;
  15071. }
  15072. $data = json_decode($json, true);
  15073. if (null === $data && JSON_ERROR_NONE !== json_last_error()) {
  15074. self::validateSyntax($json, $file);
  15075. }
  15076. return $data;
  15077. }
  15078. protected static function validateSyntax($json, $file = null)
  15079. {
  15080. $parser = new JsonParser();
  15081. $result = $parser->lint($json);
  15082. if (null === $result) {
  15083. if (defined('JSON_ERROR_UTF8') && JSON_ERROR_UTF8 === json_last_error()) {
  15084. throw new \UnexpectedValueException('"'.$file.'" is not UTF-8, could not parse as JSON');
  15085. }
  15086. return true;
  15087. }
  15088. throw new ParsingException('"'.$file.'" does not contain valid JSON'."\n".$result->getMessage(), $result->getDetails());
  15089. }
  15090. }
  15091. <?php
  15092. namespace Composer\Json;
  15093. class JsonFormatter
  15094. {
  15095. public static function format($json, $unescapeUnicode, $unescapeSlashes)
  15096. {
  15097. $result = '';
  15098. $pos = 0;
  15099. $strLen = strlen($json);
  15100. $indentStr = ' ';
  15101. $newLine = "\n";
  15102. $outOfQuotes = true;
  15103. $buffer = '';
  15104. $noescape = true;
  15105. for ($i = 0; $i < $strLen; $i++) {
  15106. $char = substr($json, $i, 1);
  15107. if ('"' === $char && $noescape) {
  15108. $outOfQuotes = !$outOfQuotes;
  15109. }
  15110. if (!$outOfQuotes) {
  15111. $buffer .= $char;
  15112. $noescape = '\\' === $char ? !$noescape : true;
  15113. continue;
  15114. } elseif ('' !== $buffer) {
  15115. if ($unescapeSlashes) {
  15116. $buffer = str_replace('\\/', '/', $buffer);
  15117. }
  15118. if ($unescapeUnicode && function_exists('mb_convert_encoding')) {
  15119. $buffer = preg_replace_callback('/(\\\\+)u([0-9a-f]{4})/i', function ($match) {
  15120. $l = strlen($match[1]);
  15121. if ($l % 2) {
  15122. return str_repeat('\\', $l - 1) . mb_convert_encoding(
  15123. pack('H*', $match[2]),
  15124. 'UTF-8',
  15125. 'UCS-2BE'
  15126. );
  15127. }
  15128. return $match[0];
  15129. }, $buffer);
  15130. }
  15131. $result .= $buffer.$char;
  15132. $buffer = '';
  15133. continue;
  15134. }
  15135. if (':' === $char) {
  15136. $char .= ' ';
  15137. } elseif (('}' === $char || ']' === $char)) {
  15138. $pos--;
  15139. $prevChar = substr($json, $i - 1, 1);
  15140. if ('{' !== $prevChar && '[' !== $prevChar) {
  15141. $result .= $newLine;
  15142. for ($j = 0; $j < $pos; $j++) {
  15143. $result .= $indentStr;
  15144. }
  15145. } else {
  15146. $result = rtrim($result);
  15147. }
  15148. }
  15149. $result .= $char;
  15150. if (',' === $char || '{' === $char || '[' === $char) {
  15151. $result .= $newLine;
  15152. if ('{' === $char || '[' === $char) {
  15153. $pos++;
  15154. }
  15155. for ($j = 0; $j < $pos; $j++) {
  15156. $result .= $indentStr;
  15157. }
  15158. }
  15159. }
  15160. return $result;
  15161. }
  15162. }
  15163. <?php
  15164. namespace Composer\Json;
  15165. use Composer\Repository\PlatformRepository;
  15166. class JsonManipulator
  15167. {
  15168. private static $DEFINES = '(?(DEFINE)
  15169. (?<number> -? (?= [1-9]|0(?!\d) ) \d+ (\.\d+)? ([eE] [+-]? \d+)? )
  15170. (?<boolean> true | false | null )
  15171. (?<string> " ([^"\\\\]* | \\\\ ["\\\\bfnrt\/] | \\\\ u [0-9a-f]{4} )* " )
  15172. (?<array> \[ (?: (?&json) \s* (?: , (?&json) \s* )* )? \s* \] )
  15173. (?<pair> \s* (?&string) \s* : (?&json) \s* )
  15174. (?<object> \{ (?: (?&pair) (?: , (?&pair) )* )? \s* \} )
  15175. (?<json> \s* (?: (?&number) | (?&boolean) | (?&string) | (?&array) | (?&object) ) )
  15176. )';
  15177. private $contents;
  15178. private $newline;
  15179. private $indent;
  15180. public function __construct($contents)
  15181. {
  15182. $contents = trim($contents);
  15183. if ($contents === '') {
  15184. $contents = '{}';
  15185. }
  15186. if (!$this->pregMatch('#^\{(.*)\}$#s', $contents)) {
  15187. throw new \InvalidArgumentException('The json file must be an object ({})');
  15188. }
  15189. $this->newline = false !== strpos($contents, "\r\n") ? "\r\n" : "\n";
  15190. $this->contents = $contents === '{}' ? '{' . $this->newline . '}' : $contents;
  15191. $this->detectIndenting();
  15192. }
  15193. public function getContents()
  15194. {
  15195. return $this->contents . $this->newline;
  15196. }
  15197. public function addLink($type, $package, $constraint, $sortPackages = false)
  15198. {
  15199. $decoded = JsonFile::parseJson($this->contents);
  15200. if (!isset($decoded[$type])) {
  15201. return $this->addMainKey($type, array($package => $constraint));
  15202. }
  15203. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  15204. '(?P<property>'.preg_quote(JsonFile::encode($type)).'\s*:\s*)(?P<value>(?&json))(?P<end>.*)}sx';
  15205. if (!$this->pregMatch($regex, $this->contents, $matches)) {
  15206. return false;
  15207. }
  15208. $links = $matches['value'];
  15209. $packageRegex = str_replace('/', '\\\\?/', preg_quote($package));
  15210. $regex = '{'.self::$DEFINES.'"(?P<package>'.$packageRegex.')"(\s*:\s*)(?&string)}ix';
  15211. if ($this->pregMatch($regex, $links, $packageMatches)) {
  15212. $existingPackage = $packageMatches['package'];
  15213. $packageRegex = str_replace('/', '\\\\?/', preg_quote($existingPackage));
  15214. $links = preg_replace_callback('{'.self::$DEFINES.'"'.$packageRegex.'"(?P<separator>\s*:\s*)(?&string)}ix', function ($m) use ($existingPackage, $constraint) {
  15215. return JsonFile::encode(str_replace('\\/', '/', $existingPackage)) . $m['separator'] . '"' . $constraint . '"';
  15216. }, $links);
  15217. } else {
  15218. if ($this->pregMatch('#^\s*\{\s*\S+.*?(\s*\}\s*)$#s', $links, $match)) {
  15219. $links = preg_replace(
  15220. '{'.preg_quote($match[1]).'$}',
  15221. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $match[1], '\\$'),
  15222. $links
  15223. );
  15224. } else {
  15225. $links = '{' . $this->newline .
  15226. $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $this->newline .
  15227. $this->indent . '}';
  15228. }
  15229. }
  15230. if (true === $sortPackages) {
  15231. $requirements = json_decode($links, true);
  15232. $this->sortPackages($requirements);
  15233. $links = $this->format($requirements);
  15234. }
  15235. $this->contents = $matches['start'] . $matches['property'] . $links . $matches['end'];
  15236. return true;
  15237. }
  15238. private function sortPackages(array &$packages = array())
  15239. {
  15240. $prefix = function ($requirement) {
  15241. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $requirement)) {
  15242. return preg_replace(
  15243. array(
  15244. '/^php/',
  15245. '/^hhvm/',
  15246. '/^ext/',
  15247. '/^lib/',
  15248. '/^\D/',
  15249. ),
  15250. array(
  15251. '0-$0',
  15252. '1-$0',
  15253. '2-$0',
  15254. '3-$0',
  15255. '4-$0',
  15256. ),
  15257. $requirement
  15258. );
  15259. }
  15260. return '5-'.$requirement;
  15261. };
  15262. uksort($packages, function ($a, $b) use ($prefix) {
  15263. return strnatcmp($prefix($a), $prefix($b));
  15264. });
  15265. }
  15266. public function addRepository($name, $config)
  15267. {
  15268. return $this->addSubNode('repositories', $name, $config);
  15269. }
  15270. public function removeRepository($name)
  15271. {
  15272. return $this->removeSubNode('repositories', $name);
  15273. }
  15274. public function addConfigSetting($name, $value)
  15275. {
  15276. return $this->addSubNode('config', $name, $value);
  15277. }
  15278. public function removeConfigSetting($name)
  15279. {
  15280. return $this->removeSubNode('config', $name);
  15281. }
  15282. public function addProperty($name, $value)
  15283. {
  15284. if (substr($name, 0, 6) === 'extra.') {
  15285. return $this->addSubNode('extra', substr($name, 6), $value);
  15286. }
  15287. return $this->addMainKey($name, $value);
  15288. }
  15289. public function removeProperty($name)
  15290. {
  15291. if (substr($name, 0, 6) === 'extra.') {
  15292. return $this->removeSubNode('extra', substr($name, 6));
  15293. }
  15294. return $this->removeMainKey($name);
  15295. }
  15296. public function addSubNode($mainNode, $name, $value)
  15297. {
  15298. $decoded = JsonFile::parseJson($this->contents);
  15299. $subName = null;
  15300. if (in_array($mainNode, array('config', 'extra')) && false !== strpos($name, '.')) {
  15301. list($name, $subName) = explode('.', $name, 2);
  15302. }
  15303. if (!isset($decoded[$mainNode])) {
  15304. if ($subName !== null) {
  15305. $this->addMainKey($mainNode, array($name => array($subName => $value)));
  15306. } else {
  15307. $this->addMainKey($mainNode, array($name => $value));
  15308. }
  15309. return true;
  15310. }
  15311. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  15312. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  15313. try {
  15314. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  15315. return false;
  15316. }
  15317. } catch (\RuntimeException $e) {
  15318. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  15319. return false;
  15320. }
  15321. throw $e;
  15322. }
  15323. $children = $match['content'];
  15324. if (!@json_decode($children)) {
  15325. return false;
  15326. }
  15327. $that = $this;
  15328. $childRegex = '{'.self::$DEFINES.'(?P<start>"'.preg_quote($name).'"\s*:\s*)(?P<content>(?&json))(?P<end>,?)}x';
  15329. if ($this->pregMatch($childRegex, $children, $matches)) {
  15330. $children = preg_replace_callback($childRegex, function ($matches) use ($name, $subName, $value, $that) {
  15331. if ($subName !== null) {
  15332. $curVal = json_decode($matches['content'], true);
  15333. if (!is_array($curVal)) {
  15334. $curVal = array();
  15335. }
  15336. $curVal[$subName] = $value;
  15337. $value = $curVal;
  15338. }
  15339. return $matches['start'] . $that->format($value, 1) . $matches['end'];
  15340. }, $children);
  15341. } else {
  15342. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $children, $match);
  15343. $whitespace = '';
  15344. if (!empty($match['trailingspace'])) {
  15345. $whitespace = $match['trailingspace'];
  15346. }
  15347. if (!empty($match['content'])) {
  15348. if ($subName !== null) {
  15349. $value = array($subName => $value);
  15350. }
  15351. $children = preg_replace(
  15352. '#'.$whitespace.'}$#',
  15353. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}', '\\$'),
  15354. $children
  15355. );
  15356. } else {
  15357. if ($subName !== null) {
  15358. $value = array($subName => $value);
  15359. }
  15360. $children = '{' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}';
  15361. }
  15362. }
  15363. $this->contents = preg_replace_callback($nodeRegex, function ($m) use ($children) {
  15364. return $m['start'] . $children . $m['end'];
  15365. }, $this->contents);
  15366. return true;
  15367. }
  15368. public function removeSubNode($mainNode, $name)
  15369. {
  15370. $decoded = JsonFile::parseJson($this->contents);
  15371. if (empty($decoded[$mainNode])) {
  15372. return true;
  15373. }
  15374. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  15375. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  15376. try {
  15377. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  15378. return false;
  15379. }
  15380. } catch (\RuntimeException $e) {
  15381. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  15382. return false;
  15383. }
  15384. throw $e;
  15385. }
  15386. $children = $match['content'];
  15387. if (!@json_decode($children, true)) {
  15388. return false;
  15389. }
  15390. $subName = null;
  15391. if (in_array($mainNode, array('config', 'extra')) && false !== strpos($name, '.')) {
  15392. list($name, $subName) = explode('.', $name, 2);
  15393. }
  15394. if (!isset($decoded[$mainNode][$name]) || ($subName && !isset($decoded[$mainNode][$name][$subName]))) {
  15395. return true;
  15396. }
  15397. if ($this->pregMatch('{"'.preg_quote($name).'"\s*:}i', $children)) {
  15398. if (preg_match_all('{'.self::$DEFINES.'"'.preg_quote($name).'"\s*:\s*(?:(?&json))}x', $children, $matches)) {
  15399. $bestMatch = '';
  15400. foreach ($matches[0] as $match) {
  15401. if (strlen($bestMatch) < strlen($match)) {
  15402. $bestMatch = $match;
  15403. }
  15404. }
  15405. $childrenClean = preg_replace('{,\s*'.preg_quote($bestMatch).'}i', '', $children, -1, $count);
  15406. if (1 !== $count) {
  15407. $childrenClean = preg_replace('{'.preg_quote($bestMatch).'\s*,?\s*}i', '', $childrenClean, -1, $count);
  15408. if (1 !== $count) {
  15409. return false;
  15410. }
  15411. }
  15412. }
  15413. } else {
  15414. $childrenClean = $children;
  15415. }
  15416. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $childrenClean, $match);
  15417. if (empty($match['content'])) {
  15418. $newline = $this->newline;
  15419. $indent = $this->indent;
  15420. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($indent, $newline) {
  15421. return $matches['start'] . '{' . $newline . $indent . '}' . $matches['end'];
  15422. }, $this->contents);
  15423. if ($subName !== null) {
  15424. $curVal = json_decode($children, true);
  15425. unset($curVal[$name][$subName]);
  15426. $this->addSubNode($mainNode, $name, $curVal[$name]);
  15427. }
  15428. return true;
  15429. }
  15430. $that = $this;
  15431. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($that, $name, $subName, $childrenClean) {
  15432. if ($subName !== null) {
  15433. $curVal = json_decode($matches['content'], true);
  15434. unset($curVal[$name][$subName]);
  15435. $childrenClean = $that->format($curVal, 0);
  15436. }
  15437. return $matches['start'] . $childrenClean . $matches['end'];
  15438. }, $this->contents);
  15439. return true;
  15440. }
  15441. public function addMainKey($key, $content)
  15442. {
  15443. $decoded = JsonFile::parseJson($this->contents);
  15444. $content = $this->format($content);
  15445. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  15446. '(?P<key>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))(?P<end>.*)}sx';
  15447. if (isset($decoded[$key]) && $this->pregMatch($regex, $this->contents, $matches)) {
  15448. if (!@json_decode('{'.$matches['key'].'}')) {
  15449. return false;
  15450. }
  15451. $this->contents = $matches['start'] . JsonFile::encode($key).': '.$content . $matches['end'];
  15452. return true;
  15453. }
  15454. if ($this->pregMatch('#[^{\s](\s*)\}$#', $this->contents, $match)) {
  15455. $this->contents = preg_replace(
  15456. '#'.$match[1].'\}$#',
  15457. addcslashes(',' . $this->newline . $this->indent . JsonFile::encode($key). ': '. $content . $this->newline . '}', '\\$'),
  15458. $this->contents
  15459. );
  15460. return true;
  15461. }
  15462. $this->contents = preg_replace(
  15463. '#\}$#',
  15464. addcslashes($this->indent . JsonFile::encode($key). ': '.$content . $this->newline . '}', '\\$'),
  15465. $this->contents
  15466. );
  15467. return true;
  15468. }
  15469. public function removeMainKey($key)
  15470. {
  15471. $decoded = JsonFile::parseJson($this->contents);
  15472. if (!array_key_exists($key, $decoded)) {
  15473. return true;
  15474. }
  15475. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  15476. '(?P<removal>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))\s*,?\s*(?P<end>.*)}sx';
  15477. if ($this->pregMatch($regex, $this->contents, $matches)) {
  15478. if (!@json_decode('{'.$matches['removal'].'}')) {
  15479. return false;
  15480. }
  15481. if (preg_match('#,\s*$#', $matches['start']) && preg_match('#^\}$#', $matches['end'])) {
  15482. $matches['start'] = rtrim(preg_replace('#,(\s*)$#', '$1', $matches['start']), $this->indent);
  15483. }
  15484. $this->contents = $matches['start'] . $matches['end'];
  15485. if (preg_match('#^\{\s*\}\s*$#', $this->contents)) {
  15486. $this->contents = "{\n}";
  15487. }
  15488. return true;
  15489. }
  15490. return false;
  15491. }
  15492. public function format($data, $depth = 0)
  15493. {
  15494. if (is_array($data)) {
  15495. reset($data);
  15496. if (is_numeric(key($data))) {
  15497. foreach ($data as $key => $val) {
  15498. $data[$key] = $this->format($val, $depth + 1);
  15499. }
  15500. return '['.implode(', ', $data).']';
  15501. }
  15502. $out = '{' . $this->newline;
  15503. $elems = array();
  15504. foreach ($data as $key => $val) {
  15505. $elems[] = str_repeat($this->indent, $depth + 2) . JsonFile::encode($key). ': '.$this->format($val, $depth + 1);
  15506. }
  15507. return $out . implode(','.$this->newline, $elems) . $this->newline . str_repeat($this->indent, $depth + 1) . '}';
  15508. }
  15509. return JsonFile::encode($data);
  15510. }
  15511. protected function detectIndenting()
  15512. {
  15513. if ($this->pregMatch('{^([ \t]+)"}m', $this->contents, $match)) {
  15514. $this->indent = $match[1];
  15515. } else {
  15516. $this->indent = ' ';
  15517. }
  15518. }
  15519. protected function pregMatch($re, $str, &$matches = array())
  15520. {
  15521. $count = preg_match($re, $str, $matches);
  15522. if ($count === false) {
  15523. switch (preg_last_error()) {
  15524. case PREG_NO_ERROR:
  15525. throw new \RuntimeException('Failed to execute regex: PREG_NO_ERROR', PREG_NO_ERROR);
  15526. case PREG_INTERNAL_ERROR:
  15527. throw new \RuntimeException('Failed to execute regex: PREG_INTERNAL_ERROR', PREG_INTERNAL_ERROR);
  15528. case PREG_BACKTRACK_LIMIT_ERROR:
  15529. throw new \RuntimeException('Failed to execute regex: PREG_BACKTRACK_LIMIT_ERROR', PREG_BACKTRACK_LIMIT_ERROR);
  15530. case PREG_RECURSION_LIMIT_ERROR:
  15531. throw new \RuntimeException('Failed to execute regex: PREG_RECURSION_LIMIT_ERROR', PREG_RECURSION_LIMIT_ERROR);
  15532. case PREG_BAD_UTF8_ERROR:
  15533. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_ERROR', PREG_BAD_UTF8_ERROR);
  15534. case PREG_BAD_UTF8_OFFSET_ERROR:
  15535. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_OFFSET_ERROR', PREG_BAD_UTF8_OFFSET_ERROR);
  15536. case 6:
  15537. if (PHP_VERSION_ID > 70000) {
  15538. throw new \RuntimeException('Failed to execute regex: PREG_JIT_STACKLIMIT_ERROR', 6);
  15539. }
  15540. default:
  15541. throw new \RuntimeException('Failed to execute regex: Unknown error');
  15542. }
  15543. }
  15544. return $count;
  15545. }
  15546. }
  15547. <?php
  15548. namespace Composer\Json;
  15549. use Exception;
  15550. class JsonValidationException extends Exception
  15551. {
  15552. protected $errors;
  15553. public function __construct($message, $errors = array(), Exception $previous = null)
  15554. {
  15555. $this->errors = $errors;
  15556. parent::__construct($message, 0, $previous);
  15557. }
  15558. public function getErrors()
  15559. {
  15560. return $this->errors;
  15561. }
  15562. }
  15563. <?php
  15564. namespace Composer\Package;
  15565. use Composer\Semver\Constraint\Constraint;
  15566. use Composer\Package\Version\VersionParser;
  15567. class AliasPackage extends BasePackage implements CompletePackageInterface
  15568. {
  15569. protected $version;
  15570. protected $prettyVersion;
  15571. protected $dev;
  15572. protected $rootPackageAlias = false;
  15573. protected $stability;
  15574. protected $aliasOf;
  15575. protected $requires;
  15576. protected $devRequires;
  15577. protected $conflicts;
  15578. protected $provides;
  15579. protected $replaces;
  15580. public function __construct(PackageInterface $aliasOf, $version, $prettyVersion)
  15581. {
  15582. parent::__construct($aliasOf->getName());
  15583. $this->version = $version;
  15584. $this->prettyVersion = $prettyVersion;
  15585. $this->aliasOf = $aliasOf;
  15586. $this->stability = VersionParser::parseStability($version);
  15587. $this->dev = $this->stability === 'dev';
  15588. foreach (array('requires', 'devRequires', 'conflicts', 'provides', 'replaces') as $type) {
  15589. $links = $aliasOf->{'get' . ucfirst($type)}();
  15590. $this->$type = $this->replaceSelfVersionDependencies($links, $type);
  15591. }
  15592. }
  15593. public function getAliasOf()
  15594. {
  15595. return $this->aliasOf;
  15596. }
  15597. public function getVersion()
  15598. {
  15599. return $this->version;
  15600. }
  15601. public function getStability()
  15602. {
  15603. return $this->stability;
  15604. }
  15605. public function getPrettyVersion()
  15606. {
  15607. return $this->prettyVersion;
  15608. }
  15609. public function isDev()
  15610. {
  15611. return $this->dev;
  15612. }
  15613. public function getRequires()
  15614. {
  15615. return $this->requires;
  15616. }
  15617. public function getConflicts()
  15618. {
  15619. return $this->conflicts;
  15620. }
  15621. public function getProvides()
  15622. {
  15623. return $this->provides;
  15624. }
  15625. public function getReplaces()
  15626. {
  15627. return $this->replaces;
  15628. }
  15629. public function getDevRequires()
  15630. {
  15631. return $this->devRequires;
  15632. }
  15633. public function setRootPackageAlias($value)
  15634. {
  15635. return $this->rootPackageAlias = $value;
  15636. }
  15637. public function isRootPackageAlias()
  15638. {
  15639. return $this->rootPackageAlias;
  15640. }
  15641. protected function replaceSelfVersionDependencies(array $links, $linkType)
  15642. {
  15643. if (in_array($linkType, array('conflicts', 'provides', 'replaces'), true)) {
  15644. $newLinks = array();
  15645. foreach ($links as $link) {
  15646. if ('self.version' === $link->getPrettyConstraint()) {
  15647. $newLinks[] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  15648. }
  15649. }
  15650. $links = array_merge($links, $newLinks);
  15651. } else {
  15652. foreach ($links as $index => $link) {
  15653. if ('self.version' === $link->getPrettyConstraint()) {
  15654. $links[$index] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  15655. }
  15656. }
  15657. }
  15658. return $links;
  15659. }
  15660. public function getType()
  15661. {
  15662. return $this->aliasOf->getType();
  15663. }
  15664. public function getTargetDir()
  15665. {
  15666. return $this->aliasOf->getTargetDir();
  15667. }
  15668. public function getExtra()
  15669. {
  15670. return $this->aliasOf->getExtra();
  15671. }
  15672. public function setInstallationSource($type)
  15673. {
  15674. $this->aliasOf->setInstallationSource($type);
  15675. }
  15676. public function getInstallationSource()
  15677. {
  15678. return $this->aliasOf->getInstallationSource();
  15679. }
  15680. public function getSourceType()
  15681. {
  15682. return $this->aliasOf->getSourceType();
  15683. }
  15684. public function getSourceUrl()
  15685. {
  15686. return $this->aliasOf->getSourceUrl();
  15687. }
  15688. public function getSourceUrls()
  15689. {
  15690. return $this->aliasOf->getSourceUrls();
  15691. }
  15692. public function getSourceReference()
  15693. {
  15694. return $this->aliasOf->getSourceReference();
  15695. }
  15696. public function setSourceReference($reference)
  15697. {
  15698. return $this->aliasOf->setSourceReference($reference);
  15699. }
  15700. public function setSourceMirrors($mirrors)
  15701. {
  15702. return $this->aliasOf->setSourceMirrors($mirrors);
  15703. }
  15704. public function getSourceMirrors()
  15705. {
  15706. return $this->aliasOf->getSourceMirrors();
  15707. }
  15708. public function getDistType()
  15709. {
  15710. return $this->aliasOf->getDistType();
  15711. }
  15712. public function getDistUrl()
  15713. {
  15714. return $this->aliasOf->getDistUrl();
  15715. }
  15716. public function getDistUrls()
  15717. {
  15718. return $this->aliasOf->getDistUrls();
  15719. }
  15720. public function getDistReference()
  15721. {
  15722. return $this->aliasOf->getDistReference();
  15723. }
  15724. public function setDistReference($reference)
  15725. {
  15726. return $this->aliasOf->setDistReference($reference);
  15727. }
  15728. public function getDistSha1Checksum()
  15729. {
  15730. return $this->aliasOf->getDistSha1Checksum();
  15731. }
  15732. public function setTransportOptions(array $options)
  15733. {
  15734. return $this->aliasOf->setTransportOptions($options);
  15735. }
  15736. public function getTransportOptions()
  15737. {
  15738. return $this->aliasOf->getTransportOptions();
  15739. }
  15740. public function setDistMirrors($mirrors)
  15741. {
  15742. return $this->aliasOf->setDistMirrors($mirrors);
  15743. }
  15744. public function getDistMirrors()
  15745. {
  15746. return $this->aliasOf->getDistMirrors();
  15747. }
  15748. public function getScripts()
  15749. {
  15750. return $this->aliasOf->getScripts();
  15751. }
  15752. public function getLicense()
  15753. {
  15754. return $this->aliasOf->getLicense();
  15755. }
  15756. public function getAutoload()
  15757. {
  15758. return $this->aliasOf->getAutoload();
  15759. }
  15760. public function getDevAutoload()
  15761. {
  15762. return $this->aliasOf->getDevAutoload();
  15763. }
  15764. public function getIncludePaths()
  15765. {
  15766. return $this->aliasOf->getIncludePaths();
  15767. }
  15768. public function getRepositories()
  15769. {
  15770. return $this->aliasOf->getRepositories();
  15771. }
  15772. public function getReleaseDate()
  15773. {
  15774. return $this->aliasOf->getReleaseDate();
  15775. }
  15776. public function getBinaries()
  15777. {
  15778. return $this->aliasOf->getBinaries();
  15779. }
  15780. public function getKeywords()
  15781. {
  15782. return $this->aliasOf->getKeywords();
  15783. }
  15784. public function getDescription()
  15785. {
  15786. return $this->aliasOf->getDescription();
  15787. }
  15788. public function getHomepage()
  15789. {
  15790. return $this->aliasOf->getHomepage();
  15791. }
  15792. public function getSuggests()
  15793. {
  15794. return $this->aliasOf->getSuggests();
  15795. }
  15796. public function getAuthors()
  15797. {
  15798. return $this->aliasOf->getAuthors();
  15799. }
  15800. public function getSupport()
  15801. {
  15802. return $this->aliasOf->getSupport();
  15803. }
  15804. public function getNotificationUrl()
  15805. {
  15806. return $this->aliasOf->getNotificationUrl();
  15807. }
  15808. public function getArchiveExcludes()
  15809. {
  15810. return $this->aliasOf->getArchiveExcludes();
  15811. }
  15812. public function isAbandoned()
  15813. {
  15814. return $this->aliasOf->isAbandoned();
  15815. }
  15816. public function getReplacementPackage()
  15817. {
  15818. return $this->aliasOf->getReplacementPackage();
  15819. }
  15820. public function __toString()
  15821. {
  15822. return parent::__toString().' (alias of '.$this->aliasOf->getVersion().')';
  15823. }
  15824. }
  15825. <?php
  15826. namespace Composer\Package\Archiver;
  15827. use FilterIterator;
  15828. use PharData;
  15829. class ArchivableFilesFilter extends FilterIterator
  15830. {
  15831. private $dirs = array();
  15832. public function accept()
  15833. {
  15834. $file = $this->getInnerIterator()->current();
  15835. if ($file->isDir()) {
  15836. $this->dirs[] = (string) $file;
  15837. return false;
  15838. }
  15839. return true;
  15840. }
  15841. public function addEmptyDir(PharData $phar, $sources)
  15842. {
  15843. foreach ($this->dirs as $filepath) {
  15844. $localname = str_replace($sources . "/", '', $filepath);
  15845. $phar->addEmptyDir($localname);
  15846. }
  15847. }
  15848. }
  15849. <?php
  15850. namespace Composer\Package\Archiver;
  15851. use Composer\Util\Filesystem;
  15852. use FilesystemIterator;
  15853. use Symfony\Component\Finder\Finder;
  15854. use Symfony\Component\Finder\SplFileInfo;
  15855. class ArchivableFilesFinder extends \FilterIterator
  15856. {
  15857. protected $finder;
  15858. public function __construct($sources, array $excludes, $ignoreFilters = false)
  15859. {
  15860. $fs = new Filesystem();
  15861. $sources = $fs->normalizePath($sources);
  15862. if ($ignoreFilters) {
  15863. $filters = array();
  15864. } else {
  15865. $filters = array(
  15866. new HgExcludeFilter($sources),
  15867. new GitExcludeFilter($sources),
  15868. new ComposerExcludeFilter($sources, $excludes),
  15869. );
  15870. }
  15871. $this->finder = new Finder();
  15872. $filter = function (\SplFileInfo $file) use ($sources, $filters, $fs) {
  15873. if ($file->isLink() && strpos($file->getLinkTarget(), $sources) !== 0) {
  15874. return false;
  15875. }
  15876. $relativePath = preg_replace(
  15877. '#^'.preg_quote($sources, '#').'#',
  15878. '',
  15879. $fs->normalizePath($file->getRealPath())
  15880. );
  15881. $exclude = false;
  15882. foreach ($filters as $filter) {
  15883. $exclude = $filter->filter($relativePath, $exclude);
  15884. }
  15885. return !$exclude;
  15886. };
  15887. if (method_exists($filter, 'bindTo')) {
  15888. $filter = $filter->bindTo(null);
  15889. }
  15890. $this->finder
  15891. ->in($sources)
  15892. ->filter($filter)
  15893. ->ignoreVCS(true)
  15894. ->ignoreDotFiles(false);
  15895. parent::__construct($this->finder->getIterator());
  15896. }
  15897. public function accept()
  15898. {
  15899. $current = $this->getInnerIterator()->current();
  15900. if (!$current->isDir()) {
  15901. return true;
  15902. }
  15903. $iterator = new FilesystemIterator($current, FilesystemIterator::SKIP_DOTS);
  15904. return !$iterator->valid();
  15905. }
  15906. }
  15907. <?php
  15908. namespace Composer\Package\Archiver;
  15909. use Composer\Downloader\DownloadManager;
  15910. use Composer\Package\PackageInterface;
  15911. use Composer\Package\RootPackageInterface;
  15912. use Composer\Util\Filesystem;
  15913. use Composer\Json\JsonFile;
  15914. class ArchiveManager
  15915. {
  15916. protected $downloadManager;
  15917. protected $archivers = array();
  15918. protected $overwriteFiles = true;
  15919. public function __construct(DownloadManager $downloadManager)
  15920. {
  15921. $this->downloadManager = $downloadManager;
  15922. }
  15923. public function addArchiver(ArchiverInterface $archiver)
  15924. {
  15925. $this->archivers[] = $archiver;
  15926. }
  15927. public function setOverwriteFiles($overwriteFiles)
  15928. {
  15929. $this->overwriteFiles = $overwriteFiles;
  15930. return $this;
  15931. }
  15932. public function getPackageFilename(PackageInterface $package)
  15933. {
  15934. $nameParts = array(preg_replace('#[^a-z0-9-_]#i', '-', $package->getName()));
  15935. if (preg_match('{^[a-f0-9]{40}$}', $package->getDistReference())) {
  15936. $nameParts = array_merge($nameParts, array($package->getDistReference(), $package->getDistType()));
  15937. } else {
  15938. $nameParts = array_merge($nameParts, array($package->getPrettyVersion(), $package->getDistReference()));
  15939. }
  15940. if ($package->getSourceReference()) {
  15941. $nameParts[] = substr(sha1($package->getSourceReference()), 0, 6);
  15942. }
  15943. $name = implode('-', array_filter($nameParts, function ($p) {
  15944. return !empty($p);
  15945. }));
  15946. return str_replace('/', '-', $name);
  15947. }
  15948. public function archive(PackageInterface $package, $format, $targetDir, $fileName = null, $ignoreFilters = false)
  15949. {
  15950. if (empty($format)) {
  15951. throw new \InvalidArgumentException('Format must be specified');
  15952. }
  15953. $usableArchiver = null;
  15954. foreach ($this->archivers as $archiver) {
  15955. if ($archiver->supports($format, $package->getSourceType())) {
  15956. $usableArchiver = $archiver;
  15957. break;
  15958. }
  15959. }
  15960. if (null === $usableArchiver) {
  15961. throw new \RuntimeException(sprintf('No archiver found to support %s format', $format));
  15962. }
  15963. $filesystem = new Filesystem();
  15964. if (null === $fileName) {
  15965. $packageName = $this->getPackageFilename($package);
  15966. } else {
  15967. $packageName = $fileName;
  15968. }
  15969. $filesystem->ensureDirectoryExists($targetDir);
  15970. $target = realpath($targetDir).'/'.$packageName.'.'.$format;
  15971. $filesystem->ensureDirectoryExists(dirname($target));
  15972. if (!$this->overwriteFiles && file_exists($target)) {
  15973. return $target;
  15974. }
  15975. if ($package instanceof RootPackageInterface) {
  15976. $sourcePath = realpath('.');
  15977. } else {
  15978. $sourcePath = sys_get_temp_dir().'/composer_archive'.uniqid();
  15979. $filesystem->ensureDirectoryExists($sourcePath);
  15980. $this->downloadManager->download($package, $sourcePath);
  15981. if (file_exists($composerJsonPath = $sourcePath.'/composer.json')) {
  15982. $jsonFile = new JsonFile($composerJsonPath);
  15983. $jsonData = $jsonFile->read();
  15984. if (!empty($jsonData['archive']['exclude'])) {
  15985. $package->setArchiveExcludes($jsonData['archive']['exclude']);
  15986. }
  15987. }
  15988. }
  15989. $tempTarget = sys_get_temp_dir().'/composer_archive'.uniqid().'.'.$format;
  15990. $filesystem->ensureDirectoryExists(dirname($tempTarget));
  15991. $archivePath = $usableArchiver->archive($sourcePath, $tempTarget, $format, $package->getArchiveExcludes(), $ignoreFilters);
  15992. $filesystem->rename($archivePath, $target);
  15993. if (!$package instanceof RootPackageInterface) {
  15994. $filesystem->removeDirectory($sourcePath);
  15995. }
  15996. $filesystem->remove($tempTarget);
  15997. return $target;
  15998. }
  15999. }
  16000. <?php
  16001. namespace Composer\Package\Archiver;
  16002. interface ArchiverInterface
  16003. {
  16004. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false);
  16005. public function supports($format, $sourceType);
  16006. }
  16007. <?php
  16008. namespace Composer\Package\Archiver;
  16009. use Symfony\Component\Finder;
  16010. abstract class BaseExcludeFilter
  16011. {
  16012. protected $sourcePath;
  16013. protected $excludePatterns;
  16014. public function __construct($sourcePath)
  16015. {
  16016. $this->sourcePath = $sourcePath;
  16017. $this->excludePatterns = array();
  16018. }
  16019. public function filter($relativePath, $exclude)
  16020. {
  16021. foreach ($this->excludePatterns as $patternData) {
  16022. list($pattern, $negate, $stripLeadingSlash) = $patternData;
  16023. if ($stripLeadingSlash) {
  16024. $path = substr($relativePath, 1);
  16025. } else {
  16026. $path = $relativePath;
  16027. }
  16028. if (preg_match($pattern, $path)) {
  16029. $exclude = !$negate;
  16030. }
  16031. }
  16032. return $exclude;
  16033. }
  16034. protected function parseLines(array $lines, $lineParser)
  16035. {
  16036. return array_filter(
  16037. array_map(
  16038. function ($line) use ($lineParser) {
  16039. $line = trim($line);
  16040. if (!$line || 0 === strpos($line, '#')) {
  16041. return null;
  16042. }
  16043. return call_user_func($lineParser, $line);
  16044. },
  16045. $lines
  16046. ),
  16047. function ($pattern) {
  16048. return $pattern !== null;
  16049. }
  16050. );
  16051. }
  16052. protected function generatePatterns($rules)
  16053. {
  16054. $patterns = array();
  16055. foreach ($rules as $rule) {
  16056. $patterns[] = $this->generatePattern($rule);
  16057. }
  16058. return $patterns;
  16059. }
  16060. protected function generatePattern($rule)
  16061. {
  16062. $negate = false;
  16063. $pattern = '{';
  16064. if (strlen($rule) && $rule[0] === '!') {
  16065. $negate = true;
  16066. $rule = substr($rule, 1);
  16067. }
  16068. if (strlen($rule) && $rule[0] === '/') {
  16069. $pattern .= '^/';
  16070. $rule = substr($rule, 1);
  16071. } elseif (strlen($rule) - 1 === strpos($rule, '/')) {
  16072. $pattern .= '/';
  16073. $rule = substr($rule, 0, -1);
  16074. } elseif (false === strpos($rule, '/')) {
  16075. $pattern .= '/';
  16076. }
  16077. $pattern .= substr(Finder\Glob::toRegex($rule), 2, -2) . '(?=$|/)';
  16078. return array($pattern . '}', $negate, false);
  16079. }
  16080. }
  16081. <?php
  16082. namespace Composer\Package\Archiver;
  16083. class ComposerExcludeFilter extends BaseExcludeFilter
  16084. {
  16085. public function __construct($sourcePath, array $excludeRules)
  16086. {
  16087. parent::__construct($sourcePath);
  16088. $this->excludePatterns = $this->generatePatterns($excludeRules);
  16089. }
  16090. }
  16091. <?php
  16092. namespace Composer\Package\Archiver;
  16093. class GitExcludeFilter extends BaseExcludeFilter
  16094. {
  16095. public function __construct($sourcePath)
  16096. {
  16097. parent::__construct($sourcePath);
  16098. if (file_exists($sourcePath.'/.gitignore')) {
  16099. $this->excludePatterns = $this->parseLines(
  16100. file($sourcePath.'/.gitignore'),
  16101. array($this, 'parseGitIgnoreLine')
  16102. );
  16103. }
  16104. if (file_exists($sourcePath.'/.gitattributes')) {
  16105. $this->excludePatterns = array_merge(
  16106. $this->excludePatterns,
  16107. $this->parseLines(
  16108. file($sourcePath.'/.gitattributes'),
  16109. array($this, 'parseGitAttributesLine')
  16110. ));
  16111. }
  16112. }
  16113. public function parseGitIgnoreLine($line)
  16114. {
  16115. return $this->generatePattern($line);
  16116. }
  16117. public function parseGitAttributesLine($line)
  16118. {
  16119. $parts = preg_split('#\s+#', $line);
  16120. if (count($parts) == 2 && $parts[1] === 'export-ignore') {
  16121. return $this->generatePattern($parts[0]);
  16122. }
  16123. return null;
  16124. }
  16125. }
  16126. <?php
  16127. namespace Composer\Package\Archiver;
  16128. use Symfony\Component\Finder;
  16129. class HgExcludeFilter extends BaseExcludeFilter
  16130. {
  16131. const HG_IGNORE_REGEX = 1;
  16132. const HG_IGNORE_GLOB = 2;
  16133. protected $patternMode;
  16134. public function __construct($sourcePath)
  16135. {
  16136. parent::__construct($sourcePath);
  16137. $this->patternMode = self::HG_IGNORE_REGEX;
  16138. if (file_exists($sourcePath.'/.hgignore')) {
  16139. $this->excludePatterns = $this->parseLines(
  16140. file($sourcePath.'/.hgignore'),
  16141. array($this, 'parseHgIgnoreLine')
  16142. );
  16143. }
  16144. }
  16145. public function parseHgIgnoreLine($line)
  16146. {
  16147. if (preg_match('#^syntax\s*:\s*(glob|regexp)$#', $line, $matches)) {
  16148. if ($matches[1] === 'glob') {
  16149. $this->patternMode = self::HG_IGNORE_GLOB;
  16150. } else {
  16151. $this->patternMode = self::HG_IGNORE_REGEX;
  16152. }
  16153. return null;
  16154. }
  16155. if ($this->patternMode == self::HG_IGNORE_GLOB) {
  16156. return $this->patternFromGlob($line);
  16157. }
  16158. return $this->patternFromRegex($line);
  16159. }
  16160. protected function patternFromGlob($line)
  16161. {
  16162. $pattern = '#'.substr(Finder\Glob::toRegex($line), 2, -1).'#';
  16163. $pattern = str_replace('[^/]*', '.*', $pattern);
  16164. return array($pattern, false, true);
  16165. }
  16166. public function patternFromRegex($line)
  16167. {
  16168. $pattern = '#'.preg_replace('/((?:\\\\\\\\)*)(\\\\?)#/', '\1\2\2\\#', $line).'#';
  16169. return array($pattern, false, true);
  16170. }
  16171. }
  16172. <?php
  16173. namespace Composer\Package\Archiver;
  16174. class PharArchiver implements ArchiverInterface
  16175. {
  16176. protected static $formats = array(
  16177. 'zip' => \Phar::ZIP,
  16178. 'tar' => \Phar::TAR,
  16179. 'tar.gz' => \Phar::TAR,
  16180. 'tar.bz2' => \Phar::TAR,
  16181. );
  16182. protected static $compressFormats = array(
  16183. 'tar.gz' => \Phar::GZ,
  16184. 'tar.bz2' => \Phar::BZ2,
  16185. );
  16186. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  16187. {
  16188. $sources = realpath($sources);
  16189. if (file_exists($target)) {
  16190. unlink($target);
  16191. }
  16192. try {
  16193. $filename = substr($target, 0, strrpos($target, $format) - 1);
  16194. if (isset(static::$compressFormats[$format])) {
  16195. $target = $filename . '.tar';
  16196. }
  16197. $phar = new \PharData($target, null, null, static::$formats[$format]);
  16198. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  16199. $filesOnly = new ArchivableFilesFilter($files);
  16200. $phar->buildFromIterator($filesOnly, $sources);
  16201. $filesOnly->addEmptyDir($phar, $sources);
  16202. if (isset(static::$compressFormats[$format])) {
  16203. if (!$phar->canCompress(static::$compressFormats[$format])) {
  16204. throw new \RuntimeException(sprintf('Can not compress to %s format', $format));
  16205. }
  16206. unlink($target);
  16207. $phar->compress(static::$compressFormats[$format]);
  16208. $target = $filename . '.' . $format;
  16209. }
  16210. return $target;
  16211. } catch (\UnexpectedValueException $e) {
  16212. $message = sprintf("Could not create archive '%s' from '%s': %s",
  16213. $target,
  16214. $sources,
  16215. $e->getMessage()
  16216. );
  16217. throw new \RuntimeException($message, $e->getCode(), $e);
  16218. }
  16219. }
  16220. public function supports($format, $sourceType)
  16221. {
  16222. return isset(static::$formats[$format]);
  16223. }
  16224. }
  16225. <?php
  16226. namespace Composer\Package\Archiver;
  16227. use ZipArchive;
  16228. use Composer\Util\Filesystem;
  16229. class ZipArchiver implements ArchiverInterface
  16230. {
  16231. protected static $formats = array(
  16232. 'zip' => 1,
  16233. );
  16234. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  16235. {
  16236. $fs = new Filesystem();
  16237. $sources = $fs->normalizePath($sources);
  16238. $zip = new ZipArchive();
  16239. $res = $zip->open($target, ZipArchive::CREATE);
  16240. if ($res === true) {
  16241. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  16242. foreach ($files as $file) {
  16243. $filepath = strtr($file->getPath()."/".$file->getFilename(), '\\', '/');
  16244. $localname = str_replace($sources.'/', '', $filepath);
  16245. if ($file->isDir()) {
  16246. $zip->addEmptyDir($localname);
  16247. } else {
  16248. $zip->addFile($filepath, $localname);
  16249. }
  16250. }
  16251. if ($zip->close()) {
  16252. return $target;
  16253. }
  16254. }
  16255. $message = sprintf("Could not create archive '%s' from '%s': %s",
  16256. $target,
  16257. $sources,
  16258. $zip->getStatusString()
  16259. );
  16260. throw new \RuntimeException($message);
  16261. }
  16262. public function supports($format, $sourceType)
  16263. {
  16264. return isset(static::$formats[$format]) && $this->compressionAvailable();
  16265. }
  16266. private function compressionAvailable()
  16267. {
  16268. return class_exists('ZipArchive');
  16269. }
  16270. }
  16271. <?php
  16272. namespace Composer\Package;
  16273. use Composer\Repository\RepositoryInterface;
  16274. use Composer\Repository\PlatformRepository;
  16275. abstract class BasePackage implements PackageInterface
  16276. {
  16277. public static $supportedLinkTypes = array(
  16278. 'require' => array('description' => 'requires', 'method' => 'requires'),
  16279. 'conflict' => array('description' => 'conflicts', 'method' => 'conflicts'),
  16280. 'provide' => array('description' => 'provides', 'method' => 'provides'),
  16281. 'replace' => array('description' => 'replaces', 'method' => 'replaces'),
  16282. 'require-dev' => array('description' => 'requires (for development)', 'method' => 'devRequires'),
  16283. );
  16284. const STABILITY_STABLE = 0;
  16285. const STABILITY_RC = 5;
  16286. const STABILITY_BETA = 10;
  16287. const STABILITY_ALPHA = 15;
  16288. const STABILITY_DEV = 20;
  16289. public static $stabilities = array(
  16290. 'stable' => self::STABILITY_STABLE,
  16291. 'RC' => self::STABILITY_RC,
  16292. 'beta' => self::STABILITY_BETA,
  16293. 'alpha' => self::STABILITY_ALPHA,
  16294. 'dev' => self::STABILITY_DEV,
  16295. );
  16296. public $id;
  16297. protected $name;
  16298. protected $prettyName;
  16299. protected $repository;
  16300. protected $transportOptions = array();
  16301. public function __construct($name)
  16302. {
  16303. $this->prettyName = $name;
  16304. $this->name = strtolower($name);
  16305. $this->id = -1;
  16306. }
  16307. public function getName()
  16308. {
  16309. return $this->name;
  16310. }
  16311. public function getPrettyName()
  16312. {
  16313. return $this->prettyName;
  16314. }
  16315. public function getNames()
  16316. {
  16317. $names = array(
  16318. $this->getName() => true,
  16319. );
  16320. foreach ($this->getProvides() as $link) {
  16321. $names[$link->getTarget()] = true;
  16322. }
  16323. foreach ($this->getReplaces() as $link) {
  16324. $names[$link->getTarget()] = true;
  16325. }
  16326. return array_keys($names);
  16327. }
  16328. public function setId($id)
  16329. {
  16330. $this->id = $id;
  16331. }
  16332. public function getId()
  16333. {
  16334. return $this->id;
  16335. }
  16336. public function setRepository(RepositoryInterface $repository)
  16337. {
  16338. if ($this->repository && $repository !== $this->repository) {
  16339. throw new \LogicException('A package can only be added to one repository');
  16340. }
  16341. $this->repository = $repository;
  16342. }
  16343. public function getRepository()
  16344. {
  16345. return $this->repository;
  16346. }
  16347. public function getTransportOptions()
  16348. {
  16349. return $this->transportOptions;
  16350. }
  16351. public function setTransportOptions(array $options)
  16352. {
  16353. $this->transportOptions = $options;
  16354. }
  16355. public function isPlatform()
  16356. {
  16357. return $this->getRepository() instanceof PlatformRepository;
  16358. }
  16359. public function getUniqueName()
  16360. {
  16361. return $this->getName().'-'.$this->getVersion();
  16362. }
  16363. public function equals(PackageInterface $package)
  16364. {
  16365. $self = $this;
  16366. if ($this instanceof AliasPackage) {
  16367. $self = $this->getAliasOf();
  16368. }
  16369. if ($package instanceof AliasPackage) {
  16370. $package = $package->getAliasOf();
  16371. }
  16372. return $package === $self;
  16373. }
  16374. public function __toString()
  16375. {
  16376. return $this->getUniqueName();
  16377. }
  16378. public function getPrettyString()
  16379. {
  16380. return $this->getPrettyName().' '.$this->getPrettyVersion();
  16381. }
  16382. public function getFullPrettyVersion($truncate = true)
  16383. {
  16384. if (!$this->isDev() || !in_array($this->getSourceType(), array('hg', 'git'))) {
  16385. return $this->getPrettyVersion();
  16386. }
  16387. if ($truncate && strlen($this->getSourceReference()) === 40) {
  16388. return $this->getPrettyVersion() . ' ' . substr($this->getSourceReference(), 0, 7);
  16389. }
  16390. return $this->getPrettyVersion() . ' ' . $this->getSourceReference();
  16391. }
  16392. public function getStabilityPriority()
  16393. {
  16394. return self::$stabilities[$this->getStability()];
  16395. }
  16396. public function __clone()
  16397. {
  16398. $this->repository = null;
  16399. $this->id = -1;
  16400. }
  16401. }
  16402. <?php
  16403. namespace Composer\Package;
  16404. class CompletePackage extends Package implements CompletePackageInterface
  16405. {
  16406. protected $repositories;
  16407. protected $license = array();
  16408. protected $keywords;
  16409. protected $authors;
  16410. protected $description;
  16411. protected $homepage;
  16412. protected $scripts = array();
  16413. protected $support = array();
  16414. protected $abandoned = false;
  16415. public function setScripts(array $scripts)
  16416. {
  16417. $this->scripts = $scripts;
  16418. }
  16419. public function getScripts()
  16420. {
  16421. return $this->scripts;
  16422. }
  16423. public function setRepositories($repositories)
  16424. {
  16425. $this->repositories = $repositories;
  16426. }
  16427. public function getRepositories()
  16428. {
  16429. return $this->repositories;
  16430. }
  16431. public function setLicense(array $license)
  16432. {
  16433. $this->license = $license;
  16434. }
  16435. public function getLicense()
  16436. {
  16437. return $this->license;
  16438. }
  16439. public function setKeywords(array $keywords)
  16440. {
  16441. $this->keywords = $keywords;
  16442. }
  16443. public function getKeywords()
  16444. {
  16445. return $this->keywords;
  16446. }
  16447. public function setAuthors(array $authors)
  16448. {
  16449. $this->authors = $authors;
  16450. }
  16451. public function getAuthors()
  16452. {
  16453. return $this->authors;
  16454. }
  16455. public function setDescription($description)
  16456. {
  16457. $this->description = $description;
  16458. }
  16459. public function getDescription()
  16460. {
  16461. return $this->description;
  16462. }
  16463. public function setHomepage($homepage)
  16464. {
  16465. $this->homepage = $homepage;
  16466. }
  16467. public function getHomepage()
  16468. {
  16469. return $this->homepage;
  16470. }
  16471. public function setSupport(array $support)
  16472. {
  16473. $this->support = $support;
  16474. }
  16475. public function getSupport()
  16476. {
  16477. return $this->support;
  16478. }
  16479. public function isAbandoned()
  16480. {
  16481. return (bool) $this->abandoned;
  16482. }
  16483. public function setAbandoned($abandoned)
  16484. {
  16485. $this->abandoned = $abandoned;
  16486. }
  16487. public function getReplacementPackage()
  16488. {
  16489. return is_string($this->abandoned) ? $this->abandoned : null;
  16490. }
  16491. }
  16492. <?php
  16493. namespace Composer\Package;
  16494. interface CompletePackageInterface extends PackageInterface
  16495. {
  16496. public function getScripts();
  16497. public function getRepositories();
  16498. public function getLicense();
  16499. public function getKeywords();
  16500. public function getDescription();
  16501. public function getHomepage();
  16502. public function getAuthors();
  16503. public function getSupport();
  16504. public function isAbandoned();
  16505. public function getReplacementPackage();
  16506. }
  16507. <?php
  16508. namespace Composer\Package\Dumper;
  16509. use Composer\Package\BasePackage;
  16510. use Composer\Package\PackageInterface;
  16511. use Composer\Package\CompletePackageInterface;
  16512. use Composer\Package\RootPackageInterface;
  16513. class ArrayDumper
  16514. {
  16515. public function dump(PackageInterface $package)
  16516. {
  16517. $keys = array(
  16518. 'binaries' => 'bin',
  16519. 'type',
  16520. 'extra',
  16521. 'installationSource' => 'installation-source',
  16522. 'autoload',
  16523. 'devAutoload' => 'autoload-dev',
  16524. 'notificationUrl' => 'notification-url',
  16525. 'includePaths' => 'include-path',
  16526. );
  16527. $data = array();
  16528. $data['name'] = $package->getPrettyName();
  16529. $data['version'] = $package->getPrettyVersion();
  16530. $data['version_normalized'] = $package->getVersion();
  16531. if ($package->getTargetDir()) {
  16532. $data['target-dir'] = $package->getTargetDir();
  16533. }
  16534. if ($package->getSourceType()) {
  16535. $data['source']['type'] = $package->getSourceType();
  16536. $data['source']['url'] = $package->getSourceUrl();
  16537. $data['source']['reference'] = $package->getSourceReference();
  16538. if ($mirrors = $package->getSourceMirrors()) {
  16539. $data['source']['mirrors'] = $mirrors;
  16540. }
  16541. }
  16542. if ($package->getDistType()) {
  16543. $data['dist']['type'] = $package->getDistType();
  16544. $data['dist']['url'] = $package->getDistUrl();
  16545. $data['dist']['reference'] = $package->getDistReference();
  16546. $data['dist']['shasum'] = $package->getDistSha1Checksum();
  16547. if ($mirrors = $package->getDistMirrors()) {
  16548. $data['dist']['mirrors'] = $mirrors;
  16549. }
  16550. }
  16551. if ($package->getArchiveExcludes()) {
  16552. $data['archive']['exclude'] = $package->getArchiveExcludes();
  16553. }
  16554. foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
  16555. if ($links = $package->{'get'.ucfirst($opts['method'])}()) {
  16556. foreach ($links as $link) {
  16557. $data[$type][$link->getTarget()] = $link->getPrettyConstraint();
  16558. }
  16559. ksort($data[$type]);
  16560. }
  16561. }
  16562. if ($packages = $package->getSuggests()) {
  16563. ksort($packages);
  16564. $data['suggest'] = $packages;
  16565. }
  16566. if ($package->getReleaseDate()) {
  16567. $data['time'] = $package->getReleaseDate()->format(DATE_RFC3339);
  16568. }
  16569. $data = $this->dumpValues($package, $keys, $data);
  16570. if ($package instanceof CompletePackageInterface) {
  16571. $keys = array(
  16572. 'scripts',
  16573. 'license',
  16574. 'authors',
  16575. 'description',
  16576. 'homepage',
  16577. 'keywords',
  16578. 'repositories',
  16579. 'support',
  16580. );
  16581. $data = $this->dumpValues($package, $keys, $data);
  16582. if (isset($data['keywords']) && is_array($data['keywords'])) {
  16583. sort($data['keywords']);
  16584. }
  16585. if ($package->isAbandoned()) {
  16586. $data['abandoned'] = $package->getReplacementPackage() ?: true;
  16587. }
  16588. }
  16589. if ($package instanceof RootPackageInterface) {
  16590. $minimumStability = $package->getMinimumStability();
  16591. if ($minimumStability) {
  16592. $data['minimum-stability'] = $minimumStability;
  16593. }
  16594. }
  16595. if (count($package->getTransportOptions()) > 0) {
  16596. $data['transport-options'] = $package->getTransportOptions();
  16597. }
  16598. return $data;
  16599. }
  16600. private function dumpValues(PackageInterface $package, array $keys, array $data)
  16601. {
  16602. foreach ($keys as $method => $key) {
  16603. if (is_numeric($method)) {
  16604. $method = $key;
  16605. }
  16606. $getter = 'get'.ucfirst($method);
  16607. $value = $package->$getter();
  16608. if (null !== $value && !(is_array($value) && 0 === count($value))) {
  16609. $data[$key] = $value;
  16610. }
  16611. }
  16612. return $data;
  16613. }
  16614. }
  16615. <?php
  16616. namespace Composer\Package;
  16617. use Composer\Semver\Constraint\ConstraintInterface;
  16618. class Link
  16619. {
  16620. protected $source;
  16621. protected $target;
  16622. protected $constraint;
  16623. protected $description;
  16624. protected $prettyConstraint;
  16625. public function __construct($source, $target, ConstraintInterface $constraint = null, $description = 'relates to', $prettyConstraint = null)
  16626. {
  16627. $this->source = strtolower($source);
  16628. $this->target = strtolower($target);
  16629. $this->constraint = $constraint;
  16630. $this->description = $description;
  16631. $this->prettyConstraint = $prettyConstraint;
  16632. }
  16633. public function getDescription()
  16634. {
  16635. return $this->description;
  16636. }
  16637. public function getSource()
  16638. {
  16639. return $this->source;
  16640. }
  16641. public function getTarget()
  16642. {
  16643. return $this->target;
  16644. }
  16645. public function getConstraint()
  16646. {
  16647. return $this->constraint;
  16648. }
  16649. public function getPrettyConstraint()
  16650. {
  16651. if (null === $this->prettyConstraint) {
  16652. throw new \UnexpectedValueException(sprintf('Link %s has been misconfigured and had no prettyConstraint given.', $this));
  16653. }
  16654. return $this->prettyConstraint;
  16655. }
  16656. public function __toString()
  16657. {
  16658. return $this->source.' '.$this->description.' '.$this->target.' ('.$this->constraint.')';
  16659. }
  16660. public function getPrettyString(PackageInterface $sourcePackage)
  16661. {
  16662. return $sourcePackage->getPrettyString().' '.$this->description.' '.$this->target.' '.$this->constraint->getPrettyString().'';
  16663. }
  16664. }
  16665. <?php
  16666. namespace Composer\Package\LinkConstraint;
  16667. use Composer\Semver\Constraint\EmptyConstraint as SemverEmptyConstraint;
  16668. trigger_error('The ' . __NAMESPACE__ . '\EmptyConstraint class is deprecated, use Composer\Semver\Constraint\EmptyConstraint instead.', E_USER_DEPRECATED);
  16669. class EmptyConstraint extends SemverEmptyConstraint implements LinkConstraintInterface
  16670. {
  16671. }
  16672. <?php
  16673. namespace Composer\Package\LinkConstraint;
  16674. use Composer\Semver\Constraint\ConstraintInterface;
  16675. trigger_error('The ' . __NAMESPACE__ . '\LinkConstraintInterface interface is deprecated, use Composer\Semver\Constraint\ConstraintInterface instead.', E_USER_DEPRECATED);
  16676. interface LinkConstraintInterface extends ConstraintInterface
  16677. {
  16678. }
  16679. <?php
  16680. namespace Composer\Package\LinkConstraint;
  16681. use Composer\Semver\Constraint\MultiConstraint as SemverMultiConstraint;
  16682. trigger_error('The ' . __NAMESPACE__ . '\MultiConstraint class is deprecated, use Composer\Semver\Constraint\MultiConstraint instead.', E_USER_DEPRECATED);
  16683. class MultiConstraint extends SemverMultiConstraint implements LinkConstraintInterface
  16684. {
  16685. }
  16686. <?php
  16687. namespace Composer\Package\LinkConstraint;
  16688. use Composer\Semver\Constraint\AbstractConstraint;
  16689. trigger_error('The ' . __NAMESPACE__ . '\SpecificConstraint abstract class is deprecated, there is no replacement for it.', E_USER_DEPRECATED);
  16690. abstract class SpecificConstraint extends AbstractConstraint implements LinkConstraintInterface
  16691. {
  16692. }
  16693. <?php
  16694. namespace Composer\Package\LinkConstraint;
  16695. use Composer\Semver\Constraint\Constraint;
  16696. trigger_error('The ' . __NAMESPACE__ . '\VersionConstraint class is deprecated, use Composer\Semver\Constraint\Constraint instead.', E_USER_DEPRECATED);
  16697. class VersionConstraint extends Constraint implements LinkConstraintInterface
  16698. {
  16699. }
  16700. <?php
  16701. namespace Composer\Package\Loader;
  16702. use Composer\Package;
  16703. use Composer\Package\AliasPackage;
  16704. use Composer\Package\Link;
  16705. use Composer\Package\RootAliasPackage;
  16706. use Composer\Package\RootPackageInterface;
  16707. use Composer\Package\Version\VersionParser;
  16708. use Composer\Semver\VersionParser as SemverVersionParser;
  16709. class ArrayLoader implements LoaderInterface
  16710. {
  16711. protected $versionParser;
  16712. protected $loadOptions;
  16713. public function __construct(SemverVersionParser $parser = null, $loadOptions = false)
  16714. {
  16715. if (!$parser) {
  16716. $parser = new VersionParser;
  16717. }
  16718. $this->versionParser = $parser;
  16719. $this->loadOptions = $loadOptions;
  16720. }
  16721. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  16722. {
  16723. if (!isset($config['name'])) {
  16724. throw new \UnexpectedValueException('Unknown package has no name defined ('.json_encode($config).').');
  16725. }
  16726. if (!isset($config['version'])) {
  16727. throw new \UnexpectedValueException('Package '.$config['name'].' has no version defined.');
  16728. }
  16729. if (isset($config['version_normalized'])) {
  16730. $version = $config['version_normalized'];
  16731. } else {
  16732. $version = $this->versionParser->normalize($config['version']);
  16733. }
  16734. $package = new $class($config['name'], $version, $config['version']);
  16735. $package->setType(isset($config['type']) ? strtolower($config['type']) : 'library');
  16736. if (isset($config['target-dir'])) {
  16737. $package->setTargetDir($config['target-dir']);
  16738. }
  16739. if (isset($config['extra']) && is_array($config['extra'])) {
  16740. $package->setExtra($config['extra']);
  16741. }
  16742. if (isset($config['bin'])) {
  16743. foreach ((array) $config['bin'] as $key => $bin) {
  16744. $config['bin'][$key] = ltrim($bin, '/');
  16745. }
  16746. $package->setBinaries((array) $config['bin']);
  16747. }
  16748. if (isset($config['installation-source'])) {
  16749. $package->setInstallationSource($config['installation-source']);
  16750. }
  16751. if (isset($config['source'])) {
  16752. if (!isset($config['source']['type']) || !isset($config['source']['url']) || !isset($config['source']['reference'])) {
  16753. throw new \UnexpectedValueException(sprintf(
  16754. "Package %s's source key should be specified as {\"type\": ..., \"url\": ..., \"reference\": ...},\n%s given.",
  16755. $config['name'],
  16756. json_encode($config['source'])
  16757. ));
  16758. }
  16759. $package->setSourceType($config['source']['type']);
  16760. $package->setSourceUrl($config['source']['url']);
  16761. $package->setSourceReference($config['source']['reference']);
  16762. if (isset($config['source']['mirrors'])) {
  16763. $package->setSourceMirrors($config['source']['mirrors']);
  16764. }
  16765. }
  16766. if (isset($config['dist'])) {
  16767. if (!isset($config['dist']['type'])
  16768. || !isset($config['dist']['url'])) {
  16769. throw new \UnexpectedValueException(sprintf(
  16770. "Package %s's dist key should be specified as ".
  16771. "{\"type\": ..., \"url\": ..., \"reference\": ..., \"shasum\": ...},\n%s given.",
  16772. $config['name'],
  16773. json_encode($config['dist'])
  16774. ));
  16775. }
  16776. $package->setDistType($config['dist']['type']);
  16777. $package->setDistUrl($config['dist']['url']);
  16778. $package->setDistReference(isset($config['dist']['reference']) ? $config['dist']['reference'] : null);
  16779. $package->setDistSha1Checksum(isset($config['dist']['shasum']) ? $config['dist']['shasum'] : null);
  16780. if (isset($config['dist']['mirrors'])) {
  16781. $package->setDistMirrors($config['dist']['mirrors']);
  16782. }
  16783. }
  16784. foreach (Package\BasePackage::$supportedLinkTypes as $type => $opts) {
  16785. if (isset($config[$type])) {
  16786. $method = 'set'.ucfirst($opts['method']);
  16787. $package->{$method}(
  16788. $this->parseLinks(
  16789. $package->getName(),
  16790. $package->getPrettyVersion(),
  16791. $opts['description'],
  16792. $config[$type]
  16793. )
  16794. );
  16795. }
  16796. }
  16797. if (isset($config['suggest']) && is_array($config['suggest'])) {
  16798. foreach ($config['suggest'] as $target => $reason) {
  16799. if ('self.version' === trim($reason)) {
  16800. $config['suggest'][$target] = $package->getPrettyVersion();
  16801. }
  16802. }
  16803. $package->setSuggests($config['suggest']);
  16804. }
  16805. if (isset($config['autoload'])) {
  16806. $package->setAutoload($config['autoload']);
  16807. }
  16808. if (isset($config['autoload-dev'])) {
  16809. $package->setDevAutoload($config['autoload-dev']);
  16810. }
  16811. if (isset($config['include-path'])) {
  16812. $package->setIncludePaths($config['include-path']);
  16813. }
  16814. if (!empty($config['time'])) {
  16815. $time = preg_match('/^\d++$/D', $config['time']) ? '@'.$config['time'] : $config['time'];
  16816. try {
  16817. $date = new \DateTime($time, new \DateTimeZone('UTC'));
  16818. $package->setReleaseDate($date);
  16819. } catch (\Exception $e) {
  16820. }
  16821. }
  16822. if (!empty($config['notification-url'])) {
  16823. $package->setNotificationUrl($config['notification-url']);
  16824. }
  16825. if (!empty($config['archive']['exclude'])) {
  16826. $package->setArchiveExcludes($config['archive']['exclude']);
  16827. }
  16828. if ($package instanceof Package\CompletePackageInterface) {
  16829. if (isset($config['scripts']) && is_array($config['scripts'])) {
  16830. foreach ($config['scripts'] as $event => $listeners) {
  16831. $config['scripts'][$event] = (array) $listeners;
  16832. }
  16833. if (isset($config['scripts']['composer'])) {
  16834. trigger_error('The `composer` script name is reserved for internal use, please avoid defining it', E_USER_DEPRECATED);
  16835. }
  16836. $package->setScripts($config['scripts']);
  16837. }
  16838. if (!empty($config['description']) && is_string($config['description'])) {
  16839. $package->setDescription($config['description']);
  16840. }
  16841. if (!empty($config['homepage']) && is_string($config['homepage'])) {
  16842. $package->setHomepage($config['homepage']);
  16843. }
  16844. if (!empty($config['keywords']) && is_array($config['keywords'])) {
  16845. $package->setKeywords($config['keywords']);
  16846. }
  16847. if (!empty($config['license'])) {
  16848. $package->setLicense(is_array($config['license']) ? $config['license'] : array($config['license']));
  16849. }
  16850. if (!empty($config['authors']) && is_array($config['authors'])) {
  16851. $package->setAuthors($config['authors']);
  16852. }
  16853. if (isset($config['support'])) {
  16854. $package->setSupport($config['support']);
  16855. }
  16856. if (isset($config['abandoned'])) {
  16857. $package->setAbandoned($config['abandoned']);
  16858. }
  16859. }
  16860. if ($aliasNormalized = $this->getBranchAlias($config)) {
  16861. if ($package instanceof RootPackageInterface) {
  16862. $package = new RootAliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  16863. } else {
  16864. $package = new AliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  16865. }
  16866. }
  16867. if ($this->loadOptions && isset($config['transport-options'])) {
  16868. $package->setTransportOptions($config['transport-options']);
  16869. }
  16870. return $package;
  16871. }
  16872. public function parseLinks($source, $sourceVersion, $description, $links)
  16873. {
  16874. $res = array();
  16875. foreach ($links as $target => $constraint) {
  16876. if (!is_string($constraint)) {
  16877. throw new \UnexpectedValueException('Link constraint in '.$source.' '.$description.' > '.$target.' should be a string, got '.gettype($constraint) . ' (' . var_export($constraint, true) . ')');
  16878. }
  16879. if ('self.version' === $constraint) {
  16880. $parsedConstraint = $this->versionParser->parseConstraints($sourceVersion);
  16881. } else {
  16882. $parsedConstraint = $this->versionParser->parseConstraints($constraint);
  16883. }
  16884. $res[strtolower($target)] = new Link($source, $target, $parsedConstraint, $description, $constraint);
  16885. }
  16886. return $res;
  16887. }
  16888. public function getBranchAlias(array $config)
  16889. {
  16890. if (('dev-' !== substr($config['version'], 0, 4) && '-dev' !== substr($config['version'], -4))
  16891. || !isset($config['extra']['branch-alias'])
  16892. || !is_array($config['extra']['branch-alias'])
  16893. ) {
  16894. return;
  16895. }
  16896. foreach ($config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  16897. if ('-dev' !== substr($targetBranch, -4)) {
  16898. continue;
  16899. }
  16900. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  16901. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  16902. continue;
  16903. }
  16904. if (strtolower($config['version']) !== strtolower($sourceBranch)) {
  16905. continue;
  16906. }
  16907. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  16908. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  16909. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  16910. ) {
  16911. continue;
  16912. }
  16913. return $validatedTargetBranch;
  16914. }
  16915. }
  16916. }
  16917. <?php
  16918. namespace Composer\Package\Loader;
  16919. class InvalidPackageException extends \Exception
  16920. {
  16921. private $errors;
  16922. private $warnings;
  16923. private $data;
  16924. public function __construct(array $errors, array $warnings, array $data)
  16925. {
  16926. $this->errors = $errors;
  16927. $this->warnings = $warnings;
  16928. $this->data = $data;
  16929. parent::__construct("Invalid package information: \n".implode("\n", array_merge($errors, $warnings)));
  16930. }
  16931. public function getData()
  16932. {
  16933. return $this->data;
  16934. }
  16935. public function getErrors()
  16936. {
  16937. return $this->errors;
  16938. }
  16939. public function getWarnings()
  16940. {
  16941. return $this->warnings;
  16942. }
  16943. }
  16944. <?php
  16945. namespace Composer\Package\Loader;
  16946. use Composer\Json\JsonFile;
  16947. class JsonLoader
  16948. {
  16949. private $loader;
  16950. public function __construct(LoaderInterface $loader)
  16951. {
  16952. $this->loader = $loader;
  16953. }
  16954. public function load($json)
  16955. {
  16956. if ($json instanceof JsonFile) {
  16957. $config = $json->read();
  16958. } elseif (file_exists($json)) {
  16959. $config = JsonFile::parseJson(file_get_contents($json), $json);
  16960. } elseif (is_string($json)) {
  16961. $config = JsonFile::parseJson($json);
  16962. }
  16963. return $this->loader->load($config);
  16964. }
  16965. }
  16966. <?php
  16967. namespace Composer\Package\Loader;
  16968. interface LoaderInterface
  16969. {
  16970. public function load(array $package, $class = 'Composer\Package\CompletePackage');
  16971. }
  16972. <?php
  16973. namespace Composer\Package\Loader;
  16974. use Composer\Package\BasePackage;
  16975. use Composer\Package\AliasPackage;
  16976. use Composer\Config;
  16977. use Composer\Package\RootPackageInterface;
  16978. use Composer\Repository\RepositoryFactory;
  16979. use Composer\Package\Version\VersionGuesser;
  16980. use Composer\Package\Version\VersionParser;
  16981. use Composer\Repository\RepositoryManager;
  16982. use Composer\Util\ProcessExecutor;
  16983. class RootPackageLoader extends ArrayLoader
  16984. {
  16985. private $manager;
  16986. private $config;
  16987. private $versionGuesser;
  16988. public function __construct(RepositoryManager $manager, Config $config, VersionParser $parser = null, VersionGuesser $versionGuesser = null)
  16989. {
  16990. parent::__construct($parser);
  16991. $this->manager = $manager;
  16992. $this->config = $config;
  16993. $this->versionGuesser = $versionGuesser ?: new VersionGuesser($config, new ProcessExecutor(), $this->versionParser);
  16994. }
  16995. public function load(array $config, $class = 'Composer\Package\RootPackage', $cwd = null)
  16996. {
  16997. if (!isset($config['name'])) {
  16998. $config['name'] = '__root__';
  16999. }
  17000. $autoVersioned = false;
  17001. if (!isset($config['version'])) {
  17002. $commit = null;
  17003. if (getenv('COMPOSER_ROOT_VERSION')) {
  17004. $config['version'] = getenv('COMPOSER_ROOT_VERSION');
  17005. } else {
  17006. $versionData = $this->versionGuesser->guessVersion($config, $cwd ?: getcwd());
  17007. if ($versionData) {
  17008. $config['version'] = $versionData['pretty_version'];
  17009. $config['version_normalized'] = $versionData['version'];
  17010. $commit = $versionData['commit'];
  17011. }
  17012. }
  17013. if (!isset($config['version'])) {
  17014. $config['version'] = '1.0.0';
  17015. $autoVersioned = true;
  17016. }
  17017. if ($commit) {
  17018. $config['source'] = array(
  17019. 'type' => '',
  17020. 'url' => '',
  17021. 'reference' => $commit,
  17022. );
  17023. $config['dist'] = array(
  17024. 'type' => '',
  17025. 'url' => '',
  17026. 'reference' => $commit,
  17027. );
  17028. }
  17029. }
  17030. $realPackage = $package = parent::load($config, $class);
  17031. if ($realPackage instanceof AliasPackage) {
  17032. $realPackage = $package->getAliasOf();
  17033. }
  17034. if ($autoVersioned) {
  17035. $realPackage->replaceVersion($realPackage->getVersion(), 'No version set (parsed as 1.0.0)');
  17036. }
  17037. if (isset($config['minimum-stability'])) {
  17038. $realPackage->setMinimumStability(VersionParser::normalizeStability($config['minimum-stability']));
  17039. }
  17040. $aliases = array();
  17041. $stabilityFlags = array();
  17042. $references = array();
  17043. foreach (array('require', 'require-dev') as $linkType) {
  17044. if (isset($config[$linkType])) {
  17045. $linkInfo = BasePackage::$supportedLinkTypes[$linkType];
  17046. $method = 'get'.ucfirst($linkInfo['method']);
  17047. $links = array();
  17048. foreach ($realPackage->$method() as $link) {
  17049. $links[$link->getTarget()] = $link->getConstraint()->getPrettyString();
  17050. }
  17051. $aliases = $this->extractAliases($links, $aliases);
  17052. $stabilityFlags = $this->extractStabilityFlags($links, $stabilityFlags, $realPackage->getMinimumStability());
  17053. $references = $this->extractReferences($links, $references);
  17054. }
  17055. }
  17056. if (isset($links[$config['name']])) {
  17057. throw new \InvalidArgumentException(sprintf('Root package \'%s\' cannot require itself in its composer.json' . PHP_EOL .
  17058. 'Did you accidentally name your root package after an external package?', $config['name']));
  17059. }
  17060. $realPackage->setAliases($aliases);
  17061. $realPackage->setStabilityFlags($stabilityFlags);
  17062. $realPackage->setReferences($references);
  17063. if (isset($config['prefer-stable'])) {
  17064. $realPackage->setPreferStable((bool) $config['prefer-stable']);
  17065. }
  17066. if (isset($config['config'])) {
  17067. $realPackage->setConfig($config['config']);
  17068. }
  17069. $repos = RepositoryFactory::defaultRepos(null, $this->config, $this->manager);
  17070. foreach ($repos as $repo) {
  17071. $this->manager->addRepository($repo);
  17072. }
  17073. $realPackage->setRepositories($this->config->getRepositories());
  17074. return $package;
  17075. }
  17076. private function extractAliases(array $requires, array $aliases)
  17077. {
  17078. foreach ($requires as $reqName => $reqVersion) {
  17079. if (preg_match('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $reqVersion, $match)) {
  17080. $aliases[] = array(
  17081. 'package' => strtolower($reqName),
  17082. 'version' => $this->versionParser->normalize($match[1], $reqVersion),
  17083. 'alias' => $match[2],
  17084. 'alias_normalized' => $this->versionParser->normalize($match[2], $reqVersion),
  17085. );
  17086. }
  17087. }
  17088. return $aliases;
  17089. }
  17090. private function extractStabilityFlags(array $requires, array $stabilityFlags, $minimumStability)
  17091. {
  17092. $stabilities = BasePackage::$stabilities;
  17093. $minimumStability = $stabilities[$minimumStability];
  17094. foreach ($requires as $reqName => $reqVersion) {
  17095. $constraints = array();
  17096. $orSplit = preg_split('{\s*\|\|?\s*}', trim($reqVersion));
  17097. foreach ($orSplit as $orConstraint) {
  17098. $andSplit = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $orConstraint);
  17099. foreach ($andSplit as $andConstraint) {
  17100. $constraints[] = $andConstraint;
  17101. }
  17102. }
  17103. $match = false;
  17104. foreach ($constraints as $constraint) {
  17105. if (preg_match('{^[^@]*?@('.implode('|', array_keys($stabilities)).')$}i', $constraint, $match)) {
  17106. $name = strtolower($reqName);
  17107. $stability = $stabilities[VersionParser::normalizeStability($match[1])];
  17108. if (isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) {
  17109. continue;
  17110. }
  17111. $stabilityFlags[$name] = $stability;
  17112. $match = true;
  17113. }
  17114. }
  17115. if ($match) {
  17116. continue;
  17117. }
  17118. foreach ($constraints as $constraint) {
  17119. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $constraint);
  17120. if (preg_match('{^[^,\s@]+$}', $reqVersion) && 'stable' !== ($stabilityName = VersionParser::parseStability($reqVersion))) {
  17121. $name = strtolower($reqName);
  17122. $stability = $stabilities[$stabilityName];
  17123. if ((isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) || ($minimumStability > $stability)) {
  17124. continue;
  17125. }
  17126. $stabilityFlags[$name] = $stability;
  17127. }
  17128. }
  17129. }
  17130. return $stabilityFlags;
  17131. }
  17132. private function extractReferences(array $requires, array $references)
  17133. {
  17134. foreach ($requires as $reqName => $reqVersion) {
  17135. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion);
  17136. if (preg_match('{^[^,\s@]+?#([a-f0-9]+)$}', $reqVersion, $match) && 'dev' === ($stabilityName = VersionParser::parseStability($reqVersion))) {
  17137. $name = strtolower($reqName);
  17138. $references[$name] = $match[1];
  17139. }
  17140. }
  17141. return $references;
  17142. }
  17143. }
  17144. <?php
  17145. namespace Composer\Package\Loader;
  17146. use Composer\Package;
  17147. use Composer\Package\BasePackage;
  17148. use Composer\Semver\Constraint\Constraint;
  17149. use Composer\Package\Version\VersionParser;
  17150. use Composer\Repository\PlatformRepository;
  17151. use Composer\Spdx\SpdxLicenses;
  17152. class ValidatingArrayLoader implements LoaderInterface
  17153. {
  17154. const CHECK_ALL = 3;
  17155. const CHECK_UNBOUND_CONSTRAINTS = 1;
  17156. const CHECK_STRICT_CONSTRAINTS = 2;
  17157. private $loader;
  17158. private $versionParser;
  17159. private $errors;
  17160. private $warnings;
  17161. private $config;
  17162. private $strictName;
  17163. private $flags;
  17164. public function __construct(LoaderInterface $loader, $strictName = true, VersionParser $parser = null, $flags = 0)
  17165. {
  17166. $this->loader = $loader;
  17167. $this->versionParser = $parser ?: new VersionParser();
  17168. $this->strictName = $strictName;
  17169. $this->flags = $flags;
  17170. }
  17171. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  17172. {
  17173. $this->errors = array();
  17174. $this->warnings = array();
  17175. $this->config = $config;
  17176. if ($this->strictName) {
  17177. $this->validateRegex('name', '[A-Za-z0-9][A-Za-z0-9_.-]*/[A-Za-z0-9][A-Za-z0-9_.-]*', true);
  17178. } else {
  17179. $this->validateString('name', true);
  17180. }
  17181. if (!empty($this->config['version'])) {
  17182. try {
  17183. $this->versionParser->normalize($this->config['version']);
  17184. } catch (\Exception $e) {
  17185. $this->errors[] = 'version : invalid value ('.$this->config['version'].'): '.$e->getMessage();
  17186. unset($this->config['version']);
  17187. }
  17188. }
  17189. if (!empty($this->config['config']['platform'])) {
  17190. foreach ((array) $this->config['config']['platform'] as $key => $platform) {
  17191. try {
  17192. $this->versionParser->normalize($platform);
  17193. } catch (\Exception $e) {
  17194. $this->errors[] = 'config.platform.' . $key . ' : invalid value ('.$platform.'): '.$e->getMessage();
  17195. }
  17196. }
  17197. }
  17198. $this->validateRegex('type', '[A-Za-z0-9-]+');
  17199. $this->validateString('target-dir');
  17200. $this->validateArray('extra');
  17201. if (isset($this->config['bin'])) {
  17202. if (is_string($this->config['bin'])) {
  17203. $this->validateString('bin');
  17204. } else {
  17205. $this->validateFlatArray('bin');
  17206. }
  17207. }
  17208. $this->validateArray('scripts');
  17209. $this->validateString('description');
  17210. $this->validateUrl('homepage');
  17211. $this->validateFlatArray('keywords', '[\p{N}\p{L} ._-]+');
  17212. $releaseDate = null;
  17213. $this->validateString('time');
  17214. if (!empty($this->config['time'])) {
  17215. try {
  17216. $releaseDate = new \DateTime($this->config['time'], new \DateTimeZone('UTC'));
  17217. } catch (\Exception $e) {
  17218. $this->errors[] = 'time : invalid value ('.$this->config['time'].'): '.$e->getMessage();
  17219. unset($this->config['time']);
  17220. }
  17221. }
  17222. if (isset($this->config['license']) && (!$releaseDate || $releaseDate->getTimestamp() >= strtotime('-8days'))) {
  17223. if (is_array($this->config['license']) || is_string($this->config['license'])) {
  17224. $licenses = (array) $this->config['license'];
  17225. foreach ($licenses as $key => $license) {
  17226. if ('proprietary' === $license) {
  17227. unset($licenses[$key]);
  17228. }
  17229. }
  17230. $licenseValidator = new SpdxLicenses();
  17231. if (count($licenses) === 1 && !$licenseValidator->validate($licenses) && $licenseValidator->validate(trim($licenses[0]))) {
  17232. $this->warnings[] = sprintf(
  17233. 'License %s must not contain extra spaces, make sure to trim it.',
  17234. json_encode($this->config['license'])
  17235. );
  17236. } elseif (array() !== $licenses && !$licenseValidator->validate($licenses)) {
  17237. $this->warnings[] = sprintf(
  17238. 'License %s is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license.' . PHP_EOL .
  17239. 'If the software is closed-source, you may use "proprietary" as license.',
  17240. json_encode($this->config['license'])
  17241. );
  17242. }
  17243. }
  17244. }
  17245. if ($this->validateArray('authors') && !empty($this->config['authors'])) {
  17246. foreach ($this->config['authors'] as $key => $author) {
  17247. if (!is_array($author)) {
  17248. $this->errors[] = 'authors.'.$key.' : should be an array, '.gettype($author).' given';
  17249. unset($this->config['authors'][$key]);
  17250. continue;
  17251. }
  17252. foreach (array('homepage', 'email', 'name', 'role') as $authorData) {
  17253. if (isset($author[$authorData]) && !is_string($author[$authorData])) {
  17254. $this->errors[] = 'authors.'.$key.'.'.$authorData.' : invalid value, must be a string';
  17255. unset($this->config['authors'][$key][$authorData]);
  17256. }
  17257. }
  17258. if (isset($author['homepage']) && !$this->filterUrl($author['homepage'])) {
  17259. $this->warnings[] = 'authors.'.$key.'.homepage : invalid value ('.$author['homepage'].'), must be an http/https URL';
  17260. unset($this->config['authors'][$key]['homepage']);
  17261. }
  17262. if (isset($author['email']) && !filter_var($author['email'], FILTER_VALIDATE_EMAIL)) {
  17263. $this->warnings[] = 'authors.'.$key.'.email : invalid value ('.$author['email'].'), must be a valid email address';
  17264. unset($this->config['authors'][$key]['email']);
  17265. }
  17266. if (empty($this->config['authors'][$key])) {
  17267. unset($this->config['authors'][$key]);
  17268. }
  17269. }
  17270. if (empty($this->config['authors'])) {
  17271. unset($this->config['authors']);
  17272. }
  17273. }
  17274. if ($this->validateArray('support') && !empty($this->config['support'])) {
  17275. foreach (array('issues', 'forum', 'wiki', 'source', 'email', 'irc', 'docs', 'rss') as $key) {
  17276. if (isset($this->config['support'][$key]) && !is_string($this->config['support'][$key])) {
  17277. $this->errors[] = 'support.'.$key.' : invalid value, must be a string';
  17278. unset($this->config['support'][$key]);
  17279. }
  17280. }
  17281. if (isset($this->config['support']['email']) && !filter_var($this->config['support']['email'], FILTER_VALIDATE_EMAIL)) {
  17282. $this->warnings[] = 'support.email : invalid value ('.$this->config['support']['email'].'), must be a valid email address';
  17283. unset($this->config['support']['email']);
  17284. }
  17285. if (isset($this->config['support']['irc']) && !$this->filterUrl($this->config['support']['irc'], array('irc'))) {
  17286. $this->warnings[] = 'support.irc : invalid value ('.$this->config['support']['irc'].'), must be a irc://<server>/<channel> URL';
  17287. unset($this->config['support']['irc']);
  17288. }
  17289. foreach (array('issues', 'forum', 'wiki', 'source', 'docs') as $key) {
  17290. if (isset($this->config['support'][$key]) && !$this->filterUrl($this->config['support'][$key])) {
  17291. $this->warnings[] = 'support.'.$key.' : invalid value ('.$this->config['support'][$key].'), must be an http/https URL';
  17292. unset($this->config['support'][$key]);
  17293. }
  17294. }
  17295. if (empty($this->config['support'])) {
  17296. unset($this->config['support']);
  17297. }
  17298. }
  17299. $unboundConstraint = new Constraint('=', $this->versionParser->normalize('dev-master'));
  17300. $stableConstraint = new Constraint('=', '1.0.0');
  17301. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  17302. if ($this->validateArray($linkType) && isset($this->config[$linkType])) {
  17303. foreach ($this->config[$linkType] as $package => $constraint) {
  17304. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $package)) {
  17305. $this->warnings[] = $linkType.'.'.$package.' : invalid key, package names must be strings containing only [A-Za-z0-9_./-]';
  17306. }
  17307. if (!is_string($constraint)) {
  17308. $this->errors[] = $linkType.'.'.$package.' : invalid value, must be a string containing a version constraint';
  17309. unset($this->config[$linkType][$package]);
  17310. } elseif ('self.version' !== $constraint) {
  17311. try {
  17312. $linkConstraint = $this->versionParser->parseConstraints($constraint);
  17313. } catch (\Exception $e) {
  17314. $this->errors[] = $linkType.'.'.$package.' : invalid version constraint ('.$e->getMessage().')';
  17315. unset($this->config[$linkType][$package]);
  17316. continue;
  17317. }
  17318. if (
  17319. ($this->flags & self::CHECK_UNBOUND_CONSTRAINTS)
  17320. && 'require' === $linkType
  17321. && $linkConstraint->matches($unboundConstraint)
  17322. && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $package)
  17323. ) {
  17324. $this->warnings[] = $linkType.'.'.$package.' : unbound version constraints ('.$constraint.') should be avoided';
  17325. } elseif (
  17326. ($this->flags & self::CHECK_STRICT_CONSTRAINTS)
  17327. && 'require' === $linkType
  17328. && substr($linkConstraint, 0, 1) === '='
  17329. && $stableConstraint->versionCompare($stableConstraint, $linkConstraint, '<=')
  17330. ) {
  17331. $this->warnings[] = $linkType.'.'.$package.' : exact version constraints ('.$constraint.') should be avoided if the package follows semantic versioning';
  17332. }
  17333. }
  17334. }
  17335. }
  17336. }
  17337. if ($this->validateArray('suggest') && !empty($this->config['suggest'])) {
  17338. foreach ($this->config['suggest'] as $package => $description) {
  17339. if (!is_string($description)) {
  17340. $this->errors[] = 'suggest.'.$package.' : invalid value, must be a string describing why the package is suggested';
  17341. unset($this->config['suggest'][$package]);
  17342. }
  17343. }
  17344. }
  17345. if ($this->validateString('minimum-stability') && !empty($this->config['minimum-stability'])) {
  17346. if (!isset(BasePackage::$stabilities[$this->config['minimum-stability']])) {
  17347. $this->errors[] = 'minimum-stability : invalid value ('.$this->config['minimum-stability'].'), must be one of '.implode(', ', array_keys(BasePackage::$stabilities));
  17348. unset($this->config['minimum-stability']);
  17349. }
  17350. }
  17351. if ($this->validateArray('autoload') && !empty($this->config['autoload'])) {
  17352. $types = array('psr-0', 'psr-4', 'classmap', 'files', 'exclude-from-classmap');
  17353. foreach ($this->config['autoload'] as $type => $typeConfig) {
  17354. if (!in_array($type, $types)) {
  17355. $this->errors[] = 'autoload : invalid value ('.$type.'), must be one of '.implode(', ', $types);
  17356. unset($this->config['autoload'][$type]);
  17357. }
  17358. if ($type === 'psr-4') {
  17359. foreach ($typeConfig as $namespace => $dirs) {
  17360. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  17361. $this->errors[] = 'autoload.psr-4 : invalid value ('.$namespace.'), namespaces must end with a namespace separator, should be '.$namespace.'\\\\';
  17362. }
  17363. }
  17364. }
  17365. }
  17366. }
  17367. if (!empty($this->config['autoload']['psr-4']) && !empty($this->config['target-dir'])) {
  17368. $this->errors[] = 'target-dir : this can not be used together with the autoload.psr-4 setting, remove target-dir to upgrade to psr-4';
  17369. unset($this->config['autoload']['psr-4']);
  17370. }
  17371. $this->validateFlatArray('include-path');
  17372. $this->validateArray('transport-options');
  17373. if (isset($this->config['extra']['branch-alias'])) {
  17374. if (!is_array($this->config['extra']['branch-alias'])) {
  17375. $this->errors[] = 'extra.branch-alias : must be an array of versions => aliases';
  17376. } else {
  17377. foreach ($this->config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  17378. if ('-dev' !== substr($targetBranch, -4)) {
  17379. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must end in -dev';
  17380. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  17381. continue;
  17382. }
  17383. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  17384. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  17385. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must be a parseable number like 2.0-dev';
  17386. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  17387. continue;
  17388. }
  17389. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  17390. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  17391. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  17392. ) {
  17393. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') is not a valid numeric alias for this version';
  17394. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  17395. }
  17396. }
  17397. }
  17398. }
  17399. if ($this->errors) {
  17400. throw new InvalidPackageException($this->errors, $this->warnings, $config);
  17401. }
  17402. $package = $this->loader->load($this->config, $class);
  17403. $this->config = null;
  17404. return $package;
  17405. }
  17406. public function getWarnings()
  17407. {
  17408. return $this->warnings;
  17409. }
  17410. public function getErrors()
  17411. {
  17412. return $this->errors;
  17413. }
  17414. private function validateRegex($property, $regex, $mandatory = false)
  17415. {
  17416. if (!$this->validateString($property, $mandatory)) {
  17417. return false;
  17418. }
  17419. if (!preg_match('{^'.$regex.'$}u', $this->config[$property])) {
  17420. $message = $property.' : invalid value ('.$this->config[$property].'), must match '.$regex;
  17421. if ($mandatory) {
  17422. $this->errors[] = $message;
  17423. } else {
  17424. $this->warnings[] = $message;
  17425. }
  17426. unset($this->config[$property]);
  17427. return false;
  17428. }
  17429. return true;
  17430. }
  17431. private function validateString($property, $mandatory = false)
  17432. {
  17433. if (isset($this->config[$property]) && !is_string($this->config[$property])) {
  17434. $this->errors[] = $property.' : should be a string, '.gettype($this->config[$property]).' given';
  17435. unset($this->config[$property]);
  17436. return false;
  17437. }
  17438. if (!isset($this->config[$property]) || trim($this->config[$property]) === '') {
  17439. if ($mandatory) {
  17440. $this->errors[] = $property.' : must be present';
  17441. }
  17442. unset($this->config[$property]);
  17443. return false;
  17444. }
  17445. return true;
  17446. }
  17447. private function validateArray($property, $mandatory = false)
  17448. {
  17449. if (isset($this->config[$property]) && !is_array($this->config[$property])) {
  17450. $this->errors[] = $property.' : should be an array, '.gettype($this->config[$property]).' given';
  17451. unset($this->config[$property]);
  17452. return false;
  17453. }
  17454. if (!isset($this->config[$property]) || !count($this->config[$property])) {
  17455. if ($mandatory) {
  17456. $this->errors[] = $property.' : must be present and contain at least one element';
  17457. }
  17458. unset($this->config[$property]);
  17459. return false;
  17460. }
  17461. return true;
  17462. }
  17463. private function validateFlatArray($property, $regex = null, $mandatory = false)
  17464. {
  17465. if (!$this->validateArray($property, $mandatory)) {
  17466. return false;
  17467. }
  17468. $pass = true;
  17469. foreach ($this->config[$property] as $key => $value) {
  17470. if (!is_string($value) && !is_numeric($value)) {
  17471. $this->errors[] = $property.'.'.$key.' : must be a string or int, '.gettype($value).' given';
  17472. unset($this->config[$property][$key]);
  17473. $pass = false;
  17474. continue;
  17475. }
  17476. if ($regex && !preg_match('{^'.$regex.'$}u', $value)) {
  17477. $this->warnings[] = $property.'.'.$key.' : invalid value ('.$value.'), must match '.$regex;
  17478. unset($this->config[$property][$key]);
  17479. $pass = false;
  17480. }
  17481. }
  17482. return $pass;
  17483. }
  17484. private function validateUrl($property, $mandatory = false)
  17485. {
  17486. if (!$this->validateString($property, $mandatory)) {
  17487. return false;
  17488. }
  17489. if (!$this->filterUrl($this->config[$property])) {
  17490. $this->warnings[] = $property.' : invalid value ('.$this->config[$property].'), must be an http/https URL';
  17491. unset($this->config[$property]);
  17492. return false;
  17493. }
  17494. return true;
  17495. }
  17496. private function filterUrl($value, array $schemes = array('http', 'https'))
  17497. {
  17498. if ($value === '') {
  17499. return true;
  17500. }
  17501. $bits = parse_url($value);
  17502. if (empty($bits['scheme']) || empty($bits['host'])) {
  17503. return false;
  17504. }
  17505. if (!in_array($bits['scheme'], $schemes, true)) {
  17506. return false;
  17507. }
  17508. return true;
  17509. }
  17510. }
  17511. <?php
  17512. namespace Composer\Package;
  17513. use Composer\Json\JsonFile;
  17514. use Composer\Installer\InstallationManager;
  17515. use Composer\Repository\RepositoryManager;
  17516. use Composer\Util\ProcessExecutor;
  17517. use Composer\Repository\ArrayRepository;
  17518. use Composer\Package\Dumper\ArrayDumper;
  17519. use Composer\Package\Loader\ArrayLoader;
  17520. use Composer\Util\Git as GitUtil;
  17521. use Composer\IO\IOInterface;
  17522. use Seld\JsonLint\ParsingException;
  17523. class Locker
  17524. {
  17525. private $lockFile;
  17526. private $repositoryManager;
  17527. private $installationManager;
  17528. private $hash;
  17529. private $contentHash;
  17530. private $loader;
  17531. private $dumper;
  17532. private $process;
  17533. private $lockDataCache;
  17534. public function __construct(IOInterface $io, JsonFile $lockFile, RepositoryManager $repositoryManager, InstallationManager $installationManager, $composerFileContents)
  17535. {
  17536. $this->lockFile = $lockFile;
  17537. $this->repositoryManager = $repositoryManager;
  17538. $this->installationManager = $installationManager;
  17539. $this->hash = md5($composerFileContents);
  17540. $this->contentHash = self::getContentHash($composerFileContents);
  17541. $this->loader = new ArrayLoader(null, true);
  17542. $this->dumper = new ArrayDumper();
  17543. $this->process = new ProcessExecutor($io);
  17544. }
  17545. public static function getContentHash($composerFileContents)
  17546. {
  17547. $content = json_decode($composerFileContents, true);
  17548. $relevantKeys = array(
  17549. 'name',
  17550. 'version',
  17551. 'require',
  17552. 'require-dev',
  17553. 'conflict',
  17554. 'replace',
  17555. 'provide',
  17556. 'minimum-stability',
  17557. 'prefer-stable',
  17558. 'repositories',
  17559. 'extra',
  17560. );
  17561. $relevantContent = array();
  17562. foreach (array_intersect($relevantKeys, array_keys($content)) as $key) {
  17563. $relevantContent[$key] = $content[$key];
  17564. }
  17565. if (isset($content['config']['platform'])) {
  17566. $relevantContent['config']['platform'] = $content['config']['platform'];
  17567. }
  17568. ksort($relevantContent);
  17569. return md5(json_encode($relevantContent));
  17570. }
  17571. public function isLocked()
  17572. {
  17573. if (!$this->lockFile->exists()) {
  17574. return false;
  17575. }
  17576. $data = $this->getLockData();
  17577. return isset($data['packages']);
  17578. }
  17579. public function isFresh()
  17580. {
  17581. $lock = $this->lockFile->read();
  17582. if (!empty($lock['content-hash'])) {
  17583. return $this->contentHash === $lock['content-hash'];
  17584. }
  17585. if (!empty($lock['hash'])) {
  17586. return $this->hash === $lock['hash'];
  17587. }
  17588. return false;
  17589. }
  17590. public function getLockedRepository($withDevReqs = false)
  17591. {
  17592. $lockData = $this->getLockData();
  17593. $packages = new ArrayRepository();
  17594. $lockedPackages = $lockData['packages'];
  17595. if ($withDevReqs) {
  17596. if (isset($lockData['packages-dev'])) {
  17597. $lockedPackages = array_merge($lockedPackages, $lockData['packages-dev']);
  17598. } else {
  17599. throw new \RuntimeException('The lock file does not contain require-dev information, run install with the --no-dev option or run update to install those packages.');
  17600. }
  17601. }
  17602. if (empty($lockedPackages)) {
  17603. return $packages;
  17604. }
  17605. if (isset($lockedPackages[0]['name'])) {
  17606. foreach ($lockedPackages as $info) {
  17607. $packages->addPackage($this->loader->load($info));
  17608. }
  17609. return $packages;
  17610. }
  17611. throw new \RuntimeException('Your composer.lock was created before 2012-09-15, and is not supported anymore. Run "composer update" to generate a new one.');
  17612. }
  17613. public function getPlatformRequirements($withDevReqs = false)
  17614. {
  17615. $lockData = $this->getLockData();
  17616. $requirements = array();
  17617. if (!empty($lockData['platform'])) {
  17618. $requirements = $this->loader->parseLinks(
  17619. '__ROOT__',
  17620. '1.0.0',
  17621. 'requires',
  17622. isset($lockData['platform']) ? $lockData['platform'] : array()
  17623. );
  17624. }
  17625. if ($withDevReqs && !empty($lockData['platform-dev'])) {
  17626. $devRequirements = $this->loader->parseLinks(
  17627. '__ROOT__',
  17628. '1.0.0',
  17629. 'requires',
  17630. isset($lockData['platform-dev']) ? $lockData['platform-dev'] : array()
  17631. );
  17632. $requirements = array_merge($requirements, $devRequirements);
  17633. }
  17634. return $requirements;
  17635. }
  17636. public function getMinimumStability()
  17637. {
  17638. $lockData = $this->getLockData();
  17639. return isset($lockData['minimum-stability']) ? $lockData['minimum-stability'] : 'stable';
  17640. }
  17641. public function getStabilityFlags()
  17642. {
  17643. $lockData = $this->getLockData();
  17644. return isset($lockData['stability-flags']) ? $lockData['stability-flags'] : array();
  17645. }
  17646. public function getPreferStable()
  17647. {
  17648. $lockData = $this->getLockData();
  17649. return isset($lockData['prefer-stable']) ? $lockData['prefer-stable'] : null;
  17650. }
  17651. public function getPreferLowest()
  17652. {
  17653. $lockData = $this->getLockData();
  17654. return isset($lockData['prefer-lowest']) ? $lockData['prefer-lowest'] : null;
  17655. }
  17656. public function getPlatformOverrides()
  17657. {
  17658. $lockData = $this->getLockData();
  17659. return isset($lockData['platform-overrides']) ? $lockData['platform-overrides'] : array();
  17660. }
  17661. public function getAliases()
  17662. {
  17663. $lockData = $this->getLockData();
  17664. return isset($lockData['aliases']) ? $lockData['aliases'] : array();
  17665. }
  17666. public function getLockData()
  17667. {
  17668. if (null !== $this->lockDataCache) {
  17669. return $this->lockDataCache;
  17670. }
  17671. if (!$this->lockFile->exists()) {
  17672. throw new \LogicException('No lockfile found. Unable to read locked packages');
  17673. }
  17674. return $this->lockDataCache = $this->lockFile->read();
  17675. }
  17676. public function setLockData(array $packages, $devPackages, array $platformReqs, $platformDevReqs, array $aliases, $minimumStability, array $stabilityFlags, $preferStable, $preferLowest, array $platformOverrides)
  17677. {
  17678. $lock = array(
  17679. '_readme' => array('This file locks the dependencies of your project to a known state',
  17680. 'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies',
  17681. 'This file is @gener'.'ated automatically', ),
  17682. 'content-hash' => $this->contentHash,
  17683. 'packages' => null,
  17684. 'packages-dev' => null,
  17685. 'aliases' => array(),
  17686. 'minimum-stability' => $minimumStability,
  17687. 'stability-flags' => $stabilityFlags,
  17688. 'prefer-stable' => $preferStable,
  17689. 'prefer-lowest' => $preferLowest,
  17690. );
  17691. foreach ($aliases as $package => $versions) {
  17692. foreach ($versions as $version => $alias) {
  17693. $lock['aliases'][] = array(
  17694. 'alias' => $alias['alias'],
  17695. 'alias_normalized' => $alias['alias_normalized'],
  17696. 'version' => $version,
  17697. 'package' => $package,
  17698. );
  17699. }
  17700. }
  17701. $lock['packages'] = $this->lockPackages($packages);
  17702. if (null !== $devPackages) {
  17703. $lock['packages-dev'] = $this->lockPackages($devPackages);
  17704. }
  17705. $lock['platform'] = $platformReqs;
  17706. $lock['platform-dev'] = $platformDevReqs;
  17707. if ($platformOverrides) {
  17708. $lock['platform-overrides'] = $platformOverrides;
  17709. }
  17710. if (empty($lock['packages']) && empty($lock['packages-dev']) && empty($lock['platform']) && empty($lock['platform-dev'])) {
  17711. if ($this->lockFile->exists()) {
  17712. unlink($this->lockFile->getPath());
  17713. }
  17714. return false;
  17715. }
  17716. try {
  17717. $isLocked = $this->isLocked();
  17718. } catch (ParsingException $e) {
  17719. $isLocked = false;
  17720. }
  17721. if (!$isLocked || $lock !== $this->getLockData()) {
  17722. $this->lockFile->write($lock);
  17723. $this->lockDataCache = null;
  17724. return true;
  17725. }
  17726. return false;
  17727. }
  17728. private function lockPackages(array $packages)
  17729. {
  17730. $locked = array();
  17731. foreach ($packages as $package) {
  17732. if ($package instanceof AliasPackage) {
  17733. continue;
  17734. }
  17735. $name = $package->getPrettyName();
  17736. $version = $package->getPrettyVersion();
  17737. if (!$name || !$version) {
  17738. throw new \LogicException(sprintf(
  17739. 'Package "%s" has no version or name and can not be locked', $package
  17740. ));
  17741. }
  17742. $spec = $this->dumper->dump($package);
  17743. unset($spec['version_normalized']);
  17744. $time = isset($spec['time']) ? $spec['time'] : null;
  17745. unset($spec['time']);
  17746. if ($package->isDev() && $package->getInstallationSource() === 'source') {
  17747. $time = $this->getPackageTime($package) ?: $time;
  17748. }
  17749. if (null !== $time) {
  17750. $spec['time'] = $time;
  17751. }
  17752. unset($spec['installation-source']);
  17753. $locked[] = $spec;
  17754. }
  17755. usort($locked, function ($a, $b) {
  17756. $comparison = strcmp($a['name'], $b['name']);
  17757. if (0 !== $comparison) {
  17758. return $comparison;
  17759. }
  17760. return strcmp($a['version'], $b['version']);
  17761. });
  17762. return $locked;
  17763. }
  17764. private function getPackageTime(PackageInterface $package)
  17765. {
  17766. if (!function_exists('proc_open')) {
  17767. return null;
  17768. }
  17769. $path = realpath($this->installationManager->getInstallPath($package));
  17770. $sourceType = $package->getSourceType();
  17771. $datetime = null;
  17772. if ($path && in_array($sourceType, array('git', 'hg'))) {
  17773. $sourceRef = $package->getSourceReference() ?: $package->getDistReference();
  17774. switch ($sourceType) {
  17775. case 'git':
  17776. GitUtil::cleanEnv();
  17777. if (0 === $this->process->execute('git log -n1 --pretty=%ct '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*\d+\s*$}', $output)) {
  17778. $datetime = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  17779. }
  17780. break;
  17781. case 'hg':
  17782. if (0 === $this->process->execute('hg log --template "{date|hgdate}" -r '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*(\d+)\s*}', $output, $match)) {
  17783. $datetime = new \DateTime('@'.$match[1], new \DateTimeZone('UTC'));
  17784. }
  17785. break;
  17786. }
  17787. }
  17788. return $datetime ? $datetime->format(DATE_RFC3339) : null;
  17789. }
  17790. }
  17791. <?php
  17792. namespace Composer\Package;
  17793. use Composer\Package\Version\VersionParser;
  17794. use Composer\Util\ComposerMirror;
  17795. class Package extends BasePackage
  17796. {
  17797. protected $type;
  17798. protected $targetDir;
  17799. protected $installationSource;
  17800. protected $sourceType;
  17801. protected $sourceUrl;
  17802. protected $sourceReference;
  17803. protected $sourceMirrors;
  17804. protected $distType;
  17805. protected $distUrl;
  17806. protected $distReference;
  17807. protected $distSha1Checksum;
  17808. protected $distMirrors;
  17809. protected $version;
  17810. protected $prettyVersion;
  17811. protected $releaseDate;
  17812. protected $extra = array();
  17813. protected $binaries = array();
  17814. protected $dev;
  17815. protected $stability;
  17816. protected $notificationUrl;
  17817. protected $requires = array();
  17818. protected $conflicts = array();
  17819. protected $provides = array();
  17820. protected $replaces = array();
  17821. protected $devRequires = array();
  17822. protected $suggests = array();
  17823. protected $autoload = array();
  17824. protected $devAutoload = array();
  17825. protected $includePaths = array();
  17826. protected $archiveExcludes = array();
  17827. public function __construct($name, $version, $prettyVersion)
  17828. {
  17829. parent::__construct($name);
  17830. $this->version = $version;
  17831. $this->prettyVersion = $prettyVersion;
  17832. $this->stability = VersionParser::parseStability($version);
  17833. $this->dev = $this->stability === 'dev';
  17834. }
  17835. public function isDev()
  17836. {
  17837. return $this->dev;
  17838. }
  17839. public function setType($type)
  17840. {
  17841. $this->type = $type;
  17842. }
  17843. public function getType()
  17844. {
  17845. return $this->type ?: 'library';
  17846. }
  17847. public function getStability()
  17848. {
  17849. return $this->stability;
  17850. }
  17851. public function setTargetDir($targetDir)
  17852. {
  17853. $this->targetDir = $targetDir;
  17854. }
  17855. public function getTargetDir()
  17856. {
  17857. if (null === $this->targetDir) {
  17858. return;
  17859. }
  17860. return ltrim(preg_replace('{ (?:^|[\\\\/]+) \.\.? (?:[\\\\/]+|$) (?:\.\.? (?:[\\\\/]+|$) )*}x', '/', $this->targetDir), '/');
  17861. }
  17862. public function setExtra(array $extra)
  17863. {
  17864. $this->extra = $extra;
  17865. }
  17866. public function getExtra()
  17867. {
  17868. return $this->extra;
  17869. }
  17870. public function setBinaries(array $binaries)
  17871. {
  17872. $this->binaries = $binaries;
  17873. }
  17874. public function getBinaries()
  17875. {
  17876. return $this->binaries;
  17877. }
  17878. public function setInstallationSource($type)
  17879. {
  17880. $this->installationSource = $type;
  17881. }
  17882. public function getInstallationSource()
  17883. {
  17884. return $this->installationSource;
  17885. }
  17886. public function setSourceType($type)
  17887. {
  17888. $this->sourceType = $type;
  17889. }
  17890. public function getSourceType()
  17891. {
  17892. return $this->sourceType;
  17893. }
  17894. public function setSourceUrl($url)
  17895. {
  17896. $this->sourceUrl = $url;
  17897. }
  17898. public function getSourceUrl()
  17899. {
  17900. return $this->sourceUrl;
  17901. }
  17902. public function setSourceReference($reference)
  17903. {
  17904. $this->sourceReference = $reference;
  17905. }
  17906. public function getSourceReference()
  17907. {
  17908. return $this->sourceReference;
  17909. }
  17910. public function setSourceMirrors($mirrors)
  17911. {
  17912. $this->sourceMirrors = $mirrors;
  17913. }
  17914. public function getSourceMirrors()
  17915. {
  17916. return $this->sourceMirrors;
  17917. }
  17918. public function getSourceUrls()
  17919. {
  17920. return $this->getUrls($this->sourceUrl, $this->sourceMirrors, $this->sourceReference, $this->sourceType, 'source');
  17921. }
  17922. public function setDistType($type)
  17923. {
  17924. $this->distType = $type;
  17925. }
  17926. public function getDistType()
  17927. {
  17928. return $this->distType;
  17929. }
  17930. public function setDistUrl($url)
  17931. {
  17932. $this->distUrl = $url;
  17933. }
  17934. public function getDistUrl()
  17935. {
  17936. return $this->distUrl;
  17937. }
  17938. public function setDistReference($reference)
  17939. {
  17940. $this->distReference = $reference;
  17941. }
  17942. public function getDistReference()
  17943. {
  17944. return $this->distReference;
  17945. }
  17946. public function setDistSha1Checksum($sha1checksum)
  17947. {
  17948. $this->distSha1Checksum = $sha1checksum;
  17949. }
  17950. public function getDistSha1Checksum()
  17951. {
  17952. return $this->distSha1Checksum;
  17953. }
  17954. public function setDistMirrors($mirrors)
  17955. {
  17956. $this->distMirrors = $mirrors;
  17957. }
  17958. public function getDistMirrors()
  17959. {
  17960. return $this->distMirrors;
  17961. }
  17962. public function getDistUrls()
  17963. {
  17964. return $this->getUrls($this->distUrl, $this->distMirrors, $this->distReference, $this->distType, 'dist');
  17965. }
  17966. public function getVersion()
  17967. {
  17968. return $this->version;
  17969. }
  17970. public function getPrettyVersion()
  17971. {
  17972. return $this->prettyVersion;
  17973. }
  17974. public function setReleaseDate(\DateTime $releaseDate)
  17975. {
  17976. $this->releaseDate = $releaseDate;
  17977. }
  17978. public function getReleaseDate()
  17979. {
  17980. return $this->releaseDate;
  17981. }
  17982. public function setRequires(array $requires)
  17983. {
  17984. $this->requires = $requires;
  17985. }
  17986. public function getRequires()
  17987. {
  17988. return $this->requires;
  17989. }
  17990. public function setConflicts(array $conflicts)
  17991. {
  17992. $this->conflicts = $conflicts;
  17993. }
  17994. public function getConflicts()
  17995. {
  17996. return $this->conflicts;
  17997. }
  17998. public function setProvides(array $provides)
  17999. {
  18000. $this->provides = $provides;
  18001. }
  18002. public function getProvides()
  18003. {
  18004. return $this->provides;
  18005. }
  18006. public function setReplaces(array $replaces)
  18007. {
  18008. $this->replaces = $replaces;
  18009. }
  18010. public function getReplaces()
  18011. {
  18012. return $this->replaces;
  18013. }
  18014. public function setDevRequires(array $devRequires)
  18015. {
  18016. $this->devRequires = $devRequires;
  18017. }
  18018. public function getDevRequires()
  18019. {
  18020. return $this->devRequires;
  18021. }
  18022. public function setSuggests(array $suggests)
  18023. {
  18024. $this->suggests = $suggests;
  18025. }
  18026. public function getSuggests()
  18027. {
  18028. return $this->suggests;
  18029. }
  18030. public function setAutoload(array $autoload)
  18031. {
  18032. $this->autoload = $autoload;
  18033. }
  18034. public function getAutoload()
  18035. {
  18036. return $this->autoload;
  18037. }
  18038. public function setDevAutoload(array $devAutoload)
  18039. {
  18040. $this->devAutoload = $devAutoload;
  18041. }
  18042. public function getDevAutoload()
  18043. {
  18044. return $this->devAutoload;
  18045. }
  18046. public function setIncludePaths(array $includePaths)
  18047. {
  18048. $this->includePaths = $includePaths;
  18049. }
  18050. public function getIncludePaths()
  18051. {
  18052. return $this->includePaths;
  18053. }
  18054. public function setNotificationUrl($notificationUrl)
  18055. {
  18056. $this->notificationUrl = $notificationUrl;
  18057. }
  18058. public function getNotificationUrl()
  18059. {
  18060. return $this->notificationUrl;
  18061. }
  18062. public function setArchiveExcludes(array $excludes)
  18063. {
  18064. $this->archiveExcludes = $excludes;
  18065. }
  18066. public function getArchiveExcludes()
  18067. {
  18068. return $this->archiveExcludes;
  18069. }
  18070. public function replaceVersion($version, $prettyVersion)
  18071. {
  18072. $this->version = $version;
  18073. $this->prettyVersion = $prettyVersion;
  18074. $this->stability = VersionParser::parseStability($version);
  18075. $this->dev = $this->stability === 'dev';
  18076. }
  18077. protected function getUrls($url, $mirrors, $ref, $type, $urlType)
  18078. {
  18079. if (!$url) {
  18080. return array();
  18081. }
  18082. $urls = array($url);
  18083. if ($mirrors) {
  18084. foreach ($mirrors as $mirror) {
  18085. if ($urlType === 'dist') {
  18086. $mirrorUrl = ComposerMirror::processUrl($mirror['url'], $this->name, $this->version, $ref, $type);
  18087. } elseif ($urlType === 'source' && $type === 'git') {
  18088. $mirrorUrl = ComposerMirror::processGitUrl($mirror['url'], $this->name, $url, $type);
  18089. } elseif ($urlType === 'source' && $type === 'hg') {
  18090. $mirrorUrl = ComposerMirror::processHgUrl($mirror['url'], $this->name, $url, $type);
  18091. }
  18092. if (!in_array($mirrorUrl, $urls)) {
  18093. $func = $mirror['preferred'] ? 'array_unshift' : 'array_push';
  18094. $func($urls, $mirrorUrl);
  18095. }
  18096. }
  18097. }
  18098. return $urls;
  18099. }
  18100. }
  18101. <?php
  18102. namespace Composer\Package;
  18103. use Composer\Repository\RepositoryInterface;
  18104. interface PackageInterface
  18105. {
  18106. public function getName();
  18107. public function getPrettyName();
  18108. public function getNames();
  18109. public function setId($id);
  18110. public function getId();
  18111. public function isDev();
  18112. public function getType();
  18113. public function getTargetDir();
  18114. public function getExtra();
  18115. public function setInstallationSource($type);
  18116. public function getInstallationSource();
  18117. public function getSourceType();
  18118. public function getSourceUrl();
  18119. public function getSourceUrls();
  18120. public function getSourceReference();
  18121. public function getSourceMirrors();
  18122. public function getDistType();
  18123. public function getDistUrl();
  18124. public function getDistUrls();
  18125. public function getDistReference();
  18126. public function getDistSha1Checksum();
  18127. public function getDistMirrors();
  18128. public function getVersion();
  18129. public function getPrettyVersion();
  18130. public function getFullPrettyVersion($truncate = true);
  18131. public function getReleaseDate();
  18132. public function getStability();
  18133. public function getRequires();
  18134. public function getConflicts();
  18135. public function getProvides();
  18136. public function getReplaces();
  18137. public function getDevRequires();
  18138. public function getSuggests();
  18139. public function getAutoload();
  18140. public function getDevAutoload();
  18141. public function getIncludePaths();
  18142. public function setRepository(RepositoryInterface $repository);
  18143. public function getRepository();
  18144. public function getBinaries();
  18145. public function getUniqueName();
  18146. public function getNotificationUrl();
  18147. public function __toString();
  18148. public function getPrettyString();
  18149. public function getArchiveExcludes();
  18150. public function getTransportOptions();
  18151. }
  18152. <?php
  18153. namespace Composer\Package;
  18154. class RootAliasPackage extends AliasPackage implements RootPackageInterface
  18155. {
  18156. public function __construct(RootPackageInterface $aliasOf, $version, $prettyVersion)
  18157. {
  18158. parent::__construct($aliasOf, $version, $prettyVersion);
  18159. }
  18160. public function getAliases()
  18161. {
  18162. return $this->aliasOf->getAliases();
  18163. }
  18164. public function getMinimumStability()
  18165. {
  18166. return $this->aliasOf->getMinimumStability();
  18167. }
  18168. public function getStabilityFlags()
  18169. {
  18170. return $this->aliasOf->getStabilityFlags();
  18171. }
  18172. public function getReferences()
  18173. {
  18174. return $this->aliasOf->getReferences();
  18175. }
  18176. public function getPreferStable()
  18177. {
  18178. return $this->aliasOf->getPreferStable();
  18179. }
  18180. public function getConfig()
  18181. {
  18182. return $this->aliasOf->getConfig();
  18183. }
  18184. public function setRequires(array $require)
  18185. {
  18186. $this->requires = $this->replaceSelfVersionDependencies($require, 'requires');
  18187. $this->aliasOf->setRequires($require);
  18188. }
  18189. public function setDevRequires(array $devRequire)
  18190. {
  18191. $this->devRequires = $this->replaceSelfVersionDependencies($devRequire, 'devRequires');
  18192. $this->aliasOf->setDevRequires($devRequire);
  18193. }
  18194. public function setConflicts(array $conflicts)
  18195. {
  18196. $this->conflicts = $this->replaceSelfVersionDependencies($conflicts, 'conflicts');
  18197. $this->aliasOf->setConflicts($conflicts);
  18198. }
  18199. public function setProvides(array $provides)
  18200. {
  18201. $this->provides = $this->replaceSelfVersionDependencies($provides, 'provides');
  18202. $this->aliasOf->setProvides($provides);
  18203. }
  18204. public function setReplaces(array $replaces)
  18205. {
  18206. $this->replaces = $this->replaceSelfVersionDependencies($replaces, 'replaces');
  18207. $this->aliasOf->setReplaces($replaces);
  18208. }
  18209. public function setRepositories($repositories)
  18210. {
  18211. $this->aliasOf->setRepositories($repositories);
  18212. }
  18213. public function setAutoload(array $autoload)
  18214. {
  18215. $this->aliasOf->setAutoload($autoload);
  18216. }
  18217. public function setDevAutoload(array $devAutoload)
  18218. {
  18219. $this->aliasOf->setDevAutoload($devAutoload);
  18220. }
  18221. public function setStabilityFlags(array $stabilityFlags)
  18222. {
  18223. $this->aliasOf->setStabilityFlags($stabilityFlags);
  18224. }
  18225. public function setSuggests(array $suggests)
  18226. {
  18227. $this->aliasOf->setSuggests($suggests);
  18228. }
  18229. public function setExtra(array $extra)
  18230. {
  18231. $this->aliasOf->setExtra($extra);
  18232. }
  18233. public function __clone()
  18234. {
  18235. parent::__clone();
  18236. $this->aliasOf = clone $this->aliasOf;
  18237. }
  18238. }
  18239. <?php
  18240. namespace Composer\Package;
  18241. class RootPackage extends CompletePackage implements RootPackageInterface
  18242. {
  18243. protected $minimumStability = 'stable';
  18244. protected $preferStable = false;
  18245. protected $stabilityFlags = array();
  18246. protected $config = array();
  18247. protected $references = array();
  18248. protected $aliases = array();
  18249. public function setMinimumStability($minimumStability)
  18250. {
  18251. $this->minimumStability = $minimumStability;
  18252. }
  18253. public function getMinimumStability()
  18254. {
  18255. return $this->minimumStability;
  18256. }
  18257. public function setStabilityFlags(array $stabilityFlags)
  18258. {
  18259. $this->stabilityFlags = $stabilityFlags;
  18260. }
  18261. public function getStabilityFlags()
  18262. {
  18263. return $this->stabilityFlags;
  18264. }
  18265. public function setPreferStable($preferStable)
  18266. {
  18267. $this->preferStable = $preferStable;
  18268. }
  18269. public function getPreferStable()
  18270. {
  18271. return $this->preferStable;
  18272. }
  18273. public function setConfig(array $config)
  18274. {
  18275. $this->config = $config;
  18276. }
  18277. public function getConfig()
  18278. {
  18279. return $this->config;
  18280. }
  18281. public function setReferences(array $references)
  18282. {
  18283. $this->references = $references;
  18284. }
  18285. public function getReferences()
  18286. {
  18287. return $this->references;
  18288. }
  18289. public function setAliases(array $aliases)
  18290. {
  18291. $this->aliases = $aliases;
  18292. }
  18293. public function getAliases()
  18294. {
  18295. return $this->aliases;
  18296. }
  18297. }
  18298. <?php
  18299. namespace Composer\Package;
  18300. interface RootPackageInterface extends CompletePackageInterface
  18301. {
  18302. public function getAliases();
  18303. public function getMinimumStability();
  18304. public function getStabilityFlags();
  18305. public function getReferences();
  18306. public function getPreferStable();
  18307. public function getConfig();
  18308. public function setRequires(array $requires);
  18309. public function setDevRequires(array $devRequires);
  18310. public function setConflicts(array $conflicts);
  18311. public function setProvides(array $provides);
  18312. public function setReplaces(array $replaces);
  18313. public function setRepositories($repositories);
  18314. public function setAutoload(array $autoload);
  18315. public function setDevAutoload(array $devAutoload);
  18316. public function setStabilityFlags(array $stabilityFlags);
  18317. public function setSuggests(array $suggests);
  18318. public function setExtra(array $extra);
  18319. }
  18320. <?php
  18321. namespace Composer\Package\Version;
  18322. use Composer\Config;
  18323. use Composer\Repository\Vcs\HgDriver;
  18324. use Composer\IO\NullIO;
  18325. use Composer\Semver\VersionParser as SemverVersionParser;
  18326. use Composer\Util\Git as GitUtil;
  18327. use Composer\Util\ProcessExecutor;
  18328. use Composer\Util\Svn as SvnUtil;
  18329. class VersionGuesser
  18330. {
  18331. private $config;
  18332. private $process;
  18333. private $versionParser;
  18334. public function __construct(Config $config, ProcessExecutor $process, SemverVersionParser $versionParser)
  18335. {
  18336. $this->config = $config;
  18337. $this->process = $process;
  18338. $this->versionParser = $versionParser;
  18339. }
  18340. public function guessVersion(array $packageConfig, $path)
  18341. {
  18342. if (function_exists('proc_open')) {
  18343. $versionData = $this->guessGitVersion($packageConfig, $path);
  18344. if (null !== $versionData && null !== $versionData['version']) {
  18345. return $this->postprocess($versionData);
  18346. }
  18347. $versionData = $this->guessHgVersion($packageConfig, $path);
  18348. if (null !== $versionData && null !== $versionData['version']) {
  18349. return $this->postprocess($versionData);
  18350. }
  18351. $versionData = $this->guessFossilVersion($packageConfig, $path);
  18352. if (null !== $versionData && null !== $versionData['version']) {
  18353. return $this->postprocess($versionData);
  18354. }
  18355. $versionData = $this->guessSvnVersion($packageConfig, $path);
  18356. if (null !== $versionData && null !== $versionData['version']) {
  18357. return $this->postprocess($versionData);
  18358. }
  18359. }
  18360. }
  18361. private function postprocess(array $versionData)
  18362. {
  18363. if ('-dev' === substr($versionData['version'], -4) && preg_match('{\.9{7}}', $versionData['version'])) {
  18364. $versionData['pretty_version'] = preg_replace('{(\.9{7})+}', '.x', $versionData['version']);
  18365. }
  18366. return $versionData;
  18367. }
  18368. private function guessGitVersion(array $packageConfig, $path)
  18369. {
  18370. GitUtil::cleanEnv();
  18371. $commit = null;
  18372. $version = null;
  18373. $prettyVersion = null;
  18374. $isDetached = false;
  18375. if (0 === $this->process->execute('git branch --no-color --no-abbrev -v', $output, $path)) {
  18376. $branches = array();
  18377. $isFeatureBranch = false;
  18378. foreach ($this->process->splitLines($output) as $branch) {
  18379. if ($branch && preg_match('{^(?:\* ) *(\(no branch\)|\(detached from \S+\)|\(HEAD detached at \S+\)|\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  18380. if ($match[1] === '(no branch)' || substr($match[1], 0, 10) === '(detached ' || substr($match[1], 0, 17) === '(HEAD detached at') {
  18381. $version = 'dev-' . $match[2];
  18382. $prettyVersion = $version;
  18383. $isFeatureBranch = true;
  18384. $isDetached = true;
  18385. } else {
  18386. $version = $this->versionParser->normalizeBranch($match[1]);
  18387. $prettyVersion = 'dev-' . $match[1];
  18388. $isFeatureBranch = 0 === strpos($version, 'dev-');
  18389. }
  18390. if ($match[2]) {
  18391. $commit = $match[2];
  18392. }
  18393. }
  18394. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  18395. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  18396. $branches[] = $match[1];
  18397. }
  18398. }
  18399. }
  18400. if ($isFeatureBranch) {
  18401. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'git rev-list %candidate%..%branch%', $path);
  18402. $version = $result['version'];
  18403. $prettyVersion = $result['pretty_version'];
  18404. }
  18405. }
  18406. if (!$version || $isDetached) {
  18407. $result = $this->versionFromGitTags($path);
  18408. if ($result) {
  18409. $version = $result['version'];
  18410. $prettyVersion = $result['pretty_version'];
  18411. }
  18412. }
  18413. if (!$commit) {
  18414. $command = 'git log --pretty="%H" -n1 HEAD';
  18415. if (0 === $this->process->execute($command, $output, $path)) {
  18416. $commit = trim($output) ?: null;
  18417. }
  18418. }
  18419. return array('version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion);
  18420. }
  18421. private function versionFromGitTags($path)
  18422. {
  18423. if (0 === $this->process->execute('git describe --exact-match --tags', $output, $path)) {
  18424. try {
  18425. $version = $this->versionParser->normalize(trim($output));
  18426. return array('version' => $version, 'pretty_version' => trim($output));
  18427. } catch (\Exception $e) {
  18428. }
  18429. }
  18430. return null;
  18431. }
  18432. private function guessHgVersion(array $packageConfig, $path)
  18433. {
  18434. if (0 === $this->process->execute('hg branch', $output, $path)) {
  18435. $branch = trim($output);
  18436. $version = $this->versionParser->normalizeBranch($branch);
  18437. $isFeatureBranch = 0 === strpos($version, 'dev-');
  18438. if ('9999999-dev' === $version) {
  18439. return array('version' => $version, 'commit' => null, 'pretty_version' => 'dev-'.$branch);
  18440. }
  18441. if (!$isFeatureBranch) {
  18442. return array('version' => $version, 'commit' => null, 'pretty_version' => $version);
  18443. }
  18444. $driver = new HgDriver(array('url' => $path), new NullIO(), $this->config, $this->process);
  18445. $branches = array_keys($driver->getBranches());
  18446. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'hg log -r "not ancestors(\'%candidate%\') and ancestors(\'%branch%\')" --template "{node}\\n"', $path);
  18447. $result['commit'] = '';
  18448. return $result;
  18449. }
  18450. }
  18451. private function guessFeatureVersion(array $packageConfig, $version, array $branches, $scmCmdline, $path)
  18452. {
  18453. $prettyVersion = $version;
  18454. if ((isset($packageConfig['extra']['branch-alias']) && !isset($packageConfig['extra']['branch-alias'][$version]))
  18455. || strpos(json_encode($packageConfig), '"self.version"')
  18456. ) {
  18457. $branch = preg_replace('{^dev-}', '', $version);
  18458. $length = PHP_INT_MAX;
  18459. $nonFeatureBranches = '';
  18460. if (!empty($packageConfig['non-feature-branches'])) {
  18461. $nonFeatureBranches = implode('|', $packageConfig['non-feature-branches']);
  18462. }
  18463. foreach ($branches as $candidate) {
  18464. if ($candidate === $branch && preg_match('{^(' . $nonFeatureBranches . ')$}', $candidate)) {
  18465. break;
  18466. }
  18467. if ($candidate === $branch || !preg_match('{^(' . $nonFeatureBranches . '|master|trunk|default|develop|\d+\..+)$}', $candidate, $match)) {
  18468. continue;
  18469. }
  18470. $cmdLine = str_replace(array('%candidate%', '%branch%'), array($candidate, $branch), $scmCmdline);
  18471. if (0 !== $this->process->execute($cmdLine, $output, $path)) {
  18472. continue;
  18473. }
  18474. if (strlen($output) < $length) {
  18475. $length = strlen($output);
  18476. $version = $this->versionParser->normalizeBranch($candidate);
  18477. $prettyVersion = 'dev-' . $match[1];
  18478. }
  18479. }
  18480. }
  18481. return array('version' => $version, 'pretty_version' => $prettyVersion);
  18482. }
  18483. private function guessFossilVersion(array $packageConfig, $path)
  18484. {
  18485. $version = null;
  18486. $prettyVersion = null;
  18487. if (0 === $this->process->execute('fossil branch list', $output, $path)) {
  18488. $branch = trim($output);
  18489. $version = $this->versionParser->normalizeBranch($branch);
  18490. $prettyVersion = 'dev-' . $branch;
  18491. }
  18492. if (0 === $this->process->execute('fossil tag list', $output, $path)) {
  18493. try {
  18494. $version = $this->versionParser->normalize(trim($output));
  18495. $prettyVersion = trim($output);
  18496. } catch (\Exception $e) {
  18497. }
  18498. }
  18499. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  18500. }
  18501. private function guessSvnVersion(array $packageConfig, $path)
  18502. {
  18503. SvnUtil::cleanEnv();
  18504. if (0 === $this->process->execute('svn info --xml', $output, $path)) {
  18505. $trunkPath = isset($packageConfig['trunk-path']) ? preg_quote($packageConfig['trunk-path'], '#') : 'trunk';
  18506. $branchesPath = isset($packageConfig['branches-path']) ? preg_quote($packageConfig['branches-path'], '#') : 'branches';
  18507. $tagsPath = isset($packageConfig['tags-path']) ? preg_quote($packageConfig['tags-path'], '#') : 'tags';
  18508. $urlPattern = '#<url>.*/(' . $trunkPath . '|(' . $branchesPath . '|' . $tagsPath . ')/(.*))</url>#';
  18509. if (preg_match($urlPattern, $output, $matches)) {
  18510. if (isset($matches[2]) && ($branchesPath === $matches[2] || $tagsPath === $matches[2])) {
  18511. $version = $this->versionParser->normalizeBranch($matches[3]);
  18512. $prettyVersion = 'dev-' . $matches[3];
  18513. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  18514. }
  18515. $prettyVersion = trim($matches[1]);
  18516. $version = $this->versionParser->normalize($prettyVersion);
  18517. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  18518. }
  18519. }
  18520. }
  18521. }
  18522. <?php
  18523. namespace Composer\Package\Version;
  18524. use Composer\Repository\PlatformRepository;
  18525. use Composer\Semver\VersionParser as SemverVersionParser;
  18526. class VersionParser extends SemverVersionParser
  18527. {
  18528. private static $constraints = array();
  18529. public function parseConstraints($constraints)
  18530. {
  18531. if (!isset(self::$constraints[$constraints])) {
  18532. self::$constraints[$constraints] = parent::parseConstraints($constraints);
  18533. }
  18534. return self::$constraints[$constraints];
  18535. }
  18536. public function parseNameVersionPairs(array $pairs)
  18537. {
  18538. $pairs = array_values($pairs);
  18539. $result = array();
  18540. for ($i = 0, $count = count($pairs); $i < $count; $i++) {
  18541. $pair = preg_replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i]));
  18542. if (false === strpos($pair, ' ') && isset($pairs[$i + 1]) && false === strpos($pairs[$i + 1], '/') && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $pairs[$i + 1])) {
  18543. $pair .= ' '.$pairs[$i + 1];
  18544. $i++;
  18545. }
  18546. if (strpos($pair, ' ')) {
  18547. list($name, $version) = explode(' ', $pair, 2);
  18548. $result[] = array('name' => $name, 'version' => $version);
  18549. } else {
  18550. $result[] = array('name' => $pair);
  18551. }
  18552. }
  18553. return $result;
  18554. }
  18555. }
  18556. <?php
  18557. namespace Composer\Package\Version;
  18558. use Composer\DependencyResolver\Pool;
  18559. use Composer\Package\BasePackage;
  18560. use Composer\Package\PackageInterface;
  18561. use Composer\Package\Loader\ArrayLoader;
  18562. use Composer\Package\Dumper\ArrayDumper;
  18563. use Composer\Semver\Constraint\Constraint;
  18564. class VersionSelector
  18565. {
  18566. private $pool;
  18567. private $parser;
  18568. public function __construct(Pool $pool)
  18569. {
  18570. $this->pool = $pool;
  18571. }
  18572. public function findBestCandidate($packageName, $targetPackageVersion = null, $targetPhpVersion = null, $preferredStability = 'stable')
  18573. {
  18574. $constraint = $targetPackageVersion ? $this->getParser()->parseConstraints($targetPackageVersion) : null;
  18575. $candidates = $this->pool->whatProvides(strtolower($packageName), $constraint, true);
  18576. if ($targetPhpVersion) {
  18577. $phpConstraint = new Constraint('==', $this->getParser()->normalize($targetPhpVersion));
  18578. $candidates = array_filter($candidates, function ($pkg) use ($phpConstraint) {
  18579. $reqs = $pkg->getRequires();
  18580. return !isset($reqs['php']) || $reqs['php']->getConstraint()->matches($phpConstraint);
  18581. });
  18582. }
  18583. if (!$candidates) {
  18584. return false;
  18585. }
  18586. $package = reset($candidates);
  18587. $minPriority = BasePackage::$stabilities[$preferredStability];
  18588. foreach ($candidates as $candidate) {
  18589. $candidatePriority = $candidate->getStabilityPriority();
  18590. $currentPriority = $package->getStabilityPriority();
  18591. if ($minPriority < $candidatePriority && $currentPriority < $candidatePriority) {
  18592. continue;
  18593. }
  18594. if ($minPriority < $candidatePriority && $candidatePriority < $currentPriority) {
  18595. $package = $candidate;
  18596. continue;
  18597. }
  18598. if ($minPriority >= $candidatePriority && $minPriority < $currentPriority) {
  18599. $package = $candidate;
  18600. continue;
  18601. }
  18602. if (version_compare($package->getVersion(), $candidate->getVersion(), '<')) {
  18603. $package = $candidate;
  18604. }
  18605. }
  18606. return $package;
  18607. }
  18608. public function findRecommendedRequireVersion(PackageInterface $package)
  18609. {
  18610. $version = $package->getVersion();
  18611. if (!$package->isDev()) {
  18612. return $this->transformVersion($version, $package->getPrettyVersion(), $package->getStability());
  18613. }
  18614. $loader = new ArrayLoader($this->getParser());
  18615. $dumper = new ArrayDumper();
  18616. $extra = $loader->getBranchAlias($dumper->dump($package));
  18617. if ($extra) {
  18618. $extra = preg_replace('{^(\d+\.\d+\.\d+)(\.9999999)-dev$}', '$1.0', $extra, -1, $count);
  18619. if ($count) {
  18620. $extra = str_replace('.9999999', '.0', $extra);
  18621. return $this->transformVersion($extra, $extra, 'dev');
  18622. }
  18623. }
  18624. return $package->getPrettyVersion();
  18625. }
  18626. private function transformVersion($version, $prettyVersion, $stability)
  18627. {
  18628. $semanticVersionParts = explode('.', $version);
  18629. if (count($semanticVersionParts) == 4 && preg_match('{^0\D?}', $semanticVersionParts[3])) {
  18630. if ($semanticVersionParts[0] === '0') {
  18631. unset($semanticVersionParts[3]);
  18632. } else {
  18633. unset($semanticVersionParts[2], $semanticVersionParts[3]);
  18634. }
  18635. $version = implode('.', $semanticVersionParts);
  18636. } else {
  18637. return $prettyVersion;
  18638. }
  18639. if ($stability != 'stable') {
  18640. $version .= '@'.$stability;
  18641. }
  18642. return '^' . $version;
  18643. }
  18644. private function getParser()
  18645. {
  18646. if ($this->parser === null) {
  18647. $this->parser = new VersionParser();
  18648. }
  18649. return $this->parser;
  18650. }
  18651. }
  18652. <?php
  18653. namespace Composer\Plugin\Capability;
  18654. interface Capability
  18655. {
  18656. }
  18657. <?php
  18658. namespace Composer\Plugin\Capability;
  18659. interface CommandProvider extends Capability
  18660. {
  18661. public function getCommands();
  18662. }
  18663. <?php
  18664. namespace Composer\Plugin;
  18665. interface Capable
  18666. {
  18667. public function getCapabilities();
  18668. }
  18669. <?php
  18670. namespace Composer\Plugin;
  18671. use Composer\EventDispatcher\Event;
  18672. use Symfony\Component\Console\Input\InputInterface;
  18673. use Symfony\Component\Console\Output\OutputInterface;
  18674. class CommandEvent extends Event
  18675. {
  18676. private $commandName;
  18677. private $input;
  18678. private $output;
  18679. public function __construct($name, $commandName, $input, $output, array $args = array(), array $flags = array())
  18680. {
  18681. parent::__construct($name, $args, $flags);
  18682. $this->commandName = $commandName;
  18683. $this->input = $input;
  18684. $this->output = $output;
  18685. }
  18686. public function getInput()
  18687. {
  18688. return $this->input;
  18689. }
  18690. public function getOutput()
  18691. {
  18692. return $this->output;
  18693. }
  18694. public function getCommandName()
  18695. {
  18696. return $this->commandName;
  18697. }
  18698. }
  18699. <?php
  18700. namespace Composer\Plugin;
  18701. class PluginEvents
  18702. {
  18703. const INIT = 'init';
  18704. const COMMAND = 'command';
  18705. const PRE_FILE_DOWNLOAD = 'pre-file-download';
  18706. }
  18707. <?php
  18708. namespace Composer\Plugin;
  18709. use Composer\Composer;
  18710. use Composer\IO\IOInterface;
  18711. interface PluginInterface
  18712. {
  18713. const PLUGIN_API_VERSION = '1.1.0';
  18714. public function activate(Composer $composer, IOInterface $io);
  18715. }
  18716. <?php
  18717. namespace Composer\Plugin;
  18718. use Composer\Composer;
  18719. use Composer\EventDispatcher\EventSubscriberInterface;
  18720. use Composer\IO\IOInterface;
  18721. use Composer\Package\Package;
  18722. use Composer\Package\Version\VersionParser;
  18723. use Composer\Repository\RepositoryInterface;
  18724. use Composer\Package\AliasPackage;
  18725. use Composer\Package\PackageInterface;
  18726. use Composer\Package\Link;
  18727. use Composer\Semver\Constraint\Constraint;
  18728. use Composer\DependencyResolver\Pool;
  18729. use Composer\Plugin\Capability\Capability;
  18730. class PluginManager
  18731. {
  18732. protected $composer;
  18733. protected $io;
  18734. protected $globalComposer;
  18735. protected $versionParser;
  18736. protected $disablePlugins = false;
  18737. protected $plugins = array();
  18738. protected $registeredPlugins = array();
  18739. private static $classCounter = 0;
  18740. public function __construct(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  18741. {
  18742. $this->io = $io;
  18743. $this->composer = $composer;
  18744. $this->globalComposer = $globalComposer;
  18745. $this->versionParser = new VersionParser();
  18746. $this->disablePlugins = $disablePlugins;
  18747. }
  18748. public function loadInstalledPlugins()
  18749. {
  18750. if ($this->disablePlugins) {
  18751. return;
  18752. }
  18753. $repo = $this->composer->getRepositoryManager()->getLocalRepository();
  18754. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  18755. if ($repo) {
  18756. $this->loadRepository($repo);
  18757. }
  18758. if ($globalRepo) {
  18759. $this->loadRepository($globalRepo);
  18760. }
  18761. }
  18762. public function getPlugins()
  18763. {
  18764. return $this->plugins;
  18765. }
  18766. public function getGlobalComposer()
  18767. {
  18768. return $this->globalComposer;
  18769. }
  18770. public function registerPackage(PackageInterface $package, $failOnMissingClasses = false)
  18771. {
  18772. if ($this->disablePlugins) {
  18773. return;
  18774. }
  18775. if ($package->getType() === 'composer-plugin') {
  18776. $requiresComposer = null;
  18777. foreach ($package->getRequires() as $link) {
  18778. if ('composer-plugin-api' === $link->getTarget()) {
  18779. $requiresComposer = $link->getConstraint();
  18780. break;
  18781. }
  18782. }
  18783. if (!$requiresComposer) {
  18784. throw new \RuntimeException("Plugin ".$package->getName()." is missing a require statement for a version of the composer-plugin-api package.");
  18785. }
  18786. $currentPluginApiVersion = $this->getPluginApiVersion();
  18787. $currentPluginApiConstraint = new Constraint('==', $this->versionParser->normalize($currentPluginApiVersion));
  18788. if ($requiresComposer->getPrettyString() === '1.0.0' && $this->getPluginApiVersion() === '1.0.0') {
  18789. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin requires composer-plugin-api 1.0.0, this *WILL* break in the future and it should be fixed ASAP (require ^1.0 for example).</warning>');
  18790. } elseif (!$requiresComposer->matches($currentPluginApiConstraint)) {
  18791. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin was skipped because it requires a Plugin API version ("' . $requiresComposer->getPrettyString() . '") that does not match your Composer installation ("' . $currentPluginApiVersion . '"). You may need to run composer update with the "--no-plugins" option.</warning>');
  18792. return;
  18793. }
  18794. }
  18795. $oldInstallerPlugin = ($package->getType() === 'composer-installer');
  18796. if (in_array($package->getName(), $this->registeredPlugins)) {
  18797. return;
  18798. }
  18799. $extra = $package->getExtra();
  18800. if (empty($extra['class'])) {
  18801. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  18802. }
  18803. $classes = is_array($extra['class']) ? $extra['class'] : array($extra['class']);
  18804. $localRepo = $this->composer->getRepositoryManager()->getLocalRepository();
  18805. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  18806. $pool = new Pool('dev');
  18807. $pool->addRepository($localRepo);
  18808. if ($globalRepo) {
  18809. $pool->addRepository($globalRepo);
  18810. }
  18811. $autoloadPackages = array($package->getName() => $package);
  18812. $autoloadPackages = $this->collectDependencies($pool, $autoloadPackages, $package);
  18813. $generator = $this->composer->getAutoloadGenerator();
  18814. $autoloads = array();
  18815. foreach ($autoloadPackages as $autoloadPackage) {
  18816. $downloadPath = $this->getInstallPath($autoloadPackage, ($globalRepo && $globalRepo->hasPackage($autoloadPackage)));
  18817. $autoloads[] = array($autoloadPackage, $downloadPath);
  18818. }
  18819. $map = $generator->parseAutoloads($autoloads, new Package('dummy', '1.0.0.0', '1.0.0'));
  18820. $classLoader = $generator->createLoader($map);
  18821. $classLoader->register();
  18822. foreach ($classes as $class) {
  18823. if (class_exists($class, false)) {
  18824. $class = trim($class, '\\');
  18825. $path = $classLoader->findFile($class);
  18826. $code = file_get_contents($path);
  18827. $separatorPos = strrpos($class, '\\');
  18828. $className = $class;
  18829. if ($separatorPos) {
  18830. $className = substr($class, $separatorPos + 1);
  18831. }
  18832. $code = preg_replace('{^((?:final\s+)?(?:\s*))class\s+('.preg_quote($className).')}mi', '$1class $2_composer_tmp'.self::$classCounter, $code, 1);
  18833. $code = str_replace('__FILE__', var_export($path, true), $code);
  18834. $code = str_replace('__DIR__', var_export(dirname($path), true), $code);
  18835. $code = str_replace('__CLASS__', var_export($class, true), $code);
  18836. $code = preg_replace('/^\s*<\?(php)?/i', '', $code, 1);
  18837. eval($code);
  18838. $class .= '_composer_tmp'.self::$classCounter;
  18839. self::$classCounter++;
  18840. }
  18841. if ($oldInstallerPlugin) {
  18842. $installer = new $class($this->io, $this->composer);
  18843. $this->composer->getInstallationManager()->addInstaller($installer);
  18844. } elseif (class_exists($class)) {
  18845. $plugin = new $class();
  18846. $this->addPlugin($plugin);
  18847. $this->registeredPlugins[] = $package->getName();
  18848. } elseif ($failOnMissingClasses) {
  18849. throw new \UnexpectedValueException('Plugin '.$package->getName().' could not be initialized, class not found: '.$class);
  18850. }
  18851. }
  18852. }
  18853. protected function getPluginApiVersion()
  18854. {
  18855. return PluginInterface::PLUGIN_API_VERSION;
  18856. }
  18857. public function addPlugin(PluginInterface $plugin)
  18858. {
  18859. $this->io->writeError('Loading plugin '.get_class($plugin), true, IOInterface::DEBUG);
  18860. $this->plugins[] = $plugin;
  18861. $plugin->activate($this->composer, $this->io);
  18862. if ($plugin instanceof EventSubscriberInterface) {
  18863. $this->composer->getEventDispatcher()->addSubscriber($plugin);
  18864. }
  18865. }
  18866. private function loadRepository(RepositoryInterface $repo)
  18867. {
  18868. foreach ($repo->getPackages() as $package) {
  18869. if ($package instanceof AliasPackage) {
  18870. continue;
  18871. }
  18872. if ('composer-plugin' === $package->getType()) {
  18873. $this->registerPackage($package);
  18874. } elseif ('composer-installer' === $package->getType()) {
  18875. $this->registerPackage($package);
  18876. }
  18877. }
  18878. }
  18879. private function collectDependencies(Pool $pool, array $collected, PackageInterface $package)
  18880. {
  18881. $requires = array_merge(
  18882. $package->getRequires(),
  18883. $package->getDevRequires()
  18884. );
  18885. foreach ($requires as $requireLink) {
  18886. $requiredPackage = $this->lookupInstalledPackage($pool, $requireLink);
  18887. if ($requiredPackage && !isset($collected[$requiredPackage->getName()])) {
  18888. $collected[$requiredPackage->getName()] = $requiredPackage;
  18889. $collected = $this->collectDependencies($pool, $collected, $requiredPackage);
  18890. }
  18891. }
  18892. return $collected;
  18893. }
  18894. private function lookupInstalledPackage(Pool $pool, Link $link)
  18895. {
  18896. $packages = $pool->whatProvides($link->getTarget(), $link->getConstraint());
  18897. return (!empty($packages)) ? $packages[0] : null;
  18898. }
  18899. private function getInstallPath(PackageInterface $package, $global = false)
  18900. {
  18901. if (!$global) {
  18902. return $this->composer->getInstallationManager()->getInstallPath($package);
  18903. }
  18904. return $this->globalComposer->getInstallationManager()->getInstallPath($package);
  18905. }
  18906. protected function getCapabilityImplementationClassName(PluginInterface $plugin, $capability)
  18907. {
  18908. if (!($plugin instanceof Capable)) {
  18909. return null;
  18910. }
  18911. $capabilities = (array) $plugin->getCapabilities();
  18912. if (!empty($capabilities[$capability]) && is_string($capabilities[$capability]) && trim($capabilities[$capability])) {
  18913. return trim($capabilities[$capability]);
  18914. }
  18915. if (
  18916. array_key_exists($capability, $capabilities)
  18917. && (empty($capabilities[$capability]) || !is_string($capabilities[$capability]) || !trim($capabilities[$capability]))
  18918. ) {
  18919. throw new \UnexpectedValueException('Plugin '.get_class($plugin).' provided invalid capability class name(s), got '.var_export($capabilities[$capability], 1));
  18920. }
  18921. }
  18922. public function getPluginCapability(PluginInterface $plugin, $capabilityClassName, array $ctorArgs = array())
  18923. {
  18924. if ($capabilityClass = $this->getCapabilityImplementationClassName($plugin, $capabilityClassName)) {
  18925. if (!class_exists($capabilityClass)) {
  18926. throw new \RuntimeException("Cannot instantiate Capability, as class $capabilityClass from plugin ".get_class($plugin)." does not exist.");
  18927. }
  18928. $ctorArgs['plugin'] = $plugin;
  18929. $capabilityObj = new $capabilityClass($ctorArgs);
  18930. if (!$capabilityObj instanceof Capability || !$capabilityObj instanceof $capabilityClassName) {
  18931. throw new \RuntimeException(
  18932. 'Class ' . $capabilityClass . ' must implement both Composer\Plugin\Capability\Capability and '. $capabilityClassName . '.'
  18933. );
  18934. }
  18935. return $capabilityObj;
  18936. }
  18937. }
  18938. public function getPluginCapabilities($capabilityClassName, array $ctorArgs = array())
  18939. {
  18940. $capabilities = array();
  18941. foreach ($this->getPlugins() as $plugin) {
  18942. if ($capability = $this->getPluginCapability($plugin, $capabilityClassName, $ctorArgs)) {
  18943. $capabilities[] = $capability;
  18944. }
  18945. }
  18946. return $capabilities;
  18947. }
  18948. }
  18949. <?php
  18950. namespace Composer\Plugin;
  18951. use Composer\EventDispatcher\Event;
  18952. use Composer\Util\RemoteFilesystem;
  18953. class PreFileDownloadEvent extends Event
  18954. {
  18955. private $rfs;
  18956. private $processedUrl;
  18957. public function __construct($name, RemoteFilesystem $rfs, $processedUrl)
  18958. {
  18959. parent::__construct($name);
  18960. $this->rfs = $rfs;
  18961. $this->processedUrl = $processedUrl;
  18962. }
  18963. public function getRemoteFilesystem()
  18964. {
  18965. return $this->rfs;
  18966. }
  18967. public function setRemoteFilesystem(RemoteFilesystem $rfs)
  18968. {
  18969. $this->rfs = $rfs;
  18970. }
  18971. public function getProcessedUrl()
  18972. {
  18973. return $this->processedUrl;
  18974. }
  18975. }
  18976. <?php
  18977. namespace Composer\Question;
  18978. use Symfony\Component\Console\Exception\InvalidArgumentException;
  18979. use Symfony\Component\Console\Question\Question;
  18980. class StrictConfirmationQuestion extends Question
  18981. {
  18982. private $trueAnswerRegex;
  18983. private $falseAnswerRegex;
  18984. public function __construct($question, $default = true, $trueAnswerRegex = '/^y(?:es)?$/i', $falseAnswerRegex = '/^no?$/i')
  18985. {
  18986. parent::__construct($question, (bool) $default);
  18987. $this->trueAnswerRegex = $trueAnswerRegex;
  18988. $this->falseAnswerRegex = $falseAnswerRegex;
  18989. $this->setNormalizer($this->getDefaultNormalizer());
  18990. $this->setValidator($this->getDefaultValidator());
  18991. }
  18992. private function getDefaultNormalizer()
  18993. {
  18994. $default = $this->getDefault();
  18995. $trueRegex = $this->trueAnswerRegex;
  18996. $falseRegex = $this->falseAnswerRegex;
  18997. return function ($answer) use ($default, $trueRegex, $falseRegex) {
  18998. if (is_bool($answer)) {
  18999. return $answer;
  19000. }
  19001. if (empty($answer) && !empty($default)) {
  19002. return $default;
  19003. }
  19004. if (preg_match($trueRegex, $answer)) {
  19005. return true;
  19006. }
  19007. if (preg_match($falseRegex, $answer)) {
  19008. return false;
  19009. }
  19010. return null;
  19011. };
  19012. }
  19013. private function getDefaultValidator()
  19014. {
  19015. return function ($answer) {
  19016. if (!is_bool($answer)) {
  19017. throw new InvalidArgumentException('Please answer yes, y, no, or n.');
  19018. }
  19019. return $answer;
  19020. };
  19021. }
  19022. }
  19023. <?php
  19024. namespace Composer\Repository;
  19025. use Composer\Package\AliasPackage;
  19026. use Composer\Package\PackageInterface;
  19027. use Composer\Package\CompletePackageInterface;
  19028. use Composer\Package\Version\VersionParser;
  19029. use Composer\Semver\Constraint\ConstraintInterface;
  19030. use Composer\Semver\Constraint\Constraint;
  19031. class ArrayRepository extends BaseRepository
  19032. {
  19033. protected $packages;
  19034. public function __construct(array $packages = array())
  19035. {
  19036. foreach ($packages as $package) {
  19037. $this->addPackage($package);
  19038. }
  19039. }
  19040. public function findPackage($name, $constraint)
  19041. {
  19042. $name = strtolower($name);
  19043. if (!$constraint instanceof ConstraintInterface) {
  19044. $versionParser = new VersionParser();
  19045. $constraint = $versionParser->parseConstraints($constraint);
  19046. }
  19047. foreach ($this->getPackages() as $package) {
  19048. if ($name === $package->getName()) {
  19049. $pkgConstraint = new Constraint('==', $package->getVersion());
  19050. if ($constraint->matches($pkgConstraint)) {
  19051. return $package;
  19052. }
  19053. }
  19054. }
  19055. return null;
  19056. }
  19057. public function findPackages($name, $constraint = null)
  19058. {
  19059. $name = strtolower($name);
  19060. $packages = array();
  19061. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  19062. $versionParser = new VersionParser();
  19063. $constraint = $versionParser->parseConstraints($constraint);
  19064. }
  19065. foreach ($this->getPackages() as $package) {
  19066. if ($name === $package->getName()) {
  19067. $pkgConstraint = new Constraint('==', $package->getVersion());
  19068. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  19069. $packages[] = $package;
  19070. }
  19071. }
  19072. }
  19073. return $packages;
  19074. }
  19075. public function search($query, $mode = 0, $type = null)
  19076. {
  19077. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  19078. $matches = array();
  19079. foreach ($this->getPackages() as $package) {
  19080. $name = $package->getName();
  19081. if (isset($matches[$name])) {
  19082. continue;
  19083. }
  19084. if (preg_match($regex, $name)
  19085. || ($mode === self::SEARCH_FULLTEXT && $package instanceof CompletePackageInterface && preg_match($regex, implode(' ', (array) $package->getKeywords()) . ' ' . $package->getDescription()))
  19086. ) {
  19087. if (null !== $type && $package->getType() !== $type) {
  19088. continue;
  19089. }
  19090. $matches[$name] = array(
  19091. 'name' => $package->getPrettyName(),
  19092. 'description' => $package instanceof CompletePackageInterface ? $package->getDescription() : null,
  19093. );
  19094. }
  19095. }
  19096. return array_values($matches);
  19097. }
  19098. public function hasPackage(PackageInterface $package)
  19099. {
  19100. $packageId = $package->getUniqueName();
  19101. foreach ($this->getPackages() as $repoPackage) {
  19102. if ($packageId === $repoPackage->getUniqueName()) {
  19103. return true;
  19104. }
  19105. }
  19106. return false;
  19107. }
  19108. public function addPackage(PackageInterface $package)
  19109. {
  19110. if (null === $this->packages) {
  19111. $this->initialize();
  19112. }
  19113. $package->setRepository($this);
  19114. $this->packages[] = $package;
  19115. if ($package instanceof AliasPackage) {
  19116. $aliasedPackage = $package->getAliasOf();
  19117. if (null === $aliasedPackage->getRepository()) {
  19118. $this->addPackage($aliasedPackage);
  19119. }
  19120. }
  19121. }
  19122. protected function createAliasPackage(PackageInterface $package, $alias, $prettyAlias)
  19123. {
  19124. return new AliasPackage($package instanceof AliasPackage ? $package->getAliasOf() : $package, $alias, $prettyAlias);
  19125. }
  19126. public function removePackage(PackageInterface $package)
  19127. {
  19128. $packageId = $package->getUniqueName();
  19129. foreach ($this->getPackages() as $key => $repoPackage) {
  19130. if ($packageId === $repoPackage->getUniqueName()) {
  19131. array_splice($this->packages, $key, 1);
  19132. return;
  19133. }
  19134. }
  19135. }
  19136. public function getPackages()
  19137. {
  19138. if (null === $this->packages) {
  19139. $this->initialize();
  19140. }
  19141. return $this->packages;
  19142. }
  19143. public function count()
  19144. {
  19145. return count($this->packages);
  19146. }
  19147. protected function initialize()
  19148. {
  19149. $this->packages = array();
  19150. }
  19151. }
  19152. <?php
  19153. namespace Composer\Repository;
  19154. use Composer\IO\IOInterface;
  19155. use Composer\Json\JsonFile;
  19156. use Composer\Package\Loader\ArrayLoader;
  19157. use Composer\Package\Loader\LoaderInterface;
  19158. class ArtifactRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  19159. {
  19160. protected $loader;
  19161. protected $lookup;
  19162. protected $repoConfig;
  19163. private $io;
  19164. public function __construct(array $repoConfig, IOInterface $io)
  19165. {
  19166. parent::__construct();
  19167. if (!extension_loaded('zip')) {
  19168. throw new \RuntimeException('The artifact repository requires PHP\'s zip extension');
  19169. }
  19170. $this->loader = new ArrayLoader();
  19171. $this->lookup = $repoConfig['url'];
  19172. $this->io = $io;
  19173. $this->repoConfig = $repoConfig;
  19174. }
  19175. public function getRepoConfig()
  19176. {
  19177. return $this->repoConfig;
  19178. }
  19179. protected function initialize()
  19180. {
  19181. parent::initialize();
  19182. $this->scanDirectory($this->lookup);
  19183. }
  19184. private function scanDirectory($path)
  19185. {
  19186. $io = $this->io;
  19187. $directory = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
  19188. $iterator = new \RecursiveIteratorIterator($directory);
  19189. $regex = new \RegexIterator($iterator, '/^.+\.(zip|phar)$/i');
  19190. foreach ($regex as $file) {
  19191. if (!$file->isFile()) {
  19192. continue;
  19193. }
  19194. $package = $this->getComposerInformation($file);
  19195. if (!$package) {
  19196. $io->writeError("File <comment>{$file->getBasename()}</comment> doesn't seem to hold a package", true, IOInterface::VERBOSE);
  19197. continue;
  19198. }
  19199. $template = 'Found package <info>%s</info> (<comment>%s</comment>) in file <info>%s</info>';
  19200. $io->writeError(sprintf($template, $package->getName(), $package->getPrettyVersion(), $file->getBasename()), true, IOInterface::VERBOSE);
  19201. $this->addPackage($package);
  19202. }
  19203. }
  19204. private function locateFile(\ZipArchive $zip, $filename)
  19205. {
  19206. $indexOfShortestMatch = false;
  19207. $lengthOfShortestMatch = -1;
  19208. for ($i = 0; $i < $zip->numFiles; $i++) {
  19209. $stat = $zip->statIndex($i);
  19210. if (strcmp(basename($stat['name']), $filename) === 0) {
  19211. $directoryName = dirname($stat['name']);
  19212. if ($directoryName == '.') {
  19213. return $i;
  19214. }
  19215. if (strpos($directoryName, '\\') !== false ||
  19216. strpos($directoryName, '/') !== false) {
  19217. continue;
  19218. }
  19219. $length = strlen($stat['name']);
  19220. if ($indexOfShortestMatch === false || $length < $lengthOfShortestMatch) {
  19221. $contents = $zip->getFromIndex($i);
  19222. if ($contents !== false) {
  19223. $indexOfShortestMatch = $i;
  19224. $lengthOfShortestMatch = $length;
  19225. }
  19226. }
  19227. }
  19228. }
  19229. return $indexOfShortestMatch;
  19230. }
  19231. private function getComposerInformation(\SplFileInfo $file)
  19232. {
  19233. $zip = new \ZipArchive();
  19234. $zip->open($file->getPathname());
  19235. if (0 == $zip->numFiles) {
  19236. return false;
  19237. }
  19238. $foundFileIndex = $this->locateFile($zip, 'composer.json');
  19239. if (false === $foundFileIndex) {
  19240. return false;
  19241. }
  19242. $configurationFileName = $zip->getNameIndex($foundFileIndex);
  19243. $composerFile = "zip://{$file->getPathname()}#$configurationFileName";
  19244. $json = file_get_contents($composerFile);
  19245. $package = JsonFile::parseJson($json, $composerFile);
  19246. $package['dist'] = array(
  19247. 'type' => 'zip',
  19248. 'url' => strtr($file->getPathname(), '\\', '/'),
  19249. 'shasum' => sha1_file($file->getRealPath()),
  19250. );
  19251. try {
  19252. $package = $this->loader->load($package);
  19253. } catch (\UnexpectedValueException $e) {
  19254. throw new \UnexpectedValueException('Failed loading package in '.$file.': '.$e->getMessage(), 0, $e);
  19255. }
  19256. return $package;
  19257. }
  19258. }
  19259. <?php
  19260. namespace Composer\Repository;
  19261. use Composer\Package\RootPackageInterface;
  19262. use Composer\Semver\Constraint\ConstraintInterface;
  19263. use Composer\Semver\Constraint\Constraint;
  19264. use Composer\Package\Link;
  19265. abstract class BaseRepository implements RepositoryInterface
  19266. {
  19267. public function getDependents($needle, $constraint = null, $invert = false, $recurse = true, $packagesFound = null)
  19268. {
  19269. $needles = array_map('strtolower', (array) $needle);
  19270. $results = array();
  19271. if (null === $packagesFound) {
  19272. $packagesFound = $needles;
  19273. }
  19274. $rootPackage = null;
  19275. foreach ($this->getPackages() as $package) {
  19276. if ($package instanceof RootPackageInterface) {
  19277. $rootPackage = $package;
  19278. break;
  19279. }
  19280. }
  19281. foreach ($this->getPackages() as $package) {
  19282. $links = $package->getRequires();
  19283. $packagesInTree = $packagesFound;
  19284. if (!$invert) {
  19285. $links += $package->getReplaces();
  19286. }
  19287. if ($package instanceof RootPackageInterface) {
  19288. $links += $package->getDevRequires();
  19289. }
  19290. foreach ($links as $link) {
  19291. foreach ($needles as $needle) {
  19292. if ($link->getTarget() === $needle) {
  19293. if ($constraint === null || ($link->getConstraint()->matches($constraint) === !$invert)) {
  19294. if (in_array($link->getSource(), $packagesInTree)) {
  19295. $results[$link->getSource()] = array($package, $link, false);
  19296. continue;
  19297. }
  19298. $packagesInTree[] = $link->getSource();
  19299. $dependents = $recurse ? $this->getDependents($link->getSource(), null, false, true, $packagesInTree) : array();
  19300. $results[$link->getSource()] = array($package, $link, $dependents);
  19301. }
  19302. }
  19303. }
  19304. }
  19305. if ($invert && in_array($package->getName(), $needles)) {
  19306. foreach ($package->getConflicts() as $link) {
  19307. foreach ($this->findPackages($link->getTarget()) as $pkg) {
  19308. $version = new Constraint('=', $pkg->getVersion());
  19309. if ($link->getConstraint()->matches($version) === $invert) {
  19310. $results[] = array($package, $link, false);
  19311. }
  19312. }
  19313. }
  19314. }
  19315. if ($invert && $constraint && in_array($package->getName(), $needles) && $constraint->matches(new Constraint('=', $package->getVersion()))) {
  19316. foreach ($package->getRequires() as $link) {
  19317. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  19318. if ($this->findPackage($link->getTarget(), $link->getConstraint())) {
  19319. continue;
  19320. }
  19321. $platformPkg = $this->findPackage($link->getTarget(), '*');
  19322. $description = $platformPkg ? 'but '.$platformPkg->getPrettyVersion().' is installed' : 'but it is missing';
  19323. $results[] = array($package, new Link($package->getName(), $link->getTarget(), null, 'requires', $link->getPrettyConstraint().' '.$description), false);
  19324. continue;
  19325. }
  19326. foreach ($this->getPackages() as $pkg) {
  19327. if (!in_array($link->getTarget(), $pkg->getNames())) {
  19328. continue;
  19329. }
  19330. $version = new Constraint('=', $pkg->getVersion());
  19331. if (!$link->getConstraint()->matches($version)) {
  19332. if ($rootPackage) {
  19333. foreach (array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()) as $rootReq) {
  19334. if (in_array($rootReq->getTarget(), $pkg->getNames()) && !$rootReq->getConstraint()->matches($link->getConstraint())) {
  19335. $results[] = array($package, $link, false);
  19336. $results[] = array($rootPackage, $rootReq, false);
  19337. continue 3;
  19338. }
  19339. }
  19340. $results[] = array($package, $link, false);
  19341. $results[] = array($rootPackage, new Link($rootPackage->getName(), $link->getTarget(), null, 'does not require', 'but ' . $pkg->getPrettyVersion() . ' is installed'), false);
  19342. } else {
  19343. $results[] = array($package, $link, false);
  19344. }
  19345. }
  19346. continue 2;
  19347. }
  19348. }
  19349. }
  19350. }
  19351. ksort($results);
  19352. return $results;
  19353. }
  19354. }
  19355. <?php
  19356. namespace Composer\Repository;
  19357. use Composer\Package\Loader\ArrayLoader;
  19358. use Composer\Package\PackageInterface;
  19359. use Composer\Package\AliasPackage;
  19360. use Composer\Package\Version\VersionParser;
  19361. use Composer\DependencyResolver\Pool;
  19362. use Composer\Json\JsonFile;
  19363. use Composer\Cache;
  19364. use Composer\Config;
  19365. use Composer\Factory;
  19366. use Composer\IO\IOInterface;
  19367. use Composer\Util\RemoteFilesystem;
  19368. use Composer\Plugin\PluginEvents;
  19369. use Composer\Plugin\PreFileDownloadEvent;
  19370. use Composer\EventDispatcher\EventDispatcher;
  19371. use Composer\Downloader\TransportException;
  19372. use Composer\Semver\Constraint\ConstraintInterface;
  19373. use Composer\Semver\Constraint\Constraint;
  19374. class ComposerRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  19375. {
  19376. protected $config;
  19377. protected $repoConfig;
  19378. protected $options;
  19379. protected $url;
  19380. protected $baseUrl;
  19381. protected $io;
  19382. protected $rfs;
  19383. protected $cache;
  19384. protected $notifyUrl;
  19385. protected $searchUrl;
  19386. protected $hasProviders = false;
  19387. protected $providersUrl;
  19388. protected $lazyProvidersUrl;
  19389. protected $providerListing;
  19390. protected $providers = array();
  19391. protected $providersByUid = array();
  19392. protected $loader;
  19393. protected $rootAliases;
  19394. protected $allowSslDowngrade = false;
  19395. protected $eventDispatcher;
  19396. protected $sourceMirrors;
  19397. protected $distMirrors;
  19398. private $degradedMode = false;
  19399. private $rootData;
  19400. private $hasPartialPackages;
  19401. private $partialPackagesByName;
  19402. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  19403. {
  19404. parent::__construct();
  19405. if (!preg_match('{^[\w.]+\??://}', $repoConfig['url'])) {
  19406. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  19407. }
  19408. $repoConfig['url'] = rtrim($repoConfig['url'], '/');
  19409. if ('https?' === substr($repoConfig['url'], 0, 6)) {
  19410. $repoConfig['url'] = (extension_loaded('openssl') ? 'https' : 'http') . substr($repoConfig['url'], 6);
  19411. }
  19412. $urlBits = parse_url($repoConfig['url']);
  19413. if ($urlBits === false || empty($urlBits['scheme'])) {
  19414. throw new \UnexpectedValueException('Invalid url given for Composer repository: '.$repoConfig['url']);
  19415. }
  19416. if (!isset($repoConfig['options'])) {
  19417. $repoConfig['options'] = array();
  19418. }
  19419. if (isset($repoConfig['allow_ssl_downgrade']) && true === $repoConfig['allow_ssl_downgrade']) {
  19420. $this->allowSslDowngrade = true;
  19421. }
  19422. $this->config = $config;
  19423. $this->options = $repoConfig['options'];
  19424. $this->url = $repoConfig['url'];
  19425. $this->baseUrl = rtrim(preg_replace('{(?:/[^/\\\\]+\.json)?(?:[?#].*)?$}', '', $this->url), '/');
  19426. $this->io = $io;
  19427. $this->cache = new Cache($io, $config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->url), 'a-z0-9.$');
  19428. $this->loader = new ArrayLoader();
  19429. if ($rfs && $this->options) {
  19430. $rfs = clone $rfs;
  19431. $rfs->setOptions($this->options);
  19432. }
  19433. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $this->config, $this->options);
  19434. $this->eventDispatcher = $eventDispatcher;
  19435. $this->repoConfig = $repoConfig;
  19436. }
  19437. public function getRepoConfig()
  19438. {
  19439. return $this->repoConfig;
  19440. }
  19441. public function setRootAliases(array $rootAliases)
  19442. {
  19443. $this->rootAliases = $rootAliases;
  19444. }
  19445. public function findPackage($name, $constraint)
  19446. {
  19447. if (!$this->hasProviders()) {
  19448. return parent::findPackage($name, $constraint);
  19449. }
  19450. $name = strtolower($name);
  19451. if (!$constraint instanceof ConstraintInterface) {
  19452. $versionParser = new VersionParser();
  19453. $constraint = $versionParser->parseConstraints($constraint);
  19454. }
  19455. foreach ($this->getProviderNames() as $providerName) {
  19456. if ($name === $providerName) {
  19457. $packages = $this->whatProvides(new Pool('dev'), $providerName);
  19458. foreach ($packages as $package) {
  19459. if ($name === $package->getName()) {
  19460. $pkgConstraint = new Constraint('==', $package->getVersion());
  19461. if ($constraint->matches($pkgConstraint)) {
  19462. return $package;
  19463. }
  19464. }
  19465. }
  19466. break;
  19467. }
  19468. }
  19469. }
  19470. public function findPackages($name, $constraint = null)
  19471. {
  19472. if (!$this->hasProviders()) {
  19473. return parent::findPackages($name, $constraint);
  19474. }
  19475. $name = strtolower($name);
  19476. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  19477. $versionParser = new VersionParser();
  19478. $constraint = $versionParser->parseConstraints($constraint);
  19479. }
  19480. $packages = array();
  19481. foreach ($this->getProviderNames() as $providerName) {
  19482. if ($name === $providerName) {
  19483. $candidates = $this->whatProvides(new Pool('dev'), $providerName);
  19484. foreach ($candidates as $package) {
  19485. if ($name === $package->getName()) {
  19486. $pkgConstraint = new Constraint('==', $package->getVersion());
  19487. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  19488. $packages[] = $package;
  19489. }
  19490. }
  19491. }
  19492. break;
  19493. }
  19494. }
  19495. return $packages;
  19496. }
  19497. public function getPackages()
  19498. {
  19499. if ($this->hasProviders()) {
  19500. throw new \LogicException('Composer repositories that have providers can not load the complete list of packages, use getProviderNames instead.');
  19501. }
  19502. return parent::getPackages();
  19503. }
  19504. public function search($query, $mode = 0, $type = null)
  19505. {
  19506. $this->loadRootServerFile();
  19507. if ($this->searchUrl && $mode === self::SEARCH_FULLTEXT) {
  19508. $url = str_replace(array('%query%', '%type%'), array($query, $type), $this->searchUrl);
  19509. $hostname = parse_url($url, PHP_URL_HOST) ?: $url;
  19510. $json = $this->rfs->getContents($hostname, $url, false);
  19511. $results = JsonFile::parseJson($json, $url);
  19512. return $results['results'];
  19513. }
  19514. if ($this->hasProviders()) {
  19515. $results = array();
  19516. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  19517. foreach ($this->getProviderNames() as $name) {
  19518. if (preg_match($regex, $name)) {
  19519. $results[] = array('name' => $name);
  19520. }
  19521. }
  19522. return $results;
  19523. }
  19524. return parent::search($query, $mode);
  19525. }
  19526. public function getProviderNames()
  19527. {
  19528. $this->loadRootServerFile();
  19529. if (null === $this->providerListing) {
  19530. $this->loadProviderListings($this->loadRootServerFile());
  19531. }
  19532. if ($this->lazyProvidersUrl) {
  19533. return array();
  19534. }
  19535. if ($this->providersUrl) {
  19536. return array_keys($this->providerListing);
  19537. }
  19538. return array();
  19539. }
  19540. protected function configurePackageTransportOptions(PackageInterface $package)
  19541. {
  19542. foreach ($package->getDistUrls() as $url) {
  19543. if (strpos($url, $this->baseUrl) === 0) {
  19544. $package->setTransportOptions($this->options);
  19545. return;
  19546. }
  19547. }
  19548. }
  19549. public function hasProviders()
  19550. {
  19551. $this->loadRootServerFile();
  19552. return $this->hasProviders;
  19553. }
  19554. public function resetPackageIds()
  19555. {
  19556. foreach ($this->providersByUid as $package) {
  19557. if ($package instanceof AliasPackage) {
  19558. $package->getAliasOf()->setId(-1);
  19559. }
  19560. $package->setId(-1);
  19561. }
  19562. }
  19563. public function whatProvides(Pool $pool, $name, $bypassFilters = false)
  19564. {
  19565. if (isset($this->providers[$name]) && !$bypassFilters) {
  19566. return $this->providers[$name];
  19567. }
  19568. if ($this->hasPartialPackages && null === $this->partialPackagesByName) {
  19569. $this->initializePartialPackages();
  19570. }
  19571. if (!$this->hasPartialPackages || !isset($this->partialPackagesByName[$name])) {
  19572. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name) || '__root__' === $name || 'composer-plugin-api' === $name) {
  19573. return array();
  19574. }
  19575. if (null === $this->providerListing) {
  19576. $this->loadProviderListings($this->loadRootServerFile());
  19577. }
  19578. $useLastModifiedCheck = false;
  19579. if ($this->lazyProvidersUrl && !isset($this->providerListing[$name])) {
  19580. $hash = null;
  19581. $url = str_replace('%package%', $name, $this->lazyProvidersUrl);
  19582. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  19583. $useLastModifiedCheck = true;
  19584. } elseif ($this->providersUrl) {
  19585. if (!isset($this->providerListing[$name])) {
  19586. return array();
  19587. }
  19588. $hash = $this->providerListing[$name]['sha256'];
  19589. $url = str_replace(array('%package%', '%hash%'), array($name, $hash), $this->providersUrl);
  19590. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  19591. } else {
  19592. return array();
  19593. }
  19594. $packages = null;
  19595. if ($cacheKey) {
  19596. if (!$useLastModifiedCheck && $hash && $this->cache->sha256($cacheKey) === $hash) {
  19597. $packages = json_decode($this->cache->read($cacheKey), true);
  19598. } elseif ($useLastModifiedCheck) {
  19599. if ($contents = $this->cache->read($cacheKey)) {
  19600. $contents = json_decode($contents, true);
  19601. if (isset($contents['last-modified'])) {
  19602. $response = $this->fetchFileIfLastModified($url, $cacheKey, $contents['last-modified']);
  19603. if (true === $response) {
  19604. $packages = $contents;
  19605. } elseif ($response) {
  19606. $packages = $response;
  19607. }
  19608. }
  19609. }
  19610. }
  19611. }
  19612. if (!$packages) {
  19613. try {
  19614. $packages = $this->fetchFile($url, $cacheKey, $hash, $useLastModifiedCheck);
  19615. } catch (TransportException $e) {
  19616. if ($e->getStatusCode() === 404 && $this->lazyProvidersUrl) {
  19617. $packages = array('packages' => array());
  19618. } else {
  19619. throw $e;
  19620. }
  19621. }
  19622. }
  19623. $loadingPartialPackage = false;
  19624. } else {
  19625. $packages = array('packages' => array('versions' => $this->partialPackagesByName[$name]));
  19626. $loadingPartialPackage = true;
  19627. }
  19628. $this->providers[$name] = array();
  19629. foreach ($packages['packages'] as $versions) {
  19630. foreach ($versions as $version) {
  19631. if (!$loadingPartialPackage && $this->hasPartialPackages && isset($this->partialPackagesByName[$version['name']])) {
  19632. continue;
  19633. }
  19634. if (isset($this->providersByUid[$version['uid']])) {
  19635. if (!isset($this->providers[$name][$version['uid']])) {
  19636. if ($this->providersByUid[$version['uid']] instanceof AliasPackage) {
  19637. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']]->getAliasOf();
  19638. $this->providers[$name][$version['uid'].'-alias'] = $this->providersByUid[$version['uid']];
  19639. } else {
  19640. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']];
  19641. }
  19642. if (isset($this->providersByUid[$version['uid'].'-root'])) {
  19643. $this->providers[$name][$version['uid'].'-root'] = $this->providersByUid[$version['uid'].'-root'];
  19644. }
  19645. }
  19646. } else {
  19647. if (!$bypassFilters && !$pool->isPackageAcceptable(strtolower($version['name']), VersionParser::parseStability($version['version']))) {
  19648. continue;
  19649. }
  19650. $package = $this->createPackage($version, 'Composer\Package\CompletePackage');
  19651. $package->setRepository($this);
  19652. if ($package instanceof AliasPackage) {
  19653. $aliased = $package->getAliasOf();
  19654. $aliased->setRepository($this);
  19655. $this->providers[$name][$version['uid']] = $aliased;
  19656. $this->providers[$name][$version['uid'].'-alias'] = $package;
  19657. $this->providersByUid[$version['uid']] = $package;
  19658. } else {
  19659. $this->providers[$name][$version['uid']] = $package;
  19660. $this->providersByUid[$version['uid']] = $package;
  19661. }
  19662. unset($rootAliasData);
  19663. if (isset($this->rootAliases[$package->getName()][$package->getVersion()])) {
  19664. $rootAliasData = $this->rootAliases[$package->getName()][$package->getVersion()];
  19665. } elseif ($package instanceof AliasPackage && isset($this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()])) {
  19666. $rootAliasData = $this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()];
  19667. }
  19668. if (isset($rootAliasData)) {
  19669. $alias = $this->createAliasPackage($package, $rootAliasData['alias_normalized'], $rootAliasData['alias']);
  19670. $alias->setRepository($this);
  19671. $this->providers[$name][$version['uid'].'-root'] = $alias;
  19672. $this->providersByUid[$version['uid'].'-root'] = $alias;
  19673. }
  19674. }
  19675. }
  19676. }
  19677. $result = $this->providers[$name];
  19678. if ($bypassFilters) {
  19679. foreach ($this->providers[$name] as $uid => $provider) {
  19680. unset($this->providersByUid[$uid]);
  19681. }
  19682. unset($this->providers[$name]);
  19683. }
  19684. return $result;
  19685. }
  19686. protected function initialize()
  19687. {
  19688. parent::initialize();
  19689. $repoData = $this->loadDataFromServer();
  19690. foreach ($repoData as $package) {
  19691. $this->addPackage($this->createPackage($package, 'Composer\Package\CompletePackage'));
  19692. }
  19693. }
  19694. public function addPackage(PackageInterface $package)
  19695. {
  19696. parent::addPackage($package);
  19697. $this->configurePackageTransportOptions($package);
  19698. }
  19699. protected function loadRootServerFile()
  19700. {
  19701. if (null !== $this->rootData) {
  19702. return $this->rootData;
  19703. }
  19704. if (!extension_loaded('openssl') && 'https' === substr($this->url, 0, 5)) {
  19705. throw new \RuntimeException('You must enable the openssl extension in your php.ini to load information from '.$this->url);
  19706. }
  19707. $jsonUrlParts = parse_url($this->url);
  19708. if (isset($jsonUrlParts['path']) && false !== strpos($jsonUrlParts['path'], '.json')) {
  19709. $jsonUrl = $this->url;
  19710. } else {
  19711. $jsonUrl = $this->url . '/packages.json';
  19712. }
  19713. $data = $this->fetchFile($jsonUrl, 'packages.json');
  19714. if (!empty($data['notify-batch'])) {
  19715. $this->notifyUrl = $this->canonicalizeUrl($data['notify-batch']);
  19716. } elseif (!empty($data['notify'])) {
  19717. $this->notifyUrl = $this->canonicalizeUrl($data['notify']);
  19718. }
  19719. if (!empty($data['search'])) {
  19720. $this->searchUrl = $this->canonicalizeUrl($data['search']);
  19721. }
  19722. if (!empty($data['mirrors'])) {
  19723. foreach ($data['mirrors'] as $mirror) {
  19724. if (!empty($mirror['git-url'])) {
  19725. $this->sourceMirrors['git'][] = array('url' => $mirror['git-url'], 'preferred' => !empty($mirror['preferred']));
  19726. }
  19727. if (!empty($mirror['hg-url'])) {
  19728. $this->sourceMirrors['hg'][] = array('url' => $mirror['hg-url'], 'preferred' => !empty($mirror['preferred']));
  19729. }
  19730. if (!empty($mirror['dist-url'])) {
  19731. $this->distMirrors[] = array(
  19732. 'url' => $this->canonicalizeUrl($mirror['dist-url']),
  19733. 'preferred' => !empty($mirror['preferred']),
  19734. );
  19735. }
  19736. }
  19737. }
  19738. if (!empty($data['providers-lazy-url'])) {
  19739. $this->lazyProvidersUrl = $this->canonicalizeUrl($data['providers-lazy-url']);
  19740. $this->hasProviders = true;
  19741. $this->hasPartialPackages = !empty($data['packages']) && is_array($data['packages']);
  19742. }
  19743. if ($this->allowSslDowngrade) {
  19744. $this->url = str_replace('https://', 'http://', $this->url);
  19745. $this->baseUrl = str_replace('https://', 'http://', $this->baseUrl);
  19746. }
  19747. if (!empty($data['providers-url'])) {
  19748. $this->providersUrl = $this->canonicalizeUrl($data['providers-url']);
  19749. $this->hasProviders = true;
  19750. }
  19751. if (!empty($data['providers']) || !empty($data['providers-includes'])) {
  19752. $this->hasProviders = true;
  19753. }
  19754. if (preg_match('{^https?://packagist.org/?$}i', $this->url) && !empty($this->repoConfig['force-lazy-providers'])) {
  19755. $this->url = 'https://packagist.org';
  19756. $this->baseUrl = 'https://packagist.org';
  19757. $this->lazyProvidersUrl = $this->canonicalizeUrl('https://packagist.org/p/%package%.json');
  19758. $this->providersUrl = null;
  19759. } elseif (!empty($this->repoConfig['force-lazy-providers'])) {
  19760. $this->lazyProvidersUrl = $this->canonicalizeUrl('/p/%package%.json');
  19761. $this->providersUrl = null;
  19762. }
  19763. return $this->rootData = $data;
  19764. }
  19765. protected function canonicalizeUrl($url)
  19766. {
  19767. if ('/' === $url[0]) {
  19768. return preg_replace('{(https?://[^/]+).*}i', '$1' . $url, $this->url);
  19769. }
  19770. return $url;
  19771. }
  19772. protected function loadDataFromServer()
  19773. {
  19774. $data = $this->loadRootServerFile();
  19775. return $this->loadIncludes($data);
  19776. }
  19777. protected function loadProviderListings($data)
  19778. {
  19779. if (isset($data['providers'])) {
  19780. if (!is_array($this->providerListing)) {
  19781. $this->providerListing = array();
  19782. }
  19783. $this->providerListing = array_merge($this->providerListing, $data['providers']);
  19784. }
  19785. if ($this->providersUrl && isset($data['provider-includes'])) {
  19786. $includes = $data['provider-includes'];
  19787. foreach ($includes as $include => $metadata) {
  19788. $url = $this->baseUrl . '/' . str_replace('%hash%', $metadata['sha256'], $include);
  19789. $cacheKey = str_replace(array('%hash%','$'), '', $include);
  19790. if ($this->cache->sha256($cacheKey) === $metadata['sha256']) {
  19791. $includedData = json_decode($this->cache->read($cacheKey), true);
  19792. } else {
  19793. $includedData = $this->fetchFile($url, $cacheKey, $metadata['sha256']);
  19794. }
  19795. $this->loadProviderListings($includedData);
  19796. }
  19797. }
  19798. }
  19799. protected function loadIncludes($data)
  19800. {
  19801. $packages = array();
  19802. if (!isset($data['packages']) && !isset($data['includes'])) {
  19803. foreach ($data as $pkg) {
  19804. foreach ($pkg['versions'] as $metadata) {
  19805. $packages[] = $metadata;
  19806. }
  19807. }
  19808. return $packages;
  19809. }
  19810. if (isset($data['packages'])) {
  19811. foreach ($data['packages'] as $package => $versions) {
  19812. foreach ($versions as $version => $metadata) {
  19813. $packages[] = $metadata;
  19814. }
  19815. }
  19816. }
  19817. if (isset($data['includes'])) {
  19818. foreach ($data['includes'] as $include => $metadata) {
  19819. if ($this->cache->sha1($include) === $metadata['sha1']) {
  19820. $includedData = json_decode($this->cache->read($include), true);
  19821. } else {
  19822. $includedData = $this->fetchFile($include);
  19823. }
  19824. $packages = array_merge($packages, $this->loadIncludes($includedData));
  19825. }
  19826. }
  19827. return $packages;
  19828. }
  19829. protected function createPackage(array $data, $class = 'Composer\Package\CompletePackage')
  19830. {
  19831. try {
  19832. if (!isset($data['notification-url'])) {
  19833. $data['notification-url'] = $this->notifyUrl;
  19834. }
  19835. $package = $this->loader->load($data, $class);
  19836. if (isset($this->sourceMirrors[$package->getSourceType()])) {
  19837. $package->setSourceMirrors($this->sourceMirrors[$package->getSourceType()]);
  19838. }
  19839. $package->setDistMirrors($this->distMirrors);
  19840. $this->configurePackageTransportOptions($package);
  19841. return $package;
  19842. } catch (\Exception $e) {
  19843. throw new \RuntimeException('Could not load package '.(isset($data['name']) ? $data['name'] : json_encode($data)).' in '.$this->url.': ['.get_class($e).'] '.$e->getMessage(), 0, $e);
  19844. }
  19845. }
  19846. protected function fetchFile($filename, $cacheKey = null, $sha256 = null, $storeLastModifiedTime = false)
  19847. {
  19848. if (null === $cacheKey) {
  19849. $cacheKey = $filename;
  19850. $filename = $this->baseUrl.'/'.$filename;
  19851. }
  19852. if (($pos = strpos($filename, '$')) && preg_match('{^https?://.*}i', $filename)) {
  19853. $filename = substr($filename, 0, $pos) . '%24' . substr($filename, $pos + 1);
  19854. }
  19855. $retries = 3;
  19856. while ($retries--) {
  19857. try {
  19858. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  19859. if ($this->eventDispatcher) {
  19860. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  19861. }
  19862. $hostname = parse_url($filename, PHP_URL_HOST) ?: $filename;
  19863. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  19864. $json = $rfs->getContents($hostname, $filename, false);
  19865. if ($sha256 && $sha256 !== hash('sha256', $json)) {
  19866. if ($this->allowSslDowngrade) {
  19867. $this->url = str_replace('http://', 'https://', $this->url);
  19868. $this->baseUrl = str_replace('http://', 'https://', $this->baseUrl);
  19869. $filename = str_replace('http://', 'https://', $filename);
  19870. }
  19871. if ($retries) {
  19872. usleep(100000);
  19873. continue;
  19874. }
  19875. throw new RepositorySecurityException('The contents of '.$filename.' do not match its signature. This could indicate a man-in-the-middle attack or e.g. antivirus software corrupting files. Try running composer again and report this if you think it is a mistake.');
  19876. }
  19877. $data = JsonFile::parseJson($json, $filename);
  19878. if (!empty($data['warning'])) {
  19879. $this->io->writeError('<warning>Warning from '.$this->url.': '.$data['warning'].'</warning>');
  19880. }
  19881. if (!empty($data['info'])) {
  19882. $this->io->writeError('<info>Info from '.$this->url.': '.$data['info'].'</info>');
  19883. }
  19884. if ($cacheKey) {
  19885. if ($storeLastModifiedTime) {
  19886. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  19887. if ($lastModifiedDate) {
  19888. $data['last-modified'] = $lastModifiedDate;
  19889. $json = json_encode($data);
  19890. }
  19891. }
  19892. $this->cache->write($cacheKey, $json);
  19893. }
  19894. break;
  19895. } catch (\Exception $e) {
  19896. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  19897. throw $e;
  19898. }
  19899. if ($retries) {
  19900. usleep(100000);
  19901. continue;
  19902. }
  19903. if ($e instanceof RepositorySecurityException) {
  19904. throw $e;
  19905. }
  19906. if ($cacheKey && ($contents = $this->cache->read($cacheKey))) {
  19907. if (!$this->degradedMode) {
  19908. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  19909. $this->io->writeError('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
  19910. }
  19911. $this->degradedMode = true;
  19912. $data = JsonFile::parseJson($contents, $this->cache->getRoot().$cacheKey);
  19913. break;
  19914. }
  19915. throw $e;
  19916. }
  19917. }
  19918. return $data;
  19919. }
  19920. protected function fetchFileIfLastModified($filename, $cacheKey, $lastModifiedTime)
  19921. {
  19922. $retries = 3;
  19923. while ($retries--) {
  19924. try {
  19925. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  19926. if ($this->eventDispatcher) {
  19927. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  19928. }
  19929. $hostname = parse_url($filename, PHP_URL_HOST) ?: $filename;
  19930. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  19931. $options = array('http' => array('header' => array('If-Modified-Since: '.$lastModifiedTime)));
  19932. $json = $rfs->getContents($hostname, $filename, false, $options);
  19933. if ($json === '' && $rfs->findStatusCode($rfs->getLastHeaders()) === 304) {
  19934. return true;
  19935. }
  19936. $data = JsonFile::parseJson($json, $filename);
  19937. if (!empty($data['warning'])) {
  19938. $this->io->writeError('<warning>Warning from '.$this->url.': '.$data['warning'].'</warning>');
  19939. }
  19940. if (!empty($data['info'])) {
  19941. $this->io->writeError('<info>Info from '.$this->url.': '.$data['info'].'</info>');
  19942. }
  19943. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  19944. if ($lastModifiedDate) {
  19945. $data['last-modified'] = $lastModifiedDate;
  19946. $json = json_encode($data);
  19947. }
  19948. $this->cache->write($cacheKey, $json);
  19949. return $data;
  19950. } catch (\Exception $e) {
  19951. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  19952. throw $e;
  19953. }
  19954. if ($retries) {
  19955. usleep(100000);
  19956. continue;
  19957. }
  19958. if (!$this->degradedMode) {
  19959. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  19960. $this->io->writeError('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
  19961. }
  19962. $this->degradedMode = true;
  19963. return true;
  19964. }
  19965. }
  19966. }
  19967. private function initializePartialPackages()
  19968. {
  19969. $rootData = $this->loadRootServerFile();
  19970. $this->partialPackagesByName = array();
  19971. foreach ($rootData['packages'] as $package => $versions) {
  19972. $package = strtolower($package);
  19973. foreach ($versions as $version) {
  19974. $this->partialPackagesByName[$package][] = $version;
  19975. if (!empty($version['provide']) && is_array($version['provide'])) {
  19976. foreach ($version['provide'] as $provided => $providedVersion) {
  19977. $this->partialPackagesByName[strtolower($provided)][] = $version;
  19978. }
  19979. }
  19980. if (!empty($version['replace']) && is_array($version['replace'])) {
  19981. foreach ($version['replace'] as $provided => $providedVersion) {
  19982. $this->partialPackagesByName[strtolower($provided)][] = $version;
  19983. }
  19984. }
  19985. }
  19986. }
  19987. $this->rootData = true;
  19988. }
  19989. }
  19990. <?php
  19991. namespace Composer\Repository;
  19992. use Composer\Package\PackageInterface;
  19993. class CompositeRepository extends BaseRepository
  19994. {
  19995. private $repositories;
  19996. public function __construct(array $repositories)
  19997. {
  19998. $this->repositories = array();
  19999. foreach ($repositories as $repo) {
  20000. $this->addRepository($repo);
  20001. }
  20002. }
  20003. public function getRepositories()
  20004. {
  20005. return $this->repositories;
  20006. }
  20007. public function hasPackage(PackageInterface $package)
  20008. {
  20009. foreach ($this->repositories as $repository) {
  20010. if ($repository->hasPackage($package)) {
  20011. return true;
  20012. }
  20013. }
  20014. return false;
  20015. }
  20016. public function findPackage($name, $constraint)
  20017. {
  20018. foreach ($this->repositories as $repository) {
  20019. $package = $repository->findPackage($name, $constraint);
  20020. if (null !== $package) {
  20021. return $package;
  20022. }
  20023. }
  20024. return null;
  20025. }
  20026. public function findPackages($name, $constraint = null)
  20027. {
  20028. $packages = array();
  20029. foreach ($this->repositories as $repository) {
  20030. $packages[] = $repository->findPackages($name, $constraint);
  20031. }
  20032. return $packages ? call_user_func_array('array_merge', $packages) : array();
  20033. }
  20034. public function search($query, $mode = 0, $type = null)
  20035. {
  20036. $matches = array();
  20037. foreach ($this->repositories as $repository) {
  20038. $matches[] = $repository->search($query, $mode, $type);
  20039. }
  20040. return $matches ? call_user_func_array('array_merge', $matches) : array();
  20041. }
  20042. public function getPackages()
  20043. {
  20044. $packages = array();
  20045. foreach ($this->repositories as $repository) {
  20046. $packages[] = $repository->getPackages();
  20047. }
  20048. return $packages ? call_user_func_array('array_merge', $packages) : array();
  20049. }
  20050. public function removePackage(PackageInterface $package)
  20051. {
  20052. foreach ($this->repositories as $repository) {
  20053. $repository->removePackage($package);
  20054. }
  20055. }
  20056. public function count()
  20057. {
  20058. $total = 0;
  20059. foreach ($this->repositories as $repository) {
  20060. $total += $repository->count();
  20061. }
  20062. return $total;
  20063. }
  20064. public function addRepository(RepositoryInterface $repository)
  20065. {
  20066. if ($repository instanceof self) {
  20067. foreach ($repository->getRepositories() as $repo) {
  20068. $this->addRepository($repo);
  20069. }
  20070. } else {
  20071. $this->repositories[] = $repository;
  20072. }
  20073. }
  20074. }
  20075. <?php
  20076. namespace Composer\Repository;
  20077. interface ConfigurableRepositoryInterface
  20078. {
  20079. public function getRepoConfig();
  20080. }
  20081. <?php
  20082. namespace Composer\Repository;
  20083. use Composer\Json\JsonFile;
  20084. use Composer\Package\Loader\ArrayLoader;
  20085. use Composer\Package\Dumper\ArrayDumper;
  20086. class FilesystemRepository extends WritableArrayRepository
  20087. {
  20088. private $file;
  20089. public function __construct(JsonFile $repositoryFile)
  20090. {
  20091. parent::__construct();
  20092. $this->file = $repositoryFile;
  20093. }
  20094. protected function initialize()
  20095. {
  20096. parent::initialize();
  20097. if (!$this->file->exists()) {
  20098. return;
  20099. }
  20100. try {
  20101. $packages = $this->file->read();
  20102. if (!is_array($packages)) {
  20103. throw new \UnexpectedValueException('Could not parse package list from the repository');
  20104. }
  20105. } catch (\Exception $e) {
  20106. throw new InvalidRepositoryException('Invalid repository data in '.$this->file->getPath().', packages could not be loaded: ['.get_class($e).'] '.$e->getMessage());
  20107. }
  20108. $loader = new ArrayLoader(null, true);
  20109. foreach ($packages as $packageData) {
  20110. $package = $loader->load($packageData);
  20111. $this->addPackage($package);
  20112. }
  20113. }
  20114. public function reload()
  20115. {
  20116. $this->packages = null;
  20117. $this->initialize();
  20118. }
  20119. public function write()
  20120. {
  20121. $data = array();
  20122. $dumper = new ArrayDumper();
  20123. foreach ($this->getCanonicalPackages() as $package) {
  20124. $data[] = $dumper->dump($package);
  20125. }
  20126. usort($data, function ($a, $b) {
  20127. return strcmp($a['name'], $b['name']);
  20128. });
  20129. $this->file->write($data);
  20130. }
  20131. }
  20132. <?php
  20133. namespace Composer\Repository;
  20134. class InstalledArrayRepository extends WritableArrayRepository implements InstalledRepositoryInterface
  20135. {
  20136. }
  20137. <?php
  20138. namespace Composer\Repository;
  20139. class InstalledFilesystemRepository extends FilesystemRepository implements InstalledRepositoryInterface
  20140. {
  20141. }
  20142. <?php
  20143. namespace Composer\Repository;
  20144. interface InstalledRepositoryInterface extends WritableRepositoryInterface
  20145. {
  20146. }
  20147. <?php
  20148. namespace Composer\Repository;
  20149. class InvalidRepositoryException extends \Exception
  20150. {
  20151. }
  20152. <?php
  20153. namespace Composer\Repository;
  20154. use Composer\Package\Loader\ArrayLoader;
  20155. use Composer\Package\Loader\ValidatingArrayLoader;
  20156. class PackageRepository extends ArrayRepository
  20157. {
  20158. private $config;
  20159. public function __construct(array $config)
  20160. {
  20161. parent::__construct();
  20162. $this->config = $config['package'];
  20163. if (!is_numeric(key($this->config))) {
  20164. $this->config = array($this->config);
  20165. }
  20166. }
  20167. protected function initialize()
  20168. {
  20169. parent::initialize();
  20170. $loader = new ValidatingArrayLoader(new ArrayLoader(null, true), false);
  20171. foreach ($this->config as $package) {
  20172. try {
  20173. $package = $loader->load($package);
  20174. } catch (\Exception $e) {
  20175. throw new InvalidRepositoryException('A repository of type "package" contains an invalid package definition: '.$e->getMessage()."\n\nInvalid package definition:\n".json_encode($package));
  20176. }
  20177. $this->addPackage($package);
  20178. }
  20179. }
  20180. }
  20181. <?php
  20182. namespace Composer\Repository;
  20183. use Composer\Config;
  20184. use Composer\IO\IOInterface;
  20185. use Composer\Json\JsonFile;
  20186. use Composer\Package\Loader\ArrayLoader;
  20187. use Composer\Package\Version\VersionGuesser;
  20188. use Composer\Package\Version\VersionParser;
  20189. use Composer\Util\Platform;
  20190. use Composer\Util\ProcessExecutor;
  20191. class PathRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  20192. {
  20193. private $loader;
  20194. private $versionGuesser;
  20195. private $url;
  20196. private $repoConfig;
  20197. private $process;
  20198. private $options;
  20199. public function __construct(array $repoConfig, IOInterface $io, Config $config)
  20200. {
  20201. if (!isset($repoConfig['url'])) {
  20202. throw new \RuntimeException('You must specify the `url` configuration for the path repository');
  20203. }
  20204. $this->loader = new ArrayLoader(null, true);
  20205. $this->url = Platform::expandPath($repoConfig['url']);
  20206. $this->process = new ProcessExecutor($io);
  20207. $this->versionGuesser = new VersionGuesser($config, $this->process, new VersionParser());
  20208. $this->repoConfig = $repoConfig;
  20209. $this->options = isset($repoConfig['options']) ? $repoConfig['options'] : array();
  20210. parent::__construct();
  20211. }
  20212. public function getRepoConfig()
  20213. {
  20214. return $this->repoConfig;
  20215. }
  20216. protected function initialize()
  20217. {
  20218. parent::initialize();
  20219. foreach ($this->getUrlMatches() as $url) {
  20220. $path = realpath($url) . DIRECTORY_SEPARATOR;
  20221. $composerFilePath = $path.'composer.json';
  20222. if (!file_exists($composerFilePath)) {
  20223. continue;
  20224. }
  20225. $json = file_get_contents($composerFilePath);
  20226. $package = JsonFile::parseJson($json, $composerFilePath);
  20227. $package['dist'] = array(
  20228. 'type' => 'path',
  20229. 'url' => $url,
  20230. 'reference' => sha1($json . serialize($this->options)),
  20231. );
  20232. $package['transport-options'] = $this->options;
  20233. if (!isset($package['version']) && ($rootVersion = getenv('COMPOSER_ROOT_VERSION'))) {
  20234. if (
  20235. 0 === $this->process->execute('git rev-parse HEAD', $ref1, $path)
  20236. && 0 === $this->process->execute('git rev-parse HEAD', $ref2)
  20237. && $ref1 === $ref2
  20238. ) {
  20239. $package['version'] = $rootVersion;
  20240. }
  20241. }
  20242. if (!isset($package['version'])) {
  20243. $versionData = $this->versionGuesser->guessVersion($package, $path);
  20244. $package['version'] = $versionData['pretty_version'] ?: 'dev-master';
  20245. }
  20246. $output = '';
  20247. if (is_dir($path . DIRECTORY_SEPARATOR . '.git') && 0 === $this->process->execute('git log -n1 --pretty=%H', $output, $path)) {
  20248. $package['dist']['reference'] = trim($output);
  20249. }
  20250. $package = $this->loader->load($package);
  20251. $this->addPackage($package);
  20252. }
  20253. }
  20254. private function getUrlMatches()
  20255. {
  20256. return array_map(function ($val) {
  20257. return rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $val), '/');
  20258. }, glob($this->url, GLOB_MARK | GLOB_ONLYDIR));
  20259. }
  20260. }
  20261. <?php
  20262. namespace Composer\Repository\Pear;
  20263. use Composer\Util\RemoteFilesystem;
  20264. abstract class BaseChannelReader
  20265. {
  20266. const CHANNEL_NS = 'http://pear.php.net/channel-1.0';
  20267. const ALL_CATEGORIES_NS = 'http://pear.php.net/dtd/rest.allcategories';
  20268. const CATEGORY_PACKAGES_INFO_NS = 'http://pear.php.net/dtd/rest.categorypackageinfo';
  20269. const ALL_PACKAGES_NS = 'http://pear.php.net/dtd/rest.allpackages';
  20270. const ALL_RELEASES_NS = 'http://pear.php.net/dtd/rest.allreleases';
  20271. const PACKAGE_INFO_NS = 'http://pear.php.net/dtd/rest.package';
  20272. private $rfs;
  20273. protected function __construct(RemoteFilesystem $rfs)
  20274. {
  20275. $this->rfs = $rfs;
  20276. }
  20277. protected function requestContent($origin, $path)
  20278. {
  20279. $url = rtrim($origin, '/') . '/' . ltrim($path, '/');
  20280. $content = $this->rfs->getContents($origin, $url, false);
  20281. if (!$content) {
  20282. throw new \UnexpectedValueException('The PEAR channel at ' . $url . ' did not respond.');
  20283. }
  20284. return str_replace('http://pear.php.net/rest/', 'https://pear.php.net/rest/', $content);
  20285. }
  20286. protected function requestXml($origin, $path)
  20287. {
  20288. $xml = simplexml_load_string($this->requestContent($origin, $path), "SimpleXMLElement", LIBXML_NOERROR);
  20289. if (false === $xml) {
  20290. throw new \UnexpectedValueException(sprintf('The PEAR channel at ' . $origin . ' is broken. (Invalid XML at file `%s`)', $path));
  20291. }
  20292. return $xml;
  20293. }
  20294. }
  20295. <?php
  20296. namespace Composer\Repository\Pear;
  20297. class ChannelInfo
  20298. {
  20299. private $name;
  20300. private $alias;
  20301. private $packages;
  20302. public function __construct($name, $alias, array $packages)
  20303. {
  20304. $this->name = $name;
  20305. $this->alias = $alias;
  20306. $this->packages = $packages;
  20307. }
  20308. public function getName()
  20309. {
  20310. return $this->name;
  20311. }
  20312. public function getAlias()
  20313. {
  20314. return $this->alias;
  20315. }
  20316. public function getPackages()
  20317. {
  20318. return $this->packages;
  20319. }
  20320. }
  20321. <?php
  20322. namespace Composer\Repository\Pear;
  20323. use Composer\Util\RemoteFilesystem;
  20324. class ChannelReader extends BaseChannelReader
  20325. {
  20326. private $readerMap;
  20327. public function __construct(RemoteFilesystem $rfs)
  20328. {
  20329. parent::__construct($rfs);
  20330. $rest10reader = new ChannelRest10Reader($rfs);
  20331. $rest11reader = new ChannelRest11Reader($rfs);
  20332. $this->readerMap = array(
  20333. 'REST1.3' => $rest11reader,
  20334. 'REST1.2' => $rest11reader,
  20335. 'REST1.1' => $rest11reader,
  20336. 'REST1.0' => $rest10reader,
  20337. );
  20338. }
  20339. public function read($url)
  20340. {
  20341. $xml = $this->requestXml($url, "/channel.xml");
  20342. $channelName = (string) $xml->name;
  20343. $channelAlias = (string) $xml->suggestedalias;
  20344. $supportedVersions = array_keys($this->readerMap);
  20345. $selectedRestVersion = $this->selectRestVersion($xml, $supportedVersions);
  20346. if (!$selectedRestVersion) {
  20347. throw new \UnexpectedValueException(sprintf('PEAR repository %s does not supports any of %s protocols.', $url, implode(', ', $supportedVersions)));
  20348. }
  20349. $reader = $this->readerMap[$selectedRestVersion['version']];
  20350. $packageDefinitions = $reader->read($selectedRestVersion['baseUrl']);
  20351. return new ChannelInfo($channelName, $channelAlias, $packageDefinitions);
  20352. }
  20353. private function selectRestVersion($channelXml, $supportedVersions)
  20354. {
  20355. $channelXml->registerXPathNamespace('ns', self::CHANNEL_NS);
  20356. foreach ($supportedVersions as $version) {
  20357. $xpathTest = "ns:servers/ns:*/ns:rest/ns:baseurl[@type='{$version}']";
  20358. $testResult = $channelXml->xpath($xpathTest);
  20359. foreach ($testResult as $result) {
  20360. $result = (string) $result;
  20361. if (preg_match('{^https://}i', $result)) {
  20362. return array('version' => $version, 'baseUrl' => $result);
  20363. }
  20364. }
  20365. if (count($testResult) > 0) {
  20366. return array('version' => $version, 'baseUrl' => (string) $testResult[0]);
  20367. }
  20368. }
  20369. return null;
  20370. }
  20371. }
  20372. <?php
  20373. namespace Composer\Repository\Pear;
  20374. use Composer\Downloader\TransportException;
  20375. class ChannelRest10Reader extends BaseChannelReader
  20376. {
  20377. private $dependencyReader;
  20378. public function __construct($rfs)
  20379. {
  20380. parent::__construct($rfs);
  20381. $this->dependencyReader = new PackageDependencyParser();
  20382. }
  20383. public function read($baseUrl)
  20384. {
  20385. return $this->readPackages($baseUrl);
  20386. }
  20387. private function readPackages($baseUrl)
  20388. {
  20389. $result = array();
  20390. $xmlPath = '/p/packages.xml';
  20391. $xml = $this->requestXml($baseUrl, $xmlPath);
  20392. $xml->registerXPathNamespace('ns', self::ALL_PACKAGES_NS);
  20393. foreach ($xml->xpath('ns:p') as $node) {
  20394. $packageName = (string) $node;
  20395. $packageInfo = $this->readPackage($baseUrl, $packageName);
  20396. $result[] = $packageInfo;
  20397. }
  20398. return $result;
  20399. }
  20400. private function readPackage($baseUrl, $packageName)
  20401. {
  20402. $xmlPath = '/p/' . strtolower($packageName) . '/info.xml';
  20403. $xml = $this->requestXml($baseUrl, $xmlPath);
  20404. $xml->registerXPathNamespace('ns', self::PACKAGE_INFO_NS);
  20405. $channelName = (string) $xml->c;
  20406. $packageName = (string) $xml->n;
  20407. $license = (string) $xml->l;
  20408. $shortDescription = (string) $xml->s;
  20409. $description = (string) $xml->d;
  20410. return new PackageInfo(
  20411. $channelName,
  20412. $packageName,
  20413. $license,
  20414. $shortDescription,
  20415. $description,
  20416. $this->readPackageReleases($baseUrl, $packageName)
  20417. );
  20418. }
  20419. private function readPackageReleases($baseUrl, $packageName)
  20420. {
  20421. $result = array();
  20422. try {
  20423. $xmlPath = '/r/' . strtolower($packageName) . '/allreleases.xml';
  20424. $xml = $this->requestXml($baseUrl, $xmlPath);
  20425. $xml->registerXPathNamespace('ns', self::ALL_RELEASES_NS);
  20426. foreach ($xml->xpath('ns:r') as $node) {
  20427. $releaseVersion = (string) $node->v;
  20428. $releaseStability = (string) $node->s;
  20429. try {
  20430. $result[$releaseVersion] = new ReleaseInfo(
  20431. $releaseStability,
  20432. $this->readPackageReleaseDependencies($baseUrl, $packageName, $releaseVersion)
  20433. );
  20434. } catch (TransportException $exception) {
  20435. if ($exception->getCode() != 404) {
  20436. throw $exception;
  20437. }
  20438. }
  20439. }
  20440. } catch (TransportException $exception) {
  20441. if ($exception->getCode() != 404) {
  20442. throw $exception;
  20443. }
  20444. }
  20445. return $result;
  20446. }
  20447. private function readPackageReleaseDependencies($baseUrl, $packageName, $version)
  20448. {
  20449. $dependencyReader = new PackageDependencyParser();
  20450. $depthPath = '/r/' . strtolower($packageName) . '/deps.' . $version . '.txt';
  20451. $content = $this->requestContent($baseUrl, $depthPath);
  20452. $dependencyArray = unserialize($content);
  20453. return $dependencyReader->buildDependencyInfo($dependencyArray);
  20454. }
  20455. }
  20456. <?php
  20457. namespace Composer\Repository\Pear;
  20458. class ChannelRest11Reader extends BaseChannelReader
  20459. {
  20460. private $dependencyReader;
  20461. public function __construct($rfs)
  20462. {
  20463. parent::__construct($rfs);
  20464. $this->dependencyReader = new PackageDependencyParser();
  20465. }
  20466. public function read($baseUrl)
  20467. {
  20468. return $this->readChannelPackages($baseUrl);
  20469. }
  20470. private function readChannelPackages($baseUrl)
  20471. {
  20472. $result = array();
  20473. $xml = $this->requestXml($baseUrl, "/c/categories.xml");
  20474. $xml->registerXPathNamespace('ns', self::ALL_CATEGORIES_NS);
  20475. foreach ($xml->xpath('ns:c') as $node) {
  20476. $categoryName = (string) $node;
  20477. $categoryPackages = $this->readCategoryPackages($baseUrl, $categoryName);
  20478. $result = array_merge($result, $categoryPackages);
  20479. }
  20480. return $result;
  20481. }
  20482. private function readCategoryPackages($baseUrl, $categoryName)
  20483. {
  20484. $result = array();
  20485. $categoryPath = '/c/'.urlencode($categoryName).'/packagesinfo.xml';
  20486. $xml = $this->requestXml($baseUrl, $categoryPath);
  20487. $xml->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  20488. foreach ($xml->xpath('ns:pi') as $node) {
  20489. $packageInfo = $this->parsePackage($node);
  20490. $result[] = $packageInfo;
  20491. }
  20492. return $result;
  20493. }
  20494. private function parsePackage($packageInfo)
  20495. {
  20496. $packageInfo->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  20497. $channelName = (string) $packageInfo->p->c;
  20498. $packageName = (string) $packageInfo->p->n;
  20499. $license = (string) $packageInfo->p->l;
  20500. $shortDescription = (string) $packageInfo->p->s;
  20501. $description = (string) $packageInfo->p->d;
  20502. $dependencies = array();
  20503. foreach ($packageInfo->xpath('ns:deps') as $node) {
  20504. $dependencyVersion = (string) $node->v;
  20505. $dependencyArray = unserialize((string) $node->d);
  20506. $dependencyInfo = $this->dependencyReader->buildDependencyInfo($dependencyArray);
  20507. $dependencies[$dependencyVersion] = $dependencyInfo;
  20508. }
  20509. $releases = array();
  20510. $releasesInfo = $packageInfo->xpath('ns:a/ns:r');
  20511. if ($releasesInfo) {
  20512. foreach ($releasesInfo as $node) {
  20513. $releaseVersion = (string) $node->v;
  20514. $releaseStability = (string) $node->s;
  20515. $releases[$releaseVersion] = new ReleaseInfo(
  20516. $releaseStability,
  20517. isset($dependencies[$releaseVersion]) ? $dependencies[$releaseVersion] : new DependencyInfo(array(), array())
  20518. );
  20519. }
  20520. }
  20521. return new PackageInfo(
  20522. $channelName,
  20523. $packageName,
  20524. $license,
  20525. $shortDescription,
  20526. $description,
  20527. $releases
  20528. );
  20529. }
  20530. }
  20531. <?php
  20532. namespace Composer\Repository\Pear;
  20533. class DependencyConstraint
  20534. {
  20535. private $type;
  20536. private $constraint;
  20537. private $channelName;
  20538. private $packageName;
  20539. public function __construct($type, $constraint, $channelName, $packageName)
  20540. {
  20541. $this->type = $type;
  20542. $this->constraint = $constraint;
  20543. $this->channelName = $channelName;
  20544. $this->packageName = $packageName;
  20545. }
  20546. public function getChannelName()
  20547. {
  20548. return $this->channelName;
  20549. }
  20550. public function getConstraint()
  20551. {
  20552. return $this->constraint;
  20553. }
  20554. public function getPackageName()
  20555. {
  20556. return $this->packageName;
  20557. }
  20558. public function getType()
  20559. {
  20560. return $this->type;
  20561. }
  20562. }
  20563. <?php
  20564. namespace Composer\Repository\Pear;
  20565. class DependencyInfo
  20566. {
  20567. private $requires;
  20568. private $optionals;
  20569. public function __construct($requires, $optionals)
  20570. {
  20571. $this->requires = $requires;
  20572. $this->optionals = $optionals;
  20573. }
  20574. public function getRequires()
  20575. {
  20576. return $this->requires;
  20577. }
  20578. public function getOptionals()
  20579. {
  20580. return $this->optionals;
  20581. }
  20582. }
  20583. <?php
  20584. namespace Composer\Repository\Pear;
  20585. class PackageDependencyParser
  20586. {
  20587. public function buildDependencyInfo($depArray)
  20588. {
  20589. if (!is_array($depArray)) {
  20590. return new DependencyInfo(array(), array());
  20591. }
  20592. if (!$this->isHash($depArray)) {
  20593. return new DependencyInfo($this->buildDependency10Info($depArray), array());
  20594. }
  20595. return $this->buildDependency20Info($depArray);
  20596. }
  20597. private function buildDependency10Info($depArray)
  20598. {
  20599. static $dep10toOperatorMap = array('has' => '==', 'eq' => '==', 'ge' => '>=', 'gt' => '>', 'le' => '<=', 'lt' => '<', 'not' => '!=');
  20600. $result = array();
  20601. foreach ($depArray as $depItem) {
  20602. if (empty($depItem['rel']) || !array_key_exists($depItem['rel'], $dep10toOperatorMap)) {
  20603. continue;
  20604. }
  20605. $depType = !empty($depItem['optional']) && 'yes' == $depItem['optional']
  20606. ? 'optional'
  20607. : 'required';
  20608. $depType = 'not' == $depItem['rel']
  20609. ? 'conflicts'
  20610. : $depType;
  20611. $depVersion = !empty($depItem['version']) ? $this->parseVersion($depItem['version']) : '*';
  20612. $depVersionConstraint = ('has' == $depItem['rel'] || 'not' == $depItem['rel']) && '*' == $depVersion
  20613. ? '*'
  20614. : $dep10toOperatorMap[$depItem['rel']] . $depVersion;
  20615. switch ($depItem['type']) {
  20616. case 'php':
  20617. $depChannelName = 'php';
  20618. $depPackageName = '';
  20619. break;
  20620. case 'pkg':
  20621. $depChannelName = !empty($depItem['channel']) ? $depItem['channel'] : 'pear.php.net';
  20622. $depPackageName = $depItem['name'];
  20623. break;
  20624. case 'ext':
  20625. $depChannelName = 'ext';
  20626. $depPackageName = $depItem['name'];
  20627. break;
  20628. case 'os':
  20629. case 'sapi':
  20630. $depChannelName = '';
  20631. $depPackageName = '';
  20632. break;
  20633. default:
  20634. $depChannelName = '';
  20635. $depPackageName = '';
  20636. break;
  20637. }
  20638. if ('' != $depChannelName) {
  20639. $result[] = new DependencyConstraint(
  20640. $depType,
  20641. $depVersionConstraint,
  20642. $depChannelName,
  20643. $depPackageName
  20644. );
  20645. }
  20646. }
  20647. return $result;
  20648. }
  20649. private function buildDependency20Info($depArray)
  20650. {
  20651. $result = array();
  20652. $optionals = array();
  20653. $defaultOptionals = array();
  20654. foreach ($depArray as $depType => $depTypeGroup) {
  20655. if (!is_array($depTypeGroup)) {
  20656. continue;
  20657. }
  20658. if ('required' == $depType || 'optional' == $depType) {
  20659. foreach ($depTypeGroup as $depItemType => $depItem) {
  20660. switch ($depItemType) {
  20661. case 'php':
  20662. $result[] = new DependencyConstraint(
  20663. $depType,
  20664. $this->parse20VersionConstraint($depItem),
  20665. 'php',
  20666. ''
  20667. );
  20668. break;
  20669. case 'package':
  20670. $deps = $this->buildDepPackageConstraints($depItem, $depType);
  20671. $result = array_merge($result, $deps);
  20672. break;
  20673. case 'extension':
  20674. $deps = $this->buildDepExtensionConstraints($depItem, $depType);
  20675. $result = array_merge($result, $deps);
  20676. break;
  20677. case 'subpackage':
  20678. $deps = $this->buildDepPackageConstraints($depItem, 'replaces');
  20679. $defaultOptionals += $deps;
  20680. break;
  20681. case 'os':
  20682. case 'pearinstaller':
  20683. break;
  20684. default:
  20685. break;
  20686. }
  20687. }
  20688. } elseif ('group' == $depType) {
  20689. if ($this->isHash($depTypeGroup)) {
  20690. $depTypeGroup = array($depTypeGroup);
  20691. }
  20692. foreach ($depTypeGroup as $depItem) {
  20693. $groupName = $depItem['attribs']['name'];
  20694. if (!isset($optionals[$groupName])) {
  20695. $optionals[$groupName] = array();
  20696. }
  20697. if (isset($depItem['subpackage'])) {
  20698. $optionals[$groupName] += $this->buildDepPackageConstraints($depItem['subpackage'], 'replaces');
  20699. } else {
  20700. $result += $this->buildDepPackageConstraints($depItem['package'], 'optional');
  20701. }
  20702. }
  20703. }
  20704. }
  20705. if (count($defaultOptionals) > 0) {
  20706. $optionals['*'] = $defaultOptionals;
  20707. }
  20708. return new DependencyInfo($result, $optionals);
  20709. }
  20710. private function buildDepExtensionConstraints($depItem, $depType)
  20711. {
  20712. if ($this->isHash($depItem)) {
  20713. $depItem = array($depItem);
  20714. }
  20715. $result = array();
  20716. foreach ($depItem as $subDepItem) {
  20717. $depChannelName = 'ext';
  20718. $depPackageName = $subDepItem['name'];
  20719. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  20720. $result[] = new DependencyConstraint(
  20721. $depType,
  20722. $depVersionConstraint,
  20723. $depChannelName,
  20724. $depPackageName
  20725. );
  20726. }
  20727. return $result;
  20728. }
  20729. private function buildDepPackageConstraints($depItem, $depType)
  20730. {
  20731. if ($this->isHash($depItem)) {
  20732. $depItem = array($depItem);
  20733. }
  20734. $result = array();
  20735. foreach ($depItem as $subDepItem) {
  20736. if (!array_key_exists('channel', $subDepItem)) {
  20737. $subDepItem['channel'] = $subDepItem['uri'];
  20738. }
  20739. $depChannelName = $subDepItem['channel'];
  20740. $depPackageName = $subDepItem['name'];
  20741. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  20742. if (isset($subDepItem['conflicts'])) {
  20743. $depType = 'conflicts';
  20744. }
  20745. $result[] = new DependencyConstraint(
  20746. $depType,
  20747. $depVersionConstraint,
  20748. $depChannelName,
  20749. $depPackageName
  20750. );
  20751. }
  20752. return $result;
  20753. }
  20754. private function parse20VersionConstraint(array $data)
  20755. {
  20756. static $dep20toOperatorMap = array('has' => '==', 'min' => '>=', 'max' => '<=', 'exclude' => '!=');
  20757. $versions = array();
  20758. $values = array_intersect_key($data, $dep20toOperatorMap);
  20759. if (0 == count($values)) {
  20760. return '*';
  20761. }
  20762. if (isset($values['min']) && isset($values['exclude']) && $data['min'] == $data['exclude']) {
  20763. $versions[] = '>' . $this->parseVersion($values['min']);
  20764. } elseif (isset($values['max']) && isset($values['exclude']) && $data['max'] == $data['exclude']) {
  20765. $versions[] = '<' . $this->parseVersion($values['max']);
  20766. } else {
  20767. foreach ($values as $op => $version) {
  20768. if ('exclude' == $op && is_array($version)) {
  20769. foreach ($version as $versionPart) {
  20770. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($versionPart);
  20771. }
  20772. } else {
  20773. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($version);
  20774. }
  20775. }
  20776. }
  20777. return implode(',', $versions);
  20778. }
  20779. private function parseVersion($version)
  20780. {
  20781. if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?}i', $version, $matches)) {
  20782. $version = $matches[1]
  20783. .(!empty($matches[2]) ? $matches[2] : '.0')
  20784. .(!empty($matches[3]) ? $matches[3] : '.0')
  20785. .(!empty($matches[4]) ? $matches[4] : '.0');
  20786. return $version;
  20787. }
  20788. return null;
  20789. }
  20790. private function isHash(array $array)
  20791. {
  20792. return !array_key_exists(1, $array) && !array_key_exists(0, $array);
  20793. }
  20794. }
  20795. <?php
  20796. namespace Composer\Repository\Pear;
  20797. class PackageInfo
  20798. {
  20799. private $channelName;
  20800. private $packageName;
  20801. private $license;
  20802. private $shortDescription;
  20803. private $description;
  20804. private $releases;
  20805. public function __construct($channelName, $packageName, $license, $shortDescription, $description, $releases)
  20806. {
  20807. $this->channelName = $channelName;
  20808. $this->packageName = $packageName;
  20809. $this->license = $license;
  20810. $this->shortDescription = $shortDescription;
  20811. $this->description = $description;
  20812. $this->releases = $releases;
  20813. }
  20814. public function getChannelName()
  20815. {
  20816. return $this->channelName;
  20817. }
  20818. public function getPackageName()
  20819. {
  20820. return $this->packageName;
  20821. }
  20822. public function getDescription()
  20823. {
  20824. return $this->description;
  20825. }
  20826. public function getShortDescription()
  20827. {
  20828. return $this->shortDescription;
  20829. }
  20830. public function getLicense()
  20831. {
  20832. return $this->license;
  20833. }
  20834. public function getReleases()
  20835. {
  20836. return $this->releases;
  20837. }
  20838. }
  20839. <?php
  20840. namespace Composer\Repository\Pear;
  20841. class ReleaseInfo
  20842. {
  20843. private $stability;
  20844. private $dependencyInfo;
  20845. public function __construct($stability, $dependencyInfo)
  20846. {
  20847. $this->stability = $stability;
  20848. $this->dependencyInfo = $dependencyInfo;
  20849. }
  20850. public function getDependencyInfo()
  20851. {
  20852. return $this->dependencyInfo;
  20853. }
  20854. public function getStability()
  20855. {
  20856. return $this->stability;
  20857. }
  20858. }
  20859. <?php
  20860. namespace Composer\Repository;
  20861. use Composer\IO\IOInterface;
  20862. use Composer\Semver\VersionParser as SemverVersionParser;
  20863. use Composer\Package\Version\VersionParser;
  20864. use Composer\Repository\Pear\ChannelReader;
  20865. use Composer\Package\CompletePackage;
  20866. use Composer\Repository\Pear\ChannelInfo;
  20867. use Composer\EventDispatcher\EventDispatcher;
  20868. use Composer\Package\Link;
  20869. use Composer\Semver\Constraint\Constraint;
  20870. use Composer\Util\RemoteFilesystem;
  20871. use Composer\Config;
  20872. use Composer\Factory;
  20873. class PearRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  20874. {
  20875. private $url;
  20876. private $io;
  20877. private $rfs;
  20878. private $versionParser;
  20879. private $repoConfig;
  20880. private $vendorAlias;
  20881. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, RemoteFilesystem $rfs = null)
  20882. {
  20883. parent::__construct();
  20884. if (!preg_match('{^https?://}', $repoConfig['url'])) {
  20885. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  20886. }
  20887. $urlBits = parse_url($repoConfig['url']);
  20888. if (empty($urlBits['scheme']) || empty($urlBits['host'])) {
  20889. throw new \UnexpectedValueException('Invalid url given for PEAR repository: '.$repoConfig['url']);
  20890. }
  20891. $this->url = rtrim($repoConfig['url'], '/');
  20892. $this->io = $io;
  20893. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  20894. $this->vendorAlias = isset($repoConfig['vendor-alias']) ? $repoConfig['vendor-alias'] : null;
  20895. $this->versionParser = new VersionParser();
  20896. $this->repoConfig = $repoConfig;
  20897. }
  20898. public function getRepoConfig()
  20899. {
  20900. return $this->repoConfig;
  20901. }
  20902. protected function initialize()
  20903. {
  20904. parent::initialize();
  20905. $this->io->writeError('Initializing PEAR repository '.$this->url);
  20906. $reader = new ChannelReader($this->rfs);
  20907. try {
  20908. $channelInfo = $reader->read($this->url);
  20909. } catch (\Exception $e) {
  20910. $this->io->writeError('<warning>PEAR repository from '.$this->url.' could not be loaded. '.$e->getMessage().'</warning>');
  20911. return;
  20912. }
  20913. $packages = $this->buildComposerPackages($channelInfo, $this->versionParser);
  20914. foreach ($packages as $package) {
  20915. $this->addPackage($package);
  20916. }
  20917. }
  20918. private function buildComposerPackages(ChannelInfo $channelInfo, SemverVersionParser $versionParser)
  20919. {
  20920. $result = array();
  20921. foreach ($channelInfo->getPackages() as $packageDefinition) {
  20922. foreach ($packageDefinition->getReleases() as $version => $releaseInfo) {
  20923. try {
  20924. $normalizedVersion = $versionParser->normalize($version);
  20925. } catch (\UnexpectedValueException $e) {
  20926. $this->io->writeError('Could not load '.$packageDefinition->getPackageName().' '.$version.': '.$e->getMessage(), true, IOInterface::VERBOSE);
  20927. continue;
  20928. }
  20929. $composerPackageName = $this->buildComposerPackageName($packageDefinition->getChannelName(), $packageDefinition->getPackageName());
  20930. $urlBits = parse_url($this->url);
  20931. $scheme = (isset($urlBits['scheme']) && 'https' === $urlBits['scheme'] && extension_loaded('openssl')) ? 'https' : 'http';
  20932. $distUrl = "{$scheme}://{$packageDefinition->getChannelName()}/get/{$packageDefinition->getPackageName()}-{$version}.tgz";
  20933. $requires = array();
  20934. $suggests = array();
  20935. $conflicts = array();
  20936. $replaces = array();
  20937. if ($channelInfo->getName() == $packageDefinition->getChannelName()) {
  20938. $composerPackageAlias = $this->buildComposerPackageName($channelInfo->getAlias(), $packageDefinition->getPackageName());
  20939. $aliasConstraint = new Constraint('==', $normalizedVersion);
  20940. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  20941. }
  20942. if (!empty($this->vendorAlias)
  20943. && ($this->vendorAlias != 'pear-'.$channelInfo->getAlias() || $channelInfo->getName() != $packageDefinition->getChannelName())
  20944. ) {
  20945. $composerPackageAlias = "{$this->vendorAlias}/{$packageDefinition->getPackageName()}";
  20946. $aliasConstraint = new Constraint('==', $normalizedVersion);
  20947. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  20948. }
  20949. foreach ($releaseInfo->getDependencyInfo()->getRequires() as $dependencyConstraint) {
  20950. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  20951. $constraint = $versionParser->parseConstraints($dependencyConstraint->getConstraint());
  20952. $link = new Link($composerPackageName, $dependencyPackageName, $constraint, $dependencyConstraint->getType(), $dependencyConstraint->getConstraint());
  20953. switch ($dependencyConstraint->getType()) {
  20954. case 'required':
  20955. $requires[] = $link;
  20956. break;
  20957. case 'conflicts':
  20958. $conflicts[] = $link;
  20959. break;
  20960. case 'replaces':
  20961. $replaces[] = $link;
  20962. break;
  20963. }
  20964. }
  20965. foreach ($releaseInfo->getDependencyInfo()->getOptionals() as $group => $dependencyConstraints) {
  20966. foreach ($dependencyConstraints as $dependencyConstraint) {
  20967. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  20968. $suggests[$group.'-'.$dependencyPackageName] = $dependencyConstraint->getConstraint();
  20969. }
  20970. }
  20971. $package = new CompletePackage($composerPackageName, $normalizedVersion, $version);
  20972. $package->setType('pear-library');
  20973. $package->setDescription($packageDefinition->getDescription());
  20974. $package->setLicense(array($packageDefinition->getLicense()));
  20975. $package->setDistType('file');
  20976. $package->setDistUrl($distUrl);
  20977. $package->setAutoload(array('classmap' => array('')));
  20978. $package->setIncludePaths(array('/'));
  20979. $package->setRequires($requires);
  20980. $package->setConflicts($conflicts);
  20981. $package->setSuggests($suggests);
  20982. $package->setReplaces($replaces);
  20983. $result[] = $package;
  20984. }
  20985. }
  20986. return $result;
  20987. }
  20988. private function buildComposerPackageName($channelName, $packageName)
  20989. {
  20990. if ('php' === $channelName) {
  20991. return "php";
  20992. }
  20993. if ('ext' === $channelName) {
  20994. return "ext-{$packageName}";
  20995. }
  20996. return "pear-{$channelName}/{$packageName}";
  20997. }
  20998. }
  20999. <?php
  21000. namespace Composer\Repository;
  21001. use Composer\XdebugHandler;
  21002. use Composer\Package\CompletePackage;
  21003. use Composer\Package\PackageInterface;
  21004. use Composer\Package\Version\VersionParser;
  21005. use Composer\Plugin\PluginInterface;
  21006. use Composer\Util\Silencer;
  21007. class PlatformRepository extends ArrayRepository
  21008. {
  21009. const PLATFORM_PACKAGE_REGEX = '{^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[^/ ]+)$}i';
  21010. private $versionParser;
  21011. private $overrides = array();
  21012. public function __construct(array $packages = array(), array $overrides = array())
  21013. {
  21014. foreach ($overrides as $name => $version) {
  21015. $this->overrides[strtolower($name)] = array('name' => $name, 'version' => $version);
  21016. }
  21017. parent::__construct($packages);
  21018. }
  21019. protected function initialize()
  21020. {
  21021. parent::initialize();
  21022. $this->versionParser = new VersionParser();
  21023. foreach ($this->overrides as $override) {
  21024. if (!preg_match(self::PLATFORM_PACKAGE_REGEX, $override['name'])) {
  21025. throw new \InvalidArgumentException('Invalid platform package name in config.platform: '.$override['name']);
  21026. }
  21027. $this->addOverriddenPackage($override);
  21028. }
  21029. $prettyVersion = PluginInterface::PLUGIN_API_VERSION;
  21030. $version = $this->versionParser->normalize($prettyVersion);
  21031. $composerPluginApi = new CompletePackage('composer-plugin-api', $version, $prettyVersion);
  21032. $composerPluginApi->setDescription('The Composer Plugin API');
  21033. $this->addPackage($composerPluginApi);
  21034. try {
  21035. $prettyVersion = PHP_VERSION;
  21036. $version = $this->versionParser->normalize($prettyVersion);
  21037. } catch (\UnexpectedValueException $e) {
  21038. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', PHP_VERSION);
  21039. $version = $this->versionParser->normalize($prettyVersion);
  21040. }
  21041. $php = new CompletePackage('php', $version, $prettyVersion);
  21042. $php->setDescription('The PHP interpreter');
  21043. $this->addPackage($php);
  21044. if (PHP_DEBUG) {
  21045. $phpdebug = new CompletePackage('php-debug', $version, $prettyVersion);
  21046. $phpdebug->setDescription('The PHP interpreter, with debugging symbols');
  21047. $this->addPackage($phpdebug);
  21048. }
  21049. if (defined('PHP_ZTS') && PHP_ZTS) {
  21050. $phpzts = new CompletePackage('php-zts', $version, $prettyVersion);
  21051. $phpzts->setDescription('The PHP interpreter, with Zend Thread Safety');
  21052. $this->addPackage($phpzts);
  21053. }
  21054. if (PHP_INT_SIZE === 8) {
  21055. $php64 = new CompletePackage('php-64bit', $version, $prettyVersion);
  21056. $php64->setDescription('The PHP interpreter, 64bit');
  21057. $this->addPackage($php64);
  21058. }
  21059. if (defined('AF_INET6') || Silencer::call('inet_pton', '::') !== false) {
  21060. $phpIpv6 = new CompletePackage('php-ipv6', $version, $prettyVersion);
  21061. $phpIpv6->setDescription('The PHP interpreter, with IPv6 support');
  21062. $this->addPackage($phpIpv6);
  21063. }
  21064. $loadedExtensions = get_loaded_extensions();
  21065. foreach ($loadedExtensions as $name) {
  21066. if (in_array($name, array('standard', 'Core'))) {
  21067. continue;
  21068. }
  21069. $reflExt = new \ReflectionExtension($name);
  21070. $prettyVersion = $reflExt->getVersion();
  21071. $this->addExtension($name, $prettyVersion);
  21072. }
  21073. if (!in_array('xdebug', $loadedExtensions, true) && ($prettyVersion = strval(getenv(XdebugHandler::ENV_VERSION)))) {
  21074. $this->addExtension('xdebug', $prettyVersion);
  21075. }
  21076. foreach ($loadedExtensions as $name) {
  21077. $prettyVersion = null;
  21078. $description = 'The '.$name.' PHP library';
  21079. switch ($name) {
  21080. case 'curl':
  21081. $curlVersion = curl_version();
  21082. $prettyVersion = $curlVersion['version'];
  21083. break;
  21084. case 'iconv':
  21085. $prettyVersion = ICONV_VERSION;
  21086. break;
  21087. case 'intl':
  21088. $name = 'ICU';
  21089. if (defined('INTL_ICU_VERSION')) {
  21090. $prettyVersion = INTL_ICU_VERSION;
  21091. } else {
  21092. $reflector = new \ReflectionExtension('intl');
  21093. ob_start();
  21094. $reflector->info();
  21095. $output = ob_get_clean();
  21096. preg_match('/^ICU version => (.*)$/m', $output, $matches);
  21097. $prettyVersion = $matches[1];
  21098. }
  21099. break;
  21100. case 'libxml':
  21101. $prettyVersion = LIBXML_DOTTED_VERSION;
  21102. break;
  21103. case 'openssl':
  21104. $prettyVersion = preg_replace_callback('{^(?:OpenSSL|LibreSSL)?\s*([0-9.]+)([a-z]*).*}i', function ($match) {
  21105. if (empty($match[2])) {
  21106. return $match[1];
  21107. }
  21108. if (!preg_match('{^z*[a-z]$}', $match[2])) {
  21109. return 0;
  21110. }
  21111. $len = strlen($match[2]);
  21112. $patchVersion = ($len - 1) * 26;
  21113. $patchVersion += ord($match[2][$len - 1]) - 96;
  21114. return $match[1].'.'.$patchVersion;
  21115. }, OPENSSL_VERSION_TEXT);
  21116. $description = OPENSSL_VERSION_TEXT;
  21117. break;
  21118. case 'pcre':
  21119. $prettyVersion = preg_replace('{^(\S+).*}', '$1', PCRE_VERSION);
  21120. break;
  21121. case 'uuid':
  21122. $prettyVersion = phpversion('uuid');
  21123. break;
  21124. case 'xsl':
  21125. $prettyVersion = LIBXSLT_DOTTED_VERSION;
  21126. break;
  21127. default:
  21128. continue 2;
  21129. }
  21130. try {
  21131. $version = $this->versionParser->normalize($prettyVersion);
  21132. } catch (\UnexpectedValueException $e) {
  21133. continue;
  21134. }
  21135. $lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
  21136. $lib->setDescription($description);
  21137. $this->addPackage($lib);
  21138. }
  21139. if (defined('HHVM_VERSION')) {
  21140. try {
  21141. $prettyVersion = HHVM_VERSION;
  21142. $version = $this->versionParser->normalize($prettyVersion);
  21143. } catch (\UnexpectedValueException $e) {
  21144. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', HHVM_VERSION);
  21145. $version = $this->versionParser->normalize($prettyVersion);
  21146. }
  21147. $hhvm = new CompletePackage('hhvm', $version, $prettyVersion);
  21148. $hhvm->setDescription('The HHVM Runtime (64bit)');
  21149. $this->addPackage($hhvm);
  21150. }
  21151. }
  21152. public function addPackage(PackageInterface $package)
  21153. {
  21154. if (isset($this->overrides[$package->getName()])) {
  21155. $overrider = $this->findPackage($package->getName(), '*');
  21156. $overrider->setDescription($overrider->getDescription().' (actual: '.$package->getPrettyVersion().')');
  21157. return;
  21158. }
  21159. if (isset($this->overrides['php']) && 0 === strpos($package->getName(), 'php-')) {
  21160. $overrider = $this->addOverriddenPackage($this->overrides['php'], $package->getPrettyName());
  21161. $overrider->setDescription($overrider->getDescription().' (actual: '.$package->getPrettyVersion().')');
  21162. return;
  21163. }
  21164. parent::addPackage($package);
  21165. }
  21166. private function addOverriddenPackage(array $override, $name = null)
  21167. {
  21168. $version = $this->versionParser->normalize($override['version']);
  21169. $package = new CompletePackage($name ?: $override['name'], $version, $override['version']);
  21170. $package->setDescription('Package overridden via config.platform');
  21171. $package->setExtra(array('config.platform' => true));
  21172. parent::addPackage($package);
  21173. return $package;
  21174. }
  21175. private function addExtension($name, $prettyVersion)
  21176. {
  21177. $extraDescription = null;
  21178. try {
  21179. $version = $this->versionParser->normalize($prettyVersion);
  21180. } catch (\UnexpectedValueException $e) {
  21181. $extraDescription = ' (actual version: '.$prettyVersion.')';
  21182. if (preg_match('{^(\d+\.\d+\.\d+(?:\.\d+)?)}', $prettyVersion, $match)) {
  21183. $prettyVersion = $match[1];
  21184. } else {
  21185. $prettyVersion = '0';
  21186. }
  21187. $version = $this->versionParser->normalize($prettyVersion);
  21188. }
  21189. $packageName = $this->buildPackageName($name);
  21190. $ext = new CompletePackage($packageName, $version, $prettyVersion);
  21191. $ext->setDescription('The '.$name.' PHP extension'.$extraDescription);
  21192. $this->addPackage($ext);
  21193. }
  21194. private function buildPackageName($name)
  21195. {
  21196. return 'ext-' . str_replace(' ', '-', $name);
  21197. }
  21198. }
  21199. <?php
  21200. namespace Composer\Repository;
  21201. use Composer\Factory;
  21202. use Composer\IO\IOInterface;
  21203. use Composer\Config;
  21204. use Composer\EventDispatcher\EventDispatcher;
  21205. use Composer\Util\RemoteFilesystem;
  21206. use Composer\Json\JsonFile;
  21207. class RepositoryFactory
  21208. {
  21209. public static function configFromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  21210. {
  21211. if (0 === strpos($repository, 'http')) {
  21212. $repoConfig = array('type' => 'composer', 'url' => $repository);
  21213. } elseif ("json" === pathinfo($repository, PATHINFO_EXTENSION)) {
  21214. $json = new JsonFile($repository, Factory::createRemoteFilesystem($io, $config));
  21215. $data = $json->read();
  21216. if (!empty($data['packages']) || !empty($data['includes']) || !empty($data['provider-includes'])) {
  21217. $repoConfig = array('type' => 'composer', 'url' => 'file://' . strtr(realpath($repository), '\\', '/'));
  21218. } elseif ($allowFilesystem) {
  21219. $repoConfig = array('type' => 'filesystem', 'json' => $json);
  21220. } else {
  21221. throw new \InvalidArgumentException("Invalid repository URL ($repository) given. This file does not contain a valid composer repository.");
  21222. }
  21223. } elseif ('{' === substr($repository, 0, 1)) {
  21224. $repoConfig = JsonFile::parseJson($repository);
  21225. } else {
  21226. throw new \InvalidArgumentException("Invalid repository url ($repository) given. Has to be a .json file, an http url or a JSON object.");
  21227. }
  21228. return $repoConfig;
  21229. }
  21230. public static function fromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  21231. {
  21232. $repoConfig = static::configFromString($io, $config, $repository, $allowFilesystem);
  21233. return static::createRepo($io, $config, $repoConfig);
  21234. }
  21235. public static function createRepo(IOInterface $io, Config $config, array $repoConfig)
  21236. {
  21237. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  21238. $repos = static::createRepos($rm, array($repoConfig));
  21239. return reset($repos);
  21240. }
  21241. public static function defaultRepos(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  21242. {
  21243. if (!$config) {
  21244. $config = Factory::createConfig($io);
  21245. }
  21246. if (!$rm) {
  21247. if (!$io) {
  21248. throw new \InvalidArgumentException('This function requires either an IOInterface or a RepositoryManager');
  21249. }
  21250. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  21251. }
  21252. return static::createRepos($rm, $config->getRepositories());
  21253. }
  21254. public static function manager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  21255. {
  21256. $rm = new RepositoryManager($io, $config, $eventDispatcher, $rfs);
  21257. $rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository');
  21258. $rm->setRepositoryClass('vcs', 'Composer\Repository\VcsRepository');
  21259. $rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
  21260. $rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository');
  21261. $rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository');
  21262. $rm->setRepositoryClass('git-bitbucket', 'Composer\Repository\VcsRepository');
  21263. $rm->setRepositoryClass('github', 'Composer\Repository\VcsRepository');
  21264. $rm->setRepositoryClass('gitlab', 'Composer\Repository\VcsRepository');
  21265. $rm->setRepositoryClass('svn', 'Composer\Repository\VcsRepository');
  21266. $rm->setRepositoryClass('fossil', 'Composer\Repository\VcsRepository');
  21267. $rm->setRepositoryClass('perforce', 'Composer\Repository\VcsRepository');
  21268. $rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository');
  21269. $rm->setRepositoryClass('hg-bitbucket', 'Composer\Repository\VcsRepository');
  21270. $rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');
  21271. $rm->setRepositoryClass('path', 'Composer\Repository\PathRepository');
  21272. return $rm;
  21273. }
  21274. private static function createRepos(RepositoryManager $rm, array $repoConfigs)
  21275. {
  21276. $repos = array();
  21277. foreach ($repoConfigs as $index => $repo) {
  21278. if (is_string($repo)) {
  21279. throw new \UnexpectedValueException('"repositories" should be an array of repository definitions, only a single repository was given');
  21280. }
  21281. if (!is_array($repo)) {
  21282. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') should be an array, '.gettype($repo).' given');
  21283. }
  21284. if (!isset($repo['type'])) {
  21285. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') must have a type defined');
  21286. }
  21287. $name = is_int($index) && isset($repo['url']) ? preg_replace('{^https?://}i', '', $repo['url']) : $index;
  21288. while (isset($repos[$name])) {
  21289. $name .= '2';
  21290. }
  21291. if ($repo['type'] === 'filesystem') {
  21292. $repos[$name] = new FilesystemRepository($repo['json']);
  21293. } else {
  21294. $repos[$name] = $rm->createRepository($repo['type'], $repo, $index);
  21295. }
  21296. }
  21297. return $repos;
  21298. }
  21299. }
  21300. <?php
  21301. namespace Composer\Repository;
  21302. use Composer\Package\PackageInterface;
  21303. interface RepositoryInterface extends \Countable
  21304. {
  21305. const SEARCH_FULLTEXT = 0;
  21306. const SEARCH_NAME = 1;
  21307. public function hasPackage(PackageInterface $package);
  21308. public function findPackage($name, $constraint);
  21309. public function findPackages($name, $constraint = null);
  21310. public function getPackages();
  21311. public function search($query, $mode = 0);
  21312. }
  21313. <?php
  21314. namespace Composer\Repository;
  21315. use Composer\IO\IOInterface;
  21316. use Composer\Config;
  21317. use Composer\EventDispatcher\EventDispatcher;
  21318. use Composer\Package\PackageInterface;
  21319. use Composer\Util\RemoteFilesystem;
  21320. class RepositoryManager
  21321. {
  21322. private $localRepository;
  21323. private $repositories = array();
  21324. private $repositoryClasses = array();
  21325. private $io;
  21326. private $config;
  21327. private $eventDispatcher;
  21328. private $rfs;
  21329. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  21330. {
  21331. $this->io = $io;
  21332. $this->config = $config;
  21333. $this->eventDispatcher = $eventDispatcher;
  21334. $this->rfs = $rfs;
  21335. }
  21336. public function findPackage($name, $constraint)
  21337. {
  21338. foreach ($this->repositories as $repository) {
  21339. if ($package = $repository->findPackage($name, $constraint)) {
  21340. return $package;
  21341. }
  21342. }
  21343. return null;
  21344. }
  21345. public function findPackages($name, $constraint)
  21346. {
  21347. $packages = array();
  21348. foreach ($this->repositories as $repository) {
  21349. $packages = array_merge($packages, $repository->findPackages($name, $constraint));
  21350. }
  21351. return $packages;
  21352. }
  21353. public function addRepository(RepositoryInterface $repository)
  21354. {
  21355. $this->repositories[] = $repository;
  21356. }
  21357. public function prependRepository(RepositoryInterface $repository)
  21358. {
  21359. array_unshift($this->repositories, $repository);
  21360. }
  21361. public function createRepository($type, $config, $name = null)
  21362. {
  21363. if (!isset($this->repositoryClasses[$type])) {
  21364. throw new \InvalidArgumentException('Repository type is not registered: '.$type);
  21365. }
  21366. if (isset($config['packagist']) && false === $config['packagist']) {
  21367. $this->io->writeError('<warning>Repository "'.$name.'" ('.json_encode($config).') has a packagist key which should be in its own repository definition</warning>');
  21368. }
  21369. $class = $this->repositoryClasses[$type];
  21370. $reflMethod = new \ReflectionMethod($class, '__construct');
  21371. $params = $reflMethod->getParameters();
  21372. if (isset($params[4]) && $params[4]->getClass() && $params[4]->getClass()->getName() === 'Composer\Util\RemoteFilesystem') {
  21373. return new $class($config, $this->io, $this->config, $this->eventDispatcher, $this->rfs);
  21374. }
  21375. return new $class($config, $this->io, $this->config, $this->eventDispatcher);
  21376. }
  21377. public function setRepositoryClass($type, $class)
  21378. {
  21379. $this->repositoryClasses[$type] = $class;
  21380. }
  21381. public function getRepositories()
  21382. {
  21383. return $this->repositories;
  21384. }
  21385. public function setLocalRepository(WritableRepositoryInterface $repository)
  21386. {
  21387. $this->localRepository = $repository;
  21388. }
  21389. public function getLocalRepository()
  21390. {
  21391. return $this->localRepository;
  21392. }
  21393. }
  21394. <?php
  21395. namespace Composer\Repository;
  21396. class RepositorySecurityException extends \Exception
  21397. {
  21398. }
  21399. <?php
  21400. namespace Composer\Repository\Vcs;
  21401. use Composer\Cache;
  21402. use Composer\Downloader\TransportException;
  21403. use Composer\Json\JsonFile;
  21404. use Composer\Util\Bitbucket;
  21405. abstract class BitbucketDriver extends VcsDriver
  21406. {
  21407. protected $cache;
  21408. protected $owner;
  21409. protected $repository;
  21410. protected $hasIssues;
  21411. protected $rootIdentifier;
  21412. protected $tags;
  21413. protected $branches;
  21414. protected $infoCache = array();
  21415. protected $branchesUrl = '';
  21416. protected $tagsUrl = '';
  21417. protected $homeUrl = '';
  21418. protected $website = '';
  21419. protected $cloneHttpsUrl = '';
  21420. protected $fallbackDriver;
  21421. protected $vcsType;
  21422. public function initialize()
  21423. {
  21424. preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)$#', $this->url, $match);
  21425. $this->owner = $match[1];
  21426. $this->repository = $match[2];
  21427. $this->originUrl = 'bitbucket.org';
  21428. $this->cache = new Cache(
  21429. $this->io,
  21430. implode('/', array(
  21431. $this->config->get('cache-repo-dir'),
  21432. $this->originUrl,
  21433. $this->owner,
  21434. $this->repository,
  21435. ))
  21436. );
  21437. }
  21438. public function getUrl()
  21439. {
  21440. if ($this->fallbackDriver) {
  21441. return $this->fallbackDriver->getUrl();
  21442. }
  21443. return $this->cloneHttpsUrl;
  21444. }
  21445. protected function getRepoData()
  21446. {
  21447. $resource = sprintf(
  21448. 'https://api.bitbucket.org/2.0/repositories/%s/%s?%s',
  21449. $this->owner,
  21450. $this->repository,
  21451. http_build_query(
  21452. array('fields' => '-project,-owner'),
  21453. null,
  21454. '&'
  21455. )
  21456. );
  21457. $repoData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource, true), $resource);
  21458. if ($this->fallbackDriver) {
  21459. return false;
  21460. }
  21461. $this->parseCloneUrls($repoData['links']['clone']);
  21462. $this->hasIssues = !empty($repoData['has_issues']);
  21463. $this->branchesUrl = $repoData['links']['branches']['href'];
  21464. $this->tagsUrl = $repoData['links']['tags']['href'];
  21465. $this->homeUrl = $repoData['links']['html']['href'];
  21466. $this->website = $repoData['website'];
  21467. $this->vcsType = $repoData['scm'];
  21468. return true;
  21469. }
  21470. public function getComposerInformation($identifier)
  21471. {
  21472. if ($this->fallbackDriver) {
  21473. return $this->fallbackDriver->getComposerInformation($identifier);
  21474. }
  21475. if (!isset($this->infoCache[$identifier])) {
  21476. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  21477. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  21478. }
  21479. $composer = $this->getBaseComposerInformation($identifier);
  21480. if (!isset($composer['support']['source'])) {
  21481. $label = array_search(
  21482. $identifier,
  21483. $this->getTags()
  21484. ) ?: array_search(
  21485. $identifier,
  21486. $this->getBranches()
  21487. ) ?: $identifier;
  21488. if (array_key_exists($label, $tags = $this->getTags())) {
  21489. $hash = $tags[$label];
  21490. } elseif (array_key_exists($label, $branches = $this->getBranches())) {
  21491. $hash = $branches[$label];
  21492. }
  21493. if (! isset($hash)) {
  21494. $composer['support']['source'] = sprintf(
  21495. 'https://%s/%s/%s/src',
  21496. $this->originUrl,
  21497. $this->owner,
  21498. $this->repository
  21499. );
  21500. } else {
  21501. $composer['support']['source'] = sprintf(
  21502. 'https://%s/%s/%s/src/%s/?at=%s',
  21503. $this->originUrl,
  21504. $this->owner,
  21505. $this->repository,
  21506. $hash,
  21507. $label
  21508. );
  21509. }
  21510. }
  21511. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  21512. $composer['support']['issues'] = sprintf(
  21513. 'https://%s/%s/%s/issues',
  21514. $this->originUrl,
  21515. $this->owner,
  21516. $this->repository
  21517. );
  21518. }
  21519. if (!isset($composer['homepage'])) {
  21520. $composer['homepage'] = empty($this->website) ? $this->homeUrl : $this->website;
  21521. }
  21522. $this->infoCache[$identifier] = $composer;
  21523. if ($this->shouldCache($identifier)) {
  21524. $this->cache->write($identifier, json_encode($composer));
  21525. }
  21526. }
  21527. return $this->infoCache[$identifier];
  21528. }
  21529. public function getFileContent($file, $identifier)
  21530. {
  21531. if ($this->fallbackDriver) {
  21532. return $this->fallbackDriver->getFileContent($file, $identifier);
  21533. }
  21534. $resource = sprintf(
  21535. 'https://api.bitbucket.org/1.0/repositories/%s/%s/raw/%s/%s',
  21536. $this->owner,
  21537. $this->repository,
  21538. $identifier,
  21539. $file
  21540. );
  21541. return $this->getContentsWithOAuthCredentials($resource);
  21542. }
  21543. public function getChangeDate($identifier)
  21544. {
  21545. if ($this->fallbackDriver) {
  21546. return $this->fallbackDriver->getChangeDate($identifier);
  21547. }
  21548. $resource = sprintf(
  21549. 'https://api.bitbucket.org/2.0/repositories/%s/%s/commit/%s?fields=date',
  21550. $this->owner,
  21551. $this->repository,
  21552. $identifier
  21553. );
  21554. $commit = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  21555. return new \DateTime($commit['date']);
  21556. }
  21557. public function getSource($identifier)
  21558. {
  21559. if ($this->fallbackDriver) {
  21560. return $this->fallbackDriver->getSource($identifier);
  21561. }
  21562. return array('type' => $this->vcsType, 'url' => $this->getUrl(), 'reference' => $identifier);
  21563. }
  21564. public function getDist($identifier)
  21565. {
  21566. if ($this->fallbackDriver) {
  21567. return $this->fallbackDriver->getDist($identifier);
  21568. }
  21569. $url = sprintf(
  21570. 'https://bitbucket.org/%s/%s/get/%s.zip',
  21571. $this->owner,
  21572. $this->repository,
  21573. $identifier
  21574. );
  21575. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  21576. }
  21577. public function getTags()
  21578. {
  21579. if ($this->fallbackDriver) {
  21580. return $this->fallbackDriver->getTags();
  21581. }
  21582. if (null === $this->tags) {
  21583. $this->tags = array();
  21584. $resource = sprintf(
  21585. '%s?%s',
  21586. $this->tagsUrl,
  21587. http_build_query(
  21588. array(
  21589. 'pagelen' => 100,
  21590. 'fields' => 'values.name,values.target.hash,next',
  21591. 'sort' => '-target.date',
  21592. ),
  21593. null,
  21594. '&'
  21595. )
  21596. );
  21597. $hasNext = true;
  21598. while ($hasNext) {
  21599. $tagsData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  21600. foreach ($tagsData['values'] as $data) {
  21601. $this->tags[$data['name']] = $data['target']['hash'];
  21602. }
  21603. if (empty($tagsData['next'])) {
  21604. $hasNext = false;
  21605. } else {
  21606. $resource = $tagsData['next'];
  21607. }
  21608. }
  21609. if ($this->vcsType === 'hg') {
  21610. unset($this->tags['tip']);
  21611. }
  21612. }
  21613. return $this->tags;
  21614. }
  21615. public function getBranches()
  21616. {
  21617. if ($this->fallbackDriver) {
  21618. return $this->fallbackDriver->getBranches();
  21619. }
  21620. if (null === $this->branches) {
  21621. $this->branches = array();
  21622. $resource = sprintf(
  21623. '%s?%s',
  21624. $this->branchesUrl,
  21625. http_build_query(
  21626. array(
  21627. 'pagelen' => 100,
  21628. 'fields' => 'values.name,values.target.hash,values.heads,next',
  21629. 'sort' => '-target.date',
  21630. ),
  21631. null,
  21632. '&'
  21633. )
  21634. );
  21635. $hasNext = true;
  21636. while ($hasNext) {
  21637. $branchData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  21638. foreach ($branchData['values'] as $data) {
  21639. if ($this->vcsType === 'hg' && empty($data['heads'])) {
  21640. continue;
  21641. }
  21642. $this->branches[$data['name']] = $data['target']['hash'];
  21643. }
  21644. if (empty($branchData['next'])) {
  21645. $hasNext = false;
  21646. } else {
  21647. $resource = $branchData['next'];
  21648. }
  21649. }
  21650. }
  21651. return $this->branches;
  21652. }
  21653. protected function getContentsWithOAuthCredentials($url, $fetchingRepoData = false)
  21654. {
  21655. try {
  21656. return parent::getContents($url);
  21657. } catch (TransportException $e) {
  21658. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process, $this->remoteFilesystem);
  21659. if (403 === $e->getCode() || (401 === $e->getCode() && strpos($e->getMessage(), 'Could not authenticate against') === 0)) {
  21660. if (!$this->io->hasAuthentication($this->originUrl)
  21661. && $bitbucketUtil->authorizeOAuth($this->originUrl)
  21662. ) {
  21663. return parent::getContents($url);
  21664. }
  21665. if (!$this->io->isInteractive() && $fetchingRepoData) {
  21666. return $this->attemptCloneFallback();
  21667. }
  21668. }
  21669. throw $e;
  21670. }
  21671. }
  21672. abstract protected function generateSshUrl();
  21673. protected function attemptCloneFallback()
  21674. {
  21675. try {
  21676. $this->setupFallbackDriver($this->generateSshUrl());
  21677. } catch (\RuntimeException $e) {
  21678. $this->fallbackDriver = null;
  21679. $this->io->writeError(
  21680. '<error>Failed to clone the ' . $this->generateSshUrl() . ' repository, try running in interactive mode'
  21681. . ' so that you can enter your Bitbucket OAuth consumer credentials</error>'
  21682. );
  21683. throw $e;
  21684. }
  21685. }
  21686. abstract protected function setupFallbackDriver($url);
  21687. protected function parseCloneUrls(array $cloneLinks)
  21688. {
  21689. foreach ($cloneLinks as $cloneLink) {
  21690. if ($cloneLink['name'] === 'https') {
  21691. $this->cloneHttpsUrl = preg_replace('/https:\/\/([^@]+@)?/', 'https://', $cloneLink['href']);
  21692. }
  21693. }
  21694. }
  21695. protected function getMainBranchData()
  21696. {
  21697. $resource = sprintf(
  21698. 'https://api.bitbucket.org/1.0/repositories/%s/%s/main-branch',
  21699. $this->owner,
  21700. $this->repository
  21701. );
  21702. return JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  21703. }
  21704. }
  21705. <?php
  21706. namespace Composer\Repository\Vcs;
  21707. use Composer\Config;
  21708. use Composer\Util\ProcessExecutor;
  21709. use Composer\Util\Filesystem;
  21710. use Composer\IO\IOInterface;
  21711. class FossilDriver extends VcsDriver
  21712. {
  21713. protected $tags;
  21714. protected $branches;
  21715. protected $rootIdentifier;
  21716. protected $repoFile;
  21717. protected $checkoutDir;
  21718. protected $infoCache = array();
  21719. public function initialize()
  21720. {
  21721. $this->checkFossil();
  21722. $this->config->prohibitUrlByConfig($this->url, $this->io);
  21723. if (Filesystem::isLocalPath($this->url) && is_dir($this->url)) {
  21724. $this->checkoutDir = $this->url;
  21725. } else {
  21726. $localName = preg_replace('{[^a-z0-9]}i', '-', $this->url);
  21727. $this->repoFile = $this->config->get('cache-repo-dir') . '/' . $localName . '.fossil';
  21728. $this->checkoutDir = $this->config->get('cache-vcs-dir') . '/' . $localName . '/';
  21729. $this->updateLocalRepo();
  21730. }
  21731. $this->getTags();
  21732. $this->getBranches();
  21733. }
  21734. protected function checkFossil()
  21735. {
  21736. if (0 !== $this->process->execute('fossil version', $ignoredOutput)) {
  21737. throw new \RuntimeException("fossil was not found, check that it is installed and in your PATH env.\n\n" . $this->process->getErrorOutput());
  21738. }
  21739. }
  21740. protected function updateLocalRepo()
  21741. {
  21742. $fs = new Filesystem();
  21743. $fs->ensureDirectoryExists($this->checkoutDir);
  21744. if (!is_writable(dirname($this->checkoutDir))) {
  21745. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$this->checkoutDir.'" directory is not writable by the current user.');
  21746. }
  21747. if (is_file($this->repoFile) && is_dir($this->checkoutDir) && 0 === $this->process->execute('fossil info', $output, $this->checkoutDir)) {
  21748. if (0 !== $this->process->execute('fossil pull', $output, $this->checkoutDir)) {
  21749. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  21750. }
  21751. } else {
  21752. $fs->removeDirectory($this->checkoutDir);
  21753. $fs->remove($this->repoFile);
  21754. $fs->ensureDirectoryExists($this->checkoutDir);
  21755. if (0 !== $this->process->execute(sprintf('fossil clone %s %s', ProcessExecutor::escape($this->url), ProcessExecutor::escape($this->repoFile)), $output)) {
  21756. $output = $this->process->getErrorOutput();
  21757. throw new \RuntimeException('Failed to clone '.$this->url.' to repository ' . $this->repoFile . "\n\n" .$output);
  21758. }
  21759. if (0 !== $this->process->execute(sprintf('fossil open %s --nested', ProcessExecutor::escape($this->repoFile)), $output, $this->checkoutDir)) {
  21760. $output = $this->process->getErrorOutput();
  21761. throw new \RuntimeException('Failed to open repository '.$this->repoFile.' in ' . $this->checkoutDir . "\n\n" .$output);
  21762. }
  21763. }
  21764. }
  21765. public function getRootIdentifier()
  21766. {
  21767. if (null === $this->rootIdentifier) {
  21768. $this->rootIdentifier = 'trunk';
  21769. }
  21770. return $this->rootIdentifier;
  21771. }
  21772. public function getUrl()
  21773. {
  21774. return $this->url;
  21775. }
  21776. public function getSource($identifier)
  21777. {
  21778. return array('type' => 'fossil', 'url' => $this->getUrl(), 'reference' => $identifier);
  21779. }
  21780. public function getDist($identifier)
  21781. {
  21782. return null;
  21783. }
  21784. public function getFileContent($file, $identifier)
  21785. {
  21786. $command = sprintf('fossil cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  21787. $this->process->execute($command, $content, $this->checkoutDir);
  21788. if (!trim($content)) {
  21789. return null;
  21790. }
  21791. return $content;
  21792. }
  21793. public function getChangeDate($identifier)
  21794. {
  21795. $this->process->execute('fossil finfo -b -n 1 composer.json', $output, $this->checkoutDir);
  21796. list($ckout, $date, $message) = explode(' ', trim($output), 3);
  21797. return new \DateTime($date, new \DateTimeZone('UTC'));
  21798. }
  21799. public function getTags()
  21800. {
  21801. if (null === $this->tags) {
  21802. $tags = array();
  21803. $this->process->execute('fossil tag list', $output, $this->checkoutDir);
  21804. foreach ($this->process->splitLines($output) as $tag) {
  21805. $tags[$tag] = $tag;
  21806. }
  21807. $this->tags = $tags;
  21808. }
  21809. return $this->tags;
  21810. }
  21811. public function getBranches()
  21812. {
  21813. if (null === $this->branches) {
  21814. $branches = array();
  21815. $bookmarks = array();
  21816. $this->process->execute('fossil branch list', $output, $this->checkoutDir);
  21817. foreach ($this->process->splitLines($output) as $branch) {
  21818. $branch = trim(preg_replace('/^\*/', '', trim($branch)));
  21819. $branches[$branch] = $branch;
  21820. }
  21821. $this->branches = $branches;
  21822. }
  21823. return $this->branches;
  21824. }
  21825. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  21826. {
  21827. if (preg_match('#(^(?:https?|ssh)://(?:[^@]@)?(?:chiselapp\.com|fossil\.))#i', $url)) {
  21828. return true;
  21829. }
  21830. if (preg_match('!/fossil/|\.fossil!', $url)) {
  21831. return true;
  21832. }
  21833. if (Filesystem::isLocalPath($url)) {
  21834. $url = Filesystem::getPlatformPath($url);
  21835. if (!is_dir($url)) {
  21836. return false;
  21837. }
  21838. $process = new ProcessExecutor();
  21839. if ($process->execute('fossil info', $output, $url) === 0) {
  21840. return true;
  21841. }
  21842. }
  21843. return false;
  21844. }
  21845. }
  21846. <?php
  21847. namespace Composer\Repository\Vcs;
  21848. use Composer\Config;
  21849. use Composer\IO\IOInterface;
  21850. class GitBitbucketDriver extends BitbucketDriver
  21851. {
  21852. public function getRootIdentifier()
  21853. {
  21854. if ($this->fallbackDriver) {
  21855. return $this->fallbackDriver->getRootIdentifier();
  21856. }
  21857. if (null === $this->rootIdentifier) {
  21858. if (! $this->getRepoData()) {
  21859. return $this->fallbackDriver->getRootIdentifier();
  21860. }
  21861. if ($this->vcsType !== 'git') {
  21862. throw new \RuntimeException(
  21863. $this->url.' does not appear to be a git repository, use '.
  21864. $this->cloneHttpsUrl.' if this is a mercurial bitbucket repository'
  21865. );
  21866. }
  21867. $mainBranchData = $this->getMainBranchData();
  21868. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'master';
  21869. }
  21870. return $this->rootIdentifier;
  21871. }
  21872. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  21873. {
  21874. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/(.+?)\.git$#', $url)) {
  21875. return false;
  21876. }
  21877. if (!extension_loaded('openssl')) {
  21878. $io->writeError('Skipping Bitbucket git driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  21879. return false;
  21880. }
  21881. return true;
  21882. }
  21883. protected function setupFallbackDriver($url)
  21884. {
  21885. $this->fallbackDriver = new GitDriver(
  21886. array('url' => $url),
  21887. $this->io,
  21888. $this->config,
  21889. $this->process,
  21890. $this->remoteFilesystem
  21891. );
  21892. $this->fallbackDriver->initialize();
  21893. }
  21894. protected function generateSshUrl()
  21895. {
  21896. return 'git@' . $this->originUrl . ':' . $this->owner.'/'.$this->repository.'.git';
  21897. }
  21898. }
  21899. <?php
  21900. namespace Composer\Repository\Vcs;
  21901. use Composer\Util\ProcessExecutor;
  21902. use Composer\Util\Filesystem;
  21903. use Composer\Util\Git as GitUtil;
  21904. use Composer\IO\IOInterface;
  21905. use Composer\Cache;
  21906. use Composer\Config;
  21907. class GitDriver extends VcsDriver
  21908. {
  21909. protected $cache;
  21910. protected $tags;
  21911. protected $branches;
  21912. protected $rootIdentifier;
  21913. protected $repoDir;
  21914. protected $infoCache = array();
  21915. public function initialize()
  21916. {
  21917. if (Filesystem::isLocalPath($this->url)) {
  21918. $this->url = preg_replace('{[\\/]\.git/?$}', '', $this->url);
  21919. $this->repoDir = $this->url;
  21920. $cacheUrl = realpath($this->url);
  21921. } else {
  21922. $this->repoDir = $this->config->get('cache-vcs-dir') . '/' . preg_replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
  21923. GitUtil::cleanEnv();
  21924. $fs = new Filesystem();
  21925. $fs->ensureDirectoryExists(dirname($this->repoDir));
  21926. if (!is_writable(dirname($this->repoDir))) {
  21927. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.dirname($this->repoDir).'" directory is not writable by the current user.');
  21928. }
  21929. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $this->url)) {
  21930. throw new \InvalidArgumentException('The source URL '.$this->url.' is invalid, ssh URLs should have a port number after ":".'."\n".'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.');
  21931. }
  21932. $gitUtil = new GitUtil($this->io, $this->config, $this->process, $fs);
  21933. if (!$gitUtil->syncMirror($this->url, $this->repoDir)) {
  21934. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated</error>');
  21935. }
  21936. $cacheUrl = $this->url;
  21937. }
  21938. $this->getTags();
  21939. $this->getBranches();
  21940. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $cacheUrl));
  21941. }
  21942. public function getRootIdentifier()
  21943. {
  21944. if (null === $this->rootIdentifier) {
  21945. $this->rootIdentifier = 'master';
  21946. $this->process->execute('git branch --no-color', $output, $this->repoDir);
  21947. $branches = $this->process->splitLines($output);
  21948. if (!in_array('* master', $branches)) {
  21949. foreach ($branches as $branch) {
  21950. if ($branch && preg_match('{^\* +(\S+)}', $branch, $match)) {
  21951. $this->rootIdentifier = $match[1];
  21952. break;
  21953. }
  21954. }
  21955. }
  21956. }
  21957. return $this->rootIdentifier;
  21958. }
  21959. public function getUrl()
  21960. {
  21961. return $this->url;
  21962. }
  21963. public function getSource($identifier)
  21964. {
  21965. return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $identifier);
  21966. }
  21967. public function getDist($identifier)
  21968. {
  21969. return null;
  21970. }
  21971. public function getFileContent($file, $identifier)
  21972. {
  21973. $resource = sprintf('%s:%s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  21974. $this->process->execute(sprintf('git show %s', $resource), $content, $this->repoDir);
  21975. if (!trim($content)) {
  21976. return null;
  21977. }
  21978. return $content;
  21979. }
  21980. public function getChangeDate($identifier)
  21981. {
  21982. $this->process->execute(sprintf(
  21983. 'git log -1 --format=%%at %s',
  21984. ProcessExecutor::escape($identifier)
  21985. ), $output, $this->repoDir);
  21986. return new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  21987. }
  21988. public function getTags()
  21989. {
  21990. if (null === $this->tags) {
  21991. $this->tags = array();
  21992. $this->process->execute('git show-ref --tags --dereference', $output, $this->repoDir);
  21993. foreach ($output = $this->process->splitLines($output) as $tag) {
  21994. if ($tag && preg_match('{^([a-f0-9]{40}) refs/tags/(\S+?)(\^\{\})?$}', $tag, $match)) {
  21995. $this->tags[$match[2]] = $match[1];
  21996. }
  21997. }
  21998. }
  21999. return $this->tags;
  22000. }
  22001. public function getBranches()
  22002. {
  22003. if (null === $this->branches) {
  22004. $branches = array();
  22005. $this->process->execute('git branch --no-color --no-abbrev -v', $output, $this->repoDir);
  22006. foreach ($this->process->splitLines($output) as $branch) {
  22007. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  22008. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+)(?: .*)?$}', $branch, $match)) {
  22009. $branches[$match[1]] = $match[2];
  22010. }
  22011. }
  22012. }
  22013. $this->branches = $branches;
  22014. }
  22015. return $this->branches;
  22016. }
  22017. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22018. {
  22019. if (preg_match('#(^git://|\.git/?$|git(?:olite)?@|//git\.|//github.com/)#i', $url)) {
  22020. return true;
  22021. }
  22022. if (Filesystem::isLocalPath($url)) {
  22023. $url = Filesystem::getPlatformPath($url);
  22024. if (!is_dir($url)) {
  22025. return false;
  22026. }
  22027. $process = new ProcessExecutor($io);
  22028. if ($process->execute('git tag', $output, $url) === 0) {
  22029. return true;
  22030. }
  22031. }
  22032. if (!$deep) {
  22033. return false;
  22034. }
  22035. $process = new ProcessExecutor($io);
  22036. return $process->execute('git ls-remote --heads ' . ProcessExecutor::escape($url), $output) === 0;
  22037. }
  22038. }
  22039. <?php
  22040. namespace Composer\Repository\Vcs;
  22041. use Composer\Config;
  22042. use Composer\Downloader\TransportException;
  22043. use Composer\Json\JsonFile;
  22044. use Composer\Cache;
  22045. use Composer\IO\IOInterface;
  22046. use Composer\Util\GitHub;
  22047. class GitHubDriver extends VcsDriver
  22048. {
  22049. protected $cache;
  22050. protected $owner;
  22051. protected $repository;
  22052. protected $tags;
  22053. protected $branches;
  22054. protected $rootIdentifier;
  22055. protected $repoData;
  22056. protected $hasIssues;
  22057. protected $infoCache = array();
  22058. protected $isPrivate = false;
  22059. protected $gitDriver;
  22060. public function initialize()
  22061. {
  22062. preg_match('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git|/)?$#', $this->url, $match);
  22063. $this->owner = $match[3];
  22064. $this->repository = $match[4];
  22065. $this->originUrl = !empty($match[1]) ? $match[1] : $match[2];
  22066. if ($this->originUrl === 'www.github.com') {
  22067. $this->originUrl = 'github.com';
  22068. }
  22069. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  22070. if (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api']) {
  22071. $this->setupGitDriver($this->url);
  22072. return;
  22073. }
  22074. $this->fetchRootIdentifier();
  22075. }
  22076. public function getRepositoryUrl()
  22077. {
  22078. return 'https://'.$this->originUrl.'/'.$this->owner.'/'.$this->repository;
  22079. }
  22080. public function getRootIdentifier()
  22081. {
  22082. if ($this->gitDriver) {
  22083. return $this->gitDriver->getRootIdentifier();
  22084. }
  22085. return $this->rootIdentifier;
  22086. }
  22087. public function getUrl()
  22088. {
  22089. if ($this->gitDriver) {
  22090. return $this->gitDriver->getUrl();
  22091. }
  22092. return 'https://' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  22093. }
  22094. protected function getApiUrl()
  22095. {
  22096. if ('github.com' === $this->originUrl) {
  22097. $apiUrl = 'api.github.com';
  22098. } else {
  22099. $apiUrl = $this->originUrl . '/api/v3';
  22100. }
  22101. return 'https://' . $apiUrl;
  22102. }
  22103. public function getSource($identifier)
  22104. {
  22105. if ($this->gitDriver) {
  22106. return $this->gitDriver->getSource($identifier);
  22107. }
  22108. if ($this->isPrivate) {
  22109. $url = $this->generateSshUrl();
  22110. } else {
  22111. $url = $this->getUrl();
  22112. }
  22113. return array('type' => 'git', 'url' => $url, 'reference' => $identifier);
  22114. }
  22115. public function getDist($identifier)
  22116. {
  22117. $url = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$identifier;
  22118. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  22119. }
  22120. public function getComposerInformation($identifier)
  22121. {
  22122. if ($this->gitDriver) {
  22123. return $this->gitDriver->getComposerInformation($identifier);
  22124. }
  22125. if (!isset($this->infoCache[$identifier])) {
  22126. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  22127. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  22128. }
  22129. $composer = $this->getBaseComposerInformation($identifier);
  22130. if ($composer) {
  22131. if (!isset($composer['support']['source'])) {
  22132. $label = array_search($identifier, $this->getTags()) ?: array_search($identifier, $this->getBranches()) ?: $identifier;
  22133. $composer['support']['source'] = sprintf('https://%s/%s/%s/tree/%s', $this->originUrl, $this->owner, $this->repository, $label);
  22134. }
  22135. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  22136. $composer['support']['issues'] = sprintf('https://%s/%s/%s/issues', $this->originUrl, $this->owner, $this->repository);
  22137. }
  22138. }
  22139. if ($this->shouldCache($identifier)) {
  22140. $this->cache->write($identifier, json_encode($composer));
  22141. }
  22142. $this->infoCache[$identifier] = $composer;
  22143. }
  22144. return $this->infoCache[$identifier];
  22145. }
  22146. public function getFileContent($file, $identifier)
  22147. {
  22148. if ($this->gitDriver) {
  22149. return $this->gitDriver->getFileContent($file, $identifier);
  22150. }
  22151. $notFoundRetries = 2;
  22152. while ($notFoundRetries) {
  22153. try {
  22154. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/' . $file . '?ref='.urlencode($identifier);
  22155. $resource = JsonFile::parseJson($this->getContents($resource));
  22156. if (empty($resource['content']) || $resource['encoding'] !== 'base64' || !($content = base64_decode($resource['content']))) {
  22157. throw new \RuntimeException('Could not retrieve ' . $file . ' for '.$identifier);
  22158. }
  22159. return $content;
  22160. } catch (TransportException $e) {
  22161. if (404 !== $e->getCode()) {
  22162. throw $e;
  22163. }
  22164. $notFoundRetries--;
  22165. return null;
  22166. }
  22167. }
  22168. return null;
  22169. }
  22170. public function getChangeDate($identifier)
  22171. {
  22172. if ($this->gitDriver) {
  22173. return $this->gitDriver->getChangeDate($identifier);
  22174. }
  22175. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier);
  22176. $commit = JsonFile::parseJson($this->getContents($resource), $resource);
  22177. return new \DateTime($commit['commit']['committer']['date']);
  22178. }
  22179. public function getTags()
  22180. {
  22181. if ($this->gitDriver) {
  22182. return $this->gitDriver->getTags();
  22183. }
  22184. if (null === $this->tags) {
  22185. $this->tags = array();
  22186. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/tags?per_page=100';
  22187. do {
  22188. $tagsData = JsonFile::parseJson($this->getContents($resource), $resource);
  22189. foreach ($tagsData as $tag) {
  22190. $this->tags[$tag['name']] = $tag['commit']['sha'];
  22191. }
  22192. $resource = $this->getNextPage();
  22193. } while ($resource);
  22194. }
  22195. return $this->tags;
  22196. }
  22197. public function getBranches()
  22198. {
  22199. if ($this->gitDriver) {
  22200. return $this->gitDriver->getBranches();
  22201. }
  22202. if (null === $this->branches) {
  22203. $this->branches = array();
  22204. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/git/refs/heads?per_page=100';
  22205. $branchBlacklist = array('gh-pages');
  22206. do {
  22207. $branchData = JsonFile::parseJson($this->getContents($resource), $resource);
  22208. foreach ($branchData as $branch) {
  22209. $name = substr($branch['ref'], 11);
  22210. if (!in_array($name, $branchBlacklist)) {
  22211. $this->branches[$name] = $branch['object']['sha'];
  22212. }
  22213. }
  22214. $resource = $this->getNextPage();
  22215. } while ($resource);
  22216. }
  22217. return $this->branches;
  22218. }
  22219. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22220. {
  22221. if (!preg_match('#^((?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git|/)?$#', $url, $matches)) {
  22222. return false;
  22223. }
  22224. $originUrl = !empty($matches[2]) ? $matches[2] : $matches[3];
  22225. if (!in_array(preg_replace('{^www\.}i', '', $originUrl), $config->get('github-domains'))) {
  22226. return false;
  22227. }
  22228. if (!extension_loaded('openssl')) {
  22229. $io->writeError('Skipping GitHub driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  22230. return false;
  22231. }
  22232. return true;
  22233. }
  22234. public function getRepoData()
  22235. {
  22236. $this->fetchRootIdentifier();
  22237. return $this->repoData;
  22238. }
  22239. protected function generateSshUrl()
  22240. {
  22241. return 'git@' . $this->originUrl . ':'.$this->owner.'/'.$this->repository.'.git';
  22242. }
  22243. protected function getContents($url, $fetchingRepoData = false)
  22244. {
  22245. try {
  22246. return parent::getContents($url);
  22247. } catch (TransportException $e) {
  22248. $gitHubUtil = new GitHub($this->io, $this->config, $this->process, $this->remoteFilesystem);
  22249. switch ($e->getCode()) {
  22250. case 401:
  22251. case 404:
  22252. if (!$fetchingRepoData) {
  22253. throw $e;
  22254. }
  22255. if ($gitHubUtil->authorizeOAuth($this->originUrl)) {
  22256. return parent::getContents($url);
  22257. }
  22258. if (!$this->io->isInteractive()) {
  22259. return $this->attemptCloneFallback();
  22260. }
  22261. $scopesIssued = array();
  22262. $scopesNeeded = array();
  22263. if ($headers = $e->getHeaders()) {
  22264. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-OAuth-Scopes')) {
  22265. $scopesIssued = explode(' ', $scopes);
  22266. }
  22267. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-Accepted-OAuth-Scopes')) {
  22268. $scopesNeeded = explode(' ', $scopes);
  22269. }
  22270. }
  22271. $scopesFailed = array_diff($scopesNeeded, $scopesIssued);
  22272. if (!$headers || !count($scopesNeeded) || count($scopesFailed)) {
  22273. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'Your GitHub credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  22274. }
  22275. return parent::getContents($url);
  22276. case 403:
  22277. if (!$this->io->hasAuthentication($this->originUrl) && $gitHubUtil->authorizeOAuth($this->originUrl)) {
  22278. return parent::getContents($url);
  22279. }
  22280. if (!$this->io->isInteractive() && $fetchingRepoData) {
  22281. return $this->attemptCloneFallback();
  22282. }
  22283. $rateLimited = false;
  22284. foreach ($e->getHeaders() as $header) {
  22285. if (preg_match('{^X-RateLimit-Remaining: *0$}i', trim($header))) {
  22286. $rateLimited = true;
  22287. }
  22288. }
  22289. if (!$this->io->hasAuthentication($this->originUrl)) {
  22290. if (!$this->io->isInteractive()) {
  22291. $this->io->writeError('<error>GitHub API limit exhausted. Failed to get metadata for the '.$this->url.' repository, try running in interactive mode so that you can enter your GitHub credentials to increase the API limit</error>');
  22292. throw $e;
  22293. }
  22294. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'API limit exhausted. Enter your GitHub credentials to get a larger API limit (<info>'.$this->url.'</info>)');
  22295. return parent::getContents($url);
  22296. }
  22297. if ($rateLimited) {
  22298. $rateLimit = $this->getRateLimit($e->getHeaders());
  22299. $this->io->writeError(sprintf(
  22300. '<error>GitHub API limit (%d calls/hr) is exhausted. You are already authorized so you have to wait until %s before doing more requests</error>',
  22301. $rateLimit['limit'],
  22302. $rateLimit['reset']
  22303. ));
  22304. }
  22305. throw $e;
  22306. default:
  22307. throw $e;
  22308. }
  22309. }
  22310. }
  22311. protected function getRateLimit(array $headers)
  22312. {
  22313. $rateLimit = array(
  22314. 'limit' => '?',
  22315. 'reset' => '?',
  22316. );
  22317. foreach ($headers as $header) {
  22318. $header = trim($header);
  22319. if (false === strpos($header, 'X-RateLimit-')) {
  22320. continue;
  22321. }
  22322. list($type, $value) = explode(':', $header, 2);
  22323. switch ($type) {
  22324. case 'X-RateLimit-Limit':
  22325. $rateLimit['limit'] = (int) trim($value);
  22326. break;
  22327. case 'X-RateLimit-Reset':
  22328. $rateLimit['reset'] = date('Y-m-d H:i:s', (int) trim($value));
  22329. break;
  22330. }
  22331. }
  22332. return $rateLimit;
  22333. }
  22334. protected function fetchRootIdentifier()
  22335. {
  22336. if ($this->repoData) {
  22337. return;
  22338. }
  22339. $repoDataUrl = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository;
  22340. $this->repoData = JsonFile::parseJson($this->getContents($repoDataUrl, true), $repoDataUrl);
  22341. if (null === $this->repoData && null !== $this->gitDriver) {
  22342. return;
  22343. }
  22344. $this->owner = $this->repoData['owner']['login'];
  22345. $this->repository = $this->repoData['name'];
  22346. $this->isPrivate = !empty($this->repoData['private']);
  22347. if (isset($this->repoData['default_branch'])) {
  22348. $this->rootIdentifier = $this->repoData['default_branch'];
  22349. } elseif (isset($this->repoData['master_branch'])) {
  22350. $this->rootIdentifier = $this->repoData['master_branch'];
  22351. } else {
  22352. $this->rootIdentifier = 'master';
  22353. }
  22354. $this->hasIssues = !empty($this->repoData['has_issues']);
  22355. }
  22356. protected function attemptCloneFallback()
  22357. {
  22358. $this->isPrivate = true;
  22359. try {
  22360. $this->setupGitDriver($this->generateSshUrl());
  22361. return;
  22362. } catch (\RuntimeException $e) {
  22363. $this->gitDriver = null;
  22364. $this->io->writeError('<error>Failed to clone the '.$this->generateSshUrl().' repository, try running in interactive mode so that you can enter your GitHub credentials</error>');
  22365. throw $e;
  22366. }
  22367. }
  22368. protected function setupGitDriver($url)
  22369. {
  22370. $this->gitDriver = new GitDriver(
  22371. array('url' => $url),
  22372. $this->io,
  22373. $this->config,
  22374. $this->process,
  22375. $this->remoteFilesystem
  22376. );
  22377. $this->gitDriver->initialize();
  22378. }
  22379. protected function getNextPage()
  22380. {
  22381. $headers = $this->remoteFilesystem->getLastHeaders();
  22382. foreach ($headers as $header) {
  22383. if (preg_match('{^link:\s*(.+?)\s*$}i', $header, $match)) {
  22384. $links = explode(',', $match[1]);
  22385. foreach ($links as $link) {
  22386. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  22387. return $match[1];
  22388. }
  22389. }
  22390. }
  22391. }
  22392. }
  22393. }
  22394. <?php
  22395. namespace Composer\Repository\Vcs;
  22396. use Composer\Config;
  22397. use Composer\Cache;
  22398. use Composer\IO\IOInterface;
  22399. use Composer\Json\JsonFile;
  22400. use Composer\Downloader\TransportException;
  22401. use Composer\Util\RemoteFilesystem;
  22402. use Composer\Util\GitLab;
  22403. class GitLabDriver extends VcsDriver
  22404. {
  22405. private $scheme;
  22406. private $namespace;
  22407. private $repository;
  22408. private $project;
  22409. private $commits = array();
  22410. private $tags;
  22411. private $branches;
  22412. protected $gitDriver;
  22413. private $isPrivate = true;
  22414. protected $portNumber;
  22415. const URL_REGEX = '#^(?:(?P<scheme>https?)://(?P<domain>.+?)(?::(?P<port>[0-9]+))?/|git@(?P<domain2>[^:]+):)(?P<parts>.+)/(?P<repo>[^/]+?)(?:\.git|/)?$#';
  22416. public function initialize()
  22417. {
  22418. if (!preg_match(self::URL_REGEX, $this->url, $match)) {
  22419. throw new \InvalidArgumentException('The URL provided is invalid. It must be the HTTP URL of a GitLab project.');
  22420. }
  22421. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  22422. $configuredDomains = $this->config->get('gitlab-domains');
  22423. $urlParts = explode('/', $match['parts']);
  22424. $this->scheme = !empty($match['scheme'])
  22425. ? $match['scheme']
  22426. : (isset($this->repoConfig['secure-http']) && $this->repoConfig['secure-http'] === false ? 'http' : 'https')
  22427. ;
  22428. $this->originUrl = $this->determineOrigin($configuredDomains, $guessedDomain, $urlParts);
  22429. if (!empty($match['port']) && true === is_numeric($match['port'])) {
  22430. $this->portNumber = (int) $match['port'];
  22431. }
  22432. $this->namespace = implode('/', $urlParts);
  22433. $this->repository = preg_replace('#(\.git)$#', '', $match['repo']);
  22434. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository);
  22435. $this->fetchProject();
  22436. }
  22437. public function setRemoteFilesystem(RemoteFilesystem $remoteFilesystem)
  22438. {
  22439. $this->remoteFilesystem = $remoteFilesystem;
  22440. }
  22441. public function getFileContent($file, $identifier)
  22442. {
  22443. if ($this->gitDriver) {
  22444. return $this->gitDriver->getFileContent($file, $identifier);
  22445. }
  22446. if (!preg_match('{[a-f0-9]{40}}i', $identifier)) {
  22447. $branches = $this->getBranches();
  22448. if (isset($branches[$identifier])) {
  22449. $identifier = $branches[$identifier];
  22450. }
  22451. }
  22452. $resource = $this->getApiUrl().'/repository/files/'.$this->urlEncodeAll($file).'/raw?ref='.$identifier;
  22453. try {
  22454. $content = $this->getContents($resource);
  22455. } catch (TransportException $e) {
  22456. if ($e->getCode() !== 404) {
  22457. throw $e;
  22458. }
  22459. return null;
  22460. }
  22461. return $content;
  22462. }
  22463. public function getChangeDate($identifier)
  22464. {
  22465. if ($this->gitDriver) {
  22466. return $this->gitDriver->getChangeDate($identifier);
  22467. }
  22468. if (isset($this->commits[$identifier])) {
  22469. return new \DateTime($this->commits[$identifier]['committed_date']);
  22470. }
  22471. return new \DateTime();
  22472. }
  22473. public function getRepositoryUrl()
  22474. {
  22475. return $this->isPrivate ? $this->project['ssh_url_to_repo'] : $this->project['http_url_to_repo'];
  22476. }
  22477. public function getUrl()
  22478. {
  22479. if ($this->gitDriver) {
  22480. return $this->gitDriver->getUrl();
  22481. }
  22482. return $this->project['web_url'];
  22483. }
  22484. public function getDist($identifier)
  22485. {
  22486. $url = $this->getApiUrl().'/repository/archive.zip?sha='.$identifier;
  22487. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  22488. }
  22489. public function getSource($identifier)
  22490. {
  22491. if ($this->gitDriver) {
  22492. return $this->gitDriver->getSource($identifier);
  22493. }
  22494. return array('type' => 'git', 'url' => $this->getRepositoryUrl(), 'reference' => $identifier);
  22495. }
  22496. public function getRootIdentifier()
  22497. {
  22498. if ($this->gitDriver) {
  22499. return $this->gitDriver->getRootIdentifier();
  22500. }
  22501. return $this->project['default_branch'];
  22502. }
  22503. public function getBranches()
  22504. {
  22505. if ($this->gitDriver) {
  22506. return $this->gitDriver->getBranches();
  22507. }
  22508. if (!$this->branches) {
  22509. $this->branches = $this->getReferences('branches');
  22510. }
  22511. return $this->branches;
  22512. }
  22513. public function getTags()
  22514. {
  22515. if ($this->gitDriver) {
  22516. return $this->gitDriver->getTags();
  22517. }
  22518. if (!$this->tags) {
  22519. $this->tags = $this->getReferences('tags');
  22520. }
  22521. return $this->tags;
  22522. }
  22523. public function getApiUrl()
  22524. {
  22525. $domainName = $this->originUrl;
  22526. $portNumber = (true === is_numeric($this->portNumber)) ? sprintf(':%s', $this->portNumber) : '';
  22527. return $this->scheme.'://'.$domainName.$portNumber.'/api/v4/projects/'.$this->urlEncodeAll($this->namespace).'%2F'.$this->urlEncodeAll($this->repository);
  22528. }
  22529. private function urlEncodeAll($string)
  22530. {
  22531. $encoded = '';
  22532. for ($i = 0; isset($string[$i]); $i++) {
  22533. $character = $string[$i];
  22534. if (!ctype_alnum($character) && !in_array($character, array('-', '_'), true)) {
  22535. $character = '%' . sprintf('%02X', ord($character));
  22536. }
  22537. $encoded .= $character;
  22538. }
  22539. return $encoded;
  22540. }
  22541. protected function getReferences($type)
  22542. {
  22543. $perPage = 100;
  22544. $resource = $this->getApiUrl().'/repository/'.$type.'?per_page='.$perPage;
  22545. $references = array();
  22546. do {
  22547. $data = JsonFile::parseJson($this->getContents($resource), $resource);
  22548. foreach ($data as $datum) {
  22549. $references[$datum['name']] = $datum['commit']['id'];
  22550. $this->commits[$datum['commit']['id']] = $datum['commit'];
  22551. }
  22552. if (count($data) >= $perPage) {
  22553. $resource = $this->getNextPage();
  22554. } else {
  22555. $resource = false;
  22556. }
  22557. } while ($resource);
  22558. return $references;
  22559. }
  22560. protected function fetchProject()
  22561. {
  22562. $resource = $this->getApiUrl();
  22563. $this->project = JsonFile::parseJson($this->getContents($resource, true), $resource);
  22564. if (isset($this->project['visibility'])) {
  22565. $this->isPrivate = $this->project['visibility'] !== 'public';
  22566. } else {
  22567. $this->isPrivate = false;
  22568. }
  22569. }
  22570. protected function attemptCloneFallback()
  22571. {
  22572. try {
  22573. if ($this->isPrivate === false) {
  22574. $url = $this->generatePublicUrl();
  22575. } else {
  22576. $url = $this->generateSshUrl();
  22577. }
  22578. $this->setupGitDriver($url);
  22579. return;
  22580. } catch (\RuntimeException $e) {
  22581. $this->gitDriver = null;
  22582. $this->io->writeError('<error>Failed to clone the '.$url.' repository, try running in interactive mode so that you can enter your credentials</error>');
  22583. throw $e;
  22584. }
  22585. }
  22586. protected function generateSshUrl()
  22587. {
  22588. return 'git@' . $this->originUrl . ':'.$this->namespace.'/'.$this->repository.'.git';
  22589. }
  22590. protected function generatePublicUrl()
  22591. {
  22592. return $this->scheme . '://' . $this->originUrl . '/'.$this->namespace.'/'.$this->repository.'.git';
  22593. }
  22594. protected function setupGitDriver($url)
  22595. {
  22596. $this->gitDriver = new GitDriver(
  22597. array('url' => $url),
  22598. $this->io,
  22599. $this->config,
  22600. $this->process,
  22601. $this->remoteFilesystem
  22602. );
  22603. $this->gitDriver->initialize();
  22604. }
  22605. protected function getContents($url, $fetchingRepoData = false)
  22606. {
  22607. try {
  22608. $res = parent::getContents($url);
  22609. if ($fetchingRepoData) {
  22610. $json = JsonFile::parseJson($res, $url);
  22611. if (!isset($json['default_branch'])) {
  22612. if (!empty($json['id'])) {
  22613. $this->isPrivate = false;
  22614. }
  22615. throw new TransportException('GitLab API seems to not be authenticated as it did not return a default_branch', 401);
  22616. }
  22617. }
  22618. return $res;
  22619. } catch (TransportException $e) {
  22620. $gitLabUtil = new GitLab($this->io, $this->config, $this->process, $this->remoteFilesystem);
  22621. switch ($e->getCode()) {
  22622. case 401:
  22623. case 404:
  22624. if (!$fetchingRepoData) {
  22625. throw $e;
  22626. }
  22627. if ($gitLabUtil->authorizeOAuth($this->originUrl)) {
  22628. return parent::getContents($url);
  22629. }
  22630. if (!$this->io->isInteractive()) {
  22631. return $this->attemptCloneFallback();
  22632. }
  22633. $this->io->writeError('<warning>Failed to download ' . $this->namespace . '/' . $this->repository . ':' . $e->getMessage() . '</warning>');
  22634. $gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, 'Your credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  22635. return parent::getContents($url);
  22636. case 403:
  22637. if (!$this->io->hasAuthentication($this->originUrl) && $gitLabUtil->authorizeOAuth($this->originUrl)) {
  22638. return parent::getContents($url);
  22639. }
  22640. if (!$this->io->isInteractive() && $fetchingRepoData) {
  22641. return $this->attemptCloneFallback();
  22642. }
  22643. throw $e;
  22644. default:
  22645. throw $e;
  22646. }
  22647. }
  22648. }
  22649. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22650. {
  22651. if (!preg_match(self::URL_REGEX, $url, $match)) {
  22652. return false;
  22653. }
  22654. $scheme = !empty($match['scheme']) ? $match['scheme'] : null;
  22655. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  22656. $urlParts = explode('/', $match['parts']);
  22657. if (false === self::determineOrigin((array) $config->get('gitlab-domains'), $guessedDomain, $urlParts)) {
  22658. return false;
  22659. }
  22660. if ('https' === $scheme && !extension_loaded('openssl')) {
  22661. $io->writeError('Skipping GitLab driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  22662. return false;
  22663. }
  22664. return true;
  22665. }
  22666. private function getNextPage()
  22667. {
  22668. $headers = $this->remoteFilesystem->getLastHeaders();
  22669. foreach ($headers as $header) {
  22670. if (preg_match('{^link:\s*(.+?)\s*$}i', $header, $match)) {
  22671. $links = explode(',', $match[1]);
  22672. foreach ($links as $link) {
  22673. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  22674. return $match[1];
  22675. }
  22676. }
  22677. }
  22678. }
  22679. }
  22680. private static function determineOrigin(array $configuredDomains, $guessedDomain, array &$urlParts)
  22681. {
  22682. if (in_array($guessedDomain, $configuredDomains)) {
  22683. return $guessedDomain;
  22684. }
  22685. while (null !== ($part = array_shift($urlParts))) {
  22686. $guessedDomain .= '/' . $part;
  22687. if (in_array($guessedDomain, $configuredDomains)) {
  22688. return $guessedDomain;
  22689. }
  22690. }
  22691. return false;
  22692. }
  22693. }
  22694. <?php
  22695. namespace Composer\Repository\Vcs;
  22696. use Composer\Config;
  22697. use Composer\IO\IOInterface;
  22698. class HgBitbucketDriver extends BitbucketDriver
  22699. {
  22700. public function getRootIdentifier()
  22701. {
  22702. if ($this->fallbackDriver) {
  22703. return $this->fallbackDriver->getRootIdentifier();
  22704. }
  22705. if (null === $this->rootIdentifier) {
  22706. if (! $this->getRepoData()) {
  22707. return $this->fallbackDriver->getRootIdentifier();
  22708. }
  22709. if ($this->vcsType !== 'hg') {
  22710. throw new \RuntimeException(
  22711. $this->url.' does not appear to be a mercurial repository, use '.
  22712. $this->cloneHttpsUrl.' if this is a git bitbucket repository'
  22713. );
  22714. }
  22715. $mainBranchData = $this->getMainBranchData();
  22716. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'default';
  22717. }
  22718. return $this->rootIdentifier;
  22719. }
  22720. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22721. {
  22722. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+)/?$#', $url)) {
  22723. return false;
  22724. }
  22725. if (!extension_loaded('openssl')) {
  22726. $io->writeError('Skipping Bitbucket hg driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  22727. return false;
  22728. }
  22729. return true;
  22730. }
  22731. protected function setupFallbackDriver($url)
  22732. {
  22733. $this->fallbackDriver = new HgDriver(
  22734. array('url' => $url),
  22735. $this->io,
  22736. $this->config,
  22737. $this->process,
  22738. $this->remoteFilesystem
  22739. );
  22740. $this->fallbackDriver->initialize();
  22741. }
  22742. protected function generateSshUrl()
  22743. {
  22744. return 'ssh://hg@' . $this->originUrl . '/' . $this->owner.'/'.$this->repository;
  22745. }
  22746. }
  22747. <?php
  22748. namespace Composer\Repository\Vcs;
  22749. use Composer\Config;
  22750. use Composer\Util\ProcessExecutor;
  22751. use Composer\Util\Filesystem;
  22752. use Composer\IO\IOInterface;
  22753. class HgDriver extends VcsDriver
  22754. {
  22755. protected $tags;
  22756. protected $branches;
  22757. protected $rootIdentifier;
  22758. protected $repoDir;
  22759. protected $infoCache = array();
  22760. public function initialize()
  22761. {
  22762. if (Filesystem::isLocalPath($this->url)) {
  22763. $this->repoDir = $this->url;
  22764. } else {
  22765. $cacheDir = $this->config->get('cache-vcs-dir');
  22766. $this->repoDir = $cacheDir . '/' . preg_replace('{[^a-z0-9]}i', '-', $this->url) . '/';
  22767. $fs = new Filesystem();
  22768. $fs->ensureDirectoryExists($cacheDir);
  22769. if (!is_writable(dirname($this->repoDir))) {
  22770. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$cacheDir.'" directory is not writable by the current user.');
  22771. }
  22772. $this->config->prohibitUrlByConfig($this->url, $this->io);
  22773. if (is_dir($this->repoDir) && 0 === $this->process->execute('hg summary', $output, $this->repoDir)) {
  22774. if (0 !== $this->process->execute('hg pull', $output, $this->repoDir)) {
  22775. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  22776. }
  22777. } else {
  22778. $fs->removeDirectory($this->repoDir);
  22779. if (0 !== $this->process->execute(sprintf('hg clone --noupdate %s %s', ProcessExecutor::escape($this->url), ProcessExecutor::escape($this->repoDir)), $output, $cacheDir)) {
  22780. $output = $this->process->getErrorOutput();
  22781. if (0 !== $this->process->execute('hg --version', $ignoredOutput)) {
  22782. throw new \RuntimeException('Failed to clone '.$this->url.', hg was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
  22783. }
  22784. throw new \RuntimeException('Failed to clone '.$this->url.', could not read packages from it' . "\n\n" .$output);
  22785. }
  22786. }
  22787. }
  22788. $this->getTags();
  22789. $this->getBranches();
  22790. }
  22791. public function getRootIdentifier()
  22792. {
  22793. if (null === $this->rootIdentifier) {
  22794. $this->process->execute(sprintf('hg tip --template "{node}"'), $output, $this->repoDir);
  22795. $output = $this->process->splitLines($output);
  22796. $this->rootIdentifier = $output[0];
  22797. }
  22798. return $this->rootIdentifier;
  22799. }
  22800. public function getUrl()
  22801. {
  22802. return $this->url;
  22803. }
  22804. public function getSource($identifier)
  22805. {
  22806. return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier);
  22807. }
  22808. public function getDist($identifier)
  22809. {
  22810. return null;
  22811. }
  22812. public function getFileContent($file, $identifier)
  22813. {
  22814. $resource = sprintf('hg cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  22815. $this->process->execute($resource, $content, $this->repoDir);
  22816. if (!trim($content)) {
  22817. return;
  22818. }
  22819. return $content;
  22820. }
  22821. public function getChangeDate($identifier)
  22822. {
  22823. $this->process->execute(
  22824. sprintf(
  22825. 'hg log --template "{date|rfc3339date}" -r %s',
  22826. ProcessExecutor::escape($identifier)
  22827. ),
  22828. $output,
  22829. $this->repoDir
  22830. );
  22831. return new \DateTime(trim($output), new \DateTimeZone('UTC'));
  22832. }
  22833. public function getTags()
  22834. {
  22835. if (null === $this->tags) {
  22836. $tags = array();
  22837. $this->process->execute('hg tags', $output, $this->repoDir);
  22838. foreach ($this->process->splitLines($output) as $tag) {
  22839. if ($tag && preg_match('(^([^\s]+)\s+\d+:(.*)$)', $tag, $match)) {
  22840. $tags[$match[1]] = $match[2];
  22841. }
  22842. }
  22843. unset($tags['tip']);
  22844. $this->tags = $tags;
  22845. }
  22846. return $this->tags;
  22847. }
  22848. public function getBranches()
  22849. {
  22850. if (null === $this->branches) {
  22851. $branches = array();
  22852. $bookmarks = array();
  22853. $this->process->execute('hg branches', $output, $this->repoDir);
  22854. foreach ($this->process->splitLines($output) as $branch) {
  22855. if ($branch && preg_match('(^([^\s]+)\s+\d+:([a-f0-9]+))', $branch, $match)) {
  22856. $branches[$match[1]] = $match[2];
  22857. }
  22858. }
  22859. $this->process->execute('hg bookmarks', $output, $this->repoDir);
  22860. foreach ($this->process->splitLines($output) as $branch) {
  22861. if ($branch && preg_match('(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)', $branch, $match)) {
  22862. $bookmarks[$match[1]] = $match[2];
  22863. }
  22864. }
  22865. $this->branches = array_merge($bookmarks, $branches);
  22866. }
  22867. return $this->branches;
  22868. }
  22869. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22870. {
  22871. if (preg_match('#(^(?:https?|ssh)://(?:[^@]+@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
  22872. return true;
  22873. }
  22874. if (Filesystem::isLocalPath($url)) {
  22875. $url = Filesystem::getPlatformPath($url);
  22876. if (!is_dir($url)) {
  22877. return false;
  22878. }
  22879. $process = new ProcessExecutor();
  22880. if ($process->execute('hg summary', $output, $url) === 0) {
  22881. return true;
  22882. }
  22883. }
  22884. if (!$deep) {
  22885. return false;
  22886. }
  22887. $processExecutor = new ProcessExecutor();
  22888. $exit = $processExecutor->execute(sprintf('hg identify %s', ProcessExecutor::escape($url)), $ignored);
  22889. return $exit === 0;
  22890. }
  22891. }
  22892. <?php
  22893. namespace Composer\Repository\Vcs;
  22894. use Composer\Config;
  22895. use Composer\IO\IOInterface;
  22896. use Composer\Util\ProcessExecutor;
  22897. use Composer\Util\Perforce;
  22898. class PerforceDriver extends VcsDriver
  22899. {
  22900. protected $depot;
  22901. protected $branch;
  22902. protected $perforce;
  22903. public function initialize()
  22904. {
  22905. $this->depot = $this->repoConfig['depot'];
  22906. $this->branch = '';
  22907. if (!empty($this->repoConfig['branch'])) {
  22908. $this->branch = $this->repoConfig['branch'];
  22909. }
  22910. $this->initPerforce($this->repoConfig);
  22911. $this->perforce->p4Login();
  22912. $this->perforce->checkStream();
  22913. $this->perforce->writeP4ClientSpec();
  22914. $this->perforce->connectClient();
  22915. return true;
  22916. }
  22917. private function initPerforce($repoConfig)
  22918. {
  22919. if (!empty($this->perforce)) {
  22920. return;
  22921. }
  22922. $repoDir = $this->config->get('cache-vcs-dir') . '/' . $this->depot;
  22923. $this->perforce = Perforce::create($repoConfig, $this->getUrl(), $repoDir, $this->process, $this->io);
  22924. }
  22925. public function getFileContent($file, $identifier)
  22926. {
  22927. return $this->perforce->getFileContent($file, $identifier);
  22928. }
  22929. public function getChangeDate($identifier)
  22930. {
  22931. return null;
  22932. }
  22933. public function getRootIdentifier()
  22934. {
  22935. return $this->branch;
  22936. }
  22937. public function getBranches()
  22938. {
  22939. return $this->perforce->getBranches();
  22940. }
  22941. public function getTags()
  22942. {
  22943. return $this->perforce->getTags();
  22944. }
  22945. public function getDist($identifier)
  22946. {
  22947. return null;
  22948. }
  22949. public function getSource($identifier)
  22950. {
  22951. $source = array(
  22952. 'type' => 'perforce',
  22953. 'url' => $this->repoConfig['url'],
  22954. 'reference' => $identifier,
  22955. 'p4user' => $this->perforce->getUser(),
  22956. );
  22957. return $source;
  22958. }
  22959. public function getUrl()
  22960. {
  22961. return $this->url;
  22962. }
  22963. public function hasComposerFile($identifier)
  22964. {
  22965. $composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier);
  22966. $composerInfoIdentifier = $identifier;
  22967. return !empty($composerInfo);
  22968. }
  22969. public function getContents($url)
  22970. {
  22971. return false;
  22972. }
  22973. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22974. {
  22975. if ($deep || preg_match('#\b(perforce|p4)\b#i', $url)) {
  22976. return Perforce::checkServerExists($url, new ProcessExecutor($io));
  22977. }
  22978. return false;
  22979. }
  22980. public function cleanup()
  22981. {
  22982. $this->perforce->cleanupClientSpec();
  22983. $this->perforce = null;
  22984. }
  22985. public function getDepot()
  22986. {
  22987. return $this->depot;
  22988. }
  22989. public function getBranch()
  22990. {
  22991. return $this->branch;
  22992. }
  22993. }
  22994. <?php
  22995. namespace Composer\Repository\Vcs;
  22996. use Composer\Cache;
  22997. use Composer\Config;
  22998. use Composer\Json\JsonFile;
  22999. use Composer\Util\ProcessExecutor;
  23000. use Composer\Util\Filesystem;
  23001. use Composer\Util\Svn as SvnUtil;
  23002. use Composer\IO\IOInterface;
  23003. use Composer\Downloader\TransportException;
  23004. class SvnDriver extends VcsDriver
  23005. {
  23006. protected $cache;
  23007. protected $baseUrl;
  23008. protected $tags;
  23009. protected $branches;
  23010. protected $rootIdentifier;
  23011. protected $infoCache = array();
  23012. protected $trunkPath = 'trunk';
  23013. protected $branchesPath = 'branches';
  23014. protected $tagsPath = 'tags';
  23015. protected $packagePath = '';
  23016. protected $cacheCredentials = true;
  23017. private $util;
  23018. public function initialize()
  23019. {
  23020. $this->url = $this->baseUrl = rtrim(self::normalizeUrl($this->url), '/');
  23021. SvnUtil::cleanEnv();
  23022. if (isset($this->repoConfig['trunk-path'])) {
  23023. $this->trunkPath = $this->repoConfig['trunk-path'];
  23024. }
  23025. if (isset($this->repoConfig['branches-path'])) {
  23026. $this->branchesPath = $this->repoConfig['branches-path'];
  23027. }
  23028. if (isset($this->repoConfig['tags-path'])) {
  23029. $this->tagsPath = $this->repoConfig['tags-path'];
  23030. }
  23031. if (array_key_exists('svn-cache-credentials', $this->repoConfig)) {
  23032. $this->cacheCredentials = (bool) $this->repoConfig['svn-cache-credentials'];
  23033. }
  23034. if (isset($this->repoConfig['package-path'])) {
  23035. $this->packagePath = '/' . trim($this->repoConfig['package-path'], '/');
  23036. }
  23037. if (false !== ($pos = strrpos($this->url, '/' . $this->trunkPath))) {
  23038. $this->baseUrl = substr($this->url, 0, $pos);
  23039. }
  23040. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->baseUrl));
  23041. $this->getBranches();
  23042. $this->getTags();
  23043. }
  23044. public function getRootIdentifier()
  23045. {
  23046. return $this->rootIdentifier ?: $this->trunkPath;
  23047. }
  23048. public function getUrl()
  23049. {
  23050. return $this->url;
  23051. }
  23052. public function getSource($identifier)
  23053. {
  23054. return array('type' => 'svn', 'url' => $this->baseUrl, 'reference' => $identifier);
  23055. }
  23056. public function getDist($identifier)
  23057. {
  23058. return null;
  23059. }
  23060. protected function shouldCache($identifier)
  23061. {
  23062. return $this->cache && preg_match('{@\d+$}', $identifier);
  23063. }
  23064. public function getComposerInformation($identifier)
  23065. {
  23066. if (!isset($this->infoCache[$identifier])) {
  23067. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier.'.json')) {
  23068. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  23069. }
  23070. try {
  23071. $composer = $this->getBaseComposerInformation($identifier);
  23072. } catch(TransportException $e) {
  23073. $message = $e->getMessage();
  23074. if (stripos($message, 'path not found') === false && stripos($message, 'svn: warning: W160013') === false) {
  23075. throw $e;
  23076. }
  23077. $composer = '';
  23078. }
  23079. if ($this->shouldCache($identifier)) {
  23080. $this->cache->write($identifier.'.json', json_encode($composer));
  23081. }
  23082. $this->infoCache[$identifier] = $composer;
  23083. }
  23084. return $this->infoCache[$identifier];
  23085. }
  23086. public function getFileContent($file, $identifier)
  23087. {
  23088. $identifier = '/' . trim($identifier, '/') . '/';
  23089. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  23090. if (!empty($match[2])) {
  23091. $path = $match[1];
  23092. $rev = $match[2];
  23093. } else {
  23094. $path = $identifier;
  23095. $rev = '';
  23096. }
  23097. try {
  23098. $resource = $path.$file;
  23099. $output = $this->execute('svn cat', $this->baseUrl . $resource . $rev);
  23100. if (!trim($output)) {
  23101. return null;
  23102. }
  23103. } catch (\RuntimeException $e) {
  23104. throw new TransportException($e->getMessage());
  23105. }
  23106. return $output;
  23107. }
  23108. public function getChangeDate($identifier)
  23109. {
  23110. $identifier = '/' . trim($identifier, '/') . '/';
  23111. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  23112. if (!empty($match[2])) {
  23113. $path = $match[1];
  23114. $rev = $match[2];
  23115. } else {
  23116. $path = $identifier;
  23117. $rev = '';
  23118. }
  23119. $output = $this->execute('svn info', $this->baseUrl . $path . $rev);
  23120. foreach ($this->process->splitLines($output) as $line) {
  23121. if ($line && preg_match('{^Last Changed Date: ([^(]+)}', $line, $match)) {
  23122. return new \DateTime($match[1], new \DateTimeZone('UTC'));
  23123. }
  23124. }
  23125. return null;
  23126. }
  23127. public function getTags()
  23128. {
  23129. if (null === $this->tags) {
  23130. $this->tags = array();
  23131. if ($this->tagsPath !== false) {
  23132. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath);
  23133. if ($output) {
  23134. foreach ($this->process->splitLines($output) as $line) {
  23135. $line = trim($line);
  23136. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  23137. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  23138. $this->tags[rtrim($match[2], '/')] = $this->buildIdentifier(
  23139. '/' . $this->tagsPath . '/' . $match[2],
  23140. $match[1]
  23141. );
  23142. }
  23143. }
  23144. }
  23145. }
  23146. }
  23147. }
  23148. return $this->tags;
  23149. }
  23150. public function getBranches()
  23151. {
  23152. if (null === $this->branches) {
  23153. $this->branches = array();
  23154. if (false === $this->trunkPath) {
  23155. $trunkParent = $this->baseUrl . '/';
  23156. } else {
  23157. $trunkParent = $this->baseUrl . '/' . $this->trunkPath;
  23158. }
  23159. $output = $this->execute('svn ls --verbose', $trunkParent);
  23160. if ($output) {
  23161. foreach ($this->process->splitLines($output) as $line) {
  23162. $line = trim($line);
  23163. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  23164. if (isset($match[1]) && isset($match[2]) && $match[2] === './') {
  23165. $this->branches['trunk'] = $this->buildIdentifier(
  23166. '/' . $this->trunkPath,
  23167. $match[1]
  23168. );
  23169. $this->rootIdentifier = $this->branches['trunk'];
  23170. break;
  23171. }
  23172. }
  23173. }
  23174. }
  23175. unset($output);
  23176. if ($this->branchesPath !== false) {
  23177. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath);
  23178. if ($output) {
  23179. foreach ($this->process->splitLines(trim($output)) as $line) {
  23180. $line = trim($line);
  23181. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  23182. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  23183. $this->branches[rtrim($match[2], '/')] = $this->buildIdentifier(
  23184. '/' . $this->branchesPath . '/' . $match[2],
  23185. $match[1]
  23186. );
  23187. }
  23188. }
  23189. }
  23190. }
  23191. }
  23192. }
  23193. return $this->branches;
  23194. }
  23195. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23196. {
  23197. $url = self::normalizeUrl($url);
  23198. if (preg_match('#(^svn://|^svn\+ssh://|svn\.)#i', $url)) {
  23199. return true;
  23200. }
  23201. if (!$deep && !Filesystem::isLocalPath($url)) {
  23202. return false;
  23203. }
  23204. $processExecutor = new ProcessExecutor();
  23205. $exit = $processExecutor->execute(
  23206. "svn info --non-interactive {$url}",
  23207. $ignoredOutput
  23208. );
  23209. if ($exit === 0) {
  23210. return true;
  23211. }
  23212. if (false !== stripos($processExecutor->getErrorOutput(), 'authorization failed:')) {
  23213. return true;
  23214. }
  23215. if (false !== stripos($processExecutor->getErrorOutput(), 'Authentication failed')) {
  23216. return true;
  23217. }
  23218. return false;
  23219. }
  23220. protected static function normalizeUrl($url)
  23221. {
  23222. $fs = new Filesystem();
  23223. if ($fs->isAbsolutePath($url)) {
  23224. return 'file://' . strtr($url, '\\', '/');
  23225. }
  23226. return $url;
  23227. }
  23228. protected function execute($command, $url)
  23229. {
  23230. if (null === $this->util) {
  23231. $this->util = new SvnUtil($this->baseUrl, $this->io, $this->config, $this->process);
  23232. $this->util->setCacheCredentials($this->cacheCredentials);
  23233. }
  23234. try {
  23235. return $this->util->execute($command, $url);
  23236. } catch (\RuntimeException $e) {
  23237. if (null === $this->util->binaryVersion()) {
  23238. throw new \RuntimeException('Failed to load '.$this->url.', svn was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
  23239. }
  23240. throw new \RuntimeException(
  23241. 'Repository '.$this->url.' could not be processed, '.$e->getMessage()
  23242. );
  23243. }
  23244. }
  23245. protected function buildIdentifier($baseDir, $revision)
  23246. {
  23247. return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision;
  23248. }
  23249. }
  23250. <?php
  23251. namespace Composer\Repository\Vcs;
  23252. use Composer\Cache;
  23253. use Composer\Downloader\TransportException;
  23254. use Composer\Config;
  23255. use Composer\Factory;
  23256. use Composer\IO\IOInterface;
  23257. use Composer\Json\JsonFile;
  23258. use Composer\Util\ProcessExecutor;
  23259. use Composer\Util\RemoteFilesystem;
  23260. use Composer\Util\Filesystem;
  23261. abstract class VcsDriver implements VcsDriverInterface
  23262. {
  23263. protected $url;
  23264. protected $originUrl;
  23265. protected $repoConfig;
  23266. protected $io;
  23267. protected $config;
  23268. protected $process;
  23269. protected $remoteFilesystem;
  23270. protected $infoCache = array();
  23271. protected $cache;
  23272. final public function __construct(array $repoConfig, IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  23273. {
  23274. if (Filesystem::isLocalPath($repoConfig['url'])) {
  23275. $repoConfig['url'] = Filesystem::getPlatformPath($repoConfig['url']);
  23276. }
  23277. $this->url = $repoConfig['url'];
  23278. $this->originUrl = $repoConfig['url'];
  23279. $this->repoConfig = $repoConfig;
  23280. $this->io = $io;
  23281. $this->config = $config;
  23282. $this->process = $process ?: new ProcessExecutor($io);
  23283. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  23284. }
  23285. protected function shouldCache($identifier)
  23286. {
  23287. return $this->cache && preg_match('{[a-f0-9]{40}}i', $identifier);
  23288. }
  23289. public function getComposerInformation($identifier)
  23290. {
  23291. if (!isset($this->infoCache[$identifier])) {
  23292. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  23293. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  23294. }
  23295. $composer = $this->getBaseComposerInformation($identifier);
  23296. if ($this->shouldCache($identifier)) {
  23297. $this->cache->write($identifier, json_encode($composer));
  23298. }
  23299. $this->infoCache[$identifier] = $composer;
  23300. }
  23301. return $this->infoCache[$identifier];
  23302. }
  23303. protected function getBaseComposerInformation($identifier)
  23304. {
  23305. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  23306. if (!$composerFileContent) {
  23307. return null;
  23308. }
  23309. $composer = JsonFile::parseJson($composerFileContent, $identifier . ':composer.json');
  23310. if (empty($composer['time']) && $changeDate = $this->getChangeDate($identifier)) {
  23311. $composer['time'] = $changeDate->format(DATE_RFC3339);
  23312. }
  23313. return $composer;
  23314. }
  23315. public function hasComposerFile($identifier)
  23316. {
  23317. try {
  23318. return (bool) $this->getComposerInformation($identifier);
  23319. } catch (TransportException $e) {
  23320. }
  23321. return false;
  23322. }
  23323. protected function getScheme()
  23324. {
  23325. if (extension_loaded('openssl')) {
  23326. return 'https';
  23327. }
  23328. return 'http';
  23329. }
  23330. protected function getContents($url)
  23331. {
  23332. $options = isset($this->repoConfig['options']) ? $this->repoConfig['options'] : array();
  23333. return $this->remoteFilesystem->getContents($this->originUrl, $url, false, $options);
  23334. }
  23335. public function cleanup()
  23336. {
  23337. return;
  23338. }
  23339. }
  23340. <?php
  23341. namespace Composer\Repository\Vcs;
  23342. use Composer\Config;
  23343. use Composer\IO\IOInterface;
  23344. interface VcsDriverInterface
  23345. {
  23346. public function initialize();
  23347. public function getComposerInformation($identifier);
  23348. public function getFileContent($file, $identifier);
  23349. public function getChangeDate($identifier);
  23350. public function getRootIdentifier();
  23351. public function getBranches();
  23352. public function getTags();
  23353. public function getDist($identifier);
  23354. public function getSource($identifier);
  23355. public function getUrl();
  23356. public function hasComposerFile($identifier);
  23357. public function cleanup();
  23358. public static function supports(IOInterface $io, Config $config, $url, $deep = false);
  23359. }
  23360. <?php
  23361. namespace Composer\Repository;
  23362. use Composer\Downloader\TransportException;
  23363. use Composer\Repository\Vcs\VcsDriverInterface;
  23364. use Composer\Package\Version\VersionParser;
  23365. use Composer\Package\Loader\ArrayLoader;
  23366. use Composer\Package\Loader\ValidatingArrayLoader;
  23367. use Composer\Package\Loader\InvalidPackageException;
  23368. use Composer\Package\Loader\LoaderInterface;
  23369. use Composer\EventDispatcher\EventDispatcher;
  23370. use Composer\IO\IOInterface;
  23371. use Composer\Config;
  23372. class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  23373. {
  23374. protected $url;
  23375. protected $packageName;
  23376. protected $verbose;
  23377. protected $io;
  23378. protected $config;
  23379. protected $versionParser;
  23380. protected $type;
  23381. protected $loader;
  23382. protected $repoConfig;
  23383. protected $branchErrorOccurred = false;
  23384. private $drivers;
  23385. private $driver;
  23386. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, array $drivers = null)
  23387. {
  23388. parent::__construct();
  23389. $this->drivers = $drivers ?: array(
  23390. 'github' => 'Composer\Repository\Vcs\GitHubDriver',
  23391. 'gitlab' => 'Composer\Repository\Vcs\GitLabDriver',
  23392. 'git-bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
  23393. 'git' => 'Composer\Repository\Vcs\GitDriver',
  23394. 'hg-bitbucket' => 'Composer\Repository\Vcs\HgBitbucketDriver',
  23395. 'hg' => 'Composer\Repository\Vcs\HgDriver',
  23396. 'perforce' => 'Composer\Repository\Vcs\PerforceDriver',
  23397. 'fossil' => 'Composer\Repository\Vcs\FossilDriver',
  23398. 'svn' => 'Composer\Repository\Vcs\SvnDriver',
  23399. );
  23400. $this->url = $repoConfig['url'];
  23401. $this->io = $io;
  23402. $this->type = isset($repoConfig['type']) ? $repoConfig['type'] : 'vcs';
  23403. $this->verbose = $io->isVeryVerbose();
  23404. $this->config = $config;
  23405. $this->repoConfig = $repoConfig;
  23406. }
  23407. public function getRepoConfig()
  23408. {
  23409. return $this->repoConfig;
  23410. }
  23411. public function setLoader(LoaderInterface $loader)
  23412. {
  23413. $this->loader = $loader;
  23414. }
  23415. public function getDriver()
  23416. {
  23417. if ($this->driver) {
  23418. return $this->driver;
  23419. }
  23420. if (isset($this->drivers[$this->type])) {
  23421. $class = $this->drivers[$this->type];
  23422. $this->driver = new $class($this->repoConfig, $this->io, $this->config);
  23423. $this->driver->initialize();
  23424. return $this->driver;
  23425. }
  23426. foreach ($this->drivers as $driver) {
  23427. if ($driver::supports($this->io, $this->config, $this->url)) {
  23428. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  23429. $this->driver->initialize();
  23430. return $this->driver;
  23431. }
  23432. }
  23433. foreach ($this->drivers as $driver) {
  23434. if ($driver::supports($this->io, $this->config, $this->url, true)) {
  23435. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  23436. $this->driver->initialize();
  23437. return $this->driver;
  23438. }
  23439. }
  23440. }
  23441. public function hadInvalidBranches()
  23442. {
  23443. return $this->branchErrorOccurred;
  23444. }
  23445. protected function initialize()
  23446. {
  23447. parent::initialize();
  23448. $verbose = $this->verbose;
  23449. $driver = $this->getDriver();
  23450. if (!$driver) {
  23451. throw new \InvalidArgumentException('No driver found to handle VCS repository '.$this->url);
  23452. }
  23453. $this->versionParser = new VersionParser;
  23454. if (!$this->loader) {
  23455. $this->loader = new ArrayLoader($this->versionParser);
  23456. }
  23457. try {
  23458. if ($driver->hasComposerFile($driver->getRootIdentifier())) {
  23459. $data = $driver->getComposerInformation($driver->getRootIdentifier());
  23460. $this->packageName = !empty($data['name']) ? $data['name'] : null;
  23461. }
  23462. } catch (\Exception $e) {
  23463. if ($verbose) {
  23464. $this->io->writeError('<error>Skipped parsing '.$driver->getRootIdentifier().', '.$e->getMessage().'</error>');
  23465. }
  23466. }
  23467. foreach ($driver->getTags() as $tag => $identifier) {
  23468. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $tag . '</comment>)';
  23469. if ($verbose) {
  23470. $this->io->writeError($msg);
  23471. } else {
  23472. $this->io->overwriteError($msg, false);
  23473. }
  23474. $tag = str_replace('release-', '', $tag);
  23475. if (!$parsedTag = $this->validateTag($tag)) {
  23476. if ($verbose) {
  23477. $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name</warning>');
  23478. }
  23479. continue;
  23480. }
  23481. try {
  23482. if (!$data = $driver->getComposerInformation($identifier)) {
  23483. if ($verbose) {
  23484. $this->io->writeError('<warning>Skipped tag '.$tag.', no composer file</warning>');
  23485. }
  23486. continue;
  23487. }
  23488. if (isset($data['version'])) {
  23489. $data['version_normalized'] = $this->versionParser->normalize($data['version']);
  23490. } else {
  23491. $data['version'] = $tag;
  23492. $data['version_normalized'] = $parsedTag;
  23493. }
  23494. $data['version'] = preg_replace('{[.-]?dev$}i', '', $data['version']);
  23495. $data['version_normalized'] = preg_replace('{(^dev-|[.-]?dev$)}i', '', $data['version_normalized']);
  23496. if ($data['version_normalized'] !== $parsedTag) {
  23497. if ($verbose) {
  23498. $this->io->writeError('<warning>Skipped tag '.$tag.', tag ('.$parsedTag.') does not match version ('.$data['version_normalized'].') in composer.json</warning>');
  23499. }
  23500. continue;
  23501. }
  23502. if ($verbose) {
  23503. $this->io->writeError('Importing tag '.$tag.' ('.$data['version_normalized'].')');
  23504. }
  23505. $this->addPackage($this->loader->load($this->preProcess($driver, $data, $identifier)));
  23506. } catch (\Exception $e) {
  23507. if ($verbose) {
  23508. $this->io->writeError('<warning>Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found' : $e->getMessage()).'</warning>');
  23509. }
  23510. continue;
  23511. }
  23512. }
  23513. if (!$verbose) {
  23514. $this->io->overwriteError('', false);
  23515. }
  23516. foreach ($driver->getBranches() as $branch => $identifier) {
  23517. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $branch . '</comment>)';
  23518. if ($verbose) {
  23519. $this->io->writeError($msg);
  23520. } else {
  23521. $this->io->overwriteError($msg, false);
  23522. }
  23523. if (!$parsedBranch = $this->validateBranch($branch)) {
  23524. if ($verbose) {
  23525. $this->io->writeError('<warning>Skipped branch '.$branch.', invalid name</warning>');
  23526. }
  23527. continue;
  23528. }
  23529. try {
  23530. if (!$data = $driver->getComposerInformation($identifier)) {
  23531. if ($verbose) {
  23532. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file</warning>');
  23533. }
  23534. continue;
  23535. }
  23536. $data['version'] = $branch;
  23537. $data['version_normalized'] = $parsedBranch;
  23538. if ('dev-' === substr($parsedBranch, 0, 4) || '9999999-dev' === $parsedBranch) {
  23539. $data['version'] = 'dev-' . $data['version'];
  23540. } else {
  23541. $prefix = substr($branch, 0, 1) === 'v' ? 'v' : '';
  23542. $data['version'] = $prefix . preg_replace('{(\.9{7})+}', '.x', $parsedBranch);
  23543. }
  23544. if ($verbose) {
  23545. $this->io->writeError('Importing branch '.$branch.' ('.$data['version'].')');
  23546. }
  23547. $packageData = $this->preProcess($driver, $data, $identifier);
  23548. $package = $this->loader->load($packageData);
  23549. if ($this->loader instanceof ValidatingArrayLoader && $this->loader->getWarnings()) {
  23550. throw new InvalidPackageException($this->loader->getErrors(), $this->loader->getWarnings(), $packageData);
  23551. }
  23552. $this->addPackage($package);
  23553. } catch (TransportException $e) {
  23554. if ($verbose) {
  23555. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file was found</warning>');
  23556. }
  23557. continue;
  23558. } catch (\Exception $e) {
  23559. if (!$verbose) {
  23560. $this->io->writeError('');
  23561. }
  23562. $this->branchErrorOccurred = true;
  23563. $this->io->writeError('<error>Skipped branch '.$branch.', '.$e->getMessage().'</error>');
  23564. $this->io->writeError('');
  23565. continue;
  23566. }
  23567. }
  23568. $driver->cleanup();
  23569. if (!$verbose) {
  23570. $this->io->overwriteError('', false);
  23571. }
  23572. if (!$this->getPackages()) {
  23573. throw new InvalidRepositoryException('No valid composer.json was found in any branch or tag of '.$this->url.', could not load a package from it.');
  23574. }
  23575. }
  23576. protected function preProcess(VcsDriverInterface $driver, array $data, $identifier)
  23577. {
  23578. $data['name'] = $this->packageName ?: $data['name'];
  23579. if (!isset($data['dist'])) {
  23580. $data['dist'] = $driver->getDist($identifier);
  23581. }
  23582. if (!isset($data['source'])) {
  23583. $data['source'] = $driver->getSource($identifier);
  23584. }
  23585. return $data;
  23586. }
  23587. private function validateBranch($branch)
  23588. {
  23589. try {
  23590. return $this->versionParser->normalizeBranch($branch);
  23591. } catch (\Exception $e) {
  23592. }
  23593. return false;
  23594. }
  23595. private function validateTag($version)
  23596. {
  23597. try {
  23598. return $this->versionParser->normalize($version);
  23599. } catch (\Exception $e) {
  23600. }
  23601. return false;
  23602. }
  23603. }
  23604. <?php
  23605. namespace Composer\Repository;
  23606. use Composer\Package\AliasPackage;
  23607. class WritableArrayRepository extends ArrayRepository implements WritableRepositoryInterface
  23608. {
  23609. public function write()
  23610. {
  23611. }
  23612. public function reload()
  23613. {
  23614. }
  23615. public function getCanonicalPackages()
  23616. {
  23617. $packages = $this->getPackages();
  23618. $packagesByName = array();
  23619. foreach ($packages as $package) {
  23620. if (!isset($packagesByName[$package->getName()]) || $packagesByName[$package->getName()] instanceof AliasPackage) {
  23621. $packagesByName[$package->getName()] = $package;
  23622. }
  23623. }
  23624. $canonicalPackages = array();
  23625. foreach ($packagesByName as $package) {
  23626. while ($package instanceof AliasPackage) {
  23627. $package = $package->getAliasOf();
  23628. }
  23629. $canonicalPackages[] = $package;
  23630. }
  23631. return $canonicalPackages;
  23632. }
  23633. }
  23634. <?php
  23635. namespace Composer\Repository;
  23636. use Composer\Package\PackageInterface;
  23637. interface WritableRepositoryInterface extends RepositoryInterface
  23638. {
  23639. public function write();
  23640. public function addPackage(PackageInterface $package);
  23641. public function removePackage(PackageInterface $package);
  23642. public function getCanonicalPackages();
  23643. public function reload();
  23644. }
  23645. <?php
  23646. namespace Composer\Script;
  23647. class CommandEvent extends Event
  23648. {
  23649. }
  23650. <?php
  23651. namespace Composer\Script;
  23652. use Composer\Composer;
  23653. use Composer\IO\IOInterface;
  23654. use Composer\EventDispatcher\Event as BaseEvent;
  23655. class Event extends BaseEvent
  23656. {
  23657. private $composer;
  23658. private $io;
  23659. private $devMode;
  23660. public function __construct($name, Composer $composer, IOInterface $io, $devMode = false, array $args = array(), array $flags = array())
  23661. {
  23662. parent::__construct($name, $args, $flags);
  23663. $this->composer = $composer;
  23664. $this->io = $io;
  23665. $this->devMode = $devMode;
  23666. }
  23667. public function getComposer()
  23668. {
  23669. return $this->composer;
  23670. }
  23671. public function getIO()
  23672. {
  23673. return $this->io;
  23674. }
  23675. public function isDevMode()
  23676. {
  23677. return $this->devMode;
  23678. }
  23679. }
  23680. <?php
  23681. namespace Composer\Script;
  23682. use Composer\Installer\PackageEvent as BasePackageEvent;
  23683. class PackageEvent extends BasePackageEvent
  23684. {
  23685. }
  23686. <?php
  23687. namespace Composer\Script;
  23688. class ScriptEvents
  23689. {
  23690. const PRE_INSTALL_CMD = 'pre-install-cmd';
  23691. const POST_INSTALL_CMD = 'post-install-cmd';
  23692. const PRE_UPDATE_CMD = 'pre-update-cmd';
  23693. const POST_UPDATE_CMD = 'post-update-cmd';
  23694. const PRE_STATUS_CMD = 'pre-status-cmd';
  23695. const POST_STATUS_CMD = 'post-status-cmd';
  23696. const PRE_AUTOLOAD_DUMP = 'pre-autoload-dump';
  23697. const POST_AUTOLOAD_DUMP = 'post-autoload-dump';
  23698. const POST_ROOT_PACKAGE_INSTALL = 'post-root-package-install';
  23699. const POST_CREATE_PROJECT_CMD = 'post-create-project-cmd';
  23700. const PRE_ARCHIVE_CMD = 'pre-archive-cmd';
  23701. const POST_ARCHIVE_CMD = 'post-archive-cmd';
  23702. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  23703. const POST_PACKAGE_INSTALL = 'post-package-install';
  23704. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  23705. const POST_PACKAGE_UPDATE = 'post-package-update';
  23706. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  23707. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  23708. }
  23709. <?php
  23710. namespace Composer\SelfUpdate;
  23711. class Keys
  23712. {
  23713. public static function fingerprint($path)
  23714. {
  23715. $hash = strtoupper(hash('sha256', preg_replace('{\s}', '', file_get_contents($path))));
  23716. return implode(' ', array(
  23717. substr($hash, 0, 8),
  23718. substr($hash, 8, 8),
  23719. substr($hash, 16, 8),
  23720. substr($hash, 24, 8),
  23721. '',
  23722. substr($hash, 32, 8),
  23723. substr($hash, 40, 8),
  23724. substr($hash, 48, 8),
  23725. substr($hash, 56, 8),
  23726. ));
  23727. }
  23728. }
  23729. <?php
  23730. namespace Composer\SelfUpdate;
  23731. use Composer\Util\RemoteFilesystem;
  23732. use Composer\Config;
  23733. use Composer\Json\JsonFile;
  23734. class Versions
  23735. {
  23736. private $rfs;
  23737. private $config;
  23738. private $channel;
  23739. public function __construct(Config $config, RemoteFilesystem $rfs)
  23740. {
  23741. $this->rfs = $rfs;
  23742. $this->config = $config;
  23743. }
  23744. public function getChannel()
  23745. {
  23746. if ($this->channel) {
  23747. return $this->channel;
  23748. }
  23749. $channelFile = $this->config->get('home').'/update-channel';
  23750. if (file_exists($channelFile)) {
  23751. $channel = trim(file_get_contents($channelFile));
  23752. if (in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  23753. return $this->channel = $channel;
  23754. }
  23755. }
  23756. return $this->channel = 'stable';
  23757. }
  23758. public function setChannel($channel)
  23759. {
  23760. if (!in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  23761. throw new \InvalidArgumentException('Invalid channel '.$channel.', must be one of: stable, preview, snapshot');
  23762. }
  23763. $channelFile = $this->config->get('home').'/update-channel';
  23764. $this->channel = $channel;
  23765. file_put_contents($channelFile, $channel.PHP_EOL);
  23766. }
  23767. public function getLatest()
  23768. {
  23769. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  23770. $versions = JsonFile::parseJson($this->rfs->getContents('getcomposer.org', $protocol . '://getcomposer.org/versions', false));
  23771. foreach ($versions[$this->getChannel()] as $version) {
  23772. if ($version['min-php'] <= PHP_VERSION_ID) {
  23773. return $version;
  23774. }
  23775. }
  23776. throw new \LogicException('There is no version of Composer available for your PHP version ('.PHP_VERSION.')');
  23777. }
  23778. }
  23779. <?php
  23780. namespace Composer\Util;
  23781. use Composer\Config;
  23782. use Composer\IO\IOInterface;
  23783. class AuthHelper
  23784. {
  23785. protected $io;
  23786. protected $config;
  23787. public function __construct(IOInterface $io, Config $config)
  23788. {
  23789. $this->io = $io;
  23790. $this->config = $config;
  23791. }
  23792. public function storeAuth($originUrl, $storeAuth)
  23793. {
  23794. $store = false;
  23795. $configSource = $this->config->getAuthConfigSource();
  23796. if ($storeAuth === true) {
  23797. $store = $configSource;
  23798. } elseif ($storeAuth === 'prompt') {
  23799. $answer = $this->io->askAndValidate(
  23800. 'Do you want to store credentials for '.$originUrl.' in '.$configSource->getName().' ? [Yn] ',
  23801. function ($value) {
  23802. $input = strtolower(substr(trim($value), 0, 1));
  23803. if (in_array($input, array('y','n'))) {
  23804. return $input;
  23805. }
  23806. throw new \RuntimeException('Please answer (y)es or (n)o');
  23807. },
  23808. null,
  23809. 'y'
  23810. );
  23811. if ($answer === 'y') {
  23812. $store = $configSource;
  23813. }
  23814. }
  23815. if ($store) {
  23816. $store->addConfigSetting(
  23817. 'http-basic.'.$originUrl,
  23818. $this->io->getAuthentication($originUrl)
  23819. );
  23820. }
  23821. }
  23822. }
  23823. <?php
  23824. namespace Composer\Util;
  23825. use Composer\Factory;
  23826. use Composer\IO\IOInterface;
  23827. use Composer\Config;
  23828. use Composer\Downloader\TransportException;
  23829. class Bitbucket
  23830. {
  23831. private $io;
  23832. private $config;
  23833. private $process;
  23834. private $remoteFilesystem;
  23835. private $token = array();
  23836. private $time;
  23837. const OAUTH2_ACCESS_TOKEN_URL = 'https://bitbucket.org/site/oauth2/access_token';
  23838. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null, $time = null)
  23839. {
  23840. $this->io = $io;
  23841. $this->config = $config;
  23842. $this->process = $process ?: new ProcessExecutor;
  23843. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  23844. $this->time = $time;
  23845. }
  23846. public function getToken()
  23847. {
  23848. if (!isset($this->token['access_token'])) {
  23849. return '';
  23850. }
  23851. return $this->token['access_token'];
  23852. }
  23853. public function authorizeOAuth($originUrl)
  23854. {
  23855. if ($originUrl !== 'bitbucket.org') {
  23856. return false;
  23857. }
  23858. if (0 === $this->process->execute('git config bitbucket.accesstoken', $output)) {
  23859. $this->io->setAuthentication($originUrl, 'x-token-auth', trim($output));
  23860. return true;
  23861. }
  23862. return false;
  23863. }
  23864. private function requestAccessToken($originUrl)
  23865. {
  23866. try {
  23867. $json = $this->remoteFilesystem->getContents($originUrl, self::OAUTH2_ACCESS_TOKEN_URL, false, array(
  23868. 'retry-auth-failure' => false,
  23869. 'http' => array(
  23870. 'method' => 'POST',
  23871. 'content' => 'grant_type=client_credentials',
  23872. ),
  23873. ));
  23874. $this->token = json_decode($json, true);
  23875. } catch (TransportException $e) {
  23876. if ($e->getCode() === 400) {
  23877. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  23878. $this->io->writeError('This can have two reasons:');
  23879. $this->io->writeError('1. You are authenticating with a bitbucket username/password combination');
  23880. $this->io->writeError('2. You are using an OAuth consumer, but didn\'t configure a (dummy) callback url');
  23881. return false;
  23882. } elseif (in_array($e->getCode(), array(403, 401))) {
  23883. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  23884. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  23885. return false;
  23886. }
  23887. throw $e;
  23888. }
  23889. return true;
  23890. }
  23891. public function authorizeOAuthInteractively($originUrl, $message = null)
  23892. {
  23893. if ($message) {
  23894. $this->io->writeError($message);
  23895. }
  23896. $url = 'https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html';
  23897. $this->io->writeError(sprintf('Follow the instructions on %s', $url));
  23898. $this->io->writeError(sprintf('to create a consumer. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  23899. $this->io->writeError('Ensure you enter a "Callback URL" (http://example.com is fine) or it will not be possible to create an Access Token (this callback url will not be used by composer)');
  23900. $consumerKey = trim($this->io->askAndHideAnswer('Consumer Key (hidden): '));
  23901. if (!$consumerKey) {
  23902. $this->io->writeError('<warning>No consumer key given, aborting.</warning>');
  23903. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  23904. return false;
  23905. }
  23906. $consumerSecret = trim($this->io->askAndHideAnswer('Consumer Secret (hidden): '));
  23907. if (!$consumerSecret) {
  23908. $this->io->writeError('<warning>No consumer secret given, aborting.</warning>');
  23909. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  23910. return false;
  23911. }
  23912. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  23913. if (!$this->requestAccessToken($originUrl)) {
  23914. return false;
  23915. }
  23916. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  23917. $this->config->getAuthConfigSource()->removeConfigSetting('http-basic.' . $originUrl);
  23918. $this->io->writeError('<info>Consumer stored successfully.</info>');
  23919. return true;
  23920. }
  23921. public function requestToken($originUrl, $consumerKey, $consumerSecret)
  23922. {
  23923. if (!empty($this->token) || $this->getTokenFromConfig($originUrl)) {
  23924. return $this->token['access_token'];
  23925. }
  23926. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  23927. if (!$this->requestAccessToken($originUrl)) {
  23928. return '';
  23929. }
  23930. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  23931. return $this->token['access_token'];
  23932. }
  23933. private function storeInAuthConfig($originUrl, $consumerKey, $consumerSecret)
  23934. {
  23935. $this->config->getConfigSource()->removeConfigSetting('bitbucket-oauth.'.$originUrl);
  23936. $time = null === $this->time ? time() : $this->time;
  23937. $consumer = array(
  23938. "consumer-key" => $consumerKey,
  23939. "consumer-secret" => $consumerSecret,
  23940. "access-token" => $this->token['access_token'],
  23941. "access-token-expiration" => $time + $this->token['expires_in'],
  23942. );
  23943. $this->config->getAuthConfigSource()->addConfigSetting('bitbucket-oauth.'.$originUrl, $consumer);
  23944. }
  23945. private function getTokenFromConfig($originUrl)
  23946. {
  23947. $authConfig = $this->config->get('bitbucket-oauth');
  23948. if (
  23949. !isset($authConfig[$originUrl]['access-token'])
  23950. || !isset($authConfig[$originUrl]['access-token-expiration'])
  23951. || time() > $authConfig[$originUrl]['access-token-expiration']
  23952. ) {
  23953. return false;
  23954. }
  23955. $this->token = array(
  23956. 'access_token' => $authConfig[$originUrl]['access-token'],
  23957. );
  23958. return true;
  23959. }
  23960. }
  23961. <?php
  23962. namespace Composer\Util;
  23963. class ComposerMirror
  23964. {
  23965. public static function processUrl($mirrorUrl, $packageName, $version, $reference, $type)
  23966. {
  23967. if ($reference) {
  23968. $reference = preg_match('{^([a-f0-9]*|%reference%)$}', $reference) ? $reference : md5($reference);
  23969. }
  23970. $version = strpos($version, '/') === false ? $version : md5($version);
  23971. return str_replace(
  23972. array('%package%', '%version%', '%reference%', '%type%'),
  23973. array($packageName, $version, $reference, $type),
  23974. $mirrorUrl
  23975. );
  23976. }
  23977. public static function processGitUrl($mirrorUrl, $packageName, $url, $type)
  23978. {
  23979. if (preg_match('#^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#', $url, $match)) {
  23980. $url = 'gh-'.$match[1].'/'.$match[2];
  23981. } elseif (preg_match('#^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$#', $url, $match)) {
  23982. $url = 'bb-'.$match[1].'/'.$match[2];
  23983. } else {
  23984. $url = preg_replace('{[^a-z0-9_.-]}i', '-', trim($url, '/'));
  23985. }
  23986. return str_replace(
  23987. array('%package%', '%normalizedUrl%', '%type%'),
  23988. array($packageName, $url, $type),
  23989. $mirrorUrl
  23990. );
  23991. }
  23992. public static function processHgUrl($mirrorUrl, $packageName, $url, $type)
  23993. {
  23994. return self::processGitUrl($mirrorUrl, $packageName, $url, $type);
  23995. }
  23996. }
  23997. <?php
  23998. namespace Composer\Util;
  23999. use Composer\Package\Loader\ArrayLoader;
  24000. use Composer\Package\Loader\ValidatingArrayLoader;
  24001. use Composer\Package\Loader\InvalidPackageException;
  24002. use Composer\Json\JsonValidationException;
  24003. use Composer\IO\IOInterface;
  24004. use Composer\Json\JsonFile;
  24005. use Composer\Spdx\SpdxLicenses;
  24006. class ConfigValidator
  24007. {
  24008. private $io;
  24009. public function __construct(IOInterface $io)
  24010. {
  24011. $this->io = $io;
  24012. }
  24013. public function validate($file, $arrayLoaderValidationFlags = ValidatingArrayLoader::CHECK_ALL)
  24014. {
  24015. $errors = array();
  24016. $publishErrors = array();
  24017. $warnings = array();
  24018. $laxValid = false;
  24019. try {
  24020. $json = new JsonFile($file, null, $this->io);
  24021. $manifest = $json->read();
  24022. $json->validateSchema(JsonFile::LAX_SCHEMA);
  24023. $laxValid = true;
  24024. $json->validateSchema();
  24025. } catch (JsonValidationException $e) {
  24026. foreach ($e->getErrors() as $message) {
  24027. if ($laxValid) {
  24028. $publishErrors[] = $message;
  24029. } else {
  24030. $errors[] = $message;
  24031. }
  24032. }
  24033. } catch (\Exception $e) {
  24034. $errors[] = $e->getMessage();
  24035. return array($errors, $publishErrors, $warnings);
  24036. }
  24037. if (empty($manifest['license'])) {
  24038. $warnings[] = 'No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.';
  24039. } else {
  24040. $licenses = (array) $manifest['license'];
  24041. foreach ($licenses as $key => $license) {
  24042. if ('proprietary' === $license) {
  24043. unset($licenses[$key]);
  24044. }
  24045. }
  24046. $licenseValidator = new SpdxLicenses();
  24047. foreach ($licenses as $license) {
  24048. $spdxLicense = $licenseValidator->getLicenseByIdentifier($license);
  24049. if ($spdxLicense && $spdxLicense[3]) {
  24050. if (preg_match('{^[AL]?GPL-[123](\.[01])?\+$}i', $license)) {
  24051. $warnings[] = sprintf(
  24052. 'License "%s" is a deprecated SPDX license identifier, use "'.str_replace('+', '', $license).'-or-later" instead',
  24053. $license
  24054. );
  24055. } elseif (preg_match('{^[AL]?GPL-[123](\.[01])?$}i', $license)) {
  24056. $warnings[] = sprintf(
  24057. 'License "%s" is a deprecated SPDX license identifier, use "'.$license.'-only" or "'.$license.'-or-later" instead',
  24058. $license
  24059. );
  24060. } else {
  24061. $warnings[] = sprintf(
  24062. 'License "%s" is a deprecated SPDX license identifier, see https://spdx.org/licenses/',
  24063. $license
  24064. );
  24065. }
  24066. }
  24067. }
  24068. }
  24069. if (isset($manifest['version'])) {
  24070. $warnings[] = 'The version field is present, it is recommended to leave it out if the package is published on Packagist.';
  24071. }
  24072. if (!empty($manifest['name']) && preg_match('{[A-Z]}', $manifest['name'])) {
  24073. $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $manifest['name']);
  24074. $suggestName = strtolower($suggestName);
  24075. $publishErrors[] = sprintf(
  24076. 'Name "%s" does not match the best practice (e.g. lower-cased/with-dashes). We suggest using "%s" instead. As such you will not be able to submit it to Packagist.',
  24077. $manifest['name'],
  24078. $suggestName
  24079. );
  24080. }
  24081. if (!empty($manifest['type']) && $manifest['type'] == 'composer-installer') {
  24082. $warnings[] = "The package type 'composer-installer' is deprecated. Please distribute your custom installers as plugins from now on. See https://getcomposer.org/doc/articles/plugins.md for plugin documentation.";
  24083. }
  24084. if (isset($manifest['require']) && isset($manifest['require-dev'])) {
  24085. $requireOverrides = array_intersect_key($manifest['require'], $manifest['require-dev']);
  24086. if (!empty($requireOverrides)) {
  24087. $plural = (count($requireOverrides) > 1) ? 'are' : 'is';
  24088. $warnings[] = implode(', ', array_keys($requireOverrides)). " {$plural} required both in require and require-dev, this can lead to unexpected behavior";
  24089. }
  24090. }
  24091. $require = isset($manifest['require']) ? $manifest['require'] : array();
  24092. $requireDev = isset($manifest['require-dev']) ? $manifest['require-dev'] : array();
  24093. $packages = array_merge($require, $requireDev);
  24094. foreach ($packages as $package => $version) {
  24095. if (preg_match('/#/', $version) === 1) {
  24096. $warnings[] = sprintf(
  24097. 'The package "%s" is pointing to a commit-ref, this is bad practice and can cause unforeseen issues.',
  24098. $package
  24099. );
  24100. }
  24101. }
  24102. if (isset($manifest['autoload']['psr-0'][''])) {
  24103. $warnings[] = "Defining autoload.psr-0 with an empty namespace prefix is a bad idea for performance";
  24104. }
  24105. if (isset($manifest['autoload']['psr-4'][''])) {
  24106. $warnings[] = "Defining autoload.psr-4 with an empty namespace prefix is a bad idea for performance";
  24107. }
  24108. try {
  24109. $loader = new ValidatingArrayLoader(new ArrayLoader(), true, null, $arrayLoaderValidationFlags);
  24110. if (!isset($manifest['version'])) {
  24111. $manifest['version'] = '1.0.0';
  24112. }
  24113. if (!isset($manifest['name'])) {
  24114. $manifest['name'] = 'dummy/dummy';
  24115. }
  24116. $loader->load($manifest);
  24117. } catch (InvalidPackageException $e) {
  24118. $errors = array_merge($errors, $e->getErrors());
  24119. }
  24120. $warnings = array_merge($warnings, $loader->getWarnings());
  24121. return array($errors, $publishErrors, $warnings);
  24122. }
  24123. }
  24124. <?php
  24125. namespace Composer\Util;
  24126. use Composer\IO\IOInterface;
  24127. class ErrorHandler
  24128. {
  24129. private static $io;
  24130. public static function handle($level, $message, $file, $line)
  24131. {
  24132. if (!(error_reporting() & $level)) {
  24133. return;
  24134. }
  24135. if (ini_get('xdebug.scream')) {
  24136. $message .= "\n\nWarning: You have xdebug.scream enabled, the warning above may be".
  24137. "\na legitimately suppressed error that you were not supposed to see.";
  24138. }
  24139. if ($level !== E_DEPRECATED && $level !== E_USER_DEPRECATED) {
  24140. throw new \ErrorException($message, 0, $level, $file, $line);
  24141. }
  24142. if (self::$io) {
  24143. self::$io->writeError('<warning>Deprecation Notice: '.$message.' in '.$file.':'.$line.'</warning>');
  24144. if (self::$io->isVerbose()) {
  24145. self::$io->writeError('<warning>Stack trace:</warning>');
  24146. self::$io->writeError(array_filter(array_map(function ($a) {
  24147. if (isset($a['line'], $a['file'])) {
  24148. return '<warning> '.$a['file'].':'.$a['line'].'</warning>';
  24149. }
  24150. return null;
  24151. }, array_slice(debug_backtrace(), 2))));
  24152. }
  24153. }
  24154. }
  24155. public static function register(IOInterface $io = null)
  24156. {
  24157. set_error_handler(array(__CLASS__, 'handle'));
  24158. error_reporting(E_ALL | E_STRICT);
  24159. self::$io = $io;
  24160. }
  24161. }
  24162. <?php
  24163. namespace Composer\Util;
  24164. use RecursiveDirectoryIterator;
  24165. use RecursiveIteratorIterator;
  24166. use Symfony\Component\Filesystem\Exception\IOException;
  24167. use Symfony\Component\Finder\Finder;
  24168. class Filesystem
  24169. {
  24170. private $processExecutor;
  24171. public function __construct(ProcessExecutor $executor = null)
  24172. {
  24173. $this->processExecutor = $executor ?: new ProcessExecutor();
  24174. }
  24175. public function remove($file)
  24176. {
  24177. if (is_dir($file)) {
  24178. return $this->removeDirectory($file);
  24179. }
  24180. if (file_exists($file)) {
  24181. return $this->unlink($file);
  24182. }
  24183. return false;
  24184. }
  24185. public function isDirEmpty($dir)
  24186. {
  24187. $finder = Finder::create()
  24188. ->ignoreVCS(false)
  24189. ->ignoreDotFiles(false)
  24190. ->depth(0)
  24191. ->in($dir);
  24192. return count($finder) === 0;
  24193. }
  24194. public function emptyDirectory($dir, $ensureDirectoryExists = true)
  24195. {
  24196. if (file_exists($dir) && is_link($dir)) {
  24197. $this->unlink($dir);
  24198. }
  24199. if ($ensureDirectoryExists) {
  24200. $this->ensureDirectoryExists($dir);
  24201. }
  24202. if (is_dir($dir)) {
  24203. $finder = Finder::create()
  24204. ->ignoreVCS(false)
  24205. ->ignoreDotFiles(false)
  24206. ->depth(0)
  24207. ->in($dir);
  24208. foreach ($finder as $path) {
  24209. $this->remove((string) $path);
  24210. }
  24211. }
  24212. }
  24213. public function removeDirectory($directory)
  24214. {
  24215. if ($this->isSymlinkedDirectory($directory)) {
  24216. return $this->unlinkSymlinkedDirectory($directory);
  24217. }
  24218. if ($this->isJunction($directory)) {
  24219. return $this->removeJunction($directory);
  24220. }
  24221. if (is_link($directory)) {
  24222. return unlink($directory);
  24223. }
  24224. if (!file_exists($directory) || !is_dir($directory)) {
  24225. return true;
  24226. }
  24227. if (preg_match('{^(?:[a-z]:)?[/\\\\]+$}i', $directory)) {
  24228. throw new \RuntimeException('Aborting an attempted deletion of '.$directory.', this was probably not intended, if it is a real use case please report it.');
  24229. }
  24230. if (!function_exists('proc_open')) {
  24231. return $this->removeDirectoryPhp($directory);
  24232. }
  24233. if (Platform::isWindows()) {
  24234. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape(realpath($directory)));
  24235. } else {
  24236. $cmd = sprintf('rm -rf %s', ProcessExecutor::escape($directory));
  24237. }
  24238. $result = $this->getProcess()->execute($cmd, $output) === 0;
  24239. clearstatcache();
  24240. if ($result && !file_exists($directory)) {
  24241. return true;
  24242. }
  24243. return $this->removeDirectoryPhp($directory);
  24244. }
  24245. public function removeDirectoryPhp($directory)
  24246. {
  24247. try {
  24248. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  24249. } catch (\UnexpectedValueException $e) {
  24250. clearstatcache();
  24251. usleep(100000);
  24252. if (!is_dir($directory)) {
  24253. return true;
  24254. }
  24255. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  24256. }
  24257. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  24258. foreach ($ri as $file) {
  24259. if ($file->isDir()) {
  24260. $this->rmdir($file->getPathname());
  24261. } else {
  24262. $this->unlink($file->getPathname());
  24263. }
  24264. }
  24265. return $this->rmdir($directory);
  24266. }
  24267. public function ensureDirectoryExists($directory)
  24268. {
  24269. if (!is_dir($directory)) {
  24270. if (file_exists($directory)) {
  24271. throw new \RuntimeException(
  24272. $directory.' exists and is not a directory.'
  24273. );
  24274. }
  24275. if (!@mkdir($directory, 0777, true)) {
  24276. throw new \RuntimeException(
  24277. $directory.' does not exist and could not be created.'
  24278. );
  24279. }
  24280. }
  24281. }
  24282. public function unlink($path)
  24283. {
  24284. if (!@$this->unlinkImplementation($path)) {
  24285. if (!Platform::isWindows() || (usleep(350000) && !@$this->unlinkImplementation($path))) {
  24286. $error = error_get_last();
  24287. $message = 'Could not delete '.$path.': ' . @$error['message'];
  24288. if (Platform::isWindows()) {
  24289. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  24290. }
  24291. throw new \RuntimeException($message);
  24292. }
  24293. }
  24294. return true;
  24295. }
  24296. public function rmdir($path)
  24297. {
  24298. if (!@rmdir($path)) {
  24299. if (!Platform::isWindows() || (usleep(350000) && !@rmdir($path))) {
  24300. $error = error_get_last();
  24301. $message = 'Could not delete '.$path.': ' . @$error['message'];
  24302. if (Platform::isWindows()) {
  24303. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  24304. }
  24305. throw new \RuntimeException($message);
  24306. }
  24307. }
  24308. return true;
  24309. }
  24310. public function copyThenRemove($source, $target)
  24311. {
  24312. $this->copy($source, $target);
  24313. if (!is_dir($source)) {
  24314. $this->unlink($source);
  24315. return;
  24316. }
  24317. $this->removeDirectoryPhp($source);
  24318. }
  24319. public function copy($source, $target)
  24320. {
  24321. if (!is_dir($source)) {
  24322. return copy($source, $target);
  24323. }
  24324. $it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
  24325. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
  24326. $this->ensureDirectoryExists($target);
  24327. $result = true;
  24328. foreach ($ri as $file) {
  24329. $targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathName();
  24330. if ($file->isDir()) {
  24331. $this->ensureDirectoryExists($targetPath);
  24332. } else {
  24333. $result = $result && copy($file->getPathname(), $targetPath);
  24334. }
  24335. }
  24336. return $result;
  24337. }
  24338. public function rename($source, $target)
  24339. {
  24340. if (true === @rename($source, $target)) {
  24341. return;
  24342. }
  24343. if (!function_exists('proc_open')) {
  24344. return $this->copyThenRemove($source, $target);
  24345. }
  24346. if (Platform::isWindows()) {
  24347. $command = sprintf('xcopy %s %s /E /I /Q /Y', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  24348. $result = $this->processExecutor->execute($command, $output);
  24349. clearstatcache();
  24350. if (0 === $result) {
  24351. $this->remove($source);
  24352. return;
  24353. }
  24354. } else {
  24355. $command = sprintf('mv %s %s', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  24356. $result = $this->processExecutor->execute($command, $output);
  24357. clearstatcache();
  24358. if (0 === $result) {
  24359. return;
  24360. }
  24361. }
  24362. return $this->copyThenRemove($source, $target);
  24363. }
  24364. public function findShortestPath($from, $to, $directories = false)
  24365. {
  24366. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  24367. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  24368. }
  24369. $from = lcfirst($this->normalizePath($from));
  24370. $to = lcfirst($this->normalizePath($to));
  24371. if ($directories) {
  24372. $from = rtrim($from, '/') . '/dummy_file';
  24373. }
  24374. if (dirname($from) === dirname($to)) {
  24375. return './'.basename($to);
  24376. }
  24377. $commonPath = $to;
  24378. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath)) {
  24379. $commonPath = strtr(dirname($commonPath), '\\', '/');
  24380. }
  24381. if (0 !== strpos($from, $commonPath) || '/' === $commonPath) {
  24382. return $to;
  24383. }
  24384. $commonPath = rtrim($commonPath, '/') . '/';
  24385. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/');
  24386. $commonPathCode = str_repeat('../', $sourcePathDepth);
  24387. return ($commonPathCode . substr($to, strlen($commonPath))) ?: './';
  24388. }
  24389. public function findShortestPathCode($from, $to, $directories = false, $staticCode = false)
  24390. {
  24391. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  24392. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  24393. }
  24394. $from = lcfirst($this->normalizePath($from));
  24395. $to = lcfirst($this->normalizePath($to));
  24396. if ($from === $to) {
  24397. return $directories ? '__DIR__' : '__FILE__';
  24398. }
  24399. $commonPath = $to;
  24400. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath) && '.' !== $commonPath) {
  24401. $commonPath = strtr(dirname($commonPath), '\\', '/');
  24402. }
  24403. if (0 !== strpos($from, $commonPath) || '/' === $commonPath || '.' === $commonPath) {
  24404. return var_export($to, true);
  24405. }
  24406. $commonPath = rtrim($commonPath, '/') . '/';
  24407. if (strpos($to, $from.'/') === 0) {
  24408. return '__DIR__ . '.var_export(substr($to, strlen($from)), true);
  24409. }
  24410. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/') + $directories;
  24411. if ($staticCode) {
  24412. $commonPathCode = "__DIR__ . '".str_repeat('/..', $sourcePathDepth)."'";
  24413. } else {
  24414. $commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
  24415. }
  24416. $relTarget = substr($to, strlen($commonPath));
  24417. return $commonPathCode . (strlen($relTarget) ? '.' . var_export('/' . $relTarget, true) : '');
  24418. }
  24419. public function isAbsolutePath($path)
  24420. {
  24421. return substr($path, 0, 1) === '/' || substr($path, 1, 1) === ':';
  24422. }
  24423. public function size($path)
  24424. {
  24425. if (!file_exists($path)) {
  24426. throw new \RuntimeException("$path does not exist.");
  24427. }
  24428. if (is_dir($path)) {
  24429. return $this->directorySize($path);
  24430. }
  24431. return filesize($path);
  24432. }
  24433. public function normalizePath($path)
  24434. {
  24435. $parts = array();
  24436. $path = strtr($path, '\\', '/');
  24437. $prefix = '';
  24438. $absolute = false;
  24439. if (preg_match('{^( [0-9a-z]{2,}+: (?: // (?: [a-z]: )? )? | [a-z]: )}ix', $path, $match)) {
  24440. $prefix = $match[1];
  24441. $path = substr($path, strlen($prefix));
  24442. }
  24443. if (substr($path, 0, 1) === '/') {
  24444. $absolute = true;
  24445. $path = substr($path, 1);
  24446. }
  24447. $up = false;
  24448. foreach (explode('/', $path) as $chunk) {
  24449. if ('..' === $chunk && ($absolute || $up)) {
  24450. array_pop($parts);
  24451. $up = !(empty($parts) || '..' === end($parts));
  24452. } elseif ('.' !== $chunk && '' !== $chunk) {
  24453. $parts[] = $chunk;
  24454. $up = '..' !== $chunk;
  24455. }
  24456. }
  24457. return $prefix.($absolute ? '/' : '').implode('/', $parts);
  24458. }
  24459. public static function isLocalPath($path)
  24460. {
  24461. return (bool) preg_match('{^(file://(?!//)|/(?!/)|/?[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
  24462. }
  24463. public static function getPlatformPath($path)
  24464. {
  24465. if (Platform::isWindows()) {
  24466. $path = preg_replace('{^(?:file:///([a-z]):?/)}i', 'file://$1:/', $path);
  24467. }
  24468. return preg_replace('{^file://}i', '', $path);
  24469. }
  24470. protected function directorySize($directory)
  24471. {
  24472. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  24473. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  24474. $size = 0;
  24475. foreach ($ri as $file) {
  24476. if ($file->isFile()) {
  24477. $size += $file->getSize();
  24478. }
  24479. }
  24480. return $size;
  24481. }
  24482. protected function getProcess()
  24483. {
  24484. return new ProcessExecutor;
  24485. }
  24486. private function unlinkImplementation($path)
  24487. {
  24488. if (Platform::isWindows() && is_dir($path) && is_link($path)) {
  24489. return rmdir($path);
  24490. }
  24491. return unlink($path);
  24492. }
  24493. public function relativeSymlink($target, $link)
  24494. {
  24495. $cwd = getcwd();
  24496. $relativePath = $this->findShortestPath($link, $target);
  24497. chdir(dirname($link));
  24498. $result = @symlink($relativePath, $link);
  24499. chdir($cwd);
  24500. return (bool) $result;
  24501. }
  24502. public function isSymlinkedDirectory($directory)
  24503. {
  24504. if (!is_dir($directory)) {
  24505. return false;
  24506. }
  24507. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  24508. return is_link($resolved);
  24509. }
  24510. private function unlinkSymlinkedDirectory($directory)
  24511. {
  24512. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  24513. return $this->unlink($resolved);
  24514. }
  24515. private function resolveSymlinkedDirectorySymlink($pathname)
  24516. {
  24517. if (!is_dir($pathname)) {
  24518. return $pathname;
  24519. }
  24520. $resolved = rtrim($pathname, '/');
  24521. if (!strlen($resolved)) {
  24522. return $pathname;
  24523. }
  24524. return $resolved;
  24525. }
  24526. public function junction($target, $junction)
  24527. {
  24528. if (!Platform::isWindows()) {
  24529. throw new \LogicException(sprintf('Function %s is not available on non-Windows platform', __CLASS__));
  24530. }
  24531. if (!is_dir($target)) {
  24532. throw new IOException(sprintf('Cannot junction to "%s" as it is not a directory.', $target), 0, null, $target);
  24533. }
  24534. $cmd = sprintf('mklink /J %s %s',
  24535. ProcessExecutor::escape(str_replace('/', DIRECTORY_SEPARATOR, $junction)),
  24536. ProcessExecutor::escape(realpath($target)));
  24537. if ($this->getProcess()->execute($cmd, $output) !== 0) {
  24538. throw new IOException(sprintf('Failed to create junction to "%s" at "%s".', $target, $junction), 0, null, $target);
  24539. }
  24540. clearstatcache(true, $junction);
  24541. }
  24542. public function isJunction($junction)
  24543. {
  24544. if (!Platform::isWindows()) {
  24545. return false;
  24546. }
  24547. if (!is_dir($junction) || is_link($junction)) {
  24548. return false;
  24549. }
  24550. clearstatcache(true, $junction);
  24551. clearstatcache(false);
  24552. $stat = lstat($junction);
  24553. return !($stat['mode'] & 0xC000);
  24554. }
  24555. public function removeJunction($junction)
  24556. {
  24557. if (!Platform::isWindows()) {
  24558. return false;
  24559. }
  24560. $junction = rtrim(str_replace('/', DIRECTORY_SEPARATOR, $junction), DIRECTORY_SEPARATOR);
  24561. if (!$this->isJunction($junction)) {
  24562. throw new IOException(sprintf('%s is not a junction and thus cannot be removed as one', $junction));
  24563. }
  24564. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape($junction));
  24565. clearstatcache(true, $junction);
  24566. return ($this->getProcess()->execute($cmd, $output) === 0);
  24567. }
  24568. }
  24569. <?php
  24570. namespace Composer\Util;
  24571. use Composer\Config;
  24572. use Composer\IO\IOInterface;
  24573. class Git
  24574. {
  24575. private static $version;
  24576. protected $io;
  24577. protected $config;
  24578. protected $process;
  24579. protected $filesystem;
  24580. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process, Filesystem $fs)
  24581. {
  24582. $this->io = $io;
  24583. $this->config = $config;
  24584. $this->process = $process;
  24585. $this->filesystem = $fs;
  24586. }
  24587. public function runCommand($commandCallable, $url, $cwd, $initialClone = false)
  24588. {
  24589. $this->config->prohibitUrlByConfig($url, $this->io);
  24590. if ($initialClone) {
  24591. $origCwd = $cwd;
  24592. $cwd = null;
  24593. }
  24594. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $url)) {
  24595. throw new \InvalidArgumentException('The source URL ' . $url . ' is invalid, ssh URLs should have a port number after ":".' . "\n" . 'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.');
  24596. }
  24597. if (!$initialClone) {
  24598. $this->process->execute('git remote -v', $output, $cwd);
  24599. if (preg_match('{^(?:composer|origin)\s+https?://(.+):(.+)@([^/]+)}im', $output, $match)) {
  24600. $this->io->setAuthentication($match[3], urldecode($match[1]), urldecode($match[2]));
  24601. }
  24602. }
  24603. $protocols = $this->config->get('github-protocols');
  24604. if (!is_array($protocols)) {
  24605. throw new \RuntimeException('Config value "github-protocols" must be an array, got ' . gettype($protocols));
  24606. }
  24607. if (preg_match('{^(?:https?|git)://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)) {
  24608. $messages = array();
  24609. foreach ($protocols as $protocol) {
  24610. if ('ssh' === $protocol) {
  24611. $protoUrl = "git@" . $match[1] . ":" . $match[2];
  24612. } else {
  24613. $protoUrl = $protocol . "://" . $match[1] . "/" . $match[2];
  24614. }
  24615. if (0 === $this->process->execute(call_user_func($commandCallable, $protoUrl), $ignoredOutput, $cwd)) {
  24616. return;
  24617. }
  24618. $messages[] = '- ' . $protoUrl . "\n" . preg_replace('#^#m', ' ', $this->process->getErrorOutput());
  24619. if ($initialClone) {
  24620. $this->filesystem->removeDirectory($origCwd);
  24621. }
  24622. }
  24623. $this->throwException('Failed to clone ' . $url . ' via ' . implode(', ', $protocols) . ' protocols, aborting.' . "\n\n" . implode("\n", $messages), $url);
  24624. }
  24625. $bypassSshForGitHub = preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url) && !in_array('ssh', $protocols, true);
  24626. $command = call_user_func($commandCallable, $url);
  24627. $auth = null;
  24628. if ($bypassSshForGitHub || 0 !== $this->process->execute($command, $ignoredOutput, $cwd)) {
  24629. if (preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url, $match)) {
  24630. if (!$this->io->hasAuthentication($match[1])) {
  24631. $gitHubUtil = new GitHub($this->io, $this->config, $this->process);
  24632. $message = 'Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos';
  24633. if (!$gitHubUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  24634. $gitHubUtil->authorizeOAuthInteractively($match[1], $message);
  24635. }
  24636. }
  24637. if ($this->io->hasAuthentication($match[1])) {
  24638. $auth = $this->io->getAuthentication($match[1]);
  24639. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  24640. $command = call_user_func($commandCallable, $authUrl);
  24641. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  24642. return;
  24643. }
  24644. }
  24645. } elseif (preg_match('{^https://(bitbucket\.org)/(.*)(\.git)?$}U', $url, $match)) {
  24646. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process);
  24647. if (!$this->io->hasAuthentication($match[1])) {
  24648. $message = 'Enter your Bitbucket credentials to access private repos';
  24649. if (!$bitbucketUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  24650. $bitbucketUtil->authorizeOAuthInteractively($match[1], $message);
  24651. $accessToken = $bitbucketUtil->getToken();
  24652. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  24653. }
  24654. } else {
  24655. $auth = $this->io->getAuthentication($match[1]);
  24656. if ($auth['username'] !== 'x-token-auth') {
  24657. $accessToken = $bitbucketUtil->requestToken($match[1], $auth['username'], $auth['password']);
  24658. if (! empty($accessToken)) {
  24659. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  24660. }
  24661. }
  24662. }
  24663. if ($this->io->hasAuthentication($match[1])) {
  24664. $auth = $this->io->getAuthentication($match[1]);
  24665. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  24666. $command = call_user_func($commandCallable, $authUrl);
  24667. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  24668. return;
  24669. }
  24670. } else {
  24671. $sshUrl = 'git@bitbucket.org:' . $match[2] . '.git';
  24672. $this->io->writeError(' No bitbucket authentication configured. Falling back to ssh.');
  24673. $command = call_user_func($commandCallable, $sshUrl);
  24674. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  24675. return;
  24676. }
  24677. }
  24678. } elseif ($this->isAuthenticationFailure($url, $match)) {
  24679. if (strpos($match[2], '@')) {
  24680. list($authParts, $match[2]) = explode('@', $match[2], 2);
  24681. }
  24682. $storeAuth = false;
  24683. if ($this->io->hasAuthentication($match[2])) {
  24684. $auth = $this->io->getAuthentication($match[2]);
  24685. } elseif ($this->io->isInteractive()) {
  24686. $defaultUsername = null;
  24687. if (isset($authParts) && $authParts) {
  24688. if (false !== strpos($authParts, ':')) {
  24689. list($defaultUsername, ) = explode(':', $authParts, 2);
  24690. } else {
  24691. $defaultUsername = $authParts;
  24692. }
  24693. }
  24694. $this->io->writeError(' Authentication required (<info>' . parse_url($url, PHP_URL_HOST) . '</info>):');
  24695. $auth = array(
  24696. 'username' => $this->io->ask(' Username: ', $defaultUsername),
  24697. 'password' => $this->io->askAndHideAnswer(' Password: '),
  24698. );
  24699. $storeAuth = $this->config->get('store-auths');
  24700. }
  24701. if ($auth) {
  24702. $authUrl = $match[1] . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . $match[3];
  24703. $command = call_user_func($commandCallable, $authUrl);
  24704. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  24705. $this->io->setAuthentication($match[2], $auth['username'], $auth['password']);
  24706. $authHelper = new AuthHelper($this->io, $this->config);
  24707. $authHelper->storeAuth($match[2], $storeAuth);
  24708. return;
  24709. }
  24710. }
  24711. }
  24712. if ($initialClone) {
  24713. $this->filesystem->removeDirectory($origCwd);
  24714. }
  24715. $this->throwException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput(), $url);
  24716. }
  24717. }
  24718. public function syncMirror($url, $dir)
  24719. {
  24720. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  24721. try {
  24722. $commandCallable = function ($url) {
  24723. return sprintf('git remote set-url origin %s && git remote update --prune origin', ProcessExecutor::escape($url));
  24724. };
  24725. $this->runCommand($commandCallable, $url, $dir);
  24726. } catch (\Exception $e) {
  24727. return false;
  24728. }
  24729. return true;
  24730. }
  24731. $this->filesystem->removeDirectory($dir);
  24732. $commandCallable = function ($url) use ($dir) {
  24733. return sprintf('git clone --mirror %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($dir));
  24734. };
  24735. $this->runCommand($commandCallable, $url, $dir, true);
  24736. return true;
  24737. }
  24738. public function fetchRefOrSyncMirror($url, $dir, $ref)
  24739. {
  24740. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  24741. $escapedRef = ProcessExecutor::escape($ref.'^{commit}');
  24742. $exitCode = $this->process->execute(sprintf('git rev-parse --quiet --verify %s', $escapedRef), $output, $dir);
  24743. if ($exitCode === 0) {
  24744. return true;
  24745. }
  24746. }
  24747. $this->syncMirror($url, $dir);
  24748. return false;
  24749. }
  24750. private function isAuthenticationFailure($url, &$match)
  24751. {
  24752. if (!preg_match('{(https?://)([^/]+)(.*)$}i', $url, $match)) {
  24753. return false;
  24754. }
  24755. $authFailures = array(
  24756. 'fatal: Authentication failed',
  24757. 'remote error: Invalid username or password.',
  24758. 'error: 401 Unauthorized',
  24759. 'fatal: unable to access',
  24760. );
  24761. foreach ($authFailures as $authFailure) {
  24762. if (strpos($this->process->getErrorOutput(), $authFailure) !== false) {
  24763. return true;
  24764. }
  24765. }
  24766. return false;
  24767. }
  24768. public static function cleanEnv()
  24769. {
  24770. if (PHP_VERSION_ID < 50400 && ini_get('safe_mode') && false === strpos(ini_get('safe_mode_allowed_env_vars'), 'GIT_ASKPASS')) {
  24771. throw new \RuntimeException('safe_mode is enabled and safe_mode_allowed_env_vars does not contain GIT_ASKPASS, can not set env var. You can disable safe_mode with "-dsafe_mode=0" when running composer');
  24772. }
  24773. if (getenv('GIT_ASKPASS') !== 'echo') {
  24774. putenv('GIT_ASKPASS=echo');
  24775. unset($_SERVER['GIT_ASKPASS']);
  24776. }
  24777. if (getenv('GIT_DIR')) {
  24778. putenv('GIT_DIR');
  24779. unset($_SERVER['GIT_DIR']);
  24780. }
  24781. if (getenv('GIT_WORK_TREE')) {
  24782. putenv('GIT_WORK_TREE');
  24783. unset($_SERVER['GIT_WORK_TREE']);
  24784. }
  24785. if (getenv('LANGUAGE') !== 'C') {
  24786. putenv('LANGUAGE=C');
  24787. }
  24788. putenv("DYLD_LIBRARY_PATH");
  24789. unset($_SERVER['DYLD_LIBRARY_PATH']);
  24790. }
  24791. public static function getGitHubDomainsRegex(Config $config)
  24792. {
  24793. return '(' . implode('|', array_map('preg_quote', $config->get('github-domains'))) . ')';
  24794. }
  24795. public static function sanitizeUrl($message)
  24796. {
  24797. return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
  24798. if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
  24799. return '://***:***@';
  24800. }
  24801. return '://' . $m[1] . ':***@';
  24802. }, $message);
  24803. }
  24804. private function throwException($message, $url)
  24805. {
  24806. clearstatcache();
  24807. if (0 !== $this->process->execute('git --version', $ignoredOutput)) {
  24808. throw new \RuntimeException(self::sanitizeUrl('Failed to clone ' . $url . ', git was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()));
  24809. }
  24810. throw new \RuntimeException(self::sanitizeUrl($message));
  24811. }
  24812. public function getVersion()
  24813. {
  24814. if (isset(self::$version)) {
  24815. return self::$version;
  24816. }
  24817. if (0 !== $this->process->execute('git --version', $output)) {
  24818. return;
  24819. }
  24820. if (preg_match('/^git version (\d+(?:\.\d+)+)/m', $output, $matches)) {
  24821. return self::$version = $matches[1];
  24822. }
  24823. }
  24824. }
  24825. <?php
  24826. namespace Composer\Util;
  24827. use Composer\Factory;
  24828. use Composer\IO\IOInterface;
  24829. use Composer\Config;
  24830. use Composer\Downloader\TransportException;
  24831. class GitHub
  24832. {
  24833. protected $io;
  24834. protected $config;
  24835. protected $process;
  24836. protected $remoteFilesystem;
  24837. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  24838. {
  24839. $this->io = $io;
  24840. $this->config = $config;
  24841. $this->process = $process ?: new ProcessExecutor;
  24842. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  24843. }
  24844. public function authorizeOAuth($originUrl)
  24845. {
  24846. if (!in_array($originUrl, $this->config->get('github-domains'))) {
  24847. return false;
  24848. }
  24849. if (0 === $this->process->execute('git config github.accesstoken', $output)) {
  24850. $this->io->setAuthentication($originUrl, trim($output), 'x-oauth-basic');
  24851. return true;
  24852. }
  24853. return false;
  24854. }
  24855. public function authorizeOAuthInteractively($originUrl, $message = null)
  24856. {
  24857. if ($message) {
  24858. $this->io->writeError($message);
  24859. }
  24860. $note = 'Composer';
  24861. if ($this->config->get('github-expose-hostname') === true && 0 === $this->process->execute('hostname', $output)) {
  24862. $note .= ' on ' . trim($output);
  24863. }
  24864. $note .= ' ' . date('Y-m-d Hi');
  24865. $url = 'https://'.$originUrl.'/settings/tokens/new?scopes=repo&description=' . str_replace('%20', '+', rawurlencode($note));
  24866. $this->io->writeError(sprintf('Head to %s', $url));
  24867. $this->io->writeError(sprintf('to retrieve a token. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  24868. $token = trim($this->io->askAndHideAnswer('Token (hidden): '));
  24869. if (!$token) {
  24870. $this->io->writeError('<warning>No token given, aborting.</warning>');
  24871. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  24872. return false;
  24873. }
  24874. $this->io->setAuthentication($originUrl, $token, 'x-oauth-basic');
  24875. try {
  24876. $apiUrl = ('github.com' === $originUrl) ? 'api.github.com/' : $originUrl . '/api/v3/';
  24877. $this->remoteFilesystem->getContents($originUrl, 'https://'. $apiUrl, false, array(
  24878. 'retry-auth-failure' => false,
  24879. ));
  24880. } catch (TransportException $e) {
  24881. if (in_array($e->getCode(), array(403, 401))) {
  24882. $this->io->writeError('<error>Invalid token provided.</error>');
  24883. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  24884. return false;
  24885. }
  24886. throw $e;
  24887. }
  24888. $this->config->getConfigSource()->removeConfigSetting('github-oauth.'.$originUrl);
  24889. $this->config->getAuthConfigSource()->addConfigSetting('github-oauth.'.$originUrl, $token);
  24890. $this->io->writeError('<info>Token stored successfully.</info>');
  24891. return true;
  24892. }
  24893. }
  24894. <?php
  24895. namespace Composer\Util;
  24896. use Composer\IO\IOInterface;
  24897. use Composer\Config;
  24898. use Composer\Factory;
  24899. use Composer\Downloader\TransportException;
  24900. use Composer\Json\JsonFile;
  24901. class GitLab
  24902. {
  24903. protected $io;
  24904. protected $config;
  24905. protected $process;
  24906. protected $remoteFilesystem;
  24907. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  24908. {
  24909. $this->io = $io;
  24910. $this->config = $config;
  24911. $this->process = $process ?: new ProcessExecutor();
  24912. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  24913. }
  24914. public function authorizeOAuth($originUrl)
  24915. {
  24916. if (!in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  24917. return false;
  24918. }
  24919. if (0 === $this->process->execute('git config gitlab.accesstoken', $output)) {
  24920. $this->io->setAuthentication($originUrl, trim($output), 'oauth2');
  24921. return true;
  24922. }
  24923. $authTokens = $this->config->get('gitlab-token');
  24924. if (isset($authTokens[$originUrl])) {
  24925. $this->io->setAuthentication($originUrl, $authTokens[$originUrl], 'private-token');
  24926. return true;
  24927. }
  24928. return false;
  24929. }
  24930. public function authorizeOAuthInteractively($scheme, $originUrl, $message = null)
  24931. {
  24932. if ($message) {
  24933. $this->io->writeError($message);
  24934. }
  24935. $this->io->writeError(sprintf('A token will be created and stored in "%s", your password will never be stored', $this->config->getAuthConfigSource()->getName()));
  24936. $this->io->writeError('To revoke access to this token you can visit '.$originUrl.'/profile/applications');
  24937. $attemptCounter = 0;
  24938. while ($attemptCounter++ < 5) {
  24939. try {
  24940. $response = $this->createToken($scheme, $originUrl);
  24941. } catch (TransportException $e) {
  24942. if (in_array($e->getCode(), array(403, 401))) {
  24943. if (401 === $e->getCode()) {
  24944. $this->io->writeError('Bad credentials.');
  24945. } else {
  24946. $this->io->writeError('Maximum number of login attempts exceeded. Please try again later.');
  24947. }
  24948. $this->io->writeError('You can also manually create a personal token at '.$scheme.'://'.$originUrl.'/profile/personal_access_tokens');
  24949. $this->io->writeError('Add it using "composer config --global --auth gitlab-token.'.$originUrl.' <token>"');
  24950. continue;
  24951. }
  24952. throw $e;
  24953. }
  24954. $this->io->setAuthentication($originUrl, $response['access_token'], 'oauth2');
  24955. $this->config->getAuthConfigSource()->addConfigSetting('gitlab-oauth.'.$originUrl, $response['access_token']);
  24956. return true;
  24957. }
  24958. throw new \RuntimeException('Invalid GitLab credentials 5 times in a row, aborting.');
  24959. }
  24960. private function createToken($scheme, $originUrl)
  24961. {
  24962. $username = $this->io->ask('Username: ');
  24963. $password = $this->io->askAndHideAnswer('Password: ');
  24964. $headers = array('Content-Type: application/x-www-form-urlencoded');
  24965. $apiUrl = $originUrl;
  24966. $data = http_build_query(array(
  24967. 'username' => $username,
  24968. 'password' => $password,
  24969. 'grant_type' => 'password',
  24970. ), null, '&');
  24971. $options = array(
  24972. 'retry-auth-failure' => false,
  24973. 'http' => array(
  24974. 'method' => 'POST',
  24975. 'header' => $headers,
  24976. 'content' => $data,
  24977. ),
  24978. );
  24979. $json = $this->remoteFilesystem->getContents($originUrl, $scheme.'://'.$apiUrl.'/oauth/token', false, $options);
  24980. $this->io->writeError('Token successfully created');
  24981. return JsonFile::parseJson($json);
  24982. }
  24983. }
  24984. <?php
  24985. namespace Composer\Util;
  24986. class IniHelper
  24987. {
  24988. const ENV_ORIGINAL = 'COMPOSER_ORIGINAL_INIS';
  24989. public static function getAll()
  24990. {
  24991. $env = getenv(self::ENV_ORIGINAL);
  24992. if (false !== $env) {
  24993. return explode(PATH_SEPARATOR, $env);
  24994. }
  24995. $paths = array(strval(php_ini_loaded_file()));
  24996. if ($scanned = php_ini_scanned_files()) {
  24997. $paths = array_merge($paths, array_map('trim', explode(',', $scanned)));
  24998. }
  24999. return $paths;
  25000. }
  25001. public static function getMessage()
  25002. {
  25003. $paths = self::getAll();
  25004. if (empty($paths[0])) {
  25005. array_shift($paths);
  25006. }
  25007. $ini = array_shift($paths);
  25008. if (empty($ini)) {
  25009. return 'A php.ini file does not exist. You will have to create one.';
  25010. }
  25011. if (!empty($paths)) {
  25012. return 'Your command-line PHP is using multiple ini files. Run `php --ini` to show them.';
  25013. }
  25014. return 'The php.ini used by your command-line PHP is: '.$ini;
  25015. }
  25016. }
  25017. <?php
  25018. namespace Composer\Util;
  25019. class NoProxyPattern
  25020. {
  25021. protected $rules = array();
  25022. public function __construct($pattern)
  25023. {
  25024. $this->rules = preg_split("/[\s,]+/", $pattern);
  25025. }
  25026. public function test($url)
  25027. {
  25028. $host = parse_url($url, PHP_URL_HOST);
  25029. $port = parse_url($url, PHP_URL_PORT);
  25030. if (empty($port)) {
  25031. switch (parse_url($url, PHP_URL_SCHEME)) {
  25032. case 'http':
  25033. $port = 80;
  25034. break;
  25035. case 'https':
  25036. $port = 443;
  25037. break;
  25038. }
  25039. }
  25040. foreach ($this->rules as $rule) {
  25041. if ($rule == '*') {
  25042. return true;
  25043. }
  25044. $match = false;
  25045. list($ruleHost) = explode(':', $rule);
  25046. list($base) = explode('/', $ruleHost);
  25047. if (filter_var($base, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
  25048. if (!isset($ip)) {
  25049. $ip = gethostbyname($host);
  25050. }
  25051. if (strpos($ruleHost, '/') === false) {
  25052. $match = $ip === $ruleHost;
  25053. } else {
  25054. if ($ip === $host) {
  25055. $match = false;
  25056. } else {
  25057. $match = self::inCIDRBlock($ruleHost, $ip);
  25058. }
  25059. }
  25060. } else {
  25061. $haystack = '.' . trim($host, '.') . '.';
  25062. $needle = '.'. trim($ruleHost, '.') .'.';
  25063. $match = stripos(strrev($haystack), strrev($needle)) === 0;
  25064. }
  25065. if ($match && strpos($rule, ':') !== false) {
  25066. list(, $rulePort) = explode(':', $rule);
  25067. if (!empty($rulePort) && $port != $rulePort) {
  25068. $match = false;
  25069. }
  25070. }
  25071. if ($match) {
  25072. return true;
  25073. }
  25074. }
  25075. return false;
  25076. }
  25077. private static function inCIDRBlock($cidr, $ip)
  25078. {
  25079. list($base, $bits) = explode('/', $cidr);
  25080. list($a, $b, $c, $d) = explode('.', $base);
  25081. $i = ($a << 24) + ($b << 16) + ($c << 8) + $d;
  25082. $mask = $bits == 0 ? 0 : (~0 << (32 - $bits));
  25083. $low = $i & $mask;
  25084. $high = $i | (~$mask & 0xFFFFFFFF);
  25085. list($a, $b, $c, $d) = explode('.', $ip);
  25086. $check = ($a << 24) + ($b << 16) + ($c << 8) + $d;
  25087. return $check >= $low && $check <= $high;
  25088. }
  25089. }
  25090. <?php
  25091. namespace Composer\Util;
  25092. use Composer\IO\IOInterface;
  25093. use Symfony\Component\Process\Process;
  25094. class Perforce
  25095. {
  25096. protected $path;
  25097. protected $p4Depot;
  25098. protected $p4Client;
  25099. protected $p4User;
  25100. protected $p4Password;
  25101. protected $p4Port;
  25102. protected $p4Stream;
  25103. protected $p4ClientSpec;
  25104. protected $p4DepotType;
  25105. protected $p4Branch;
  25106. protected $process;
  25107. protected $uniquePerforceClientName;
  25108. protected $windowsFlag;
  25109. protected $commandResult;
  25110. protected $io;
  25111. protected $filesystem;
  25112. public function __construct($repoConfig, $port, $path, ProcessExecutor $process, $isWindows, IOInterface $io)
  25113. {
  25114. $this->windowsFlag = $isWindows;
  25115. $this->p4Port = $port;
  25116. $this->initializePath($path);
  25117. $this->process = $process;
  25118. $this->initialize($repoConfig);
  25119. $this->io = $io;
  25120. }
  25121. public static function create($repoConfig, $port, $path, ProcessExecutor $process, IOInterface $io)
  25122. {
  25123. return new Perforce($repoConfig, $port, $path, $process, Platform::isWindows(), $io);
  25124. }
  25125. public static function checkServerExists($url, ProcessExecutor $processExecutor)
  25126. {
  25127. $output = null;
  25128. return 0 === $processExecutor->execute('p4 -p ' . $url . ' info -s', $output);
  25129. }
  25130. public function initialize($repoConfig)
  25131. {
  25132. $this->uniquePerforceClientName = $this->generateUniquePerforceClientName();
  25133. if (!$repoConfig) {
  25134. return;
  25135. }
  25136. if (isset($repoConfig['unique_perforce_client_name'])) {
  25137. $this->uniquePerforceClientName = $repoConfig['unique_perforce_client_name'];
  25138. }
  25139. if (isset($repoConfig['depot'])) {
  25140. $this->p4Depot = $repoConfig['depot'];
  25141. }
  25142. if (isset($repoConfig['branch'])) {
  25143. $this->p4Branch = $repoConfig['branch'];
  25144. }
  25145. if (isset($repoConfig['p4user'])) {
  25146. $this->p4User = $repoConfig['p4user'];
  25147. } else {
  25148. $this->p4User = $this->getP4variable('P4USER');
  25149. }
  25150. if (isset($repoConfig['p4password'])) {
  25151. $this->p4Password = $repoConfig['p4password'];
  25152. }
  25153. }
  25154. public function initializeDepotAndBranch($depot, $branch)
  25155. {
  25156. if (isset($depot)) {
  25157. $this->p4Depot = $depot;
  25158. }
  25159. if (isset($branch)) {
  25160. $this->p4Branch = $branch;
  25161. }
  25162. }
  25163. public function generateUniquePerforceClientName()
  25164. {
  25165. return gethostname() . "_" . time();
  25166. }
  25167. public function cleanupClientSpec()
  25168. {
  25169. $client = $this->getClient();
  25170. $task = 'client -d ' . $client;
  25171. $useP4Client = false;
  25172. $command = $this->generateP4Command($task, $useP4Client);
  25173. $this->executeCommand($command);
  25174. $clientSpec = $this->getP4ClientSpec();
  25175. $fileSystem = $this->getFilesystem();
  25176. $fileSystem->remove($clientSpec);
  25177. }
  25178. protected function executeCommand($command)
  25179. {
  25180. $this->commandResult = '';
  25181. return $this->process->execute($command, $this->commandResult);
  25182. }
  25183. public function getClient()
  25184. {
  25185. if (!isset($this->p4Client)) {
  25186. $cleanStreamName = str_replace(array('//', '/', '@'), array('', '_', ''), $this->getStream());
  25187. $this->p4Client = 'composer_perforce_' . $this->uniquePerforceClientName . '_' . $cleanStreamName;
  25188. }
  25189. return $this->p4Client;
  25190. }
  25191. protected function getPath()
  25192. {
  25193. return $this->path;
  25194. }
  25195. public function initializePath($path)
  25196. {
  25197. $this->path = $path;
  25198. $fs = $this->getFilesystem();
  25199. $fs->ensureDirectoryExists($path);
  25200. }
  25201. protected function getPort()
  25202. {
  25203. return $this->p4Port;
  25204. }
  25205. public function setStream($stream)
  25206. {
  25207. $this->p4Stream = $stream;
  25208. $index = strrpos($stream, '/');
  25209. if ($index > 2) {
  25210. $this->p4DepotType = 'stream';
  25211. }
  25212. }
  25213. public function isStream()
  25214. {
  25215. return (strcmp($this->p4DepotType, 'stream') === 0);
  25216. }
  25217. public function getStream()
  25218. {
  25219. if (!isset($this->p4Stream)) {
  25220. if ($this->isStream()) {
  25221. $this->p4Stream = '//' . $this->p4Depot . '/' . $this->p4Branch;
  25222. } else {
  25223. $this->p4Stream = '//' . $this->p4Depot;
  25224. }
  25225. }
  25226. return $this->p4Stream;
  25227. }
  25228. public function getStreamWithoutLabel($stream)
  25229. {
  25230. $index = strpos($stream, '@');
  25231. if ($index === false) {
  25232. return $stream;
  25233. }
  25234. return substr($stream, 0, $index);
  25235. }
  25236. public function getP4ClientSpec()
  25237. {
  25238. return $this->path . '/' . $this->getClient() . '.p4.spec';
  25239. }
  25240. public function getUser()
  25241. {
  25242. return $this->p4User;
  25243. }
  25244. public function setUser($user)
  25245. {
  25246. $this->p4User = $user;
  25247. }
  25248. public function queryP4User()
  25249. {
  25250. $this->getUser();
  25251. if (strlen($this->p4User) > 0) {
  25252. return;
  25253. }
  25254. $this->p4User = $this->getP4variable('P4USER');
  25255. if (strlen($this->p4User) > 0) {
  25256. return;
  25257. }
  25258. $this->p4User = $this->io->ask('Enter P4 User:');
  25259. if ($this->windowsFlag) {
  25260. $command = 'p4 set P4USER=' . $this->p4User;
  25261. } else {
  25262. $command = 'export P4USER=' . $this->p4User;
  25263. }
  25264. $this->executeCommand($command);
  25265. }
  25266. protected function getP4variable($name)
  25267. {
  25268. if ($this->windowsFlag) {
  25269. $command = 'p4 set';
  25270. $this->executeCommand($command);
  25271. $result = trim($this->commandResult);
  25272. $resArray = explode(PHP_EOL, $result);
  25273. foreach ($resArray as $line) {
  25274. $fields = explode('=', $line);
  25275. if (strcmp($name, $fields[0]) == 0) {
  25276. $index = strpos($fields[1], ' ');
  25277. if ($index === false) {
  25278. $value = $fields[1];
  25279. } else {
  25280. $value = substr($fields[1], 0, $index);
  25281. }
  25282. $value = trim($value);
  25283. return $value;
  25284. }
  25285. }
  25286. return null;
  25287. }
  25288. $command = 'echo $' . $name;
  25289. $this->executeCommand($command);
  25290. $result = trim($this->commandResult);
  25291. return $result;
  25292. }
  25293. public function queryP4Password()
  25294. {
  25295. if (isset($this->p4Password)) {
  25296. return $this->p4Password;
  25297. }
  25298. $password = $this->getP4variable('P4PASSWD');
  25299. if (strlen($password) <= 0) {
  25300. $password = $this->io->askAndHideAnswer('Enter password for Perforce user ' . $this->getUser() . ': ');
  25301. }
  25302. $this->p4Password = $password;
  25303. return $password;
  25304. }
  25305. public function generateP4Command($command, $useClient = true)
  25306. {
  25307. $p4Command = 'p4 ';
  25308. $p4Command = $p4Command . '-u ' . $this->getUser() . ' ';
  25309. if ($useClient) {
  25310. $p4Command = $p4Command . '-c ' . $this->getClient() . ' ';
  25311. }
  25312. $p4Command = $p4Command . '-p ' . $this->getPort() . ' ' . $command;
  25313. return $p4Command;
  25314. }
  25315. public function isLoggedIn()
  25316. {
  25317. $command = $this->generateP4Command('login -s', false);
  25318. $exitCode = $this->executeCommand($command);
  25319. if ($exitCode) {
  25320. $errorOutput = $this->process->getErrorOutput();
  25321. $index = strpos($errorOutput, $this->getUser());
  25322. if ($index === false) {
  25323. $index = strpos($errorOutput, 'p4');
  25324. if ($index === false) {
  25325. return false;
  25326. }
  25327. throw new \Exception('p4 command not found in path: ' . $errorOutput);
  25328. }
  25329. throw new \Exception('Invalid user name: ' . $this->getUser());
  25330. }
  25331. return true;
  25332. }
  25333. public function connectClient()
  25334. {
  25335. $p4CreateClientCommand = $this->generateP4Command(
  25336. 'client -i < ' . str_replace(" ", "\\ ", $this->getP4ClientSpec())
  25337. );
  25338. $this->executeCommand($p4CreateClientCommand);
  25339. }
  25340. public function syncCodeBase($sourceReference)
  25341. {
  25342. $prevDir = getcwd();
  25343. chdir($this->path);
  25344. $p4SyncCommand = $this->generateP4Command('sync -f ');
  25345. if (null !== $sourceReference) {
  25346. $p4SyncCommand = $p4SyncCommand . '@' . $sourceReference;
  25347. }
  25348. $this->executeCommand($p4SyncCommand);
  25349. chdir($prevDir);
  25350. }
  25351. public function writeClientSpecToFile($spec)
  25352. {
  25353. fwrite($spec, 'Client: ' . $this->getClient() . PHP_EOL . PHP_EOL);
  25354. fwrite($spec, 'Update: ' . date('Y/m/d H:i:s') . PHP_EOL . PHP_EOL);
  25355. fwrite($spec, 'Access: ' . date('Y/m/d H:i:s') . PHP_EOL);
  25356. fwrite($spec, 'Owner: ' . $this->getUser() . PHP_EOL . PHP_EOL);
  25357. fwrite($spec, 'Description:' . PHP_EOL);
  25358. fwrite($spec, ' Created by ' . $this->getUser() . ' from composer.' . PHP_EOL . PHP_EOL);
  25359. fwrite($spec, 'Root: ' . $this->getPath() . PHP_EOL . PHP_EOL);
  25360. fwrite($spec, 'Options: noallwrite noclobber nocompress unlocked modtime rmdir' . PHP_EOL . PHP_EOL);
  25361. fwrite($spec, 'SubmitOptions: revertunchanged' . PHP_EOL . PHP_EOL);
  25362. fwrite($spec, 'LineEnd: local' . PHP_EOL . PHP_EOL);
  25363. if ($this->isStream()) {
  25364. fwrite($spec, 'Stream:' . PHP_EOL);
  25365. fwrite($spec, ' ' . $this->getStreamWithoutLabel($this->p4Stream) . PHP_EOL);
  25366. } else {
  25367. fwrite(
  25368. $spec,
  25369. 'View: ' . $this->getStream() . '/... //' . $this->getClient() . '/... ' . PHP_EOL
  25370. );
  25371. }
  25372. }
  25373. public function writeP4ClientSpec()
  25374. {
  25375. $clientSpec = $this->getP4ClientSpec();
  25376. $spec = fopen($clientSpec, 'w');
  25377. try {
  25378. $this->writeClientSpecToFile($spec);
  25379. } catch (\Exception $e) {
  25380. fclose($spec);
  25381. throw $e;
  25382. }
  25383. fclose($spec);
  25384. }
  25385. protected function read($pipe, $name)
  25386. {
  25387. if (feof($pipe)) {
  25388. return;
  25389. }
  25390. $line = fgets($pipe);
  25391. while ($line !== false) {
  25392. $line = fgets($pipe);
  25393. }
  25394. return;
  25395. }
  25396. public function windowsLogin($password)
  25397. {
  25398. $command = $this->generateP4Command(' login -a');
  25399. $process = new Process($command, null, null, $password);
  25400. return $process->run();
  25401. }
  25402. public function p4Login()
  25403. {
  25404. $this->queryP4User();
  25405. if (!$this->isLoggedIn()) {
  25406. $password = $this->queryP4Password();
  25407. if ($this->windowsFlag) {
  25408. $this->windowsLogin($password);
  25409. } else {
  25410. $command = 'echo ' . $password . ' | ' . $this->generateP4Command(' login -a', false);
  25411. $exitCode = $this->executeCommand($command);
  25412. $result = trim($this->commandResult);
  25413. if ($exitCode) {
  25414. throw new \Exception("Error logging in:" . $this->process->getErrorOutput());
  25415. }
  25416. }
  25417. }
  25418. }
  25419. public function getComposerInformation($identifier)
  25420. {
  25421. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  25422. if (!$composerFileContent) {
  25423. return;
  25424. }
  25425. return json_decode($composerFileContent, true);
  25426. }
  25427. public function getFileContent($file, $identifier)
  25428. {
  25429. $path = $this->getFilePath($file, $identifier);
  25430. $command = $this->generateP4Command(' print ' . $path);
  25431. $this->executeCommand($command);
  25432. $result = $this->commandResult;
  25433. if (!trim($result)) {
  25434. return null;
  25435. }
  25436. return $result;
  25437. }
  25438. public function getFilePath($file, $identifier)
  25439. {
  25440. $index = strpos($identifier, '@');
  25441. if ($index === false) {
  25442. $path = $identifier. '/' . $file;
  25443. return $path;
  25444. }
  25445. $path = substr($identifier, 0, $index) . '/' . $file . substr($identifier, $index);
  25446. $command = $this->generateP4Command(' files ' . $path, false);
  25447. $this->executeCommand($command);
  25448. $result = $this->commandResult;
  25449. $index2 = strpos($result, 'no such file(s).');
  25450. if ($index2 === false) {
  25451. $index3 = strpos($result, 'change');
  25452. if ($index3 !== false) {
  25453. $phrase = trim(substr($result, $index3));
  25454. $fields = explode(' ', $phrase);
  25455. return substr($identifier, 0, $index) . '/' . $file . '@' . $fields[1];
  25456. }
  25457. }
  25458. return null;
  25459. }
  25460. public function getBranches()
  25461. {
  25462. $possibleBranches = array();
  25463. if (!$this->isStream()) {
  25464. $possibleBranches[$this->p4Branch] = $this->getStream();
  25465. } else {
  25466. $command = $this->generateP4Command('streams //' . $this->p4Depot . '/...');
  25467. $this->executeCommand($command);
  25468. $result = $this->commandResult;
  25469. $resArray = explode(PHP_EOL, $result);
  25470. foreach ($resArray as $line) {
  25471. $resBits = explode(' ', $line);
  25472. if (count($resBits) > 4) {
  25473. $branch = preg_replace('/[^A-Za-z0-9 ]/', '', $resBits[4]);
  25474. $possibleBranches[$branch] = $resBits[1];
  25475. }
  25476. }
  25477. }
  25478. $command = $this->generateP4Command('changes '. $this->getStream() . '/...', false);
  25479. $this->executeCommand($command);
  25480. $result = $this->commandResult;
  25481. $resArray = explode(PHP_EOL, $result);
  25482. $lastCommit = $resArray[0];
  25483. $lastCommitArr = explode(' ', $lastCommit);
  25484. $lastCommitNum = $lastCommitArr[1];
  25485. $branches = array('master' => $possibleBranches[$this->p4Branch] . '@'. $lastCommitNum);
  25486. return $branches;
  25487. }
  25488. public function getTags()
  25489. {
  25490. $command = $this->generateP4Command('labels');
  25491. $this->executeCommand($command);
  25492. $result = $this->commandResult;
  25493. $resArray = explode(PHP_EOL, $result);
  25494. $tags = array();
  25495. foreach ($resArray as $line) {
  25496. $index = strpos($line, 'Label');
  25497. if (!($index === false)) {
  25498. $fields = explode(' ', $line);
  25499. $tags[$fields[1]] = $this->getStream() . '@' . $fields[1];
  25500. }
  25501. }
  25502. return $tags;
  25503. }
  25504. public function checkStream()
  25505. {
  25506. $command = $this->generateP4Command('depots', false);
  25507. $this->executeCommand($command);
  25508. $result = $this->commandResult;
  25509. $resArray = explode(PHP_EOL, $result);
  25510. foreach ($resArray as $line) {
  25511. $index = strpos($line, 'Depot');
  25512. if (!($index === false)) {
  25513. $fields = explode(' ', $line);
  25514. if (strcmp($this->p4Depot, $fields[1]) === 0) {
  25515. $this->p4DepotType = $fields[3];
  25516. return $this->isStream();
  25517. }
  25518. }
  25519. }
  25520. return false;
  25521. }
  25522. protected function getChangeList($reference)
  25523. {
  25524. $index = strpos($reference, '@');
  25525. if ($index === false) {
  25526. return null;
  25527. }
  25528. $label = substr($reference, $index);
  25529. $command = $this->generateP4Command(' changes -m1 ' . $label);
  25530. $this->executeCommand($command);
  25531. $changes = $this->commandResult;
  25532. if (strpos($changes, 'Change') !== 0) {
  25533. return null;
  25534. }
  25535. $fields = explode(' ', $changes);
  25536. return $fields[1];
  25537. }
  25538. public function getCommitLogs($fromReference, $toReference)
  25539. {
  25540. $fromChangeList = $this->getChangeList($fromReference);
  25541. if ($fromChangeList === null) {
  25542. return null;
  25543. }
  25544. $toChangeList = $this->getChangeList($toReference);
  25545. if ($toChangeList === null) {
  25546. return null;
  25547. }
  25548. $index = strpos($fromReference, '@');
  25549. $main = substr($fromReference, 0, $index) . '/...';
  25550. $command = $this->generateP4Command('filelog ' . $main . '@' . $fromChangeList. ',' . $toChangeList);
  25551. $this->executeCommand($command);
  25552. return $this->commandResult;
  25553. }
  25554. public function getFilesystem()
  25555. {
  25556. if (empty($this->filesystem)) {
  25557. $this->filesystem = new Filesystem($this->process);
  25558. }
  25559. return $this->filesystem;
  25560. }
  25561. public function setFilesystem(Filesystem $fs)
  25562. {
  25563. $this->filesystem = $fs;
  25564. }
  25565. }
  25566. <?php
  25567. namespace Composer\Util;
  25568. class Platform
  25569. {
  25570. public static function expandPath($path)
  25571. {
  25572. if (preg_match('#^~[\\/]#', $path)) {
  25573. return self::getUserDirectory() . substr($path, 1);
  25574. }
  25575. return preg_replace_callback('#^(\$|(?P<percent>%))(?P<var>\w++)(?(percent)%)(?P<path>.*)#', function ($matches) {
  25576. if (Platform::isWindows() && $matches['var'] == 'HOME') {
  25577. return (getenv('HOME') ?: getenv('USERPROFILE')) . $matches['path'];
  25578. }
  25579. return getenv($matches['var']) . $matches['path'];
  25580. }, $path);
  25581. }
  25582. public static function getUserDirectory()
  25583. {
  25584. if (false !== ($home = getenv('HOME'))) {
  25585. return $home;
  25586. }
  25587. if (self::isWindows() && false !== ($home = getenv('USERPROFILE'))) {
  25588. return $home;
  25589. }
  25590. if (function_exists('posix_getuid') && function_exists('posix_getpwuid')) {
  25591. $info = posix_getpwuid(posix_getuid());
  25592. return $info['dir'];
  25593. }
  25594. throw new \RuntimeException('Could not determine user directory');
  25595. }
  25596. public static function isWindows()
  25597. {
  25598. return defined('PHP_WINDOWS_VERSION_BUILD');
  25599. }
  25600. public static function strlen($str)
  25601. {
  25602. static $useMbString = null;
  25603. if (null === $useMbString) {
  25604. $useMbString = function_exists('mb_strlen') && ini_get('mbstring.func_overload');
  25605. }
  25606. if ($useMbString) {
  25607. return mb_strlen($str, '8bit');
  25608. }
  25609. return strlen($str);
  25610. }
  25611. }
  25612. <?php
  25613. namespace Composer\Util;
  25614. use Composer\IO\IOInterface;
  25615. use Symfony\Component\Process\Process;
  25616. use Symfony\Component\Process\ProcessUtils;
  25617. class ProcessExecutor
  25618. {
  25619. protected static $timeout = 300;
  25620. protected $captureOutput;
  25621. protected $errorOutput;
  25622. protected $io;
  25623. public function __construct(IOInterface $io = null)
  25624. {
  25625. $this->io = $io;
  25626. }
  25627. public function execute($command, &$output = null, $cwd = null)
  25628. {
  25629. if ($this->io && $this->io->isDebug()) {
  25630. $safeCommand = preg_replace_callback('{://(?P<user>[^:/\s]+):(?P<password>[^@\s/]+)@}i', function ($m) {
  25631. if (preg_match('{^[a-f0-9]{12,}$}', $m['user'])) {
  25632. return '://***:***@';
  25633. }
  25634. return '://'.$m['user'].':***@';
  25635. }, $command);
  25636. $this->io->writeError('Executing command ('.($cwd ?: 'CWD').'): '.$safeCommand);
  25637. }
  25638. if (null === $cwd && Platform::isWindows() && false !== strpos($command, 'git') && getcwd()) {
  25639. $cwd = realpath(getcwd());
  25640. }
  25641. $this->captureOutput = count(func_get_args()) > 1;
  25642. $this->errorOutput = null;
  25643. $process = new Process($command, $cwd, null, null, static::getTimeout());
  25644. $callback = is_callable($output) ? $output : array($this, 'outputHandler');
  25645. $process->run($callback);
  25646. if ($this->captureOutput && !is_callable($output)) {
  25647. $output = $process->getOutput();
  25648. }
  25649. $this->errorOutput = $process->getErrorOutput();
  25650. return $process->getExitCode();
  25651. }
  25652. public function splitLines($output)
  25653. {
  25654. $output = trim($output);
  25655. return ((string) $output === '') ? array() : preg_split('{\r?\n}', $output);
  25656. }
  25657. public function getErrorOutput()
  25658. {
  25659. return $this->errorOutput;
  25660. }
  25661. public function outputHandler($type, $buffer)
  25662. {
  25663. if ($this->captureOutput) {
  25664. return;
  25665. }
  25666. if (null === $this->io) {
  25667. echo $buffer;
  25668. return;
  25669. }
  25670. if (Process::ERR === $type) {
  25671. $this->io->writeError($buffer, false);
  25672. } else {
  25673. $this->io->write($buffer, false);
  25674. }
  25675. }
  25676. public static function getTimeout()
  25677. {
  25678. return static::$timeout;
  25679. }
  25680. public static function setTimeout($timeout)
  25681. {
  25682. static::$timeout = $timeout;
  25683. }
  25684. public static function escape($argument)
  25685. {
  25686. if (method_exists('Symfony\Component\Process\ProcessUtils', 'escapeArgument')) {
  25687. return ProcessUtils::escapeArgument($argument);
  25688. }
  25689. return self::escapeArgument($argument);
  25690. }
  25691. private static function escapeArgument($argument)
  25692. {
  25693. if ('\\' === DIRECTORY_SEPARATOR) {
  25694. if ('' === $argument) {
  25695. return escapeshellarg($argument);
  25696. }
  25697. $escapedArgument = '';
  25698. $quote = false;
  25699. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  25700. if ('"' === $part) {
  25701. $escapedArgument .= '\\"';
  25702. } elseif (self::isSurroundedBy($part, '%')) {
  25703. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  25704. } else {
  25705. if ('\\' === substr($part, -1)) {
  25706. $part .= '\\';
  25707. }
  25708. $quote = true;
  25709. $escapedArgument .= $part;
  25710. }
  25711. }
  25712. if ($quote) {
  25713. $escapedArgument = '"'.$escapedArgument.'"';
  25714. }
  25715. return $escapedArgument;
  25716. }
  25717. return "'".str_replace("'", "'\\''", $argument)."'";
  25718. }
  25719. private static function isSurroundedBy($arg, $char)
  25720. {
  25721. return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
  25722. }
  25723. }
  25724. <?php
  25725. namespace Composer\Util;
  25726. use Composer\Config;
  25727. use Composer\IO\IOInterface;
  25728. use Composer\Downloader\TransportException;
  25729. use Composer\CaBundle\CaBundle;
  25730. use Psr\Log\LoggerInterface;
  25731. class RemoteFilesystem
  25732. {
  25733. private $io;
  25734. private $config;
  25735. private $scheme;
  25736. private $bytesMax;
  25737. private $originUrl;
  25738. private $fileUrl;
  25739. private $fileName;
  25740. private $retry;
  25741. private $progress;
  25742. private $lastProgress;
  25743. private $options = array();
  25744. private $peerCertificateMap = array();
  25745. private $disableTls = false;
  25746. private $retryAuthFailure;
  25747. private $lastHeaders;
  25748. private $storeAuth;
  25749. private $degradedMode = false;
  25750. private $redirects;
  25751. private $maxRedirects = 20;
  25752. public function __construct(IOInterface $io, Config $config = null, array $options = array(), $disableTls = false)
  25753. {
  25754. $this->io = $io;
  25755. if ($disableTls === false) {
  25756. $this->options = $this->getTlsDefaults($options);
  25757. } else {
  25758. $this->disableTls = true;
  25759. }
  25760. $this->options = array_replace_recursive($this->options, $options);
  25761. $this->config = $config;
  25762. }
  25763. public function copy($originUrl, $fileUrl, $fileName, $progress = true, $options = array())
  25764. {
  25765. return $this->get($originUrl, $fileUrl, $options, $fileName, $progress);
  25766. }
  25767. public function getContents($originUrl, $fileUrl, $progress = true, $options = array())
  25768. {
  25769. return $this->get($originUrl, $fileUrl, $options, null, $progress);
  25770. }
  25771. public function getOptions()
  25772. {
  25773. return $this->options;
  25774. }
  25775. public function setOptions(array $options)
  25776. {
  25777. $this->options = array_replace_recursive($this->options, $options);
  25778. }
  25779. public function isTlsDisabled()
  25780. {
  25781. return $this->disableTls === true;
  25782. }
  25783. public function getLastHeaders()
  25784. {
  25785. return $this->lastHeaders;
  25786. }
  25787. public function findHeaderValue(array $headers, $name)
  25788. {
  25789. $value = null;
  25790. foreach ($headers as $header) {
  25791. if (preg_match('{^'.$name.':\s*(.+?)\s*$}i', $header, $match)) {
  25792. $value = $match[1];
  25793. } elseif (preg_match('{^HTTP/}i', $header)) {
  25794. $value = null;
  25795. }
  25796. }
  25797. return $value;
  25798. }
  25799. public function findStatusCode(array $headers)
  25800. {
  25801. $value = null;
  25802. foreach ($headers as $header) {
  25803. if (preg_match('{^HTTP/\S+ (\d+)}i', $header, $match)) {
  25804. $value = (int) $match[1];
  25805. }
  25806. }
  25807. return $value;
  25808. }
  25809. public function findStatusMessage(array $headers)
  25810. {
  25811. $value = null;
  25812. foreach ($headers as $header) {
  25813. if (preg_match('{^HTTP/\S+ \d+}i', $header)) {
  25814. $value = $header;
  25815. }
  25816. }
  25817. return $value;
  25818. }
  25819. protected function get($originUrl, $fileUrl, $additionalOptions = array(), $fileName = null, $progress = true)
  25820. {
  25821. if (strpos($originUrl, '.github.com') === (strlen($originUrl) - 11)) {
  25822. $originUrl = 'github.com';
  25823. }
  25824. if (
  25825. $this->config
  25826. && is_array($this->config->get('gitlab-domains'))
  25827. && false === strpos($originUrl, '/')
  25828. && !in_array($originUrl, $this->config->get('gitlab-domains'))
  25829. ) {
  25830. foreach ($this->config->get('gitlab-domains') as $gitlabDomain) {
  25831. if (0 === strpos($gitlabDomain, $originUrl)) {
  25832. $originUrl = $gitlabDomain;
  25833. break;
  25834. }
  25835. }
  25836. unset($gitlabDomain);
  25837. }
  25838. $this->scheme = parse_url($fileUrl, PHP_URL_SCHEME);
  25839. $this->bytesMax = 0;
  25840. $this->originUrl = $originUrl;
  25841. $this->fileUrl = $fileUrl;
  25842. $this->fileName = $fileName;
  25843. $this->progress = $progress;
  25844. $this->lastProgress = null;
  25845. $this->retryAuthFailure = true;
  25846. $this->lastHeaders = array();
  25847. $this->redirects = 1;
  25848. if (preg_match('{^https?://([^:/]+):([^@/]+)@([^/]+)}i', $fileUrl, $match)) {
  25849. $this->io->setAuthentication($originUrl, urldecode($match[1]), urldecode($match[2]));
  25850. }
  25851. $tempAdditionalOptions = $additionalOptions;
  25852. if (isset($tempAdditionalOptions['retry-auth-failure'])) {
  25853. $this->retryAuthFailure = (bool) $tempAdditionalOptions['retry-auth-failure'];
  25854. unset($tempAdditionalOptions['retry-auth-failure']);
  25855. }
  25856. $isRedirect = false;
  25857. if (isset($tempAdditionalOptions['redirects'])) {
  25858. $this->redirects = $tempAdditionalOptions['redirects'];
  25859. $isRedirect = true;
  25860. unset($tempAdditionalOptions['redirects']);
  25861. }
  25862. $options = $this->getOptionsForUrl($originUrl, $tempAdditionalOptions);
  25863. unset($tempAdditionalOptions);
  25864. $origFileUrl = $fileUrl;
  25865. if (isset($options['github-token'])) {
  25866. if (preg_match('{^https?://([a-z0-9-]+\.)*github\.com/}', $fileUrl)) {
  25867. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['github-token'];
  25868. }
  25869. unset($options['github-token']);
  25870. }
  25871. if (isset($options['gitlab-token'])) {
  25872. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['gitlab-token'];
  25873. unset($options['gitlab-token']);
  25874. }
  25875. if (isset($options['http'])) {
  25876. $options['http']['ignore_errors'] = true;
  25877. }
  25878. if ($this->degradedMode && substr($fileUrl, 0, 21) === 'http://packagist.org/') {
  25879. $fileUrl = 'http://' . gethostbyname('packagist.org') . substr($fileUrl, 20);
  25880. $degradedPackagist = true;
  25881. }
  25882. $ctx = StreamContextFactory::getContext($fileUrl, $options, array('notification' => array($this, 'callbackGet')));
  25883. $actualContextOptions = stream_context_get_options($ctx);
  25884. $usingProxy = !empty($actualContextOptions['http']['proxy']) ? ' using proxy ' . $actualContextOptions['http']['proxy'] : '';
  25885. $this->io->writeError((substr($origFileUrl, 0, 4) === 'http' ? 'Downloading ' : 'Reading ') . $origFileUrl . $usingProxy, true, IOInterface::DEBUG);
  25886. unset($origFileUrl, $actualContextOptions);
  25887. if ((substr($fileUrl, 0, 23) !== 'http://packagist.org/p/' || (false === strpos($fileUrl, '$') && false === strpos($fileUrl, '%24'))) && empty($degradedPackagist) && $this->config) {
  25888. $this->config->prohibitUrlByConfig($fileUrl, $this->io);
  25889. }
  25890. if ($this->progress && !$isRedirect) {
  25891. $this->io->writeError("Downloading (<comment>connecting...</comment>)", false);
  25892. }
  25893. $errorMessage = '';
  25894. $errorCode = 0;
  25895. $result = false;
  25896. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  25897. if ($errorMessage) {
  25898. $errorMessage .= "\n";
  25899. }
  25900. $errorMessage .= preg_replace('{^file_get_contents\(.*?\): }', '', $msg);
  25901. });
  25902. try {
  25903. $result = file_get_contents($fileUrl, false, $ctx);
  25904. if (!empty($http_response_header[0])) {
  25905. $statusCode = $this->findStatusCode($http_response_header);
  25906. if (in_array($statusCode, array(401, 403)) && $this->retryAuthFailure) {
  25907. $warning = null;
  25908. if ($this->findHeaderValue($http_response_header, 'content-type') === 'application/json') {
  25909. $data = json_decode($result, true);
  25910. if (!empty($data['warning'])) {
  25911. $warning = $data['warning'];
  25912. }
  25913. }
  25914. $this->promptAuthAndRetry($statusCode, $this->findStatusMessage($http_response_header), $warning);
  25915. }
  25916. }
  25917. $contentLength = !empty($http_response_header[0]) ? $this->findHeaderValue($http_response_header, 'content-length') : null;
  25918. if ($contentLength && Platform::strlen($result) < $contentLength) {
  25919. $e = new TransportException('Content-Length mismatch, received '.Platform::strlen($result).' bytes out of the expected '.$contentLength);
  25920. $e->setHeaders($http_response_header);
  25921. $e->setStatusCode($this->findStatusCode($http_response_header));
  25922. $e->setResponse($result);
  25923. $this->io->writeError('Content-Length mismatch, received '.Platform::strlen($result).' out of '.$contentLength.' bytes: (' . base64_encode($result).')', true, IOInterface::DEBUG);
  25924. throw $e;
  25925. }
  25926. if (PHP_VERSION_ID < 50600 && !empty($options['ssl']['peer_fingerprint'])) {
  25927. $params = stream_context_get_params($ctx);
  25928. $expectedPeerFingerprint = $options['ssl']['peer_fingerprint'];
  25929. $peerFingerprint = TlsHelper::getCertificateFingerprint($params['options']['ssl']['peer_certificate']);
  25930. if ($expectedPeerFingerprint !== $peerFingerprint) {
  25931. throw new TransportException('Peer fingerprint did not match');
  25932. }
  25933. }
  25934. } catch (\Exception $e) {
  25935. if ($e instanceof TransportException && !empty($http_response_header[0])) {
  25936. $e->setHeaders($http_response_header);
  25937. $e->setStatusCode($this->findStatusCode($http_response_header));
  25938. }
  25939. if ($e instanceof TransportException && $result !== false) {
  25940. $e->setResponse($result);
  25941. }
  25942. $result = false;
  25943. }
  25944. if ($errorMessage && !ini_get('allow_url_fopen')) {
  25945. $errorMessage = 'allow_url_fopen must be enabled in php.ini ('.$errorMessage.')';
  25946. }
  25947. restore_error_handler();
  25948. if (isset($e) && !$this->retry) {
  25949. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  25950. $this->degradedMode = true;
  25951. $this->io->writeError('');
  25952. $this->io->writeError(array(
  25953. '<error>'.$e->getMessage().'</error>',
  25954. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  25955. ));
  25956. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  25957. }
  25958. throw $e;
  25959. }
  25960. $statusCode = null;
  25961. $contentType = null;
  25962. if (!empty($http_response_header[0])) {
  25963. $statusCode = $this->findStatusCode($http_response_header);
  25964. $contentType = $this->findHeaderValue($http_response_header, 'content-type');
  25965. }
  25966. if ($originUrl === 'bitbucket.org'
  25967. && !$this->isPublicBitBucketDownload($fileUrl)
  25968. && substr($fileUrl, -4) === '.zip'
  25969. && $contentType && preg_match('{^text/html\b}i', $contentType)
  25970. ) {
  25971. $result = false;
  25972. if ($this->retryAuthFailure) {
  25973. $this->promptAuthAndRetry(401);
  25974. }
  25975. }
  25976. if ($statusCode === 404
  25977. && $this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)
  25978. && false !== strpos($fileUrl, 'archive.zip')
  25979. ) {
  25980. $result = false;
  25981. if ($this->retryAuthFailure) {
  25982. $this->promptAuthAndRetry(401);
  25983. }
  25984. }
  25985. $hasFollowedRedirect = false;
  25986. if ($statusCode >= 300 && $statusCode <= 399 && $statusCode !== 304 && $this->redirects < $this->maxRedirects) {
  25987. $hasFollowedRedirect = true;
  25988. $result = $this->handleRedirect($http_response_header, $additionalOptions, $result);
  25989. }
  25990. if ($statusCode && $statusCode >= 400 && $statusCode <= 599) {
  25991. if (!$this->retry) {
  25992. if ($this->progress && !$this->retry && !$isRedirect) {
  25993. $this->io->overwriteError("Downloading (<error>failed</error>)", false);
  25994. }
  25995. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded ('.$http_response_header[0].')', $statusCode);
  25996. $e->setHeaders($http_response_header);
  25997. $e->setResponse($result);
  25998. $e->setStatusCode($statusCode);
  25999. throw $e;
  26000. }
  26001. $result = false;
  26002. }
  26003. if ($this->progress && !$this->retry && !$isRedirect) {
  26004. $this->io->overwriteError("Downloading (".($result === false ? '<error>failed</error>' : '<comment>100%</comment>').")", false);
  26005. }
  26006. if ($result && extension_loaded('zlib') && substr($fileUrl, 0, 4) === 'http' && !$hasFollowedRedirect) {
  26007. $contentEncoding = $this->findHeaderValue($http_response_header, 'content-encoding');
  26008. $decode = $contentEncoding && 'gzip' === strtolower($contentEncoding);
  26009. if ($decode) {
  26010. try {
  26011. if (PHP_VERSION_ID >= 50400) {
  26012. $result = zlib_decode($result);
  26013. } else {
  26014. $result = file_get_contents('compress.zlib://data:application/octet-stream;base64,'.base64_encode($result));
  26015. }
  26016. if (!$result) {
  26017. throw new TransportException('Failed to decode zlib stream');
  26018. }
  26019. } catch (\Exception $e) {
  26020. if ($this->degradedMode) {
  26021. throw $e;
  26022. }
  26023. $this->degradedMode = true;
  26024. $this->io->writeError(array(
  26025. '',
  26026. '<error>Failed to decode response: '.$e->getMessage().'</error>',
  26027. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  26028. ));
  26029. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  26030. }
  26031. }
  26032. }
  26033. if (false !== $result && null !== $fileName && !$isRedirect) {
  26034. if ('' === $result) {
  26035. throw new TransportException('"'.$this->fileUrl.'" appears broken, and returned an empty 200 response');
  26036. }
  26037. $errorMessage = '';
  26038. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  26039. if ($errorMessage) {
  26040. $errorMessage .= "\n";
  26041. }
  26042. $errorMessage .= preg_replace('{^file_put_contents\(.*?\): }', '', $msg);
  26043. });
  26044. $result = (bool) file_put_contents($fileName, $result);
  26045. restore_error_handler();
  26046. if (false === $result) {
  26047. throw new TransportException('The "'.$this->fileUrl.'" file could not be written to '.$fileName.': '.$errorMessage);
  26048. }
  26049. }
  26050. if (false === $result && false !== strpos($errorMessage, 'Peer certificate') && PHP_VERSION_ID < 50600) {
  26051. if (CaBundle::isOpensslParseSafe()) {
  26052. $certDetails = $this->getCertificateCnAndFp($this->fileUrl, $options);
  26053. if ($certDetails) {
  26054. $this->peerCertificateMap[$this->getUrlAuthority($this->fileUrl)] = $certDetails;
  26055. $this->retry = true;
  26056. }
  26057. } else {
  26058. $this->io->writeError('');
  26059. $this->io->writeError(sprintf(
  26060. '<error>Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.</error>',
  26061. PHP_VERSION
  26062. ));
  26063. }
  26064. }
  26065. if ($this->retry) {
  26066. $this->retry = false;
  26067. $result = $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  26068. if ($this->storeAuth && $this->config) {
  26069. $authHelper = new AuthHelper($this->io, $this->config);
  26070. $authHelper->storeAuth($this->originUrl, $this->storeAuth);
  26071. $this->storeAuth = false;
  26072. }
  26073. return $result;
  26074. }
  26075. if (false === $result) {
  26076. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded: '.$errorMessage, $errorCode);
  26077. if (!empty($http_response_header[0])) {
  26078. $e->setHeaders($http_response_header);
  26079. }
  26080. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  26081. $this->degradedMode = true;
  26082. $this->io->writeError('');
  26083. $this->io->writeError(array(
  26084. '<error>'.$e->getMessage().'</error>',
  26085. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  26086. ));
  26087. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  26088. }
  26089. throw $e;
  26090. }
  26091. if (!empty($http_response_header[0])) {
  26092. $this->lastHeaders = $http_response_header;
  26093. }
  26094. return $result;
  26095. }
  26096. protected function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax)
  26097. {
  26098. switch ($notificationCode) {
  26099. case STREAM_NOTIFY_FAILURE:
  26100. if (400 === $messageCode) {
  26101. throw new TransportException("The '" . $this->fileUrl . "' URL could not be accessed: " . $message, $messageCode);
  26102. }
  26103. break;
  26104. case STREAM_NOTIFY_FILE_SIZE_IS:
  26105. $this->bytesMax = $bytesMax;
  26106. break;
  26107. case STREAM_NOTIFY_PROGRESS:
  26108. if ($this->bytesMax > 0 && $this->progress) {
  26109. $progression = min(100, round($bytesTransferred / $this->bytesMax * 100));
  26110. if ((0 === $progression % 5) && 100 !== $progression && $progression !== $this->lastProgress) {
  26111. $this->lastProgress = $progression;
  26112. $this->io->overwriteError("Downloading (<comment>$progression%</comment>)", false);
  26113. }
  26114. }
  26115. break;
  26116. default:
  26117. break;
  26118. }
  26119. }
  26120. protected function promptAuthAndRetry($httpStatus, $reason = null, $warning = null)
  26121. {
  26122. if ($this->config && in_array($this->originUrl, $this->config->get('github-domains'), true)) {
  26123. $message = "\n".'Could not fetch '.$this->fileUrl.', please create a GitHub OAuth token '.($httpStatus === 404 ? 'to access private repos' : 'to go over the API rate limit');
  26124. $gitHubUtil = new GitHub($this->io, $this->config, null);
  26125. if (!$gitHubUtil->authorizeOAuth($this->originUrl)
  26126. && (!$this->io->isInteractive() || !$gitHubUtil->authorizeOAuthInteractively($this->originUrl, $message))
  26127. ) {
  26128. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  26129. }
  26130. } elseif ($this->config && in_array($this->originUrl, $this->config->get('gitlab-domains'), true)) {
  26131. $message = "\n".'Could not fetch '.$this->fileUrl.', enter your ' . $this->originUrl . ' credentials ' .($httpStatus === 401 ? 'to access private repos' : 'to go over the API rate limit');
  26132. $gitLabUtil = new GitLab($this->io, $this->config, null);
  26133. if ($this->io->hasAuthentication($this->originUrl) && ($auth = $this->io->getAuthentication($this->originUrl)) && $auth['password'] === 'private-token') {
  26134. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  26135. }
  26136. if (!$gitLabUtil->authorizeOAuth($this->originUrl)
  26137. && (!$this->io->isInteractive() || !$gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, $message))
  26138. ) {
  26139. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  26140. }
  26141. } elseif ($this->config && $this->originUrl === 'bitbucket.org') {
  26142. $askForOAuthToken = true;
  26143. if ($this->io->hasAuthentication($this->originUrl)) {
  26144. $auth = $this->io->getAuthentication($this->originUrl);
  26145. if ($auth['username'] !== 'x-token-auth') {
  26146. $bitbucketUtil = new Bitbucket($this->io, $this->config);
  26147. $accessToken = $bitbucketUtil->requestToken($this->originUrl, $auth['username'], $auth['password']);
  26148. if (!empty($accessToken)) {
  26149. $this->io->setAuthentication($this->originUrl, 'x-token-auth', $accessToken);
  26150. $askForOAuthToken = false;
  26151. }
  26152. } else {
  26153. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  26154. }
  26155. }
  26156. if ($askForOAuthToken) {
  26157. $message = "\n".'Could not fetch ' . $this->fileUrl . ', please create a bitbucket OAuth token to ' . (($httpStatus === 401 || $httpStatus === 403) ? 'access private repos' : 'go over the API rate limit');
  26158. $bitBucketUtil = new Bitbucket($this->io, $this->config);
  26159. if (! $bitBucketUtil->authorizeOAuth($this->originUrl)
  26160. && (! $this->io->isInteractive() || !$bitBucketUtil->authorizeOAuthInteractively($this->originUrl, $message))
  26161. ) {
  26162. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  26163. }
  26164. }
  26165. } else {
  26166. if ($httpStatus === 404) {
  26167. return;
  26168. }
  26169. if (!$this->io->isInteractive()) {
  26170. if ($httpStatus === 401) {
  26171. $message = "The '" . $this->fileUrl . "' URL required authentication.\nYou must be using the interactive console to authenticate";
  26172. }
  26173. if ($httpStatus === 403) {
  26174. $message = "The '" . $this->fileUrl . "' URL could not be accessed: " . $reason;
  26175. }
  26176. throw new TransportException($message, $httpStatus);
  26177. }
  26178. if ($this->io->hasAuthentication($this->originUrl)) {
  26179. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  26180. }
  26181. $this->io->overwriteError('');
  26182. if ($warning) {
  26183. $this->io->writeError(' <warning>'.$warning.'</warning>');
  26184. }
  26185. $this->io->writeError(' Authentication required (<info>'.parse_url($this->fileUrl, PHP_URL_HOST).'</info>):');
  26186. $username = $this->io->ask(' Username: ');
  26187. $password = $this->io->askAndHideAnswer(' Password: ');
  26188. $this->io->setAuthentication($this->originUrl, $username, $password);
  26189. $this->storeAuth = $this->config->get('store-auths');
  26190. }
  26191. $this->retry = true;
  26192. throw new TransportException('RETRY');
  26193. }
  26194. protected function getOptionsForUrl($originUrl, $additionalOptions)
  26195. {
  26196. $tlsOptions = array();
  26197. if ($this->disableTls === false && PHP_VERSION_ID < 50600 && !stream_is_local($this->fileUrl)) {
  26198. $host = parse_url($this->fileUrl, PHP_URL_HOST);
  26199. if (PHP_VERSION_ID < 50304) {
  26200. if ($host === 'github.com' || $host === 'api.github.com') {
  26201. $host = '*.github.com';
  26202. }
  26203. }
  26204. $tlsOptions['ssl']['CN_match'] = $host;
  26205. $tlsOptions['ssl']['SNI_server_name'] = $host;
  26206. $urlAuthority = $this->getUrlAuthority($this->fileUrl);
  26207. if (isset($this->peerCertificateMap[$urlAuthority])) {
  26208. $certMap = $this->peerCertificateMap[$urlAuthority];
  26209. $this->io->writeError('', true, IOInterface::DEBUG);
  26210. $this->io->writeError(sprintf(
  26211. 'Using <info>%s</info> as CN for subjectAltName enabled host <info>%s</info>',
  26212. $certMap['cn'],
  26213. $urlAuthority
  26214. ), true, IOInterface::DEBUG);
  26215. $tlsOptions['ssl']['CN_match'] = $certMap['cn'];
  26216. $tlsOptions['ssl']['peer_fingerprint'] = $certMap['fp'];
  26217. }
  26218. }
  26219. $headers = array();
  26220. if (extension_loaded('zlib')) {
  26221. $headers[] = 'Accept-Encoding: gzip';
  26222. }
  26223. $options = array_replace_recursive($this->options, $tlsOptions, $additionalOptions);
  26224. if (!$this->degradedMode) {
  26225. $options['http']['protocol_version'] = 1.1;
  26226. $headers[] = 'Connection: close';
  26227. }
  26228. if ($this->io->hasAuthentication($originUrl)) {
  26229. $auth = $this->io->getAuthentication($originUrl);
  26230. if ('github.com' === $originUrl && 'x-oauth-basic' === $auth['password']) {
  26231. $options['github-token'] = $auth['username'];
  26232. } elseif ($this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  26233. if ($auth['password'] === 'oauth2') {
  26234. $headers[] = 'Authorization: Bearer '.$auth['username'];
  26235. } elseif ($auth['password'] === 'private-token') {
  26236. $headers[] = 'PRIVATE-TOKEN: '.$auth['username'];
  26237. }
  26238. } elseif ('bitbucket.org' === $originUrl
  26239. && $this->fileUrl !== Bitbucket::OAUTH2_ACCESS_TOKEN_URL && 'x-token-auth' === $auth['username']
  26240. ) {
  26241. if (!$this->isPublicBitBucketDownload($this->fileUrl)) {
  26242. $headers[] = 'Authorization: Bearer ' . $auth['password'];
  26243. }
  26244. } else {
  26245. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  26246. $headers[] = 'Authorization: Basic '.$authStr;
  26247. }
  26248. }
  26249. $options['http']['follow_location'] = 0;
  26250. if (isset($options['http']['header']) && !is_array($options['http']['header'])) {
  26251. $options['http']['header'] = explode("\r\n", trim($options['http']['header'], "\r\n"));
  26252. }
  26253. foreach ($headers as $header) {
  26254. $options['http']['header'][] = $header;
  26255. }
  26256. return $options;
  26257. }
  26258. private function handleRedirect(array $http_response_header, array $additionalOptions, $result)
  26259. {
  26260. if ($locationHeader = $this->findHeaderValue($http_response_header, 'location')) {
  26261. if (parse_url($locationHeader, PHP_URL_SCHEME)) {
  26262. $targetUrl = $locationHeader;
  26263. } elseif (parse_url($locationHeader, PHP_URL_HOST)) {
  26264. $targetUrl = $this->scheme.':'.$locationHeader;
  26265. } elseif ('/' === $locationHeader[0]) {
  26266. $urlHost = parse_url($this->fileUrl, PHP_URL_HOST);
  26267. $targetUrl = preg_replace('{^(.+(?://|@)'.preg_quote($urlHost).'(?::\d+)?)(?:[/\?].*)?$}', '\1'.$locationHeader, $this->fileUrl);
  26268. } else {
  26269. $targetUrl = preg_replace('{^(.+/)[^/?]*(?:\?.*)?$}', '\1'.$locationHeader, $this->fileUrl);
  26270. }
  26271. }
  26272. if (!empty($targetUrl)) {
  26273. $this->redirects++;
  26274. $this->io->writeError('', true, IOInterface::DEBUG);
  26275. $this->io->writeError(sprintf('Following redirect (%u) %s', $this->redirects, $targetUrl), true, IOInterface::DEBUG);
  26276. $additionalOptions['redirects'] = $this->redirects;
  26277. return $this->get(parse_url($targetUrl, PHP_URL_HOST), $targetUrl, $additionalOptions, $this->fileName, $this->progress);
  26278. }
  26279. if (!$this->retry) {
  26280. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded, got redirect without Location ('.$http_response_header[0].')');
  26281. $e->setHeaders($http_response_header);
  26282. $e->setResponse($result);
  26283. throw $e;
  26284. }
  26285. return false;
  26286. }
  26287. private function getTlsDefaults(array $options)
  26288. {
  26289. $ciphers = implode(':', array(
  26290. 'ECDHE-RSA-AES128-GCM-SHA256',
  26291. 'ECDHE-ECDSA-AES128-GCM-SHA256',
  26292. 'ECDHE-RSA-AES256-GCM-SHA384',
  26293. 'ECDHE-ECDSA-AES256-GCM-SHA384',
  26294. 'DHE-RSA-AES128-GCM-SHA256',
  26295. 'DHE-DSS-AES128-GCM-SHA256',
  26296. 'kEDH+AESGCM',
  26297. 'ECDHE-RSA-AES128-SHA256',
  26298. 'ECDHE-ECDSA-AES128-SHA256',
  26299. 'ECDHE-RSA-AES128-SHA',
  26300. 'ECDHE-ECDSA-AES128-SHA',
  26301. 'ECDHE-RSA-AES256-SHA384',
  26302. 'ECDHE-ECDSA-AES256-SHA384',
  26303. 'ECDHE-RSA-AES256-SHA',
  26304. 'ECDHE-ECDSA-AES256-SHA',
  26305. 'DHE-RSA-AES128-SHA256',
  26306. 'DHE-RSA-AES128-SHA',
  26307. 'DHE-DSS-AES128-SHA256',
  26308. 'DHE-RSA-AES256-SHA256',
  26309. 'DHE-DSS-AES256-SHA',
  26310. 'DHE-RSA-AES256-SHA',
  26311. 'AES128-GCM-SHA256',
  26312. 'AES256-GCM-SHA384',
  26313. 'AES128-SHA256',
  26314. 'AES256-SHA256',
  26315. 'AES128-SHA',
  26316. 'AES256-SHA',
  26317. 'AES',
  26318. 'CAMELLIA',
  26319. 'DES-CBC3-SHA',
  26320. '!aNULL',
  26321. '!eNULL',
  26322. '!EXPORT',
  26323. '!DES',
  26324. '!RC4',
  26325. '!MD5',
  26326. '!PSK',
  26327. '!aECDH',
  26328. '!EDH-DSS-DES-CBC3-SHA',
  26329. '!EDH-RSA-DES-CBC3-SHA',
  26330. '!KRB5-DES-CBC3-SHA',
  26331. ));
  26332. $defaults = array(
  26333. 'ssl' => array(
  26334. 'ciphers' => $ciphers,
  26335. 'verify_peer' => true,
  26336. 'verify_depth' => 7,
  26337. 'SNI_enabled' => true,
  26338. 'capture_peer_cert' => true,
  26339. ),
  26340. );
  26341. if (isset($options['ssl'])) {
  26342. $defaults['ssl'] = array_replace_recursive($defaults['ssl'], $options['ssl']);
  26343. }
  26344. $caBundleLogger = $this->io instanceof LoggerInterface ? $this->io : null;
  26345. if (!isset($defaults['ssl']['cafile']) && !isset($defaults['ssl']['capath'])) {
  26346. $result = CaBundle::getSystemCaRootBundlePath($caBundleLogger);
  26347. if (is_dir($result)) {
  26348. $defaults['ssl']['capath'] = $result;
  26349. } else {
  26350. $defaults['ssl']['cafile'] = $result;
  26351. }
  26352. }
  26353. if (isset($defaults['ssl']['cafile']) && (!is_readable($defaults['ssl']['cafile']) || !CaBundle::validateCaFile($defaults['ssl']['cafile'], $caBundleLogger))) {
  26354. throw new TransportException('The configured cafile was not valid or could not be read.');
  26355. }
  26356. if (isset($defaults['ssl']['capath']) && (!is_dir($defaults['ssl']['capath']) || !is_readable($defaults['ssl']['capath']))) {
  26357. throw new TransportException('The configured capath was not valid or could not be read.');
  26358. }
  26359. if (PHP_VERSION_ID >= 50413) {
  26360. $defaults['ssl']['disable_compression'] = true;
  26361. }
  26362. return $defaults;
  26363. }
  26364. private function getCertificateCnAndFp($url, $options)
  26365. {
  26366. if (PHP_VERSION_ID >= 50600) {
  26367. throw new \BadMethodCallException(sprintf(
  26368. '%s must not be used on PHP >= 5.6',
  26369. __METHOD__
  26370. ));
  26371. }
  26372. $context = StreamContextFactory::getContext($url, $options, array('options' => array(
  26373. 'ssl' => array(
  26374. 'capture_peer_cert' => true,
  26375. 'verify_peer' => false,
  26376. ), ),
  26377. ));
  26378. if (false === $handle = @fopen($url, 'rb', false, $context)) {
  26379. return;
  26380. }
  26381. fclose($handle);
  26382. $handle = null;
  26383. $params = stream_context_get_params($context);
  26384. if (!empty($params['options']['ssl']['peer_certificate'])) {
  26385. $peerCertificate = $params['options']['ssl']['peer_certificate'];
  26386. if (TlsHelper::checkCertificateHost($peerCertificate, parse_url($url, PHP_URL_HOST), $commonName)) {
  26387. return array(
  26388. 'cn' => $commonName,
  26389. 'fp' => TlsHelper::getCertificateFingerprint($peerCertificate),
  26390. );
  26391. }
  26392. }
  26393. }
  26394. private function getUrlAuthority($url)
  26395. {
  26396. $defaultPorts = array(
  26397. 'ftp' => 21,
  26398. 'http' => 80,
  26399. 'https' => 443,
  26400. 'ssh2.sftp' => 22,
  26401. 'ssh2.scp' => 22,
  26402. );
  26403. $scheme = parse_url($url, PHP_URL_SCHEME);
  26404. if (!isset($defaultPorts[$scheme])) {
  26405. throw new \InvalidArgumentException(sprintf(
  26406. 'Could not get default port for unknown scheme: %s',
  26407. $scheme
  26408. ));
  26409. }
  26410. $defaultPort = $defaultPorts[$scheme];
  26411. $port = parse_url($url, PHP_URL_PORT) ?: $defaultPort;
  26412. return parse_url($url, PHP_URL_HOST).':'.$port;
  26413. }
  26414. private function isPublicBitBucketDownload($urlToBitBucketFile)
  26415. {
  26416. $domain = parse_url($urlToBitBucketFile, PHP_URL_HOST);
  26417. if (strpos($domain, 'bitbucket.org') === false) {
  26418. return true;
  26419. }
  26420. $path = parse_url($urlToBitBucketFile, PHP_URL_PATH);
  26421. $pathParts = explode('/', $path);
  26422. return count($pathParts) >= 4 && $pathParts[3] == 'downloads';
  26423. }
  26424. }
  26425. <?php
  26426. namespace Composer\Util;
  26427. class Silencer
  26428. {
  26429. private static $stack = array();
  26430. public static function suppress($mask = null)
  26431. {
  26432. if (!isset($mask)) {
  26433. $mask = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT;
  26434. }
  26435. $old = error_reporting();
  26436. self::$stack[] = $old;
  26437. error_reporting($old & ~$mask);
  26438. return $old;
  26439. }
  26440. public static function restore()
  26441. {
  26442. if (!empty(self::$stack)) {
  26443. error_reporting(array_pop(self::$stack));
  26444. }
  26445. }
  26446. public static function call($callable )
  26447. {
  26448. try {
  26449. self::suppress();
  26450. $result = call_user_func_array($callable, array_slice(func_get_args(), 1));
  26451. self::restore();
  26452. return $result;
  26453. } catch (\Exception $e) {
  26454. self::restore();
  26455. throw $e;
  26456. }
  26457. }
  26458. }
  26459. <?php
  26460. namespace Composer\Util;
  26461. use Composer\Spdx\SpdxLicenses;
  26462. trigger_error('The ' . __NAMESPACE__ . '\SpdxLicense class is deprecated, use Composer\Spdx\SpdxLicenses instead.', E_USER_DEPRECATED);
  26463. class SpdxLicense extends SpdxLicenses
  26464. {
  26465. }
  26466. <?php
  26467. namespace Composer\Util;
  26468. use Composer\Composer;
  26469. final class StreamContextFactory
  26470. {
  26471. public static function getContext($url, array $defaultOptions = array(), array $defaultParams = array())
  26472. {
  26473. $options = array('http' => array(
  26474. 'follow_location' => 1,
  26475. 'max_redirects' => 20,
  26476. ));
  26477. if (PHP_SAPI === 'cli' && (!empty($_SERVER['HTTP_PROXY']) || !empty($_SERVER['http_proxy']))) {
  26478. $proxy = parse_url(!empty($_SERVER['http_proxy']) ? $_SERVER['http_proxy'] : $_SERVER['HTTP_PROXY']);
  26479. }
  26480. if (!empty($_SERVER['CGI_HTTP_PROXY'])) {
  26481. $proxy = parse_url($_SERVER['CGI_HTTP_PROXY']);
  26482. }
  26483. if (preg_match('{^https://}i', $url) && (!empty($_SERVER['HTTPS_PROXY']) || !empty($_SERVER['https_proxy']))) {
  26484. $proxy = parse_url(!empty($_SERVER['https_proxy']) ? $_SERVER['https_proxy'] : $_SERVER['HTTPS_PROXY']);
  26485. }
  26486. if (!empty($_SERVER['NO_PROXY']) || !empty($_SERVER['no_proxy']) && parse_url($url, PHP_URL_HOST)) {
  26487. $pattern = new NoProxyPattern(!empty($_SERVER['no_proxy']) ? $_SERVER['no_proxy'] : $_SERVER['NO_PROXY']);
  26488. if ($pattern->test($url)) {
  26489. unset($proxy);
  26490. }
  26491. }
  26492. if (!empty($proxy)) {
  26493. $proxyURL = isset($proxy['scheme']) ? $proxy['scheme'] . '://' : '';
  26494. $proxyURL .= isset($proxy['host']) ? $proxy['host'] : '';
  26495. if (isset($proxy['port'])) {
  26496. $proxyURL .= ":" . $proxy['port'];
  26497. } elseif ('http://' == substr($proxyURL, 0, 7)) {
  26498. $proxyURL .= ":80";
  26499. } elseif ('https://' == substr($proxyURL, 0, 8)) {
  26500. $proxyURL .= ":443";
  26501. }
  26502. $proxyURL = str_replace(array('http://', 'https://'), array('tcp://', 'ssl://'), $proxyURL);
  26503. if (0 === strpos($proxyURL, 'ssl:') && !extension_loaded('openssl')) {
  26504. throw new \RuntimeException('You must enable the openssl extension to use a proxy over https');
  26505. }
  26506. $options['http']['proxy'] = $proxyURL;
  26507. switch (parse_url($url, PHP_URL_SCHEME)) {
  26508. case 'http':
  26509. $reqFullUriEnv = getenv('HTTP_PROXY_REQUEST_FULLURI');
  26510. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  26511. $options['http']['request_fulluri'] = true;
  26512. }
  26513. break;
  26514. case 'https':
  26515. $reqFullUriEnv = getenv('HTTPS_PROXY_REQUEST_FULLURI');
  26516. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  26517. $options['http']['request_fulluri'] = true;
  26518. }
  26519. break;
  26520. }
  26521. if ('https' === parse_url($url, PHP_URL_SCHEME)) {
  26522. $options['ssl']['SNI_enabled'] = true;
  26523. if (PHP_VERSION_ID < 50600) {
  26524. $options['ssl']['SNI_server_name'] = parse_url($url, PHP_URL_HOST);
  26525. }
  26526. }
  26527. if (isset($proxy['user'])) {
  26528. $auth = urldecode($proxy['user']);
  26529. if (isset($proxy['pass'])) {
  26530. $auth .= ':' . urldecode($proxy['pass']);
  26531. }
  26532. $auth = base64_encode($auth);
  26533. if (isset($defaultOptions['http']['header'])) {
  26534. if (is_string($defaultOptions['http']['header'])) {
  26535. $defaultOptions['http']['header'] = array($defaultOptions['http']['header']);
  26536. }
  26537. $defaultOptions['http']['header'][] = "Proxy-Authorization: Basic {$auth}";
  26538. } else {
  26539. $options['http']['header'] = array("Proxy-Authorization: Basic {$auth}");
  26540. }
  26541. }
  26542. }
  26543. $options = array_replace_recursive($options, $defaultOptions);
  26544. if (isset($options['http']['header'])) {
  26545. $options['http']['header'] = self::fixHttpHeaderField($options['http']['header']);
  26546. }
  26547. if (defined('HHVM_VERSION')) {
  26548. $phpVersion = 'HHVM ' . HHVM_VERSION;
  26549. } else {
  26550. $phpVersion = 'PHP ' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
  26551. }
  26552. if (!isset($options['http']['header']) || false === stripos(implode('', $options['http']['header']), 'user-agent')) {
  26553. $options['http']['header'][] = sprintf(
  26554. 'User-Agent: Composer/%s (%s; %s; %s%s)',
  26555. Composer::VERSION === '@package_version@' ? 'source' : Composer::VERSION,
  26556. function_exists('php_uname') ? php_uname('s') : 'Unknown',
  26557. function_exists('php_uname') ? php_uname('r') : 'Unknown',
  26558. $phpVersion,
  26559. getenv('CI') ? '; CI' : ''
  26560. );
  26561. }
  26562. return stream_context_create($options, $defaultParams);
  26563. }
  26564. private static function fixHttpHeaderField($header)
  26565. {
  26566. if (!is_array($header)) {
  26567. $header = explode("\r\n", $header);
  26568. }
  26569. uasort($header, function ($el) {
  26570. return preg_match('{^content-type}i', $el) ? 1 : -1;
  26571. });
  26572. return $header;
  26573. }
  26574. }
  26575. <?php
  26576. namespace Composer\Util;
  26577. use Composer\Config;
  26578. use Composer\IO\IOInterface;
  26579. class Svn
  26580. {
  26581. const MAX_QTY_AUTH_TRIES = 5;
  26582. protected $credentials;
  26583. protected $hasAuth;
  26584. protected $io;
  26585. protected $url;
  26586. protected $cacheCredentials = true;
  26587. protected $process;
  26588. protected $qtyAuthTries = 0;
  26589. protected $config;
  26590. static private $version;
  26591. public function __construct($url, IOInterface $io, Config $config, ProcessExecutor $process = null)
  26592. {
  26593. $this->url = $url;
  26594. $this->io = $io;
  26595. $this->config = $config;
  26596. $this->process = $process ?: new ProcessExecutor;
  26597. }
  26598. public static function cleanEnv()
  26599. {
  26600. putenv("DYLD_LIBRARY_PATH");
  26601. unset($_SERVER['DYLD_LIBRARY_PATH']);
  26602. }
  26603. public function execute($command, $url, $cwd = null, $path = null, $verbose = false)
  26604. {
  26605. $this->config->prohibitUrlByConfig($url, $this->io);
  26606. return $this->executeWithAuthRetry($command, $cwd, $url, $path, $verbose);
  26607. }
  26608. public function executeLocal($command, $path, $cwd = null, $verbose = false)
  26609. {
  26610. return $this->executeWithAuthRetry($command, $cwd, '', $path, $verbose);
  26611. }
  26612. private function executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose)
  26613. {
  26614. $command = $this->getCommand($svnCommand, $url, $path);
  26615. $output = null;
  26616. $io = $this->io;
  26617. $handler = function ($type, $buffer) use (&$output, $io, $verbose) {
  26618. if ($type !== 'out') {
  26619. return;
  26620. }
  26621. if ('Redirecting to URL ' === substr($buffer, 0, 19)) {
  26622. return;
  26623. }
  26624. $output .= $buffer;
  26625. if ($verbose) {
  26626. $io->writeError($buffer, false);
  26627. }
  26628. };
  26629. $status = $this->process->execute($command, $handler, $cwd);
  26630. if (0 === $status) {
  26631. return $output;
  26632. }
  26633. $errorOutput = $this->process->getErrorOutput();
  26634. $fullOutput = implode("\n", array($output, $errorOutput));
  26635. if (false === stripos($fullOutput, 'Could not authenticate to server:')
  26636. && false === stripos($fullOutput, 'authorization failed')
  26637. && false === stripos($fullOutput, 'svn: E170001:')
  26638. && false === stripos($fullOutput, 'svn: E215004:')) {
  26639. throw new \RuntimeException($fullOutput);
  26640. }
  26641. if (!$this->hasAuth()) {
  26642. $this->doAuthDance();
  26643. }
  26644. if ($this->qtyAuthTries++ < self::MAX_QTY_AUTH_TRIES) {
  26645. return $this->executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose);
  26646. }
  26647. throw new \RuntimeException(
  26648. 'wrong credentials provided ('.$fullOutput.')'
  26649. );
  26650. }
  26651. public function setCacheCredentials($cacheCredentials)
  26652. {
  26653. $this->cacheCredentials = $cacheCredentials;
  26654. }
  26655. protected function doAuthDance()
  26656. {
  26657. if (!$this->io->isInteractive()) {
  26658. throw new \RuntimeException(
  26659. 'can not ask for authentication in non interactive mode'
  26660. );
  26661. }
  26662. $this->io->writeError("The Subversion server ({$this->url}) requested credentials:");
  26663. $this->hasAuth = true;
  26664. $this->credentials['username'] = $this->io->ask("Username: ");
  26665. $this->credentials['password'] = $this->io->askAndHideAnswer("Password: ");
  26666. $this->cacheCredentials = $this->io->askConfirmation("Should Subversion cache these credentials? (yes/no) ", true);
  26667. return $this;
  26668. }
  26669. protected function getCommand($cmd, $url, $path = null)
  26670. {
  26671. $cmd = sprintf('%s %s%s %s',
  26672. $cmd,
  26673. '--non-interactive ',
  26674. $this->getCredentialString(),
  26675. ProcessExecutor::escape($url)
  26676. );
  26677. if ($path) {
  26678. $cmd .= ' ' . ProcessExecutor::escape($path);
  26679. }
  26680. return $cmd;
  26681. }
  26682. protected function getCredentialString()
  26683. {
  26684. if (!$this->hasAuth()) {
  26685. return '';
  26686. }
  26687. return sprintf(
  26688. ' %s--username %s --password %s ',
  26689. $this->getAuthCache(),
  26690. ProcessExecutor::escape($this->getUsername()),
  26691. ProcessExecutor::escape($this->getPassword())
  26692. );
  26693. }
  26694. protected function getPassword()
  26695. {
  26696. if ($this->credentials === null) {
  26697. throw new \LogicException("No svn auth detected.");
  26698. }
  26699. return isset($this->credentials['password']) ? $this->credentials['password'] : '';
  26700. }
  26701. protected function getUsername()
  26702. {
  26703. if ($this->credentials === null) {
  26704. throw new \LogicException("No svn auth detected.");
  26705. }
  26706. return $this->credentials['username'];
  26707. }
  26708. protected function hasAuth()
  26709. {
  26710. if (null !== $this->hasAuth) {
  26711. return $this->hasAuth;
  26712. }
  26713. if (false === $this->createAuthFromConfig()) {
  26714. $this->createAuthFromUrl();
  26715. }
  26716. return $this->hasAuth;
  26717. }
  26718. protected function getAuthCache()
  26719. {
  26720. return $this->cacheCredentials ? '' : '--no-auth-cache ';
  26721. }
  26722. private function createAuthFromConfig()
  26723. {
  26724. if (!$this->config->has('http-basic')) {
  26725. return $this->hasAuth = false;
  26726. }
  26727. $authConfig = $this->config->get('http-basic');
  26728. $host = parse_url($this->url, PHP_URL_HOST);
  26729. if (isset($authConfig[$host])) {
  26730. $this->credentials['username'] = $authConfig[$host]['username'];
  26731. $this->credentials['password'] = $authConfig[$host]['password'];
  26732. return $this->hasAuth = true;
  26733. }
  26734. return $this->hasAuth = false;
  26735. }
  26736. private function createAuthFromUrl()
  26737. {
  26738. $uri = parse_url($this->url);
  26739. if (empty($uri['user'])) {
  26740. return $this->hasAuth = false;
  26741. }
  26742. $this->credentials['username'] = $uri['user'];
  26743. if (!empty($uri['pass'])) {
  26744. $this->credentials['password'] = $uri['pass'];
  26745. }
  26746. return $this->hasAuth = true;
  26747. }
  26748. public function binaryVersion()
  26749. {
  26750. if (!self::$version) {
  26751. if (0 === $this->process->execute('svn --version', $output)) {
  26752. if (preg_match('{(\d+(?:\.\d+)+)}', $output, $match)) {
  26753. self::$version = $match[1];
  26754. }
  26755. }
  26756. }
  26757. return self::$version;
  26758. }
  26759. }
  26760. <?php
  26761. namespace Composer\Util;
  26762. use Composer\CaBundle\CaBundle;
  26763. final class TlsHelper
  26764. {
  26765. private static $useOpensslParse;
  26766. public static function checkCertificateHost($certificate, $hostname, &$cn = null)
  26767. {
  26768. $names = self::getCertificateNames($certificate);
  26769. if (empty($names)) {
  26770. return false;
  26771. }
  26772. $combinedNames = array_merge($names['san'], array($names['cn']));
  26773. $hostname = strtolower($hostname);
  26774. foreach ($combinedNames as $certName) {
  26775. $matcher = self::certNameMatcher($certName);
  26776. if ($matcher && $matcher($hostname)) {
  26777. $cn = $names['cn'];
  26778. return true;
  26779. }
  26780. }
  26781. return false;
  26782. }
  26783. public static function getCertificateNames($certificate)
  26784. {
  26785. if (is_array($certificate)) {
  26786. $info = $certificate;
  26787. } elseif (CaBundle::isOpensslParseSafe()) {
  26788. $info = openssl_x509_parse($certificate, false);
  26789. }
  26790. if (!isset($info['subject']['commonName'])) {
  26791. return null;
  26792. }
  26793. $commonName = strtolower($info['subject']['commonName']);
  26794. $subjectAltNames = array();
  26795. if (isset($info['extensions']['subjectAltName'])) {
  26796. $subjectAltNames = preg_split('{\s*,\s*}', $info['extensions']['subjectAltName']);
  26797. $subjectAltNames = array_filter(array_map(function ($name) {
  26798. if (0 === strpos($name, 'DNS:')) {
  26799. return strtolower(ltrim(substr($name, 4)));
  26800. }
  26801. return null;
  26802. }, $subjectAltNames));
  26803. $subjectAltNames = array_values($subjectAltNames);
  26804. }
  26805. return array(
  26806. 'cn' => $commonName,
  26807. 'san' => $subjectAltNames,
  26808. );
  26809. }
  26810. public static function getCertificateFingerprint($certificate)
  26811. {
  26812. $pubkeydetails = openssl_pkey_get_details(openssl_get_publickey($certificate));
  26813. $pubkeypem = $pubkeydetails['key'];
  26814. $start = '-----BEGIN PUBLIC KEY-----';
  26815. $end = '-----END PUBLIC KEY-----';
  26816. $pemtrim = substr($pubkeypem, (strpos($pubkeypem, $start) + strlen($start)), (strlen($pubkeypem) - strpos($pubkeypem, $end)) * (-1));
  26817. $der = base64_decode($pemtrim);
  26818. return sha1($der);
  26819. }
  26820. public static function isOpensslParseSafe()
  26821. {
  26822. return CaBundle::isOpensslParseSafe();
  26823. }
  26824. private static function certNameMatcher($certName)
  26825. {
  26826. $wildcards = substr_count($certName, '*');
  26827. if (0 === $wildcards) {
  26828. return function ($hostname) use ($certName) {
  26829. return $hostname === $certName;
  26830. };
  26831. }
  26832. if (1 === $wildcards) {
  26833. $components = explode('.', $certName);
  26834. if (3 > count($components)) {
  26835. return;
  26836. }
  26837. $firstComponent = $components[0];
  26838. if ('*' !== $firstComponent[strlen($firstComponent) - 1]) {
  26839. return;
  26840. }
  26841. $wildcardRegex = preg_quote($certName);
  26842. $wildcardRegex = str_replace('\\*', '[a-z0-9-]+', $wildcardRegex);
  26843. $wildcardRegex = "{^{$wildcardRegex}$}";
  26844. return function ($hostname) use ($wildcardRegex) {
  26845. return 1 === preg_match($wildcardRegex, $hostname);
  26846. };
  26847. }
  26848. }
  26849. }
  26850. <?php
  26851. namespace Composer\Util;
  26852. use Composer\Config;
  26853. use Composer\IO\IOInterface;
  26854. class Url
  26855. {
  26856. public static function updateDistReference(Config $config, $url, $ref)
  26857. {
  26858. $host = parse_url($url, PHP_URL_HOST);
  26859. if ($host === 'api.github.com' || $host === 'github.com' || $host === 'www.github.com') {
  26860. if (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/(zip|tar)ball/(.+)$}i', $url, $match)) {
  26861. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  26862. } elseif (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/archive/.+\.(zip|tar)(?:\.gz)?$}i', $url, $match)) {
  26863. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  26864. } elseif (preg_match('{^https?://api\.github\.com/repos/([^/]+)/([^/]+)/(zip|tar)ball(?:/.+)?$}i', $url, $match)) {
  26865. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  26866. }
  26867. } elseif ($host === 'bitbucket.org' || $host === 'www.bitbucket.org') {
  26868. if (preg_match('{^https?://(?:www\.)?bitbucket\.org/([^/]+)/([^/]+)/get/(.+)\.(zip|tar\.gz|tar\.bz2)$}i', $url, $match)) {
  26869. $url = 'https://bitbucket.org/' . $match[1] . '/'. $match[2] . '/get/' . $ref . '.' . $match[4];
  26870. }
  26871. } elseif ($host === 'gitlab.com' || $host === 'www.gitlab.com') {
  26872. if (preg_match('{^https?://(?:www\.)?gitlab\.com/api/v[34]/projects/([^/]+)/repository/archive\.(zip|tar\.gz|tar\.bz2|tar)\?sha=.+$}i', $url, $match)) {
  26873. $url = 'https://gitlab.com/api/v4/projects/' . $match[1] . '/repository/archive.' . $match[2] . '?sha=' . $ref;
  26874. }
  26875. } elseif (in_array($host, $config->get('github-domains'), true)) {
  26876. $url = preg_replace('{(/repos/[^/]+/[^/]+/(zip|tar)ball)(?:/.+)?$}i', '$1/'.$ref, $url);
  26877. } elseif (in_array($host, $config->get('gitlab-domains'), true)) {
  26878. $url = preg_replace('{(/api/v[34]/projects/[^/]+/repository/archive\.(?:zip|tar\.gz|tar\.bz2|tar)\?sha=).+$}i', '${1}'.$ref, $url);
  26879. }
  26880. return $url;
  26881. }
  26882. }
  26883. <?php
  26884. namespace Composer;
  26885. use Composer\Util\IniHelper;
  26886. use Symfony\Component\Console\Output\OutputInterface;
  26887. class XdebugHandler
  26888. {
  26889. const ENV_ALLOW = 'COMPOSER_ALLOW_XDEBUG';
  26890. const ENV_VERSION = 'COMPOSER_XDEBUG_VERSION';
  26891. const RESTART_ID = 'internal';
  26892. private $output;
  26893. private $loaded;
  26894. private $envScanDir;
  26895. private $version;
  26896. private $tmpIni;
  26897. public function __construct(OutputInterface $output)
  26898. {
  26899. $this->output = $output;
  26900. $this->loaded = extension_loaded('xdebug');
  26901. $this->envScanDir = getenv('PHP_INI_SCAN_DIR');
  26902. if ($this->loaded) {
  26903. $ext = new \ReflectionExtension('xdebug');
  26904. $this->version = strval($ext->getVersion());
  26905. }
  26906. }
  26907. public function check()
  26908. {
  26909. $args = explode('|', strval(getenv(self::ENV_ALLOW)), 2);
  26910. if ($this->needsRestart($args[0])) {
  26911. if ($this->prepareRestart()) {
  26912. $command = $this->getCommand();
  26913. $this->restart($command);
  26914. }
  26915. return;
  26916. }
  26917. if (self::RESTART_ID === $args[0]) {
  26918. putenv(self::ENV_ALLOW);
  26919. if (false !== $this->envScanDir) {
  26920. if (isset($args[1])) {
  26921. putenv('PHP_INI_SCAN_DIR='.$args[1]);
  26922. } else {
  26923. putenv('PHP_INI_SCAN_DIR');
  26924. }
  26925. }
  26926. if ($this->loaded) {
  26927. putenv(self::ENV_VERSION);
  26928. }
  26929. }
  26930. }
  26931. protected function restart($command)
  26932. {
  26933. passthru($command, $exitCode);
  26934. if (!empty($this->tmpIni)) {
  26935. @unlink($this->tmpIni);
  26936. }
  26937. exit($exitCode);
  26938. }
  26939. private function needsRestart($allow)
  26940. {
  26941. if (PHP_SAPI !== 'cli' || !defined('PHP_BINARY')) {
  26942. return false;
  26943. }
  26944. return empty($allow) && $this->loaded;
  26945. }
  26946. private function prepareRestart()
  26947. {
  26948. $this->tmpIni = '';
  26949. $iniPaths = IniHelper::getAll();
  26950. $additional = count($iniPaths) > 1;
  26951. if ($this->writeTmpIni($iniPaths)) {
  26952. return $this->setEnvironment($additional, $iniPaths);
  26953. }
  26954. return false;
  26955. }
  26956. private function writeTmpIni(array $iniPaths)
  26957. {
  26958. if (!$this->tmpIni = tempnam(sys_get_temp_dir(), '')) {
  26959. return false;
  26960. }
  26961. if (empty($iniPaths[0])) {
  26962. array_shift($iniPaths);
  26963. }
  26964. $content = '';
  26965. $regex = '/^\s*(zend_extension\s*=.*xdebug.*)$/mi';
  26966. foreach ($iniPaths as $file) {
  26967. $data = preg_replace($regex, ';$1', file_get_contents($file));
  26968. $content .= $data.PHP_EOL;
  26969. }
  26970. $content .= 'allow_url_fopen='.ini_get('allow_url_fopen').PHP_EOL;
  26971. $content .= 'disable_functions="'.ini_get('disable_functions').'"'.PHP_EOL;
  26972. $content .= 'memory_limit='.ini_get('memory_limit').PHP_EOL;
  26973. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  26974. $content .= 'opcache.enable_cli=0'.PHP_EOL;
  26975. }
  26976. return @file_put_contents($this->tmpIni, $content);
  26977. }
  26978. private function getCommand()
  26979. {
  26980. $phpArgs = array(PHP_BINARY, '-c', $this->tmpIni);
  26981. $params = array_merge($phpArgs, $this->getScriptArgs($_SERVER['argv']));
  26982. return implode(' ', array_map(array($this, 'escape'), $params));
  26983. }
  26984. private function setEnvironment($additional, array $iniPaths)
  26985. {
  26986. if ($additional && !putenv('PHP_INI_SCAN_DIR=')) {
  26987. return false;
  26988. }
  26989. if (!putenv(IniHelper::ENV_ORIGINAL.'='.implode(PATH_SEPARATOR, $iniPaths))) {
  26990. return false;
  26991. }
  26992. if (!putenv(self::ENV_VERSION.'='.$this->version)) {
  26993. return false;
  26994. }
  26995. $args = array(self::RESTART_ID);
  26996. if (false !== $this->envScanDir) {
  26997. $args[] = $this->envScanDir;
  26998. }
  26999. return putenv(self::ENV_ALLOW.'='.implode('|', $args));
  27000. }
  27001. private function getScriptArgs(array $args)
  27002. {
  27003. if (in_array('--no-ansi', $args) || in_array('--ansi', $args)) {
  27004. return $args;
  27005. }
  27006. if ($this->output->isDecorated()) {
  27007. $offset = count($args) > 1 ? 2 : 1;
  27008. array_splice($args, $offset, 0, '--ansi');
  27009. }
  27010. return $args;
  27011. }
  27012. private function escape($arg, $meta = true)
  27013. {
  27014. if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
  27015. return escapeshellarg($arg);
  27016. }
  27017. $quote = strpbrk($arg, " \t") !== false || $arg === '';
  27018. $arg = preg_replace('/(\\\\*)"/', '$1$1\\"', $arg, -1, $dquotes);
  27019. if ($meta) {
  27020. $meta = $dquotes || preg_match('/%[^%]+%/', $arg);
  27021. if (!$meta && !$quote) {
  27022. $quote = strpbrk($arg, '^&|<>()') !== false;
  27023. }
  27024. }
  27025. if ($quote) {
  27026. $arg = preg_replace('/(\\\\*)$/', '$1$1', $arg);
  27027. $arg = '"'.$arg.'"';
  27028. }
  27029. if ($meta) {
  27030. $arg = preg_replace('/(["^&|<>()%])/', '^$1', $arg);
  27031. }
  27032. return $arg;
  27033. }
  27034. }
  27035. <?php
  27036. function includeIfExists($file)
  27037. {
  27038. return file_exists($file) ? include $file : false;
  27039. }
  27040. if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
  27041. echo 'You must set up the project dependencies using `composer install`'.PHP_EOL.
  27042. 'See https://getcomposer.org/download/ for instructions on installing Composer'.PHP_EOL;
  27043. exit(1);
  27044. }
  27045. return $loader;
  27046. <?php
  27047. /*
  27048. * This file is part of Composer.
  27049. *
  27050. * (c) Nils Adermann <naderman@naderman.de>
  27051. * Jordi Boggiano <j.boggiano@seld.be>
  27052. *
  27053. * For the full copyright and license information, please view the LICENSE
  27054. * file that was distributed with this source code.
  27055. */
  27056. namespace Composer\Autoload;
  27057. /**
  27058. * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
  27059. *
  27060. * $loader = new \Composer\Autoload\ClassLoader();
  27061. *
  27062. * // register classes with namespaces
  27063. * $loader->add('Symfony\Component', __DIR__.'/component');
  27064. * $loader->add('Symfony', __DIR__.'/framework');
  27065. *
  27066. * // activate the autoloader
  27067. * $loader->register();
  27068. *
  27069. * // to enable searching the include path (eg. for PEAR packages)
  27070. * $loader->setUseIncludePath(true);
  27071. *
  27072. * In this example, if you try to use a class in the Symfony\Component
  27073. * namespace or one of its children (Symfony\Component\Console for instance),
  27074. * the autoloader will first look for the class under the component/
  27075. * directory, and it will then fallback to the framework/ directory if not
  27076. * found before giving up.
  27077. *
  27078. * This class is loosely based on the Symfony UniversalClassLoader.
  27079. *
  27080. * @author Fabien Potencier <fabien@symfony.com>
  27081. * @author Jordi Boggiano <j.boggiano@seld.be>
  27082. * @see http://www.php-fig.org/psr/psr-0/
  27083. * @see http://www.php-fig.org/psr/psr-4/
  27084. */
  27085. class ClassLoader
  27086. {
  27087. // PSR-4
  27088. private $prefixLengthsPsr4 = array();
  27089. private $prefixDirsPsr4 = array();
  27090. private $fallbackDirsPsr4 = array();
  27091. // PSR-0
  27092. private $prefixesPsr0 = array();
  27093. private $fallbackDirsPsr0 = array();
  27094. private $useIncludePath = false;
  27095. private $classMap = array();
  27096. private $classMapAuthoritative = false;
  27097. private $missingClasses = array();
  27098. private $apcuPrefix;
  27099. public function getPrefixes()
  27100. {
  27101. if (!empty($this->prefixesPsr0)) {
  27102. return call_user_func_array('array_merge', $this->prefixesPsr0);
  27103. }
  27104. return array();
  27105. }
  27106. public function getPrefixesPsr4()
  27107. {
  27108. return $this->prefixDirsPsr4;
  27109. }
  27110. public function getFallbackDirs()
  27111. {
  27112. return $this->fallbackDirsPsr0;
  27113. }
  27114. public function getFallbackDirsPsr4()
  27115. {
  27116. return $this->fallbackDirsPsr4;
  27117. }
  27118. public function getClassMap()
  27119. {
  27120. return $this->classMap;
  27121. }
  27122. /**
  27123. * @param array $classMap Class to filename map
  27124. */
  27125. public function addClassMap(array $classMap)
  27126. {
  27127. if ($this->classMap) {
  27128. $this->classMap = array_merge($this->classMap, $classMap);
  27129. } else {
  27130. $this->classMap = $classMap;
  27131. }
  27132. }
  27133. /**
  27134. * Registers a set of PSR-0 directories for a given prefix, either
  27135. * appending or prepending to the ones previously set for this prefix.
  27136. *
  27137. * @param string $prefix The prefix
  27138. * @param array|string $paths The PSR-0 root directories
  27139. * @param bool $prepend Whether to prepend the directories
  27140. */
  27141. public function add($prefix, $paths, $prepend = false)
  27142. {
  27143. if (!$prefix) {
  27144. if ($prepend) {
  27145. $this->fallbackDirsPsr0 = array_merge(
  27146. (array) $paths,
  27147. $this->fallbackDirsPsr0
  27148. );
  27149. } else {
  27150. $this->fallbackDirsPsr0 = array_merge(
  27151. $this->fallbackDirsPsr0,
  27152. (array) $paths
  27153. );
  27154. }
  27155. return;
  27156. }
  27157. $first = $prefix[0];
  27158. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  27159. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  27160. return;
  27161. }
  27162. if ($prepend) {
  27163. $this->prefixesPsr0[$first][$prefix] = array_merge(
  27164. (array) $paths,
  27165. $this->prefixesPsr0[$first][$prefix]
  27166. );
  27167. } else {
  27168. $this->prefixesPsr0[$first][$prefix] = array_merge(
  27169. $this->prefixesPsr0[$first][$prefix],
  27170. (array) $paths
  27171. );
  27172. }
  27173. }
  27174. /**
  27175. * Registers a set of PSR-4 directories for a given namespace, either
  27176. * appending or prepending to the ones previously set for this namespace.
  27177. *
  27178. * @param string $prefix The prefix/namespace, with trailing '\\'
  27179. * @param array|string $paths The PSR-4 base directories
  27180. * @param bool $prepend Whether to prepend the directories
  27181. *
  27182. * @throws \InvalidArgumentException
  27183. */
  27184. public function addPsr4($prefix, $paths, $prepend = false)
  27185. {
  27186. if (!$prefix) {
  27187. // Register directories for the root namespace.
  27188. if ($prepend) {
  27189. $this->fallbackDirsPsr4 = array_merge(
  27190. (array) $paths,
  27191. $this->fallbackDirsPsr4
  27192. );
  27193. } else {
  27194. $this->fallbackDirsPsr4 = array_merge(
  27195. $this->fallbackDirsPsr4,
  27196. (array) $paths
  27197. );
  27198. }
  27199. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  27200. // Register directories for a new namespace.
  27201. $length = strlen($prefix);
  27202. if ('\\' !== $prefix[$length - 1]) {
  27203. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  27204. }
  27205. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  27206. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  27207. } elseif ($prepend) {
  27208. // Prepend directories for an already registered namespace.
  27209. $this->prefixDirsPsr4[$prefix] = array_merge(
  27210. (array) $paths,
  27211. $this->prefixDirsPsr4[$prefix]
  27212. );
  27213. } else {
  27214. // Append directories for an already registered namespace.
  27215. $this->prefixDirsPsr4[$prefix] = array_merge(
  27216. $this->prefixDirsPsr4[$prefix],
  27217. (array) $paths
  27218. );
  27219. }
  27220. }
  27221. /**
  27222. * Registers a set of PSR-0 directories for a given prefix,
  27223. * replacing any others previously set for this prefix.
  27224. *
  27225. * @param string $prefix The prefix
  27226. * @param array|string $paths The PSR-0 base directories
  27227. */
  27228. public function set($prefix, $paths)
  27229. {
  27230. if (!$prefix) {
  27231. $this->fallbackDirsPsr0 = (array) $paths;
  27232. } else {
  27233. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  27234. }
  27235. }
  27236. /**
  27237. * Registers a set of PSR-4 directories for a given namespace,
  27238. * replacing any others previously set for this namespace.
  27239. *
  27240. * @param string $prefix The prefix/namespace, with trailing '\\'
  27241. * @param array|string $paths The PSR-4 base directories
  27242. *
  27243. * @throws \InvalidArgumentException
  27244. */
  27245. public function setPsr4($prefix, $paths)
  27246. {
  27247. if (!$prefix) {
  27248. $this->fallbackDirsPsr4 = (array) $paths;
  27249. } else {
  27250. $length = strlen($prefix);
  27251. if ('\\' !== $prefix[$length - 1]) {
  27252. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  27253. }
  27254. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  27255. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  27256. }
  27257. }
  27258. /**
  27259. * Turns on searching the include path for class files.
  27260. *
  27261. * @param bool $useIncludePath
  27262. */
  27263. public function setUseIncludePath($useIncludePath)
  27264. {
  27265. $this->useIncludePath = $useIncludePath;
  27266. }
  27267. /**
  27268. * Can be used to check if the autoloader uses the include path to check
  27269. * for classes.
  27270. *
  27271. * @return bool
  27272. */
  27273. public function getUseIncludePath()
  27274. {
  27275. return $this->useIncludePath;
  27276. }
  27277. /**
  27278. * Turns off searching the prefix and fallback directories for classes
  27279. * that have not been registered with the class map.
  27280. *
  27281. * @param bool $classMapAuthoritative
  27282. */
  27283. public function setClassMapAuthoritative($classMapAuthoritative)
  27284. {
  27285. $this->classMapAuthoritative = $classMapAuthoritative;
  27286. }
  27287. /**
  27288. * Should class lookup fail if not found in the current class map?
  27289. *
  27290. * @return bool
  27291. */
  27292. public function isClassMapAuthoritative()
  27293. {
  27294. return $this->classMapAuthoritative;
  27295. }
  27296. /**
  27297. * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
  27298. *
  27299. * @param string|null $apcuPrefix
  27300. */
  27301. public function setApcuPrefix($apcuPrefix)
  27302. {
  27303. $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
  27304. }
  27305. /**
  27306. * The APCu prefix in use, or null if APCu caching is not enabled.
  27307. *
  27308. * @return string|null
  27309. */
  27310. public function getApcuPrefix()
  27311. {
  27312. return $this->apcuPrefix;
  27313. }
  27314. /**
  27315. * Registers this instance as an autoloader.
  27316. *
  27317. * @param bool $prepend Whether to prepend the autoloader or not
  27318. */
  27319. public function register($prepend = false)
  27320. {
  27321. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  27322. }
  27323. /**
  27324. * Unregisters this instance as an autoloader.
  27325. */
  27326. public function unregister()
  27327. {
  27328. spl_autoload_unregister(array($this, 'loadClass'));
  27329. }
  27330. /**
  27331. * Loads the given class or interface.
  27332. *
  27333. * @param string $class The name of the class
  27334. * @return bool|null True if loaded, null otherwise
  27335. */
  27336. public function loadClass($class)
  27337. {
  27338. if ($file = $this->findFile($class)) {
  27339. includeFile($file);
  27340. return true;
  27341. }
  27342. }
  27343. /**
  27344. * Finds the path to the file where the class is defined.
  27345. *
  27346. * @param string $class The name of the class
  27347. *
  27348. * @return string|false The path if found, false otherwise
  27349. */
  27350. public function findFile($class)
  27351. {
  27352. // class map lookup
  27353. if (isset($this->classMap[$class])) {
  27354. return $this->classMap[$class];
  27355. }
  27356. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  27357. return false;
  27358. }
  27359. if (null !== $this->apcuPrefix) {
  27360. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  27361. if ($hit) {
  27362. return $file;
  27363. }
  27364. }
  27365. $file = $this->findFileWithExtension($class, '.php');
  27366. // Search for Hack files if we are running on HHVM
  27367. if (false === $file && defined('HHVM_VERSION')) {
  27368. $file = $this->findFileWithExtension($class, '.hh');
  27369. }
  27370. if (null !== $this->apcuPrefix) {
  27371. apcu_add($this->apcuPrefix.$class, $file);
  27372. }
  27373. if (false === $file) {
  27374. // Remember that this class does not exist.
  27375. $this->missingClasses[$class] = true;
  27376. }
  27377. return $file;
  27378. }
  27379. private function findFileWithExtension($class, $ext)
  27380. {
  27381. // PSR-4 lookup
  27382. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  27383. $first = $class[0];
  27384. if (isset($this->prefixLengthsPsr4[$first])) {
  27385. $subPath = $class;
  27386. while (false !== $lastPos = strrpos($subPath, '\\')) {
  27387. $subPath = substr($subPath, 0, $lastPos);
  27388. $search = $subPath.'\\';
  27389. if (isset($this->prefixDirsPsr4[$search])) {
  27390. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  27391. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  27392. if (file_exists($file = $dir . $pathEnd)) {
  27393. return $file;
  27394. }
  27395. }
  27396. }
  27397. }
  27398. }
  27399. // PSR-4 fallback dirs
  27400. foreach ($this->fallbackDirsPsr4 as $dir) {
  27401. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  27402. return $file;
  27403. }
  27404. }
  27405. // PSR-0 lookup
  27406. if (false !== $pos = strrpos($class, '\\')) {
  27407. // namespaced class name
  27408. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  27409. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  27410. } else {
  27411. // PEAR-like class name
  27412. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  27413. }
  27414. if (isset($this->prefixesPsr0[$first])) {
  27415. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  27416. if (0 === strpos($class, $prefix)) {
  27417. foreach ($dirs as $dir) {
  27418. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  27419. return $file;
  27420. }
  27421. }
  27422. }
  27423. }
  27424. }
  27425. // PSR-0 fallback dirs
  27426. foreach ($this->fallbackDirsPsr0 as $dir) {
  27427. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  27428. return $file;
  27429. }
  27430. }
  27431. // PSR-0 include paths.
  27432. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  27433. return $file;
  27434. }
  27435. return false;
  27436. }
  27437. }
  27438. /**
  27439. * Scope isolated include.
  27440. *
  27441. * Prevents access to $this/self from included files.
  27442. */
  27443. function includeFile($file)
  27444. {
  27445. include $file;
  27446. }
  27447. {
  27448. "$schema": "http://json-schema.org/draft-04/schema#",
  27449. "description": "A representation of packages metadata.",
  27450. "type": "object",
  27451. "oneOf": [
  27452. { "required": [ "packages" ] },
  27453. { "required": [ "providers" ] },
  27454. { "required": [ "provider-includes", "providers-url" ] }
  27455. ],
  27456. "properties": {
  27457. "packages": {
  27458. "type": ["object", "array"],
  27459. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  27460. "additionalProperties": { "$ref": "#/definitions/versions" }
  27461. },
  27462. "providers-url": {
  27463. "type": "string",
  27464. "description": "Endpoint to retrieve provider data from, e.g. '/p/%package%$%hash%.json'."
  27465. },
  27466. "provider-includes": {
  27467. "type": "object",
  27468. "description": "A hashmap of provider listings.",
  27469. "additionalProperties": { "$ref": "#/definitions/provider" }
  27470. },
  27471. "providers": {
  27472. "type": "object",
  27473. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  27474. "additionalProperties": { "$ref": "#/definitions/provider" }
  27475. },
  27476. "notify-batch": {
  27477. "type": "string",
  27478. "description": "Endpoint to call after multiple packages have been installed, e.g. '/downloads/'."
  27479. },
  27480. "search": {
  27481. "type": "string",
  27482. "description": "Endpoint that provides search capabilities, e.g. '/search.json?q=%query%&type=%type%'."
  27483. },
  27484. "warning": {
  27485. "type": "string",
  27486. "description": "A message that will be output by Composer as a warning when this source is consulted."
  27487. }
  27488. },
  27489. "definitions": {
  27490. "versions": {
  27491. "type": "object",
  27492. "description": "A hashmap of versions and their metadata.",
  27493. "additionalProperties": { "$ref": "#/definitions/version" }
  27494. },
  27495. "version": {
  27496. "type": "object",
  27497. "oneOf": [
  27498. { "$ref": "#/definitions/package" },
  27499. { "$ref": "#/definitions/metapackage" }
  27500. ]
  27501. },
  27502. "package-base": {
  27503. "properties": {
  27504. "name": { "type": "string" },
  27505. "type": { "type": "string" },
  27506. "version": { "type": "string" },
  27507. "version_normalized": {
  27508. "type": "string",
  27509. "description": "Normalized version, optional but can save computational time on client side."
  27510. },
  27511. "autoload": { "type": "object" },
  27512. "require": { "type": "object" },
  27513. "replace": { "type": "object" },
  27514. "conflict": { "type": "object" },
  27515. "provide": { "type": "object" },
  27516. "time": { "type": "string" }
  27517. },
  27518. "additionalProperties": true
  27519. },
  27520. "package": {
  27521. "allOf": [
  27522. { "$ref": "#/definitions/package-base" },
  27523. {
  27524. "properties": {
  27525. "dist": { "type": "object" },
  27526. "source": { "type": "object" }
  27527. }
  27528. },
  27529. { "oneOf": [
  27530. { "required": [ "name", "version", "source" ] },
  27531. { "required": [ "name", "version", "dist" ] }
  27532. ] }
  27533. ]
  27534. },
  27535. "metapackage": {
  27536. "allOf": [
  27537. { "$ref": "#/definitions/package-base" },
  27538. {
  27539. "properties": {
  27540. "type": { "type": "string", "enum": [ "metapackage" ] }
  27541. },
  27542. "required": [ "name", "version", "type" ]
  27543. }
  27544. ]
  27545. },
  27546. "provider": {
  27547. "type": "object",
  27548. "properties": {
  27549. "sha256": {
  27550. "type": "string",
  27551. "description": "Hash value that can be used to validate the resource."
  27552. }
  27553. }
  27554. }
  27555. }
  27556. }
  27557. {
  27558. "$schema": "http://json-schema.org/draft-04/schema#",
  27559. "name": "Package",
  27560. "type": "object",
  27561. "additionalProperties": false,
  27562. "required": [ "name", "description" ],
  27563. "properties": {
  27564. "name": {
  27565. "type": "string",
  27566. "description": "Package name, including 'vendor-name/' prefix."
  27567. },
  27568. "type": {
  27569. "description": "Package type, either 'library' for common packages, 'composer-plugin' for plugins, 'metapackage' for empty packages, or a custom type ([a-z0-9-]+) defined by whatever project this package applies to.",
  27570. "type": "string"
  27571. },
  27572. "target-dir": {
  27573. "description": "DEPRECATED: Forces the package to be installed into the given subdirectory path. This is used for autoloading PSR-0 packages that do not contain their full path. Use forward slashes for cross-platform compatibility.",
  27574. "type": "string"
  27575. },
  27576. "description": {
  27577. "type": "string",
  27578. "description": "Short package description."
  27579. },
  27580. "keywords": {
  27581. "type": "array",
  27582. "items": {
  27583. "type": "string",
  27584. "description": "A tag/keyword that this package relates to."
  27585. }
  27586. },
  27587. "homepage": {
  27588. "type": "string",
  27589. "description": "Homepage URL for the project.",
  27590. "format": "uri"
  27591. },
  27592. "readme": {
  27593. "type": "string",
  27594. "description": "Relative path to the readme document."
  27595. },
  27596. "version": {
  27597. "type": "string",
  27598. "description": "Package version, see https://getcomposer.org/doc/04-schema.md#version for more info on valid schemes."
  27599. },
  27600. "time": {
  27601. "type": "string",
  27602. "description": "Package release date, in 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM:SS' or 'YYYY-MM-DDTHH:MM:SSZ' format."
  27603. },
  27604. "license": {
  27605. "type": ["string", "array"],
  27606. "description": "License name. Or an array of license names."
  27607. },
  27608. "authors": {
  27609. "$ref": "#/definitions/authors"
  27610. },
  27611. "require": {
  27612. "type": "object",
  27613. "description": "This is a hash of package name (keys) and version constraints (values) that are required to run this package.",
  27614. "additionalProperties": {
  27615. "type": "string"
  27616. }
  27617. },
  27618. "replace": {
  27619. "type": "object",
  27620. "description": "This is a hash of package name (keys) and version constraints (values) that can be replaced by this package.",
  27621. "additionalProperties": {
  27622. "type": "string"
  27623. }
  27624. },
  27625. "conflict": {
  27626. "type": "object",
  27627. "description": "This is a hash of package name (keys) and version constraints (values) that conflict with this package.",
  27628. "additionalProperties": {
  27629. "type": "string"
  27630. }
  27631. },
  27632. "provide": {
  27633. "type": "object",
  27634. "description": "This is a hash of package name (keys) and version constraints (values) that this package provides in addition to this package's name.",
  27635. "additionalProperties": {
  27636. "type": "string"
  27637. }
  27638. },
  27639. "require-dev": {
  27640. "type": "object",
  27641. "description": "This is a hash of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).",
  27642. "additionalProperties": {
  27643. "type": "string"
  27644. }
  27645. },
  27646. "suggest": {
  27647. "type": "object",
  27648. "description": "This is a hash of package name (keys) and descriptions (values) that this package suggests work well with it (this will be suggested to the user during installation).",
  27649. "additionalProperties": {
  27650. "type": "string"
  27651. }
  27652. },
  27653. "config": {
  27654. "type": "object",
  27655. "description": "Composer options.",
  27656. "properties": {
  27657. "process-timeout": {
  27658. "type": "integer",
  27659. "description": "The timeout in seconds for process executions, defaults to 300 (5mins)."
  27660. },
  27661. "use-include-path": {
  27662. "type": "boolean",
  27663. "description": "If true, the Composer autoloader will also look for classes in the PHP include path."
  27664. },
  27665. "preferred-install": {
  27666. "type": ["string", "object"],
  27667. "description": "The install method Composer will prefer to use, defaults to auto and can be any of source, dist, auto, or a hash of {\"pattern\": \"preference\"}."
  27668. },
  27669. "notify-on-install": {
  27670. "type": "boolean",
  27671. "description": "Composer allows repositories to define a notification URL, so that they get notified whenever a package from that repository is installed. This option allows you to disable that behaviour, defaults to true."
  27672. },
  27673. "github-protocols": {
  27674. "type": "array",
  27675. "description": "A list of protocols to use for github.com clones, in priority order, defaults to [\"git\", \"https\", \"http\"].",
  27676. "items": {
  27677. "type": "string"
  27678. }
  27679. },
  27680. "github-oauth": {
  27681. "type": "object",
  27682. "description": "A hash of domain name => github API oauth tokens, typically {\"github.com\":\"<token>\"}.",
  27683. "additionalProperties": {
  27684. "type": "string"
  27685. }
  27686. },
  27687. "gitlab-oauth": {
  27688. "type": "object",
  27689. "description": "A hash of domain name => gitlab API oauth tokens, typically {\"gitlab.com\":\"<token>\"}.",
  27690. "additionalProperties": {
  27691. "type": "string"
  27692. }
  27693. },
  27694. "gitlab-token": {
  27695. "type": "object",
  27696. "description": "A hash of domain name => gitlab private tokens, typically {\"gitlab.com\":\"<token>\"}.",
  27697. "additionalProperties": true
  27698. },
  27699. "disable-tls": {
  27700. "type": "boolean",
  27701. "description": "Defaults to `false`. If set to true all HTTPS URLs will be tried with HTTP instead and no network level encryption is performed. Enabling this is a security risk and is NOT recommended. The better way is to enable the php_openssl extension in php.ini."
  27702. },
  27703. "secure-http": {
  27704. "type": "boolean",
  27705. "description": "Defaults to `true`. If set to true only HTTPS URLs are allowed to be downloaded via Composer. If you really absolutely need HTTP access to something then you can disable it, but using \"Let's Encrypt\" to get a free SSL certificate is generally a better alternative."
  27706. },
  27707. "cafile": {
  27708. "type": "string",
  27709. "description": "A way to set the path to the openssl CA file. In PHP 5.6+ you should rather set this via openssl.cafile in php.ini, although PHP 5.6+ should be able to detect your system CA file automatically."
  27710. },
  27711. "capath": {
  27712. "type": "string",
  27713. "description": "If cafile is not specified or if the certificate is not found there, the directory pointed to by capath is searched for a suitable certificate. capath must be a correctly hashed certificate directory."
  27714. },
  27715. "http-basic": {
  27716. "type": "object",
  27717. "description": "A hash of domain name => {\"username\": \"...\", \"password\": \"...\"}.",
  27718. "additionalProperties": {
  27719. "type": "object",
  27720. "required": ["username", "password"],
  27721. "properties": {
  27722. "username": {
  27723. "type": "string",
  27724. "description": "The username used for HTTP Basic authentication"
  27725. },
  27726. "password": {
  27727. "type": "string",
  27728. "description": "The password used for HTTP Basic authentication"
  27729. }
  27730. }
  27731. }
  27732. },
  27733. "store-auths": {
  27734. "type": ["string", "boolean"],
  27735. "description": "What to do after prompting for authentication, one of: true (store), false (do not store) or \"prompt\" (ask every time), defaults to prompt."
  27736. },
  27737. "platform": {
  27738. "type": "object",
  27739. "description": "This is a hash of package name (keys) and version (values) that will be used to mock the platform packages on this machine.",
  27740. "additionalProperties": {
  27741. "type": "string"
  27742. }
  27743. },
  27744. "vendor-dir": {
  27745. "type": "string",
  27746. "description": "The location where all packages are installed, defaults to \"vendor\"."
  27747. },
  27748. "bin-dir": {
  27749. "type": "string",
  27750. "description": "The location where all binaries are linked, defaults to \"vendor/bin\"."
  27751. },
  27752. "data-dir": {
  27753. "type": "string",
  27754. "description": "The location where old phar files are stored, defaults to \"$home\" except on XDG Base Directory compliant unixes."
  27755. },
  27756. "cache-dir": {
  27757. "type": "string",
  27758. "description": "The location where all caches are located, defaults to \"~/.composer/cache\" on *nix and \"%LOCALAPPDATA%\\Composer\" on windows."
  27759. },
  27760. "cache-files-dir": {
  27761. "type": "string",
  27762. "description": "The location where files (zip downloads) are cached, defaults to \"{$cache-dir}/files\"."
  27763. },
  27764. "cache-repo-dir": {
  27765. "type": "string",
  27766. "description": "The location where repo (git/hg repo clones) are cached, defaults to \"{$cache-dir}/repo\"."
  27767. },
  27768. "cache-vcs-dir": {
  27769. "type": "string",
  27770. "description": "The location where vcs infos (git clones, github api calls, etc. when reading vcs repos) are cached, defaults to \"{$cache-dir}/vcs\"."
  27771. },
  27772. "cache-ttl": {
  27773. "type": "integer",
  27774. "description": "The default cache time-to-live, defaults to 15552000 (6 months)."
  27775. },
  27776. "cache-files-ttl": {
  27777. "type": "integer",
  27778. "description": "The cache time-to-live for files, defaults to the value of cache-ttl."
  27779. },
  27780. "cache-files-maxsize": {
  27781. "type": ["string", "integer"],
  27782. "description": "The cache max size for the files cache, defaults to \"300MiB\"."
  27783. },
  27784. "bin-compat": {
  27785. "enum": ["auto", "full"],
  27786. "description": "The compatibility of the binaries, defaults to \"auto\" (automatically guessed) and can be \"full\" (compatible with both Windows and Unix-based systems)."
  27787. },
  27788. "discard-changes": {
  27789. "type": ["string", "boolean"],
  27790. "description": "The default style of handling dirty updates, defaults to false and can be any of true, false or \"stash\"."
  27791. },
  27792. "autoloader-suffix": {
  27793. "type": "string",
  27794. "description": "Optional string to be used as a suffix for the generated Composer autoloader. When null a random one will be generated."
  27795. },
  27796. "optimize-autoloader": {
  27797. "type": "boolean",
  27798. "description": "Always optimize when dumping the autoloader."
  27799. },
  27800. "prepend-autoloader": {
  27801. "type": "boolean",
  27802. "description": "If false, the composer autoloader will not be prepended to existing autoloaders, defaults to true."
  27803. },
  27804. "classmap-authoritative": {
  27805. "type": "boolean",
  27806. "description": "If true, the composer autoloader will not scan the filesystem for classes that are not found in the class map, defaults to false."
  27807. },
  27808. "apcu-autoloader": {
  27809. "type": "boolean",
  27810. "description": "If true, the Composer autoloader will check for APCu and use it to cache found/not-found classes when the extension is enabled, defaults to false."
  27811. },
  27812. "github-domains": {
  27813. "type": "array",
  27814. "description": "A list of domains to use in github mode. This is used for GitHub Enterprise setups, defaults to [\"github.com\"].",
  27815. "items": {
  27816. "type": "string"
  27817. }
  27818. },
  27819. "github-expose-hostname": {
  27820. "type": "boolean",
  27821. "description": "Defaults to true. If set to false, the OAuth tokens created to access the github API will have a date instead of the machine hostname."
  27822. },
  27823. "gitlab-domains": {
  27824. "type": "array",
  27825. "description": "A list of domains to use in gitlab mode. This is used for custom GitLab setups, defaults to [\"gitlab.com\"].",
  27826. "items": {
  27827. "type": "string"
  27828. }
  27829. },
  27830. "archive-format": {
  27831. "type": "string",
  27832. "description": "The default archiving format when not provided on cli, defaults to \"tar\"."
  27833. },
  27834. "archive-dir": {
  27835. "type": "string",
  27836. "description": "The default archive path when not provided on cli, defaults to \".\"."
  27837. },
  27838. "htaccess-protect": {
  27839. "type": "boolean",
  27840. "description": "Defaults to true. If set to false, Composer will not create .htaccess files in the composer home, cache, and data directories."
  27841. },
  27842. "sort-packages": {
  27843. "type": "boolean",
  27844. "description": "Defaults to false. If set to true, Composer will sort packages when adding/updating a new dependency."
  27845. }
  27846. }
  27847. },
  27848. "extra": {
  27849. "type": ["object", "array"],
  27850. "description": "Arbitrary extra data that can be used by plugins, for example, package of type composer-plugin may have a 'class' key defining an installer class name.",
  27851. "additionalProperties": true
  27852. },
  27853. "autoload": {
  27854. "$ref": "#/definitions/autoload"
  27855. },
  27856. "autoload-dev": {
  27857. "type": "object",
  27858. "description": "Description of additional autoload rules for development purpose (eg. a test suite).",
  27859. "properties": {
  27860. "psr-0": {
  27861. "type": "object",
  27862. "description": "This is a hash of namespaces (keys) and the directories they can be found into (values, can be arrays of paths) by the autoloader.",
  27863. "additionalProperties": {
  27864. "type": ["string", "array"],
  27865. "items": {
  27866. "type": "string"
  27867. }
  27868. }
  27869. },
  27870. "psr-4": {
  27871. "type": "object",
  27872. "description": "This is a hash of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
  27873. "additionalProperties": {
  27874. "type": ["string", "array"],
  27875. "items": {
  27876. "type": "string"
  27877. }
  27878. }
  27879. },
  27880. "classmap": {
  27881. "type": "array",
  27882. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  27883. },
  27884. "files": {
  27885. "type": "array",
  27886. "description": "This is an array of files that are always required on every request."
  27887. }
  27888. }
  27889. },
  27890. "archive": {
  27891. "type": ["object"],
  27892. "description": "Options for creating package archives for distribution.",
  27893. "properties": {
  27894. "exclude": {
  27895. "type": "array",
  27896. "description": "A list of patterns for paths to exclude or include if prefixed with an exclamation mark."
  27897. }
  27898. }
  27899. },
  27900. "repositories": {
  27901. "type": ["object", "array"],
  27902. "description": "A set of additional repositories where packages can be found.",
  27903. "additionalProperties": {
  27904. "oneOf": [
  27905. { "$ref": "#/definitions/repository" },
  27906. { "type": "boolean", "enum": [false] }
  27907. ]
  27908. },
  27909. "items": {
  27910. "oneOf": [
  27911. { "$ref": "#/definitions/repository" },
  27912. {
  27913. "type": "object",
  27914. "additionalProperties": { "type": "boolean", "enum": [false] },
  27915. "minProperties": 1,
  27916. "maxProperties": 1
  27917. }
  27918. ]
  27919. }
  27920. },
  27921. "minimum-stability": {
  27922. "type": ["string"],
  27923. "description": "The minimum stability the packages must have to be install-able. Possible values are: dev, alpha, beta, RC, stable.",
  27924. "pattern": "^dev|alpha|beta|rc|RC|stable$"
  27925. },
  27926. "prefer-stable": {
  27927. "type": ["boolean"],
  27928. "description": "If set to true, stable packages will be preferred to dev packages when possible, even if the minimum-stability allows unstable packages."
  27929. },
  27930. "bin": {
  27931. "type": ["string", "array"],
  27932. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  27933. "items": {
  27934. "type": "string"
  27935. }
  27936. },
  27937. "include-path": {
  27938. "type": ["array"],
  27939. "description": "DEPRECATED: A list of directories which should get added to PHP's include path. This is only present to support legacy projects, and all new code should preferably use autoloading.",
  27940. "items": {
  27941. "type": "string"
  27942. }
  27943. },
  27944. "scripts": {
  27945. "type": ["object"],
  27946. "description": "Script listeners that will be executed before/after some events.",
  27947. "properties": {
  27948. "pre-install-cmd": {
  27949. "type": ["array", "string"],
  27950. "description": "Occurs before the install command is executed, contains one or more Class::method callables or shell commands."
  27951. },
  27952. "post-install-cmd": {
  27953. "type": ["array", "string"],
  27954. "description": "Occurs after the install command is executed, contains one or more Class::method callables or shell commands."
  27955. },
  27956. "pre-update-cmd": {
  27957. "type": ["array", "string"],
  27958. "description": "Occurs before the update command is executed, contains one or more Class::method callables or shell commands."
  27959. },
  27960. "post-update-cmd": {
  27961. "type": ["array", "string"],
  27962. "description": "Occurs after the update command is executed, contains one or more Class::method callables or shell commands."
  27963. },
  27964. "pre-status-cmd": {
  27965. "type": ["array", "string"],
  27966. "description": "Occurs before the status command is executed, contains one or more Class::method callables or shell commands."
  27967. },
  27968. "post-status-cmd": {
  27969. "type": ["array", "string"],
  27970. "description": "Occurs after the status command is executed, contains one or more Class::method callables or shell commands."
  27971. },
  27972. "pre-package-install": {
  27973. "type": ["array", "string"],
  27974. "description": "Occurs before a package is installed, contains one or more Class::method callables or shell commands."
  27975. },
  27976. "post-package-install": {
  27977. "type": ["array", "string"],
  27978. "description": "Occurs after a package is installed, contains one or more Class::method callables or shell commands."
  27979. },
  27980. "pre-package-update": {
  27981. "type": ["array", "string"],
  27982. "description": "Occurs before a package is updated, contains one or more Class::method callables or shell commands."
  27983. },
  27984. "post-package-update": {
  27985. "type": ["array", "string"],
  27986. "description": "Occurs after a package is updated, contains one or more Class::method callables or shell commands."
  27987. },
  27988. "pre-package-uninstall": {
  27989. "type": ["array", "string"],
  27990. "description": "Occurs before a package has been uninstalled, contains one or more Class::method callables or shell commands."
  27991. },
  27992. "post-package-uninstall": {
  27993. "type": ["array", "string"],
  27994. "description": "Occurs after a package has been uninstalled, contains one or more Class::method callables or shell commands."
  27995. },
  27996. "pre-autoload-dump": {
  27997. "type": ["array", "string"],
  27998. "description": "Occurs before the autoloader is dumped, contains one or more Class::method callables or shell commands."
  27999. },
  28000. "post-autoload-dump": {
  28001. "type": ["array", "string"],
  28002. "description": "Occurs after the autoloader is dumped, contains one or more Class::method callables or shell commands."
  28003. },
  28004. "post-root-package-install": {
  28005. "type": ["array", "string"],
  28006. "description": "Occurs after the root-package is installed, contains one or more Class::method callables or shell commands."
  28007. },
  28008. "post-create-project-cmd": {
  28009. "type": ["array", "string"],
  28010. "description": "Occurs after the create-project command is executed, contains one or more Class::method callables or shell commands."
  28011. }
  28012. }
  28013. },
  28014. "scripts-descriptions": {
  28015. "type": ["object"],
  28016. "description": "Descriptions for custom commands, shown in console help.",
  28017. "additionalProperties": {
  28018. "type": "string"
  28019. }
  28020. },
  28021. "support": {
  28022. "type": "object",
  28023. "properties": {
  28024. "email": {
  28025. "type": "string",
  28026. "description": "Email address for support.",
  28027. "format": "email"
  28028. },
  28029. "issues": {
  28030. "type": "string",
  28031. "description": "URL to the issue tracker.",
  28032. "format": "uri"
  28033. },
  28034. "forum": {
  28035. "type": "string",
  28036. "description": "URL to the forum.",
  28037. "format": "uri"
  28038. },
  28039. "wiki": {
  28040. "type": "string",
  28041. "description": "URL to the wiki.",
  28042. "format": "uri"
  28043. },
  28044. "irc": {
  28045. "type": "string",
  28046. "description": "IRC channel for support, as irc://server/channel.",
  28047. "format": "uri"
  28048. },
  28049. "source": {
  28050. "type": "string",
  28051. "description": "URL to browse or download the sources.",
  28052. "format": "uri"
  28053. },
  28054. "docs": {
  28055. "type": "string",
  28056. "description": "URL to the documentation.",
  28057. "format": "uri"
  28058. },
  28059. "rss": {
  28060. "type": "string",
  28061. "description": "URL to the RSS feed.",
  28062. "format": "uri"
  28063. }
  28064. }
  28065. },
  28066. "non-feature-branches": {
  28067. "type": ["array"],
  28068. "description": "A set of string or regex patterns for non-numeric branch names that will not be handled as feature branches.",
  28069. "items": {
  28070. "type": "string"
  28071. }
  28072. },
  28073. "abandoned": {
  28074. "type": ["boolean", "string"],
  28075. "description": "Indicates whether this package has been abandoned, it can be boolean or a package name/URL pointing to a recommended alternative. Defaults to false."
  28076. },
  28077. "_comment": {
  28078. "type": ["array", "string"],
  28079. "description": "A key to store comments in"
  28080. }
  28081. },
  28082. "definitions": {
  28083. "authors": {
  28084. "type": "array",
  28085. "description": "List of authors that contributed to the package. This is typically the main maintainers, not the full list.",
  28086. "items": {
  28087. "type": "object",
  28088. "additionalProperties": false,
  28089. "required": [ "name"],
  28090. "properties": {
  28091. "name": {
  28092. "type": "string",
  28093. "description": "Full name of the author."
  28094. },
  28095. "email": {
  28096. "type": "string",
  28097. "description": "Email address of the author.",
  28098. "format": "email"
  28099. },
  28100. "homepage": {
  28101. "type": "string",
  28102. "description": "Homepage URL for the author.",
  28103. "format": "uri"
  28104. },
  28105. "role": {
  28106. "type": "string",
  28107. "description": "Author's role in the project."
  28108. }
  28109. }
  28110. }
  28111. },
  28112. "autoload": {
  28113. "type": "object",
  28114. "description": "Description of how the package can be autoloaded.",
  28115. "properties": {
  28116. "psr-0": {
  28117. "type": "object",
  28118. "description": "This is a hash of namespaces (keys) and the directories they can be found in (values, can be arrays of paths) by the autoloader.",
  28119. "additionalProperties": {
  28120. "type": ["string", "array"],
  28121. "items": {
  28122. "type": "string"
  28123. }
  28124. }
  28125. },
  28126. "psr-4": {
  28127. "type": "object",
  28128. "description": "This is a hash of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
  28129. "additionalProperties": {
  28130. "type": ["string", "array"],
  28131. "items": {
  28132. "type": "string"
  28133. }
  28134. }
  28135. },
  28136. "classmap": {
  28137. "type": "array",
  28138. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  28139. },
  28140. "files": {
  28141. "type": "array",
  28142. "description": "This is an array of files that are always required on every request."
  28143. },
  28144. "exclude-from-classmap": {
  28145. "type": "array",
  28146. "description": "This is an array of patterns to exclude from autoload classmap generation. (e.g. \"exclude-from-classmap\": [\"/test/\", \"/tests/\", \"/Tests/\"]"
  28147. }
  28148. }
  28149. },
  28150. "repository": {
  28151. "type": "object",
  28152. "oneOf": [
  28153. { "$ref": "#/definitions/composer-repository" },
  28154. { "$ref": "#/definitions/vcs-repository" },
  28155. { "$ref": "#/definitions/path-repository" },
  28156. { "$ref": "#/definitions/artifact-repository" },
  28157. { "$ref": "#/definitions/pear-repository" },
  28158. { "$ref": "#/definitions/package-repository" }
  28159. ]
  28160. },
  28161. "composer-repository": {
  28162. "type": "object",
  28163. "required": ["type", "url"],
  28164. "properties": {
  28165. "type": { "type": "string", "enum": ["composer"] },
  28166. "url": { "type": "string" },
  28167. "options": {
  28168. "type": "object",
  28169. "additionalProperties": true
  28170. },
  28171. "allow_ssl_downgrade": { "type": "boolean" },
  28172. "force-lazy-providers": { "type": "boolean" }
  28173. }
  28174. },
  28175. "vcs-repository": {
  28176. "type": "object",
  28177. "required": ["type", "url"],
  28178. "properties": {
  28179. "type": { "type": "string", "enum": ["vcs", "github", "git", "gitlab", "git-bitbucket", "hg", "hg-bitbucket", "fossil", "perforce", "svn"] },
  28180. "url": { "type": "string" },
  28181. "no-api": { "type": "boolean" },
  28182. "secure-http": { "type": "boolean" },
  28183. "svn-cache-credentials": { "type": "boolean" },
  28184. "trunk-path": { "type": ["string", "boolean"] },
  28185. "branches-path": { "type": ["string", "boolean"] },
  28186. "tags-path": { "type": ["string", "boolean"] },
  28187. "package-path": { "type": "string" },
  28188. "depot": { "type": "string" },
  28189. "branch": { "type": "string" },
  28190. "unique_perforce_client_name": { "type": "string" },
  28191. "p4user": { "type": "string" },
  28192. "p4password": { "type": "string" }
  28193. }
  28194. },
  28195. "path-repository": {
  28196. "type": "object",
  28197. "required": ["type", "url"],
  28198. "properties": {
  28199. "type": { "type": "string", "enum": ["path"] },
  28200. "url": { "type": "string" },
  28201. "options": {
  28202. "type": "object",
  28203. "properties": {
  28204. "symlink": { "type": ["boolean", "null"] }
  28205. },
  28206. "additionalProperties": true
  28207. }
  28208. }
  28209. },
  28210. "artifact-repository": {
  28211. "type": "object",
  28212. "required": ["type", "url"],
  28213. "properties": {
  28214. "type": { "type": "string", "enum": ["artifact"] },
  28215. "url": { "type": "string" }
  28216. }
  28217. },
  28218. "pear-repository": {
  28219. "type": "object",
  28220. "required": ["type", "url"],
  28221. "properties": {
  28222. "type": { "type": "string", "enum": ["pear"] },
  28223. "url": { "type": "string" },
  28224. "vendor-alias": { "type": "string" }
  28225. }
  28226. },
  28227. "package-repository": {
  28228. "type": "object",
  28229. "required": ["type", "package"],
  28230. "properties": {
  28231. "type": { "type": "string", "enum": ["package"] },
  28232. "package": {
  28233. "oneOf": [
  28234. { "$ref": "#/definitions/inline-package" },
  28235. {
  28236. "type": "array",
  28237. "items": { "$ref": "#/definitions/inline-package" }
  28238. }
  28239. ]
  28240. }
  28241. }
  28242. },
  28243. "inline-package": {
  28244. "required": ["name", "version"],
  28245. "properties": {
  28246. "name": {
  28247. "type": "string",
  28248. "description": "Package name, including 'vendor-name/' prefix."
  28249. },
  28250. "type": {
  28251. "type": "string"
  28252. },
  28253. "target-dir": {
  28254. "description": "DEPRECATED: Forces the package to be installed into the given subdirectory path. This is used for autoloading PSR-0 packages that do not contain their full path. Use forward slashes for cross-platform compatibility.",
  28255. "type": "string"
  28256. },
  28257. "description": {
  28258. "type": "string"
  28259. },
  28260. "keywords": {
  28261. "type": "array",
  28262. "items": {
  28263. "type": "string"
  28264. }
  28265. },
  28266. "homepage": {
  28267. "type": "string",
  28268. "format": "uri"
  28269. },
  28270. "version": {
  28271. "type": "string"
  28272. },
  28273. "time": {
  28274. "type": "string"
  28275. },
  28276. "license": {
  28277. "type": [
  28278. "string",
  28279. "array"
  28280. ]
  28281. },
  28282. "authors": {
  28283. "$ref": "#/definitions/authors"
  28284. },
  28285. "require": {
  28286. "type": "object",
  28287. "additionalProperties": {
  28288. "type": "string"
  28289. }
  28290. },
  28291. "replace": {
  28292. "type": "object",
  28293. "additionalProperties": {
  28294. "type": "string"
  28295. }
  28296. },
  28297. "conflict": {
  28298. "type": "object",
  28299. "additionalProperties": {
  28300. "type": "string"
  28301. }
  28302. },
  28303. "provide": {
  28304. "type": "object",
  28305. "additionalProperties": {
  28306. "type": "string"
  28307. }
  28308. },
  28309. "require-dev": {
  28310. "type": "object",
  28311. "additionalProperties": {
  28312. "type": "string"
  28313. }
  28314. },
  28315. "suggest": {
  28316. "type": "object",
  28317. "additionalProperties": {
  28318. "type": "string"
  28319. }
  28320. },
  28321. "extra": {
  28322. "type": ["object", "array"],
  28323. "additionalProperties": true
  28324. },
  28325. "autoload": {
  28326. "$ref": "#/definitions/autoload"
  28327. },
  28328. "archive": {
  28329. "type": ["object"],
  28330. "properties": {
  28331. "exclude": {
  28332. "type": "array"
  28333. }
  28334. }
  28335. },
  28336. "bin": {
  28337. "type": ["string", "array"],
  28338. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  28339. "items": {
  28340. "type": "string"
  28341. }
  28342. },
  28343. "include-path": {
  28344. "type": ["array"],
  28345. "description": "DEPRECATED: A list of directories which should get added to PHP's include path. This is only present to support legacy projects, and all new code should preferably use autoloading.",
  28346. "items": {
  28347. "type": "string"
  28348. }
  28349. },
  28350. "source": {
  28351. "type": "object",
  28352. "required": ["type", "url", "reference"],
  28353. "properties": {
  28354. "type": {
  28355. "type": "string"
  28356. },
  28357. "url": {
  28358. "type": "string"
  28359. },
  28360. "reference": {
  28361. "type": "string"
  28362. },
  28363. "mirrors": {
  28364. "type": "array"
  28365. }
  28366. }
  28367. },
  28368. "dist": {
  28369. "type": "object",
  28370. "required": ["type", "url"],
  28371. "properties": {
  28372. "type": {
  28373. "type": "string"
  28374. },
  28375. "url": {
  28376. "type": "string"
  28377. },
  28378. "reference": {
  28379. "type": "string"
  28380. },
  28381. "shasum": {
  28382. "type": "string"
  28383. },
  28384. "mirrors": {
  28385. "type": "array"
  28386. }
  28387. }
  28388. }
  28389. },
  28390. "additionalProperties": true
  28391. }
  28392. }
  28393. }
  28394. {
  28395. "389-exception": [
  28396. "389 Directory Server Exception"
  28397. ],
  28398. "Autoconf-exception-2.0": [
  28399. "Autoconf exception 2.0"
  28400. ],
  28401. "Autoconf-exception-3.0": [
  28402. "Autoconf exception 3.0"
  28403. ],
  28404. "Bison-exception-2.2": [
  28405. "Bison exception 2.2"
  28406. ],
  28407. "Bootloader-exception": [
  28408. "Bootloader Distribution Exception"
  28409. ],
  28410. "Classpath-exception-2.0": [
  28411. "Classpath exception 2.0"
  28412. ],
  28413. "CLISP-exception-2.0": [
  28414. "CLISP exception 2.0"
  28415. ],
  28416. "DigiRule-FOSS-exception": [
  28417. "DigiRule FOSS License Exception"
  28418. ],
  28419. "eCos-exception-2.0": [
  28420. "eCos exception 2.0"
  28421. ],
  28422. "Fawkes-Runtime-exception": [
  28423. "Fawkes Runtime Exception"
  28424. ],
  28425. "FLTK-exception": [
  28426. "FLTK exception"
  28427. ],
  28428. "Font-exception-2.0": [
  28429. "Font exception 2.0"
  28430. ],
  28431. "freertos-exception-2.0": [
  28432. "FreeRTOS Exception 2.0"
  28433. ],
  28434. "GCC-exception-2.0": [
  28435. "GCC Runtime Library exception 2.0"
  28436. ],
  28437. "GCC-exception-3.1": [
  28438. "GCC Runtime Library exception 3.1"
  28439. ],
  28440. "gnu-javamail-exception": [
  28441. "GNU JavaMail exception"
  28442. ],
  28443. "i2p-gpl-java-exception": [
  28444. "i2p GPL+Java Exception"
  28445. ],
  28446. "Libtool-exception": [
  28447. "Libtool Exception"
  28448. ],
  28449. "Linux-syscall-note": [
  28450. "Linux Syscall Note"
  28451. ],
  28452. "LZMA-exception": [
  28453. "LZMA exception"
  28454. ],
  28455. "mif-exception": [
  28456. "Macros and Inline Functions Exception"
  28457. ],
  28458. "Nokia-Qt-exception-1.1": [
  28459. "Nokia Qt LGPL exception 1.1"
  28460. ],
  28461. "OCCT-exception-1.0": [
  28462. "Open CASCADE Exception 1.0"
  28463. ],
  28464. "openvpn-openssl-exception": [
  28465. "OpenVPN OpenSSL Exception"
  28466. ],
  28467. "Qwt-exception-1.0": [
  28468. "Qwt exception 1.0"
  28469. ],
  28470. "u-boot-exception-2.0": [
  28471. "U-Boot exception 2.0"
  28472. ],
  28473. "WxWindows-exception-3.1": [
  28474. "WxWindows Library Exception 3.1"
  28475. ]
  28476. }{
  28477. "0BSD": [
  28478. "BSD Zero Clause License",
  28479. false,
  28480. false
  28481. ],
  28482. "AAL": [
  28483. "Attribution Assurance License",
  28484. true,
  28485. false
  28486. ],
  28487. "Abstyles": [
  28488. "Abstyles License",
  28489. false,
  28490. false
  28491. ],
  28492. "Adobe-2006": [
  28493. "Adobe Systems Incorporated Source Code License Agreement",
  28494. false,
  28495. false
  28496. ],
  28497. "Adobe-Glyph": [
  28498. "Adobe Glyph List License",
  28499. false,
  28500. false
  28501. ],
  28502. "ADSL": [
  28503. "Amazon Digital Services License",
  28504. false,
  28505. false
  28506. ],
  28507. "AFL-1.1": [
  28508. "Academic Free License v1.1",
  28509. true,
  28510. false
  28511. ],
  28512. "AFL-1.2": [
  28513. "Academic Free License v1.2",
  28514. true,
  28515. false
  28516. ],
  28517. "AFL-2.0": [
  28518. "Academic Free License v2.0",
  28519. true,
  28520. false
  28521. ],
  28522. "AFL-2.1": [
  28523. "Academic Free License v2.1",
  28524. true,
  28525. false
  28526. ],
  28527. "AFL-3.0": [
  28528. "Academic Free License v3.0",
  28529. true,
  28530. false
  28531. ],
  28532. "Afmparse": [
  28533. "Afmparse License",
  28534. false,
  28535. false
  28536. ],
  28537. "AGPL-1.0": [
  28538. "Affero General Public License v1.0",
  28539. false,
  28540. false
  28541. ],
  28542. "AGPL-3.0": [
  28543. "GNU Affero General Public License v3.0",
  28544. true,
  28545. true
  28546. ],
  28547. "AGPL-3.0-only": [
  28548. "GNU Affero General Public License v3.0 only",
  28549. true,
  28550. false
  28551. ],
  28552. "AGPL-3.0-or-later": [
  28553. "GNU Affero General Public License v3.0 or later",
  28554. true,
  28555. false
  28556. ],
  28557. "Aladdin": [
  28558. "Aladdin Free Public License",
  28559. false,
  28560. false
  28561. ],
  28562. "AMDPLPA": [
  28563. "AMD's plpa_map.c License",
  28564. false,
  28565. false
  28566. ],
  28567. "AML": [
  28568. "Apple MIT License",
  28569. false,
  28570. false
  28571. ],
  28572. "AMPAS": [
  28573. "Academy of Motion Picture Arts and Sciences BSD",
  28574. false,
  28575. false
  28576. ],
  28577. "ANTLR-PD": [
  28578. "ANTLR Software Rights Notice",
  28579. false,
  28580. false
  28581. ],
  28582. "Apache-1.0": [
  28583. "Apache License 1.0",
  28584. false,
  28585. false
  28586. ],
  28587. "Apache-1.1": [
  28588. "Apache License 1.1",
  28589. true,
  28590. false
  28591. ],
  28592. "Apache-2.0": [
  28593. "Apache License 2.0",
  28594. true,
  28595. false
  28596. ],
  28597. "APAFML": [
  28598. "Adobe Postscript AFM License",
  28599. false,
  28600. false
  28601. ],
  28602. "APL-1.0": [
  28603. "Adaptive Public License 1.0",
  28604. true,
  28605. false
  28606. ],
  28607. "APSL-1.0": [
  28608. "Apple Public Source License 1.0",
  28609. true,
  28610. false
  28611. ],
  28612. "APSL-1.1": [
  28613. "Apple Public Source License 1.1",
  28614. true,
  28615. false
  28616. ],
  28617. "APSL-1.2": [
  28618. "Apple Public Source License 1.2",
  28619. true,
  28620. false
  28621. ],
  28622. "APSL-2.0": [
  28623. "Apple Public Source License 2.0",
  28624. true,
  28625. false
  28626. ],
  28627. "Artistic-1.0": [
  28628. "Artistic License 1.0",
  28629. true,
  28630. false
  28631. ],
  28632. "Artistic-1.0-cl8": [
  28633. "Artistic License 1.0 w/clause 8",
  28634. true,
  28635. false
  28636. ],
  28637. "Artistic-1.0-Perl": [
  28638. "Artistic License 1.0 (Perl)",
  28639. true,
  28640. false
  28641. ],
  28642. "Artistic-2.0": [
  28643. "Artistic License 2.0",
  28644. true,
  28645. false
  28646. ],
  28647. "Bahyph": [
  28648. "Bahyph License",
  28649. false,
  28650. false
  28651. ],
  28652. "Barr": [
  28653. "Barr License",
  28654. false,
  28655. false
  28656. ],
  28657. "Beerware": [
  28658. "Beerware License",
  28659. false,
  28660. false
  28661. ],
  28662. "BitTorrent-1.0": [
  28663. "BitTorrent Open Source License v1.0",
  28664. false,
  28665. false
  28666. ],
  28667. "BitTorrent-1.1": [
  28668. "BitTorrent Open Source License v1.1",
  28669. false,
  28670. false
  28671. ],
  28672. "Borceux": [
  28673. "Borceux license",
  28674. false,
  28675. false
  28676. ],
  28677. "BSD-1-Clause": [
  28678. "BSD 1-Clause License",
  28679. false,
  28680. false
  28681. ],
  28682. "BSD-2-Clause": [
  28683. "BSD 2-Clause \"Simplified\" License",
  28684. true,
  28685. false
  28686. ],
  28687. "BSD-2-Clause-FreeBSD": [
  28688. "BSD 2-Clause FreeBSD License",
  28689. false,
  28690. false
  28691. ],
  28692. "BSD-2-Clause-NetBSD": [
  28693. "BSD 2-Clause NetBSD License",
  28694. false,
  28695. false
  28696. ],
  28697. "BSD-2-Clause-Patent": [
  28698. "BSD-2-Clause Plus Patent License",
  28699. true,
  28700. false
  28701. ],
  28702. "BSD-3-Clause": [
  28703. "BSD 3-Clause \"New\" or \"Revised\" License",
  28704. true,
  28705. false
  28706. ],
  28707. "BSD-3-Clause-Attribution": [
  28708. "BSD with attribution",
  28709. false,
  28710. false
  28711. ],
  28712. "BSD-3-Clause-Clear": [
  28713. "BSD 3-Clause Clear License",
  28714. false,
  28715. false
  28716. ],
  28717. "BSD-3-Clause-LBNL": [
  28718. "Lawrence Berkeley National Labs BSD variant license",
  28719. false,
  28720. false
  28721. ],
  28722. "BSD-3-Clause-No-Nuclear-License": [
  28723. "BSD 3-Clause No Nuclear License",
  28724. false,
  28725. false
  28726. ],
  28727. "BSD-3-Clause-No-Nuclear-License-2014": [
  28728. "BSD 3-Clause No Nuclear License 2014",
  28729. false,
  28730. false
  28731. ],
  28732. "BSD-3-Clause-No-Nuclear-Warranty": [
  28733. "BSD 3-Clause No Nuclear Warranty",
  28734. false,
  28735. false
  28736. ],
  28737. "BSD-4-Clause": [
  28738. "BSD 4-Clause \"Original\" or \"Old\" License",
  28739. false,
  28740. false
  28741. ],
  28742. "BSD-4-Clause-UC": [
  28743. "BSD-4-Clause (University of California-Specific)",
  28744. false,
  28745. false
  28746. ],
  28747. "BSD-Protection": [
  28748. "BSD Protection License",
  28749. false,
  28750. false
  28751. ],
  28752. "BSD-Source-Code": [
  28753. "BSD Source Code Attribution",
  28754. false,
  28755. false
  28756. ],
  28757. "BSL-1.0": [
  28758. "Boost Software License 1.0",
  28759. true,
  28760. false
  28761. ],
  28762. "bzip2-1.0.5": [
  28763. "bzip2 and libbzip2 License v1.0.5",
  28764. false,
  28765. false
  28766. ],
  28767. "bzip2-1.0.6": [
  28768. "bzip2 and libbzip2 License v1.0.6",
  28769. false,
  28770. false
  28771. ],
  28772. "Caldera": [
  28773. "Caldera License",
  28774. false,
  28775. false
  28776. ],
  28777. "CATOSL-1.1": [
  28778. "Computer Associates Trusted Open Source License 1.1",
  28779. true,
  28780. false
  28781. ],
  28782. "CC-BY-1.0": [
  28783. "Creative Commons Attribution 1.0",
  28784. false,
  28785. false
  28786. ],
  28787. "CC-BY-2.0": [
  28788. "Creative Commons Attribution 2.0",
  28789. false,
  28790. false
  28791. ],
  28792. "CC-BY-2.5": [
  28793. "Creative Commons Attribution 2.5",
  28794. false,
  28795. false
  28796. ],
  28797. "CC-BY-3.0": [
  28798. "Creative Commons Attribution 3.0",
  28799. false,
  28800. false
  28801. ],
  28802. "CC-BY-4.0": [
  28803. "Creative Commons Attribution 4.0",
  28804. false,
  28805. false
  28806. ],
  28807. "CC-BY-NC-1.0": [
  28808. "Creative Commons Attribution Non Commercial 1.0",
  28809. false,
  28810. false
  28811. ],
  28812. "CC-BY-NC-2.0": [
  28813. "Creative Commons Attribution Non Commercial 2.0",
  28814. false,
  28815. false
  28816. ],
  28817. "CC-BY-NC-2.5": [
  28818. "Creative Commons Attribution Non Commercial 2.5",
  28819. false,
  28820. false
  28821. ],
  28822. "CC-BY-NC-3.0": [
  28823. "Creative Commons Attribution Non Commercial 3.0",
  28824. false,
  28825. false
  28826. ],
  28827. "CC-BY-NC-4.0": [
  28828. "Creative Commons Attribution Non Commercial 4.0",
  28829. false,
  28830. false
  28831. ],
  28832. "CC-BY-NC-ND-1.0": [
  28833. "Creative Commons Attribution Non Commercial No Derivatives 1.0",
  28834. false,
  28835. false
  28836. ],
  28837. "CC-BY-NC-ND-2.0": [
  28838. "Creative Commons Attribution Non Commercial No Derivatives 2.0",
  28839. false,
  28840. false
  28841. ],
  28842. "CC-BY-NC-ND-2.5": [
  28843. "Creative Commons Attribution Non Commercial No Derivatives 2.5",
  28844. false,
  28845. false
  28846. ],
  28847. "CC-BY-NC-ND-3.0": [
  28848. "Creative Commons Attribution Non Commercial No Derivatives 3.0",
  28849. false,
  28850. false
  28851. ],
  28852. "CC-BY-NC-ND-4.0": [
  28853. "Creative Commons Attribution Non Commercial No Derivatives 4.0",
  28854. false,
  28855. false
  28856. ],
  28857. "CC-BY-NC-SA-1.0": [
  28858. "Creative Commons Attribution Non Commercial Share Alike 1.0",
  28859. false,
  28860. false
  28861. ],
  28862. "CC-BY-NC-SA-2.0": [
  28863. "Creative Commons Attribution Non Commercial Share Alike 2.0",
  28864. false,
  28865. false
  28866. ],
  28867. "CC-BY-NC-SA-2.5": [
  28868. "Creative Commons Attribution Non Commercial Share Alike 2.5",
  28869. false,
  28870. false
  28871. ],
  28872. "CC-BY-NC-SA-3.0": [
  28873. "Creative Commons Attribution Non Commercial Share Alike 3.0",
  28874. false,
  28875. false
  28876. ],
  28877. "CC-BY-NC-SA-4.0": [
  28878. "Creative Commons Attribution Non Commercial Share Alike 4.0",
  28879. false,
  28880. false
  28881. ],
  28882. "CC-BY-ND-1.0": [
  28883. "Creative Commons Attribution No Derivatives 1.0",
  28884. false,
  28885. false
  28886. ],
  28887. "CC-BY-ND-2.0": [
  28888. "Creative Commons Attribution No Derivatives 2.0",
  28889. false,
  28890. false
  28891. ],
  28892. "CC-BY-ND-2.5": [
  28893. "Creative Commons Attribution No Derivatives 2.5",
  28894. false,
  28895. false
  28896. ],
  28897. "CC-BY-ND-3.0": [
  28898. "Creative Commons Attribution No Derivatives 3.0",
  28899. false,
  28900. false
  28901. ],
  28902. "CC-BY-ND-4.0": [
  28903. "Creative Commons Attribution No Derivatives 4.0",
  28904. false,
  28905. false
  28906. ],
  28907. "CC-BY-SA-1.0": [
  28908. "Creative Commons Attribution Share Alike 1.0",
  28909. false,
  28910. false
  28911. ],
  28912. "CC-BY-SA-2.0": [
  28913. "Creative Commons Attribution Share Alike 2.0",
  28914. false,
  28915. false
  28916. ],
  28917. "CC-BY-SA-2.5": [
  28918. "Creative Commons Attribution Share Alike 2.5",
  28919. false,
  28920. false
  28921. ],
  28922. "CC-BY-SA-3.0": [
  28923. "Creative Commons Attribution Share Alike 3.0",
  28924. false,
  28925. false
  28926. ],
  28927. "CC-BY-SA-4.0": [
  28928. "Creative Commons Attribution Share Alike 4.0",
  28929. false,
  28930. false
  28931. ],
  28932. "CC0-1.0": [
  28933. "Creative Commons Zero v1.0 Universal",
  28934. false,
  28935. false
  28936. ],
  28937. "CDDL-1.0": [
  28938. "Common Development and Distribution License 1.0",
  28939. true,
  28940. false
  28941. ],
  28942. "CDDL-1.1": [
  28943. "Common Development and Distribution License 1.1",
  28944. false,
  28945. false
  28946. ],
  28947. "CDLA-Permissive-1.0": [
  28948. "Community Data License Agreement Permissive 1.0",
  28949. false,
  28950. false
  28951. ],
  28952. "CDLA-Sharing-1.0": [
  28953. "Community Data License Agreement Sharing 1.0",
  28954. false,
  28955. false
  28956. ],
  28957. "CECILL-1.0": [
  28958. "CeCILL Free Software License Agreement v1.0",
  28959. false,
  28960. false
  28961. ],
  28962. "CECILL-1.1": [
  28963. "CeCILL Free Software License Agreement v1.1",
  28964. false,
  28965. false
  28966. ],
  28967. "CECILL-2.0": [
  28968. "CeCILL Free Software License Agreement v2.0",
  28969. false,
  28970. false
  28971. ],
  28972. "CECILL-2.1": [
  28973. "CeCILL Free Software License Agreement v2.1",
  28974. true,
  28975. false
  28976. ],
  28977. "CECILL-B": [
  28978. "CeCILL-B Free Software License Agreement",
  28979. false,
  28980. false
  28981. ],
  28982. "CECILL-C": [
  28983. "CeCILL-C Free Software License Agreement",
  28984. false,
  28985. false
  28986. ],
  28987. "ClArtistic": [
  28988. "Clarified Artistic License",
  28989. false,
  28990. false
  28991. ],
  28992. "CNRI-Jython": [
  28993. "CNRI Jython License",
  28994. false,
  28995. false
  28996. ],
  28997. "CNRI-Python": [
  28998. "CNRI Python License",
  28999. true,
  29000. false
  29001. ],
  29002. "CNRI-Python-GPL-Compatible": [
  29003. "CNRI Python Open Source GPL Compatible License Agreement",
  29004. false,
  29005. false
  29006. ],
  29007. "Condor-1.1": [
  29008. "Condor Public License v1.1",
  29009. false,
  29010. false
  29011. ],
  29012. "CPAL-1.0": [
  29013. "Common Public Attribution License 1.0",
  29014. true,
  29015. false
  29016. ],
  29017. "CPL-1.0": [
  29018. "Common Public License 1.0",
  29019. true,
  29020. false
  29021. ],
  29022. "CPOL-1.02": [
  29023. "Code Project Open License 1.02",
  29024. false,
  29025. false
  29026. ],
  29027. "Crossword": [
  29028. "Crossword License",
  29029. false,
  29030. false
  29031. ],
  29032. "CrystalStacker": [
  29033. "CrystalStacker License",
  29034. false,
  29035. false
  29036. ],
  29037. "CUA-OPL-1.0": [
  29038. "CUA Office Public License v1.0",
  29039. true,
  29040. false
  29041. ],
  29042. "Cube": [
  29043. "Cube License",
  29044. false,
  29045. false
  29046. ],
  29047. "curl": [
  29048. "curl License",
  29049. false,
  29050. false
  29051. ],
  29052. "D-FSL-1.0": [
  29053. "Deutsche Freie Software Lizenz",
  29054. false,
  29055. false
  29056. ],
  29057. "diffmark": [
  29058. "diffmark license",
  29059. false,
  29060. false
  29061. ],
  29062. "DOC": [
  29063. "DOC License",
  29064. false,
  29065. false
  29066. ],
  29067. "Dotseqn": [
  29068. "Dotseqn License",
  29069. false,
  29070. false
  29071. ],
  29072. "DSDP": [
  29073. "DSDP License",
  29074. false,
  29075. false
  29076. ],
  29077. "dvipdfm": [
  29078. "dvipdfm License",
  29079. false,
  29080. false
  29081. ],
  29082. "ECL-1.0": [
  29083. "Educational Community License v1.0",
  29084. true,
  29085. false
  29086. ],
  29087. "ECL-2.0": [
  29088. "Educational Community License v2.0",
  29089. true,
  29090. false
  29091. ],
  29092. "eCos-2.0": [
  29093. "eCos license version 2.0",
  29094. false,
  29095. true
  29096. ],
  29097. "EFL-1.0": [
  29098. "Eiffel Forum License v1.0",
  29099. true,
  29100. false
  29101. ],
  29102. "EFL-2.0": [
  29103. "Eiffel Forum License v2.0",
  29104. true,
  29105. false
  29106. ],
  29107. "eGenix": [
  29108. "eGenix.com Public License 1.1.0",
  29109. false,
  29110. false
  29111. ],
  29112. "Entessa": [
  29113. "Entessa Public License v1.0",
  29114. true,
  29115. false
  29116. ],
  29117. "EPL-1.0": [
  29118. "Eclipse Public License 1.0",
  29119. true,
  29120. false
  29121. ],
  29122. "EPL-2.0": [
  29123. "Eclipse Public License 2.0",
  29124. true,
  29125. false
  29126. ],
  29127. "ErlPL-1.1": [
  29128. "Erlang Public License v1.1",
  29129. false,
  29130. false
  29131. ],
  29132. "EUDatagrid": [
  29133. "EU DataGrid Software License",
  29134. true,
  29135. false
  29136. ],
  29137. "EUPL-1.0": [
  29138. "European Union Public License 1.0",
  29139. false,
  29140. false
  29141. ],
  29142. "EUPL-1.1": [
  29143. "European Union Public License 1.1",
  29144. true,
  29145. false
  29146. ],
  29147. "EUPL-1.2": [
  29148. "European Union Public License 1.2",
  29149. true,
  29150. false
  29151. ],
  29152. "Eurosym": [
  29153. "Eurosym License",
  29154. false,
  29155. false
  29156. ],
  29157. "Fair": [
  29158. "Fair License",
  29159. true,
  29160. false
  29161. ],
  29162. "Frameworx-1.0": [
  29163. "Frameworx Open License 1.0",
  29164. true,
  29165. false
  29166. ],
  29167. "FreeImage": [
  29168. "FreeImage Public License v1.0",
  29169. false,
  29170. false
  29171. ],
  29172. "FSFAP": [
  29173. "FSF All Permissive License",
  29174. false,
  29175. false
  29176. ],
  29177. "FSFUL": [
  29178. "FSF Unlimited License",
  29179. false,
  29180. false
  29181. ],
  29182. "FSFULLR": [
  29183. "FSF Unlimited License (with License Retention)",
  29184. false,
  29185. false
  29186. ],
  29187. "FTL": [
  29188. "Freetype Project License",
  29189. false,
  29190. false
  29191. ],
  29192. "GFDL-1.1": [
  29193. "GNU Free Documentation License v1.1",
  29194. false,
  29195. true
  29196. ],
  29197. "GFDL-1.1-only": [
  29198. "GNU Free Documentation License v1.1 only",
  29199. false,
  29200. false
  29201. ],
  29202. "GFDL-1.1-or-later": [
  29203. "GNU Free Documentation License v1.1 or later",
  29204. false,
  29205. false
  29206. ],
  29207. "GFDL-1.2": [
  29208. "GNU Free Documentation License v1.2",
  29209. false,
  29210. true
  29211. ],
  29212. "GFDL-1.2-only": [
  29213. "GNU Free Documentation License v1.2 only",
  29214. false,
  29215. false
  29216. ],
  29217. "GFDL-1.2-or-later": [
  29218. "GNU Free Documentation License v1.2 or later",
  29219. false,
  29220. false
  29221. ],
  29222. "GFDL-1.3": [
  29223. "GNU Free Documentation License v1.3",
  29224. false,
  29225. true
  29226. ],
  29227. "GFDL-1.3-only": [
  29228. "GNU Free Documentation License v1.3 only",
  29229. false,
  29230. false
  29231. ],
  29232. "GFDL-1.3-or-later": [
  29233. "GNU Free Documentation License v1.3 or later",
  29234. false,
  29235. false
  29236. ],
  29237. "Giftware": [
  29238. "Giftware License",
  29239. false,
  29240. false
  29241. ],
  29242. "GL2PS": [
  29243. "GL2PS License",
  29244. false,
  29245. false
  29246. ],
  29247. "Glide": [
  29248. "3dfx Glide License",
  29249. false,
  29250. false
  29251. ],
  29252. "Glulxe": [
  29253. "Glulxe License",
  29254. false,
  29255. false
  29256. ],
  29257. "gnuplot": [
  29258. "gnuplot License",
  29259. false,
  29260. false
  29261. ],
  29262. "GPL-1.0": [
  29263. "GNU General Public License v1.0 only",
  29264. false,
  29265. true
  29266. ],
  29267. "GPL-1.0+": [
  29268. "GNU General Public License v1.0 or later",
  29269. false,
  29270. true
  29271. ],
  29272. "GPL-1.0-only": [
  29273. "GNU General Public License v1.0 only",
  29274. false,
  29275. false
  29276. ],
  29277. "GPL-1.0-or-later": [
  29278. "GNU General Public License v1.0 or later",
  29279. false,
  29280. false
  29281. ],
  29282. "GPL-2.0": [
  29283. "GNU General Public License v2.0 only",
  29284. true,
  29285. true
  29286. ],
  29287. "GPL-2.0+": [
  29288. "GNU General Public License v2.0 or later",
  29289. true,
  29290. true
  29291. ],
  29292. "GPL-2.0-only": [
  29293. "GNU General Public License v2.0 only",
  29294. true,
  29295. false
  29296. ],
  29297. "GPL-2.0-or-later": [
  29298. "GNU General Public License v2.0 or later",
  29299. true,
  29300. false
  29301. ],
  29302. "GPL-2.0-with-autoconf-exception": [
  29303. "GNU General Public License v2.0 w/Autoconf exception",
  29304. false,
  29305. true
  29306. ],
  29307. "GPL-2.0-with-bison-exception": [
  29308. "GNU General Public License v2.0 w/Bison exception",
  29309. false,
  29310. true
  29311. ],
  29312. "GPL-2.0-with-classpath-exception": [
  29313. "GNU General Public License v2.0 w/Classpath exception",
  29314. false,
  29315. true
  29316. ],
  29317. "GPL-2.0-with-font-exception": [
  29318. "GNU General Public License v2.0 w/Font exception",
  29319. false,
  29320. true
  29321. ],
  29322. "GPL-2.0-with-GCC-exception": [
  29323. "GNU General Public License v2.0 w/GCC Runtime Library exception",
  29324. false,
  29325. true
  29326. ],
  29327. "GPL-3.0": [
  29328. "GNU General Public License v3.0 only",
  29329. true,
  29330. true
  29331. ],
  29332. "GPL-3.0+": [
  29333. "GNU General Public License v3.0 or later",
  29334. true,
  29335. true
  29336. ],
  29337. "GPL-3.0-only": [
  29338. "GNU General Public License v3.0 only",
  29339. true,
  29340. false
  29341. ],
  29342. "GPL-3.0-or-later": [
  29343. "GNU General Public License v3.0 or later",
  29344. true,
  29345. false
  29346. ],
  29347. "GPL-3.0-with-autoconf-exception": [
  29348. "GNU General Public License v3.0 w/Autoconf exception",
  29349. false,
  29350. true
  29351. ],
  29352. "GPL-3.0-with-GCC-exception": [
  29353. "GNU General Public License v3.0 w/GCC Runtime Library exception",
  29354. true,
  29355. true
  29356. ],
  29357. "gSOAP-1.3b": [
  29358. "gSOAP Public License v1.3b",
  29359. false,
  29360. false
  29361. ],
  29362. "HaskellReport": [
  29363. "Haskell Language Report License",
  29364. false,
  29365. false
  29366. ],
  29367. "HPND": [
  29368. "Historical Permission Notice and Disclaimer",
  29369. true,
  29370. false
  29371. ],
  29372. "IBM-pibs": [
  29373. "IBM PowerPC Initialization and Boot Software",
  29374. false,
  29375. false
  29376. ],
  29377. "ICU": [
  29378. "ICU License",
  29379. false,
  29380. false
  29381. ],
  29382. "IJG": [
  29383. "Independent JPEG Group License",
  29384. false,
  29385. false
  29386. ],
  29387. "ImageMagick": [
  29388. "ImageMagick License",
  29389. false,
  29390. false
  29391. ],
  29392. "iMatix": [
  29393. "iMatix Standard Function Library Agreement",
  29394. false,
  29395. false
  29396. ],
  29397. "Imlib2": [
  29398. "Imlib2 License",
  29399. false,
  29400. false
  29401. ],
  29402. "Info-ZIP": [
  29403. "Info-ZIP License",
  29404. false,
  29405. false
  29406. ],
  29407. "Intel": [
  29408. "Intel Open Source License",
  29409. true,
  29410. false
  29411. ],
  29412. "Intel-ACPI": [
  29413. "Intel ACPI Software License Agreement",
  29414. false,
  29415. false
  29416. ],
  29417. "Interbase-1.0": [
  29418. "Interbase Public License v1.0",
  29419. false,
  29420. false
  29421. ],
  29422. "IPA": [
  29423. "IPA Font License",
  29424. true,
  29425. false
  29426. ],
  29427. "IPL-1.0": [
  29428. "IBM Public License v1.0",
  29429. true,
  29430. false
  29431. ],
  29432. "ISC": [
  29433. "ISC License",
  29434. true,
  29435. false
  29436. ],
  29437. "JasPer-2.0": [
  29438. "JasPer License",
  29439. false,
  29440. false
  29441. ],
  29442. "JSON": [
  29443. "JSON License",
  29444. false,
  29445. false
  29446. ],
  29447. "LAL-1.2": [
  29448. "Licence Art Libre 1.2",
  29449. false,
  29450. false
  29451. ],
  29452. "LAL-1.3": [
  29453. "Licence Art Libre 1.3",
  29454. false,
  29455. false
  29456. ],
  29457. "Latex2e": [
  29458. "Latex2e License",
  29459. false,
  29460. false
  29461. ],
  29462. "Leptonica": [
  29463. "Leptonica License",
  29464. false,
  29465. false
  29466. ],
  29467. "LGPL-2.0": [
  29468. "GNU Library General Public License v2 only",
  29469. true,
  29470. true
  29471. ],
  29472. "LGPL-2.0+": [
  29473. "GNU Library General Public License v2 or later",
  29474. true,
  29475. true
  29476. ],
  29477. "LGPL-2.0-only": [
  29478. "GNU Library General Public License v2 only",
  29479. true,
  29480. false
  29481. ],
  29482. "LGPL-2.0-or-later": [
  29483. "GNU Library General Public License v2 or later",
  29484. true,
  29485. false
  29486. ],
  29487. "LGPL-2.1": [
  29488. "GNU Lesser General Public License v2.1 only",
  29489. true,
  29490. true
  29491. ],
  29492. "LGPL-2.1+": [
  29493. "GNU Library General Public License v2 or later",
  29494. true,
  29495. true
  29496. ],
  29497. "LGPL-2.1-only": [
  29498. "GNU Lesser General Public License v2.1 only",
  29499. true,
  29500. false
  29501. ],
  29502. "LGPL-2.1-or-later": [
  29503. "GNU Lesser General Public License v2.1 or later",
  29504. true,
  29505. false
  29506. ],
  29507. "LGPL-3.0": [
  29508. "GNU Lesser General Public License v3.0 only",
  29509. true,
  29510. true
  29511. ],
  29512. "LGPL-3.0+": [
  29513. "GNU Lesser General Public License v3.0 or later",
  29514. true,
  29515. true
  29516. ],
  29517. "LGPL-3.0-only": [
  29518. "GNU Lesser General Public License v3.0 only",
  29519. true,
  29520. false
  29521. ],
  29522. "LGPL-3.0-or-later": [
  29523. "GNU Lesser General Public License v3.0 or later",
  29524. true,
  29525. false
  29526. ],
  29527. "LGPLLR": [
  29528. "Lesser General Public License For Linguistic Resources",
  29529. false,
  29530. false
  29531. ],
  29532. "Libpng": [
  29533. "libpng License",
  29534. false,
  29535. false
  29536. ],
  29537. "libtiff": [
  29538. "libtiff License",
  29539. false,
  29540. false
  29541. ],
  29542. "LiLiQ-P-1.1": [
  29543. "Licence Libre du Qu\u00e9bec \u2013 Permissive version 1.1",
  29544. true,
  29545. false
  29546. ],
  29547. "LiLiQ-R-1.1": [
  29548. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 version 1.1",
  29549. true,
  29550. false
  29551. ],
  29552. "LiLiQ-Rplus-1.1": [
  29553. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 forte version 1.1",
  29554. true,
  29555. false
  29556. ],
  29557. "LPL-1.0": [
  29558. "Lucent Public License Version 1.0",
  29559. true,
  29560. false
  29561. ],
  29562. "LPL-1.02": [
  29563. "Lucent Public License v1.02",
  29564. true,
  29565. false
  29566. ],
  29567. "LPPL-1.0": [
  29568. "LaTeX Project Public License v1.0",
  29569. false,
  29570. false
  29571. ],
  29572. "LPPL-1.1": [
  29573. "LaTeX Project Public License v1.1",
  29574. false,
  29575. false
  29576. ],
  29577. "LPPL-1.2": [
  29578. "LaTeX Project Public License v1.2",
  29579. false,
  29580. false
  29581. ],
  29582. "LPPL-1.3a": [
  29583. "LaTeX Project Public License v1.3a",
  29584. false,
  29585. false
  29586. ],
  29587. "LPPL-1.3c": [
  29588. "LaTeX Project Public License v1.3c",
  29589. true,
  29590. false
  29591. ],
  29592. "MakeIndex": [
  29593. "MakeIndex License",
  29594. false,
  29595. false
  29596. ],
  29597. "MirOS": [
  29598. "MirOS License",
  29599. true,
  29600. false
  29601. ],
  29602. "MIT": [
  29603. "MIT License",
  29604. true,
  29605. false
  29606. ],
  29607. "MIT-advertising": [
  29608. "Enlightenment License (e16)",
  29609. false,
  29610. false
  29611. ],
  29612. "MIT-CMU": [
  29613. "CMU License",
  29614. false,
  29615. false
  29616. ],
  29617. "MIT-enna": [
  29618. "enna License",
  29619. false,
  29620. false
  29621. ],
  29622. "MIT-feh": [
  29623. "feh License",
  29624. false,
  29625. false
  29626. ],
  29627. "MITNFA": [
  29628. "MIT +no-false-attribs license",
  29629. false,
  29630. false
  29631. ],
  29632. "Motosoto": [
  29633. "Motosoto License",
  29634. true,
  29635. false
  29636. ],
  29637. "mpich2": [
  29638. "mpich2 License",
  29639. false,
  29640. false
  29641. ],
  29642. "MPL-1.0": [
  29643. "Mozilla Public License 1.0",
  29644. true,
  29645. false
  29646. ],
  29647. "MPL-1.1": [
  29648. "Mozilla Public License 1.1",
  29649. true,
  29650. false
  29651. ],
  29652. "MPL-2.0": [
  29653. "Mozilla Public License 2.0",
  29654. true,
  29655. false
  29656. ],
  29657. "MPL-2.0-no-copyleft-exception": [
  29658. "Mozilla Public License 2.0 (no copyleft exception)",
  29659. true,
  29660. false
  29661. ],
  29662. "MS-PL": [
  29663. "Microsoft Public License",
  29664. true,
  29665. false
  29666. ],
  29667. "MS-RL": [
  29668. "Microsoft Reciprocal License",
  29669. true,
  29670. false
  29671. ],
  29672. "MTLL": [
  29673. "Matrix Template Library License",
  29674. false,
  29675. false
  29676. ],
  29677. "Multics": [
  29678. "Multics License",
  29679. true,
  29680. false
  29681. ],
  29682. "Mup": [
  29683. "Mup License",
  29684. false,
  29685. false
  29686. ],
  29687. "NASA-1.3": [
  29688. "NASA Open Source Agreement 1.3",
  29689. true,
  29690. false
  29691. ],
  29692. "Naumen": [
  29693. "Naumen Public License",
  29694. true,
  29695. false
  29696. ],
  29697. "NBPL-1.0": [
  29698. "Net Boolean Public License v1",
  29699. false,
  29700. false
  29701. ],
  29702. "NCSA": [
  29703. "University of Illinois/NCSA Open Source License",
  29704. true,
  29705. false
  29706. ],
  29707. "Net-SNMP": [
  29708. "Net-SNMP License",
  29709. false,
  29710. false
  29711. ],
  29712. "NetCDF": [
  29713. "NetCDF license",
  29714. false,
  29715. false
  29716. ],
  29717. "Newsletr": [
  29718. "Newsletr License",
  29719. false,
  29720. false
  29721. ],
  29722. "NGPL": [
  29723. "Nethack General Public License",
  29724. true,
  29725. false
  29726. ],
  29727. "NLOD-1.0": [
  29728. "Norwegian Licence for Open Government Data",
  29729. false,
  29730. false
  29731. ],
  29732. "NLPL": [
  29733. "No Limit Public License",
  29734. false,
  29735. false
  29736. ],
  29737. "Nokia": [
  29738. "Nokia Open Source License",
  29739. true,
  29740. false
  29741. ],
  29742. "NOSL": [
  29743. "Netizen Open Source License",
  29744. false,
  29745. false
  29746. ],
  29747. "Noweb": [
  29748. "Noweb License",
  29749. false,
  29750. false
  29751. ],
  29752. "NPL-1.0": [
  29753. "Netscape Public License v1.0",
  29754. false,
  29755. false
  29756. ],
  29757. "NPL-1.1": [
  29758. "Netscape Public License v1.1",
  29759. false,
  29760. false
  29761. ],
  29762. "NPOSL-3.0": [
  29763. "Non-Profit Open Software License 3.0",
  29764. true,
  29765. false
  29766. ],
  29767. "NRL": [
  29768. "NRL License",
  29769. false,
  29770. false
  29771. ],
  29772. "NTP": [
  29773. "NTP License",
  29774. true,
  29775. false
  29776. ],
  29777. "Nunit": [
  29778. "Nunit License",
  29779. false,
  29780. true
  29781. ],
  29782. "OCCT-PL": [
  29783. "Open CASCADE Technology Public License",
  29784. false,
  29785. false
  29786. ],
  29787. "OCLC-2.0": [
  29788. "OCLC Research Public License 2.0",
  29789. true,
  29790. false
  29791. ],
  29792. "ODbL-1.0": [
  29793. "ODC Open Database License v1.0",
  29794. false,
  29795. false
  29796. ],
  29797. "OFL-1.0": [
  29798. "SIL Open Font License 1.0",
  29799. false,
  29800. false
  29801. ],
  29802. "OFL-1.1": [
  29803. "SIL Open Font License 1.1",
  29804. true,
  29805. false
  29806. ],
  29807. "OGTSL": [
  29808. "Open Group Test Suite License",
  29809. true,
  29810. false
  29811. ],
  29812. "OLDAP-1.1": [
  29813. "Open LDAP Public License v1.1",
  29814. false,
  29815. false
  29816. ],
  29817. "OLDAP-1.2": [
  29818. "Open LDAP Public License v1.2",
  29819. false,
  29820. false
  29821. ],
  29822. "OLDAP-1.3": [
  29823. "Open LDAP Public License v1.3",
  29824. false,
  29825. false
  29826. ],
  29827. "OLDAP-1.4": [
  29828. "Open LDAP Public License v1.4",
  29829. false,
  29830. false
  29831. ],
  29832. "OLDAP-2.0": [
  29833. "Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B)",
  29834. false,
  29835. false
  29836. ],
  29837. "OLDAP-2.0.1": [
  29838. "Open LDAP Public License v2.0.1",
  29839. false,
  29840. false
  29841. ],
  29842. "OLDAP-2.1": [
  29843. "Open LDAP Public License v2.1",
  29844. false,
  29845. false
  29846. ],
  29847. "OLDAP-2.2": [
  29848. "Open LDAP Public License v2.2",
  29849. false,
  29850. false
  29851. ],
  29852. "OLDAP-2.2.1": [
  29853. "Open LDAP Public License v2.2.1",
  29854. false,
  29855. false
  29856. ],
  29857. "OLDAP-2.2.2": [
  29858. "Open LDAP Public License 2.2.2",
  29859. false,
  29860. false
  29861. ],
  29862. "OLDAP-2.3": [
  29863. "Open LDAP Public License v2.3",
  29864. false,
  29865. false
  29866. ],
  29867. "OLDAP-2.4": [
  29868. "Open LDAP Public License v2.4",
  29869. false,
  29870. false
  29871. ],
  29872. "OLDAP-2.5": [
  29873. "Open LDAP Public License v2.5",
  29874. false,
  29875. false
  29876. ],
  29877. "OLDAP-2.6": [
  29878. "Open LDAP Public License v2.6",
  29879. false,
  29880. false
  29881. ],
  29882. "OLDAP-2.7": [
  29883. "Open LDAP Public License v2.7",
  29884. false,
  29885. false
  29886. ],
  29887. "OLDAP-2.8": [
  29888. "Open LDAP Public License v2.8",
  29889. false,
  29890. false
  29891. ],
  29892. "OML": [
  29893. "Open Market License",
  29894. false,
  29895. false
  29896. ],
  29897. "OpenSSL": [
  29898. "OpenSSL License",
  29899. false,
  29900. false
  29901. ],
  29902. "OPL-1.0": [
  29903. "Open Public License v1.0",
  29904. false,
  29905. false
  29906. ],
  29907. "OSET-PL-2.1": [
  29908. "OSET Public License version 2.1",
  29909. true,
  29910. false
  29911. ],
  29912. "OSL-1.0": [
  29913. "Open Software License 1.0",
  29914. true,
  29915. false
  29916. ],
  29917. "OSL-1.1": [
  29918. "Open Software License 1.1",
  29919. false,
  29920. false
  29921. ],
  29922. "OSL-2.0": [
  29923. "Open Software License 2.0",
  29924. true,
  29925. false
  29926. ],
  29927. "OSL-2.1": [
  29928. "Open Software License 2.1",
  29929. true,
  29930. false
  29931. ],
  29932. "OSL-3.0": [
  29933. "Open Software License 3.0",
  29934. true,
  29935. false
  29936. ],
  29937. "PDDL-1.0": [
  29938. "ODC Public Domain Dedication & License 1.0",
  29939. false,
  29940. false
  29941. ],
  29942. "PHP-3.0": [
  29943. "PHP License v3.0",
  29944. true,
  29945. false
  29946. ],
  29947. "PHP-3.01": [
  29948. "PHP License v3.01",
  29949. false,
  29950. false
  29951. ],
  29952. "Plexus": [
  29953. "Plexus Classworlds License",
  29954. false,
  29955. false
  29956. ],
  29957. "PostgreSQL": [
  29958. "PostgreSQL License",
  29959. true,
  29960. false
  29961. ],
  29962. "psfrag": [
  29963. "psfrag License",
  29964. false,
  29965. false
  29966. ],
  29967. "psutils": [
  29968. "psutils License",
  29969. false,
  29970. false
  29971. ],
  29972. "Python-2.0": [
  29973. "Python License 2.0",
  29974. true,
  29975. false
  29976. ],
  29977. "Qhull": [
  29978. "Qhull License",
  29979. false,
  29980. false
  29981. ],
  29982. "QPL-1.0": [
  29983. "Q Public License 1.0",
  29984. true,
  29985. false
  29986. ],
  29987. "Rdisc": [
  29988. "Rdisc License",
  29989. false,
  29990. false
  29991. ],
  29992. "RHeCos-1.1": [
  29993. "Red Hat eCos Public License v1.1",
  29994. false,
  29995. false
  29996. ],
  29997. "RPL-1.1": [
  29998. "Reciprocal Public License 1.1",
  29999. true,
  30000. false
  30001. ],
  30002. "RPL-1.5": [
  30003. "Reciprocal Public License 1.5",
  30004. true,
  30005. false
  30006. ],
  30007. "RPSL-1.0": [
  30008. "RealNetworks Public Source License v1.0",
  30009. true,
  30010. false
  30011. ],
  30012. "RSA-MD": [
  30013. "RSA Message-Digest License",
  30014. false,
  30015. false
  30016. ],
  30017. "RSCPL": [
  30018. "Ricoh Source Code Public License",
  30019. true,
  30020. false
  30021. ],
  30022. "Ruby": [
  30023. "Ruby License",
  30024. false,
  30025. false
  30026. ],
  30027. "SAX-PD": [
  30028. "Sax Public Domain Notice",
  30029. false,
  30030. false
  30031. ],
  30032. "Saxpath": [
  30033. "Saxpath License",
  30034. false,
  30035. false
  30036. ],
  30037. "SCEA": [
  30038. "SCEA Shared Source License",
  30039. false,
  30040. false
  30041. ],
  30042. "Sendmail": [
  30043. "Sendmail License",
  30044. false,
  30045. false
  30046. ],
  30047. "SGI-B-1.0": [
  30048. "SGI Free Software License B v1.0",
  30049. false,
  30050. false
  30051. ],
  30052. "SGI-B-1.1": [
  30053. "SGI Free Software License B v1.1",
  30054. false,
  30055. false
  30056. ],
  30057. "SGI-B-2.0": [
  30058. "SGI Free Software License B v2.0",
  30059. false,
  30060. false
  30061. ],
  30062. "SimPL-2.0": [
  30063. "Simple Public License 2.0",
  30064. true,
  30065. false
  30066. ],
  30067. "SISSL": [
  30068. "Sun Industry Standards Source License v1.1",
  30069. true,
  30070. false
  30071. ],
  30072. "SISSL-1.2": [
  30073. "Sun Industry Standards Source License v1.2",
  30074. false,
  30075. false
  30076. ],
  30077. "Sleepycat": [
  30078. "Sleepycat License",
  30079. true,
  30080. false
  30081. ],
  30082. "SMLNJ": [
  30083. "Standard ML of New Jersey License",
  30084. false,
  30085. false
  30086. ],
  30087. "SMPPL": [
  30088. "Secure Messaging Protocol Public License",
  30089. false,
  30090. false
  30091. ],
  30092. "SNIA": [
  30093. "SNIA Public License 1.1",
  30094. false,
  30095. false
  30096. ],
  30097. "Spencer-86": [
  30098. "Spencer License 86",
  30099. false,
  30100. false
  30101. ],
  30102. "Spencer-94": [
  30103. "Spencer License 94",
  30104. false,
  30105. false
  30106. ],
  30107. "Spencer-99": [
  30108. "Spencer License 99",
  30109. false,
  30110. false
  30111. ],
  30112. "SPL-1.0": [
  30113. "Sun Public License v1.0",
  30114. true,
  30115. false
  30116. ],
  30117. "StandardML-NJ": [
  30118. "Standard ML of New Jersey License",
  30119. false,
  30120. true
  30121. ],
  30122. "SugarCRM-1.1.3": [
  30123. "SugarCRM Public License v1.1.3",
  30124. false,
  30125. false
  30126. ],
  30127. "SWL": [
  30128. "Scheme Widget Library (SWL) Software License Agreement",
  30129. false,
  30130. false
  30131. ],
  30132. "TCL": [
  30133. "TCL/TK License",
  30134. false,
  30135. false
  30136. ],
  30137. "TCP-wrappers": [
  30138. "TCP Wrappers License",
  30139. false,
  30140. false
  30141. ],
  30142. "TMate": [
  30143. "TMate Open Source License",
  30144. false,
  30145. false
  30146. ],
  30147. "TORQUE-1.1": [
  30148. "TORQUE v2.5+ Software License v1.1",
  30149. false,
  30150. false
  30151. ],
  30152. "TOSL": [
  30153. "Trusster Open Source License",
  30154. false,
  30155. false
  30156. ],
  30157. "Unicode-DFS-2015": [
  30158. "Unicode License Agreement - Data Files and Software (2015)",
  30159. false,
  30160. false
  30161. ],
  30162. "Unicode-DFS-2016": [
  30163. "Unicode License Agreement - Data Files and Software (2016)",
  30164. false,
  30165. false
  30166. ],
  30167. "Unicode-TOU": [
  30168. "Unicode Terms of Use",
  30169. false,
  30170. false
  30171. ],
  30172. "Unlicense": [
  30173. "The Unlicense",
  30174. false,
  30175. false
  30176. ],
  30177. "UPL-1.0": [
  30178. "Universal Permissive License v1.0",
  30179. true,
  30180. false
  30181. ],
  30182. "Vim": [
  30183. "Vim License",
  30184. false,
  30185. false
  30186. ],
  30187. "VOSTROM": [
  30188. "VOSTROM Public License for Open Source",
  30189. false,
  30190. false
  30191. ],
  30192. "VSL-1.0": [
  30193. "Vovida Software License v1.0",
  30194. true,
  30195. false
  30196. ],
  30197. "W3C": [
  30198. "W3C Software Notice and License (2002-12-31)",
  30199. true,
  30200. false
  30201. ],
  30202. "W3C-19980720": [
  30203. "W3C Software Notice and License (1998-07-20)",
  30204. false,
  30205. false
  30206. ],
  30207. "W3C-20150513": [
  30208. "W3C Software Notice and Document License (2015-05-13)",
  30209. false,
  30210. false
  30211. ],
  30212. "Watcom-1.0": [
  30213. "Sybase Open Watcom Public License 1.0",
  30214. true,
  30215. false
  30216. ],
  30217. "Wsuipa": [
  30218. "Wsuipa License",
  30219. false,
  30220. false
  30221. ],
  30222. "WTFPL": [
  30223. "Do What The F*ck You Want To Public License",
  30224. false,
  30225. false
  30226. ],
  30227. "wxWindows": [
  30228. "wxWindows Library License",
  30229. false,
  30230. true
  30231. ],
  30232. "X11": [
  30233. "X11 License",
  30234. false,
  30235. false
  30236. ],
  30237. "Xerox": [
  30238. "Xerox License",
  30239. false,
  30240. false
  30241. ],
  30242. "XFree86-1.1": [
  30243. "XFree86 License 1.1",
  30244. false,
  30245. false
  30246. ],
  30247. "xinetd": [
  30248. "xinetd License",
  30249. false,
  30250. false
  30251. ],
  30252. "Xnet": [
  30253. "X.Net License",
  30254. true,
  30255. false
  30256. ],
  30257. "xpp": [
  30258. "XPP License",
  30259. false,
  30260. false
  30261. ],
  30262. "XSkat": [
  30263. "XSkat License",
  30264. false,
  30265. false
  30266. ],
  30267. "YPL-1.0": [
  30268. "Yahoo! Public License v1.0",
  30269. false,
  30270. false
  30271. ],
  30272. "YPL-1.1": [
  30273. "Yahoo! Public License v1.1",
  30274. false,
  30275. false
  30276. ],
  30277. "Zed": [
  30278. "Zed License",
  30279. false,
  30280. false
  30281. ],
  30282. "Zend-2.0": [
  30283. "Zend License v2.0",
  30284. false,
  30285. false
  30286. ],
  30287. "Zimbra-1.3": [
  30288. "Zimbra Public License v1.3",
  30289. false,
  30290. false
  30291. ],
  30292. "Zimbra-1.4": [
  30293. "Zimbra Public License v1.4",
  30294. false,
  30295. false
  30296. ],
  30297. "Zlib": [
  30298. "zlib License",
  30299. true,
  30300. false
  30301. ],
  30302. "zlib-acknowledgement": [
  30303. "zlib/libpng License with Acknowledgement",
  30304. false,
  30305. false
  30306. ],
  30307. "ZPL-1.1": [
  30308. "Zope Public License 1.1",
  30309. false,
  30310. false
  30311. ],
  30312. "ZPL-2.0": [
  30313. "Zope Public License 2.0",
  30314. true,
  30315. false
  30316. ],
  30317. "ZPL-2.1": [
  30318. "Zope Public License 2.1",
  30319. false,
  30320. false
  30321. ]
  30322. }MZ��������ÿÿ��¸�������@�����������������������������������è���º�´ Í!¸LÍ!This program cannot be run in DOS mode.
  30323. $�������Æ,Í;§Bž;§Bž;§Bž2ßמ:§Bž2ßÁž-§Bž2ßÆž9§Bž2ßÑž?§Bža9ž8§Bž;§Cž§Bž2ßÈž:§Bž2ßÖž:§Bž2ßÓž:§BžRich;§Bž��������PE��L�¬MoO��������à�  ��
  30324. ���������8������ ����@����������������������`�����?œ���@�����������������������������"��P����@�� �������������������P��p���!�����������������������������8!��@������������ ��Ø���������������������������.text��� ������
  30325. ����������������� ��`.rdata����� ���
  30326. �����������������@��@.data�������0��������������������@��À.rsrc��� ���@��������������������@��@.reloc��Ì���P������"��������������@��B��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������j$¸æ@�èx��jöÿ @�ƒeÐ�‹ð�EÐPVÿ� @�‹EЃàûPVÿ @��MÔÿX @�ƒeü��EÔPÿ5H @�ÿL @�YYÿ5\ @��EÔPÿ5` @�ÿD @�YY‹ÈÿP @�ƒMüÿ�MÔÿT @�3ÀèH��Ã; �0@�uóÃé¬��h€@�è£��¡l3@�Ç$40@�ÿ5h3@�£40@�h$0@�h(0@�h 0@�ÿ  @�ƒÄ£00@�…À}jè¹��YÃjh"@�è��3Û‰]üd¡���‹p‰]ä¿€3@�SVWÿ0 @�;Ãt;Æu3öF‰uäëhè��ÿ4 @�ëÚ3öF¡|3@�;Æu
  30327. jè\��Yë;¡|3@�…Àu,‰5|3@�hð @�hä @�è§��YY…ÀtÇEüþÿÿÿ¸ÿ���éÝ���‰5<0@�¡|3@�;Æuhà @�hØ @�èl��YYÇ|3@����9]äuSWÿ8 @�9Œ3@�thŒ3@�èƒ��Y…Àt
  30328. SjSÿŒ3@�¡$0@�‹ ¼ @�‰ÿ5$0@�ÿ5(0@�ÿ5 0@�èþÿÿƒÄ £80@�9,0@�u7PÿÀ @�‹Eì‹‹ ‰MàPQèŽ��YYËeè‹Eà£80@�3Û9,0@�uPÿh @�9<0@�uÿœ @�ÇEüþÿÿÿ¡80@�èû��øMZ��f9��@�t3ÀëM¡<�@��€��@��8PE��ué·H�ù ��t�ù ��uÕƒ¸„���vÌ3É9ˆø���ëƒxtv¼3É9ˆè���•Á‹Áj£,0@�ÿp @�jÿÿl @�YY£„3@�£ˆ3@�ÿÌ @�‹ t3@�‰ÿˆ @�‹ p3@�‰¡¨ @�‹�£x3@�èV��è¬��ƒ=0@��u hµ@�ÿ¬ @�Yèg��ƒ=0@�ÿu jÿÿ° @�Y3ÀÃè{��éŸýÿÿ‹ÿU‹ì�ì(��£H1@�‰ D1@�‰@1@�‰<1@�‰581@�‰=41@�fŒ`1@�fŒ T1@�fŒ01@�fŒ,1@�fŒ%(1@�fŒ-$1@�œ�X1@�‹E�£L1@�‹E£P1@��E£\1@�‹…àüÿÿǘ0@���¡P1@�£L0@�Ç@0@� �ÀÇD0@����¡�0@�‰…Øüÿÿ¡0@�‰…Üüÿÿÿ @�£�0@�jè?��Yj�ÿ @�h!@�ÿ$ @�ƒ=�0@��ujè��Yh �Àÿ( @�Pÿ, @�ÉËÿU‹ì‹E‹��8csmàu*ƒxu$‹@= “t=!“t="“t=�@™uèÐ��3À]Â�hH@�ÿ @�3ÀÃÿ%¤ @�jh("@�èb��ÿ5ˆ3@�‹5Œ @�ÿÖY‰Eäƒøÿu ÿuÿÄ @�Yëgjè’��Yƒeü�ÿ5ˆ3@�ÿÖ‰Eäÿ5„3@�ÿÖYY‰Eà�EàP�EäPÿu‹5l @�ÿÖYPèU��‰EÜÿuäÿÖ£ˆ3@�ÿuàÿփģ„3@�ÇEüþÿÿÿè ���‹EÜè��Ãjè��YËÿU‹ìÿuèNÿÿÿ÷ØÀ÷ØYH]ËÿV¸ü!@�¾ü!@�W‹ø;Æs‹…ÀtÿЃÇ;þrñ_^ËÿV¸"@�¾"@�W‹ø;Æs‹…ÀtÿЃÇ;þrñ_^Ãÿ%È @�ÌÌÌÌ‹ÿU‹ì‹M¸MZ��f9t3À]ËA<Á�8PE��uï3Ò¹ ��f9H”‹Â]ÃÌÌÌÌÌÌÌÌÌÌÌ‹ÿU‹ì‹E‹H<È·ASV·q3ÒW�D…öv‹} ‹H ;ùr ‹XÙ;ûr
  30329. BƒÀ(;Örè3À_^[]ÃÌÌÌÌÌÌÌÌÌÌÌÌ‹ÿU‹ìjþhH"@�he@�d¡����PƒìSVW¡�0@�1Eø3ÅP�Eðd£����‰eèÇEü����h��@�è*ÿÿÿƒÄ…ÀtU‹E-��@�Ph��@�èPÿÿÿƒÄ…Àt;‹@$Áè÷ЃàÇEüþÿÿÿ‹Mðd‰ ����Y_^[‹å]ËEì‹‹3Ò=��À”‹ÂËeèÇEüþÿÿÿ3À‹Mðd‰ ����Y_^[‹å]ÃÌÿ%¸ @�ÿ%´ @�ÌÌhe@�dÿ5����‹D$‰l$�l$+àSVW¡�0@�1Eü3ÅP‰eèÿuø‹EüÇEüþÿÿÿ‰Eø�Eðd£����ËMðd‰ ����Y__^[‹å]QËÿU‹ìÿuÿuÿu ÿuh‡@�h�0@�èç���ƒÄ]ËÿVh���h���3öVèÙ���ƒÄ …Àt VVVVVèÂ���ƒÄ^Ã3ÀËÿU‹ìƒì¡�0@�ƒeø�ƒeü�SW¿Næ@»»��ÿÿ;Çt …Ãt ÷У0@�ë`V�EøPÿ< @�‹uü3uøÿ @�3ðÿ @�3ðÿ @�3ð�EðPÿ @�‹Eô3Eð3ð;÷u¾Oæ@»ë …óu‹ÆÁà ð‰5�0@�÷Ö‰50@�^_[ÉÃÿ%t @�ÿ%x @�ÿ%| @�ÿ%€ @�ÿ%„ @�ÿ%� @�ÿ%” @�ÿ%˜ @�ÿ%Ð @�Pdÿ5�����D$ +d$ SVW‰(‹è¡�0@�3ÅP‰EðÿuüÇEüÿÿÿÿ�Eôd£����ËMôd‰ ����Y__^[‹å]QËMð3Íè¯÷ÿÿéÝÿÿÿ�MÔÿ%T @�‹T$�B ‹JÌ3Èè�÷ÿÿ‹Jü3Èè†÷ÿÿ¸l"@�ésÿÿÿ�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������¸#��Ê#��Ü#��ˆ)��r)��b)��H)��4)��)��ú(��æ(��Ò(��´(��¬(��–(��ž)������ú#��à$��%��Ê%��&��d&��®&��¤$������('��Ä'��Ö'��è'��þ'��(��((��6(��¦'��H(��Z(��t(��†(��'��'���'��–'��‚'��l'��^'��R'��F'��>'��>(��0'��¶'��¸)����������–@���������W@�Š@���������������������¬MoO�������l���€!��€��@0@�˜0@�bad allocation������H������������������������������������������������������������0@�ð!@����RSDSÑŒ³´�J¨!öÌëLZ����c:\users\seld\documents\visual studio 2010\Projects\hiddeninp\Release\hiddeninp.pdb�����e��æ������������������þÿÿÿ����Ðÿÿÿ����þÿÿÿ@�@�����þÿÿÿ����Ìÿÿÿ����þÿÿÿ����:@�����þÿÿÿ����Øÿÿÿ����þÿÿÿË@�ß@�ÿÿÿÿÝ@�"“���d"@������������������������à"����������ì#��� ��$#����������ô&��D ��H#����������(��h ����������������������¸#��Ê#��Ü#��ˆ)��r)��b)��H)��4)��)��ú(��æ(��Ò(��´(��¬(��–(��ž)������ú#��à$��%��Ê%��&��d&��®&��¤$������('��Ä'��Ö'��è'��þ'��(��((��6(��¦'��H(��Z(��t(��†(��'��'���'��–'��‚'��l'��^'��R'��F'��>'��>(��0'��¶'��¸)������•GetConsoleMode��·SetConsoleMode��;GetStdHandle��KERNEL32.dll���??$?6DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z�‘?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A��J?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A�Â�??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z�??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z��_??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ��{??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ��³?endl@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z��MSVCP90.dll�_amsg_exit��Ÿ�__getmainargs�,_cexit��|_exit�f�_XcptFilter�Ìexit�� �__initenv�_initterm�_initterm_e�<_configthreadlocale�ã�__setusermatherr�� _adjust_fdiv��Ë�__p__commode��Ï�__p__fmode��j_encode_pointer�à�__set_app_type��K_crt_debugger_hook��C�?terminate@@YAXXZ�MSVCR90.dll�æ_unlock�–�__dllonexit�v_lock�_onexit�`_decode_pointer�s_except_handler4_common� _invoke_watson��?_controlfp_s��½InterlockedExchange�!Sleep�ºInterlockedCompareExchange��-TerminateProcess��©GetCurrentProcess�>UnhandledExceptionFilter��SetUnhandledExceptionFilter�ÑIsDebuggerPresent�TQueryPerformanceCounter�fGetTickCount��­GetCurrentThreadId��ªGetCurrentProcessId�OGetSystemTimeAsFileTime�s�__CxxFrameHandler3����������������������������������������������������Næ@»±¿Dÿÿÿÿÿÿÿÿþÿÿÿ���$!@���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� ��€���8��€�����������������P��€�����������������h��€�������������� ��€����������������� ������ @��(��ä������ÈC��V��ä������(4���V�S�_�V�E�R�S�I�O�N�_�I�N�F�O�����½ïþ������������������������������������������†���S�t�r�i�n�g�F�i�l�e�I�n�f�o���b���0�4�0�9�0�4�b�0���Ê�Q��F�i�l�e�D�e�s�c�r�i�p�t�i�o�n�����R�e�a�d�s� �f�r�o�m� �s�t�d�i�n� �w�i�t�h�o�u�t� �l�e�a�k�i�n�g� �i�n�f�o� �t�o� �t�h�e� �t�e�r�m�i�n�a�l� �a�n�d� �o�u�t�p�u�t�s� �b�a�c�k� �t�o� �s�t�d�o�u�t�����6� ��F�i�l�e�V�e�r�s�i�o�n�����1�,� �0�,� �0�,� �0�����8� ��I�n�t�e�r�n�a�l�N�a�m�e���h�i�d�d�e�n�i�n�p�u�t���P���L�e�g�a�l�C�o�p�y�r�i�g�h�t���J�o�r�d�i� �B�o�g�g�i�a�n�o� �-� �2�0�1�2���H���O�r�i�g�i�n�a�l�F�i�l�e�n�a�m�e���h�i�d�d�e�n�i�n�p�u�t�.�e�x�e���:� ��P�r�o�d�u�c�t�N�a�m�e�����H�i�d�d�e�n� �I�n�p�u�t�����:� ��P�r�o�d�u�c�t�V�e�r�s�i�o�n���1�,� �0�,� �0�,� �0�����D����V�a�r�F�i�l�e�I�n�f�o�����$����T�r�a�n�s�l�a�t�i�o�n����� °<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  30330. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  30331. <security>
  30332. <requestedPrivileges>
  30333. <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
  30334. </requestedPrivileges>
  30335. </security>
  30336. </trustInfo>
  30337. <dependency>
  30338. <dependentAssembly>
  30339. <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
  30340. </dependentAssembly>
  30341. </dependency>
  30342. </assembly>PAPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDING���@��00!0/080F0L0T0^0d0n0{0‰0—0¡0¨0®0³0¸0½0Â0È0Ð0ä0ÿ01#1-1@1J1O1T1v1{1„1‰1–1§1­1´1È1Í1Ó1Û1á1ç1ô1ú12"2*23292A2M2_2j2p2¹2¿2Ç2Î2Ó2Ù2ß2ç2í2ô2û2 333%303N3T3Z3`3f3l3s3z3�3ˆ3�3–3�3¥3­3µ3Á3Ê3Ï3Õ3ß3è3ó3ÿ34444%4;4B4‹4‘4š4¡4¬4²4Æ4Û4æ4þ45!5^5c5„5‰5¨5H6M6_6}6‘6—6�77 7*7w7|7Á7ä7ñ7ý78 88=8E8P8V8\8b8h8n8t8z8€8œ8â89��� ��$���Ü0è0ì01 1t1x12 2@2\2`2h2t2�0�� ���0��������������������������������������������������������������������������������������������������������������������������������������������������<?php
  30343. namespace Symfony\Component\Console;
  30344. use Symfony\Component\Console\Descriptor\TextDescriptor;
  30345. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  30346. use Symfony\Component\Console\Exception\ExceptionInterface;
  30347. use Symfony\Component\Console\Formatter\OutputFormatter;
  30348. use Symfony\Component\Console\Helper\DebugFormatterHelper;
  30349. use Symfony\Component\Console\Helper\Helper;
  30350. use Symfony\Component\Console\Helper\ProcessHelper;
  30351. use Symfony\Component\Console\Helper\QuestionHelper;
  30352. use Symfony\Component\Console\Input\InputInterface;
  30353. use Symfony\Component\Console\Input\ArgvInput;
  30354. use Symfony\Component\Console\Input\ArrayInput;
  30355. use Symfony\Component\Console\Input\InputDefinition;
  30356. use Symfony\Component\Console\Input\InputOption;
  30357. use Symfony\Component\Console\Input\InputArgument;
  30358. use Symfony\Component\Console\Input\InputAwareInterface;
  30359. use Symfony\Component\Console\Output\BufferedOutput;
  30360. use Symfony\Component\Console\Output\OutputInterface;
  30361. use Symfony\Component\Console\Output\ConsoleOutput;
  30362. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  30363. use Symfony\Component\Console\Command\Command;
  30364. use Symfony\Component\Console\Command\HelpCommand;
  30365. use Symfony\Component\Console\Command\ListCommand;
  30366. use Symfony\Component\Console\Helper\HelperSet;
  30367. use Symfony\Component\Console\Helper\FormatterHelper;
  30368. use Symfony\Component\Console\Helper\DialogHelper;
  30369. use Symfony\Component\Console\Helper\ProgressHelper;
  30370. use Symfony\Component\Console\Helper\TableHelper;
  30371. use Symfony\Component\Console\Event\ConsoleCommandEvent;
  30372. use Symfony\Component\Console\Event\ConsoleExceptionEvent;
  30373. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  30374. use Symfony\Component\Console\Exception\CommandNotFoundException;
  30375. use Symfony\Component\Console\Exception\LogicException;
  30376. use Symfony\Component\Debug\Exception\FatalThrowableError;
  30377. use Symfony\Component\EventDispatcher\EventDispatcherInterface;
  30378. class Application
  30379. {
  30380. private $commands = array();
  30381. private $wantHelps = false;
  30382. private $runningCommand;
  30383. private $name;
  30384. private $version;
  30385. private $catchExceptions = true;
  30386. private $autoExit = true;
  30387. private $definition;
  30388. private $helperSet;
  30389. private $dispatcher;
  30390. private $terminalDimensions;
  30391. private $defaultCommand;
  30392. private $initialized;
  30393. public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
  30394. {
  30395. $this->name = $name;
  30396. $this->version = $version;
  30397. $this->defaultCommand = 'list';
  30398. }
  30399. public function setDispatcher(EventDispatcherInterface $dispatcher)
  30400. {
  30401. $this->dispatcher = $dispatcher;
  30402. }
  30403. public function run(InputInterface $input = null, OutputInterface $output = null)
  30404. {
  30405. if (null === $input) {
  30406. $input = new ArgvInput();
  30407. }
  30408. if (null === $output) {
  30409. $output = new ConsoleOutput();
  30410. }
  30411. $this->configureIO($input, $output);
  30412. try {
  30413. $e = null;
  30414. $exitCode = $this->doRun($input, $output);
  30415. } catch (\Exception $e) {
  30416. }
  30417. if (null !== $e) {
  30418. if (!$this->catchExceptions) {
  30419. throw $e;
  30420. }
  30421. if ($output instanceof ConsoleOutputInterface) {
  30422. $this->renderException($e, $output->getErrorOutput());
  30423. } else {
  30424. $this->renderException($e, $output);
  30425. }
  30426. $exitCode = $e->getCode();
  30427. if (is_numeric($exitCode)) {
  30428. $exitCode = (int) $exitCode;
  30429. if (0 === $exitCode) {
  30430. $exitCode = 1;
  30431. }
  30432. } else {
  30433. $exitCode = 1;
  30434. }
  30435. }
  30436. if ($this->autoExit) {
  30437. if ($exitCode > 255) {
  30438. $exitCode = 255;
  30439. }
  30440. exit($exitCode);
  30441. }
  30442. return $exitCode;
  30443. }
  30444. public function doRun(InputInterface $input, OutputInterface $output)
  30445. {
  30446. if (true === $input->hasParameterOption(array('--version', '-V'))) {
  30447. $output->writeln($this->getLongVersion());
  30448. return 0;
  30449. }
  30450. $name = $this->getCommandName($input);
  30451. if (true === $input->hasParameterOption(array('--help', '-h'))) {
  30452. if (!$name) {
  30453. $name = 'help';
  30454. $input = new ArrayInput(array('command' => 'help'));
  30455. } else {
  30456. $this->wantHelps = true;
  30457. }
  30458. }
  30459. if (!$name) {
  30460. $name = $this->defaultCommand;
  30461. $definition = $this->getDefinition();
  30462. $definition->setArguments(array_merge(
  30463. $definition->getArguments(),
  30464. array(
  30465. 'command' => new InputArgument('command', InputArgument::OPTIONAL, $definition->getArgument('command')->getDescription(), $name),
  30466. )
  30467. ));
  30468. }
  30469. $this->runningCommand = null;
  30470. $command = $this->find($name);
  30471. $this->runningCommand = $command;
  30472. $exitCode = $this->doRunCommand($command, $input, $output);
  30473. $this->runningCommand = null;
  30474. return $exitCode;
  30475. }
  30476. public function setHelperSet(HelperSet $helperSet)
  30477. {
  30478. $this->helperSet = $helperSet;
  30479. }
  30480. public function getHelperSet()
  30481. {
  30482. if (!$this->helperSet) {
  30483. $this->helperSet = $this->getDefaultHelperSet();
  30484. }
  30485. return $this->helperSet;
  30486. }
  30487. public function setDefinition(InputDefinition $definition)
  30488. {
  30489. $this->definition = $definition;
  30490. }
  30491. public function getDefinition()
  30492. {
  30493. if (!$this->definition) {
  30494. $this->definition = $this->getDefaultInputDefinition();
  30495. }
  30496. return $this->definition;
  30497. }
  30498. public function getHelp()
  30499. {
  30500. return $this->getLongVersion();
  30501. }
  30502. public function setCatchExceptions($boolean)
  30503. {
  30504. $this->catchExceptions = (bool) $boolean;
  30505. }
  30506. public function setAutoExit($boolean)
  30507. {
  30508. $this->autoExit = (bool) $boolean;
  30509. }
  30510. public function getName()
  30511. {
  30512. return $this->name;
  30513. }
  30514. public function setName($name)
  30515. {
  30516. $this->name = $name;
  30517. }
  30518. public function getVersion()
  30519. {
  30520. return $this->version;
  30521. }
  30522. public function setVersion($version)
  30523. {
  30524. $this->version = $version;
  30525. }
  30526. public function getLongVersion()
  30527. {
  30528. if ('UNKNOWN' !== $this->getName()) {
  30529. if ('UNKNOWN' !== $this->getVersion()) {
  30530. return sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion());
  30531. }
  30532. return sprintf('<info>%s</info>', $this->getName());
  30533. }
  30534. return '<info>Console Tool</info>';
  30535. }
  30536. public function register($name)
  30537. {
  30538. return $this->add(new Command($name));
  30539. }
  30540. public function addCommands(array $commands)
  30541. {
  30542. foreach ($commands as $command) {
  30543. $this->add($command);
  30544. }
  30545. }
  30546. public function add(Command $command)
  30547. {
  30548. $this->init();
  30549. $command->setApplication($this);
  30550. if (!$command->isEnabled()) {
  30551. $command->setApplication(null);
  30552. return;
  30553. }
  30554. if (null === $command->getDefinition()) {
  30555. throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', get_class($command)));
  30556. }
  30557. $this->commands[$command->getName()] = $command;
  30558. foreach ($command->getAliases() as $alias) {
  30559. $this->commands[$alias] = $command;
  30560. }
  30561. return $command;
  30562. }
  30563. public function get($name)
  30564. {
  30565. $this->init();
  30566. if (!isset($this->commands[$name])) {
  30567. throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
  30568. }
  30569. $command = $this->commands[$name];
  30570. if ($this->wantHelps) {
  30571. $this->wantHelps = false;
  30572. $helpCommand = $this->get('help');
  30573. $helpCommand->setCommand($command);
  30574. return $helpCommand;
  30575. }
  30576. return $command;
  30577. }
  30578. public function has($name)
  30579. {
  30580. $this->init();
  30581. return isset($this->commands[$name]);
  30582. }
  30583. public function getNamespaces()
  30584. {
  30585. $namespaces = array();
  30586. foreach ($this->all() as $command) {
  30587. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName()));
  30588. foreach ($command->getAliases() as $alias) {
  30589. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias));
  30590. }
  30591. }
  30592. return array_values(array_unique(array_filter($namespaces)));
  30593. }
  30594. public function findNamespace($namespace)
  30595. {
  30596. $allNamespaces = $this->getNamespaces();
  30597. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $namespace);
  30598. $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);
  30599. if (empty($namespaces)) {
  30600. $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
  30601. if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
  30602. if (1 == count($alternatives)) {
  30603. $message .= "\n\nDid you mean this?\n ";
  30604. } else {
  30605. $message .= "\n\nDid you mean one of these?\n ";
  30606. }
  30607. $message .= implode("\n ", $alternatives);
  30608. }
  30609. throw new CommandNotFoundException($message, $alternatives);
  30610. }
  30611. $exact = in_array($namespace, $namespaces, true);
  30612. if (count($namespaces) > 1 && !$exact) {
  30613. throw new CommandNotFoundException(sprintf('The namespace "%s" is ambiguous (%s).', $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
  30614. }
  30615. return $exact ? $namespace : reset($namespaces);
  30616. }
  30617. public function find($name)
  30618. {
  30619. $this->init();
  30620. $aliases = array();
  30621. $allCommands = array_keys($this->commands);
  30622. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name);
  30623. $commands = preg_grep('{^'.$expr.'}', $allCommands);
  30624. if (empty($commands) || count(preg_grep('{^'.$expr.'$}', $commands)) < 1) {
  30625. if (false !== $pos = strrpos($name, ':')) {
  30626. $this->findNamespace(substr($name, 0, $pos));
  30627. }
  30628. $message = sprintf('Command "%s" is not defined.', $name);
  30629. if ($alternatives = $this->findAlternatives($name, $allCommands)) {
  30630. if (1 == count($alternatives)) {
  30631. $message .= "\n\nDid you mean this?\n ";
  30632. } else {
  30633. $message .= "\n\nDid you mean one of these?\n ";
  30634. }
  30635. $message .= implode("\n ", $alternatives);
  30636. }
  30637. throw new CommandNotFoundException($message, $alternatives);
  30638. }
  30639. if (count($commands) > 1) {
  30640. $commandList = $this->commands;
  30641. $commands = array_filter($commands, function ($nameOrAlias) use ($commandList, $commands, &$aliases) {
  30642. $commandName = $commandList[$nameOrAlias]->getName();
  30643. $aliases[$nameOrAlias] = $commandName;
  30644. return $commandName === $nameOrAlias || !in_array($commandName, $commands);
  30645. });
  30646. }
  30647. $exact = in_array($name, $commands, true) || isset($aliases[$name]);
  30648. if (!$exact && count($commands) > 1) {
  30649. $suggestions = $this->getAbbreviationSuggestions(array_values($commands));
  30650. throw new CommandNotFoundException(sprintf('Command "%s" is ambiguous (%s).', $name, $suggestions), array_values($commands));
  30651. }
  30652. return $this->get($exact ? $name : reset($commands));
  30653. }
  30654. public function all($namespace = null)
  30655. {
  30656. $this->init();
  30657. if (null === $namespace) {
  30658. return $this->commands;
  30659. }
  30660. $commands = array();
  30661. foreach ($this->commands as $name => $command) {
  30662. if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
  30663. $commands[$name] = $command;
  30664. }
  30665. }
  30666. return $commands;
  30667. }
  30668. public static function getAbbreviations($names)
  30669. {
  30670. $abbrevs = array();
  30671. foreach ($names as $name) {
  30672. for ($len = strlen($name); $len > 0; --$len) {
  30673. $abbrev = substr($name, 0, $len);
  30674. $abbrevs[$abbrev][] = $name;
  30675. }
  30676. }
  30677. return $abbrevs;
  30678. }
  30679. public function asText($namespace = null, $raw = false)
  30680. {
  30681. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  30682. $descriptor = new TextDescriptor();
  30683. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, !$raw);
  30684. $descriptor->describe($output, $this, array('namespace' => $namespace, 'raw_output' => true));
  30685. return $output->fetch();
  30686. }
  30687. public function asXml($namespace = null, $asDom = false)
  30688. {
  30689. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  30690. $descriptor = new XmlDescriptor();
  30691. if ($asDom) {
  30692. return $descriptor->getApplicationDocument($this, $namespace);
  30693. }
  30694. $output = new BufferedOutput();
  30695. $descriptor->describe($output, $this, array('namespace' => $namespace));
  30696. return $output->fetch();
  30697. }
  30698. public function renderException($e, $output)
  30699. {
  30700. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  30701. do {
  30702. $title = sprintf(' [%s] ', get_class($e));
  30703. $len = Helper::strlen($title);
  30704. $width = $this->getTerminalWidth() ? $this->getTerminalWidth() - 1 : PHP_INT_MAX;
  30705. if (defined('HHVM_VERSION') && $width > 1 << 31) {
  30706. $width = 1 << 31;
  30707. }
  30708. $lines = array();
  30709. foreach (preg_split('/\r?\n/', trim($e->getMessage())) as $line) {
  30710. foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
  30711. $lineLength = Helper::strlen($line) + 4;
  30712. $lines[] = array($line, $lineLength);
  30713. $len = max($lineLength, $len);
  30714. }
  30715. }
  30716. $messages = array();
  30717. $messages[] = $emptyLine = sprintf('<error>%s</error>', str_repeat(' ', $len));
  30718. $messages[] = sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - Helper::strlen($title))));
  30719. foreach ($lines as $line) {
  30720. $messages[] = sprintf('<error> %s %s</error>', OutputFormatter::escape($line[0]), str_repeat(' ', $len - $line[1]));
  30721. }
  30722. $messages[] = $emptyLine;
  30723. $messages[] = '';
  30724. $output->writeln($messages, OutputInterface::VERBOSITY_QUIET);
  30725. if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  30726. $output->writeln('<comment>Exception trace:</comment>', OutputInterface::VERBOSITY_QUIET);
  30727. $trace = $e->getTrace();
  30728. array_unshift($trace, array(
  30729. 'function' => '',
  30730. 'file' => null !== $e->getFile() ? $e->getFile() : 'n/a',
  30731. 'line' => null !== $e->getLine() ? $e->getLine() : 'n/a',
  30732. 'args' => array(),
  30733. ));
  30734. for ($i = 0, $count = count($trace); $i < $count; ++$i) {
  30735. $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
  30736. $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
  30737. $function = $trace[$i]['function'];
  30738. $file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
  30739. $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
  30740. $output->writeln(sprintf(' %s%s%s() at <info>%s:%s</info>', $class, $type, $function, $file, $line), OutputInterface::VERBOSITY_QUIET);
  30741. }
  30742. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  30743. }
  30744. } while ($e = $e->getPrevious());
  30745. if (null !== $this->runningCommand) {
  30746. $output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())), OutputInterface::VERBOSITY_QUIET);
  30747. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  30748. }
  30749. }
  30750. protected function getTerminalWidth()
  30751. {
  30752. $dimensions = $this->getTerminalDimensions();
  30753. return $dimensions[0];
  30754. }
  30755. protected function getTerminalHeight()
  30756. {
  30757. $dimensions = $this->getTerminalDimensions();
  30758. return $dimensions[1];
  30759. }
  30760. public function getTerminalDimensions()
  30761. {
  30762. if ($this->terminalDimensions) {
  30763. return $this->terminalDimensions;
  30764. }
  30765. if ('\\' === DIRECTORY_SEPARATOR) {
  30766. if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) {
  30767. return array((int) $matches[1], (int) $matches[2]);
  30768. }
  30769. if (preg_match('/^(\d+)x(\d+)$/', $this->getConsoleMode(), $matches)) {
  30770. return array((int) $matches[1], (int) $matches[2]);
  30771. }
  30772. }
  30773. if ($sttyString = $this->getSttyColumns()) {
  30774. if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
  30775. return array((int) $matches[2], (int) $matches[1]);
  30776. }
  30777. if (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {
  30778. return array((int) $matches[2], (int) $matches[1]);
  30779. }
  30780. }
  30781. return array(null, null);
  30782. }
  30783. public function setTerminalDimensions($width, $height)
  30784. {
  30785. $this->terminalDimensions = array($width, $height);
  30786. return $this;
  30787. }
  30788. protected function configureIO(InputInterface $input, OutputInterface $output)
  30789. {
  30790. if (true === $input->hasParameterOption(array('--ansi'))) {
  30791. $output->setDecorated(true);
  30792. } elseif (true === $input->hasParameterOption(array('--no-ansi'))) {
  30793. $output->setDecorated(false);
  30794. }
  30795. if (true === $input->hasParameterOption(array('--no-interaction', '-n'))) {
  30796. $input->setInteractive(false);
  30797. } elseif (function_exists('posix_isatty') && $this->getHelperSet()->has('question')) {
  30798. $inputStream = $this->getHelperSet()->get('question')->getInputStream();
  30799. if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
  30800. $input->setInteractive(false);
  30801. }
  30802. }
  30803. if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
  30804. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  30805. $input->setInteractive(false);
  30806. } else {
  30807. if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || 3 === $input->getParameterOption('--verbose')) {
  30808. $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
  30809. } elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2') || 2 === $input->getParameterOption('--verbose')) {
  30810. $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
  30811. } elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose') || $input->getParameterOption('--verbose')) {
  30812. $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
  30813. }
  30814. }
  30815. }
  30816. protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
  30817. {
  30818. foreach ($command->getHelperSet() as $helper) {
  30819. if ($helper instanceof InputAwareInterface) {
  30820. $helper->setInput($input);
  30821. }
  30822. }
  30823. if (null === $this->dispatcher) {
  30824. return $command->run($input, $output);
  30825. }
  30826. try {
  30827. $command->mergeApplicationDefinition();
  30828. $input->bind($command->getDefinition());
  30829. } catch (ExceptionInterface $e) {
  30830. }
  30831. $event = new ConsoleCommandEvent($command, $input, $output);
  30832. $e = null;
  30833. try {
  30834. $this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event);
  30835. if ($event->commandShouldRun()) {
  30836. $exitCode = $command->run($input, $output);
  30837. } else {
  30838. $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;
  30839. }
  30840. } catch (\Exception $e) {
  30841. } catch (\Throwable $e) {
  30842. }
  30843. if (null !== $e) {
  30844. $x = $e instanceof \Exception ? $e : new FatalThrowableError($e);
  30845. $event = new ConsoleExceptionEvent($command, $input, $output, $x, $x->getCode());
  30846. $this->dispatcher->dispatch(ConsoleEvents::EXCEPTION, $event);
  30847. if ($x !== $event->getException()) {
  30848. $e = $event->getException();
  30849. }
  30850. $exitCode = $e->getCode();
  30851. }
  30852. $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode);
  30853. $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event);
  30854. if (null !== $e) {
  30855. throw $e;
  30856. }
  30857. return $event->getExitCode();
  30858. }
  30859. protected function getCommandName(InputInterface $input)
  30860. {
  30861. return $input->getFirstArgument();
  30862. }
  30863. protected function getDefaultInputDefinition()
  30864. {
  30865. return new InputDefinition(array(
  30866. new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
  30867. new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'),
  30868. new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'),
  30869. new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'),
  30870. new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'),
  30871. new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'),
  30872. new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'),
  30873. new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
  30874. ));
  30875. }
  30876. protected function getDefaultCommands()
  30877. {
  30878. return array(new HelpCommand(), new ListCommand());
  30879. }
  30880. protected function getDefaultHelperSet()
  30881. {
  30882. return new HelperSet(array(
  30883. new FormatterHelper(),
  30884. new DialogHelper(false),
  30885. new ProgressHelper(false),
  30886. new TableHelper(false),
  30887. new DebugFormatterHelper(),
  30888. new ProcessHelper(),
  30889. new QuestionHelper(),
  30890. ));
  30891. }
  30892. private function getSttyColumns()
  30893. {
  30894. if (!function_exists('proc_open')) {
  30895. return;
  30896. }
  30897. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  30898. $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  30899. if (is_resource($process)) {
  30900. $info = stream_get_contents($pipes[1]);
  30901. fclose($pipes[1]);
  30902. fclose($pipes[2]);
  30903. proc_close($process);
  30904. return $info;
  30905. }
  30906. }
  30907. private function getConsoleMode()
  30908. {
  30909. if (!function_exists('proc_open')) {
  30910. return;
  30911. }
  30912. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  30913. $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  30914. if (is_resource($process)) {
  30915. $info = stream_get_contents($pipes[1]);
  30916. fclose($pipes[1]);
  30917. fclose($pipes[2]);
  30918. proc_close($process);
  30919. if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
  30920. return $matches[2].'x'.$matches[1];
  30921. }
  30922. }
  30923. }
  30924. private function getAbbreviationSuggestions($abbrevs)
  30925. {
  30926. return sprintf('%s, %s%s', $abbrevs[0], $abbrevs[1], count($abbrevs) > 2 ? sprintf(' and %d more', count($abbrevs) - 2) : '');
  30927. }
  30928. public function extractNamespace($name, $limit = null)
  30929. {
  30930. $parts = explode(':', $name);
  30931. array_pop($parts);
  30932. return implode(':', null === $limit ? $parts : array_slice($parts, 0, $limit));
  30933. }
  30934. private function findAlternatives($name, $collection)
  30935. {
  30936. $threshold = 1e3;
  30937. $alternatives = array();
  30938. $collectionParts = array();
  30939. foreach ($collection as $item) {
  30940. $collectionParts[$item] = explode(':', $item);
  30941. }
  30942. foreach (explode(':', $name) as $i => $subname) {
  30943. foreach ($collectionParts as $collectionName => $parts) {
  30944. $exists = isset($alternatives[$collectionName]);
  30945. if (!isset($parts[$i]) && $exists) {
  30946. $alternatives[$collectionName] += $threshold;
  30947. continue;
  30948. } elseif (!isset($parts[$i])) {
  30949. continue;
  30950. }
  30951. $lev = levenshtein($subname, $parts[$i]);
  30952. if ($lev <= strlen($subname) / 3 || '' !== $subname && false !== strpos($parts[$i], $subname)) {
  30953. $alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev;
  30954. } elseif ($exists) {
  30955. $alternatives[$collectionName] += $threshold;
  30956. }
  30957. }
  30958. }
  30959. foreach ($collection as $item) {
  30960. $lev = levenshtein($name, $item);
  30961. if ($lev <= strlen($name) / 3 || false !== strpos($item, $name)) {
  30962. $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
  30963. }
  30964. }
  30965. $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
  30966. asort($alternatives);
  30967. return array_keys($alternatives);
  30968. }
  30969. public function setDefaultCommand($commandName)
  30970. {
  30971. $this->defaultCommand = $commandName;
  30972. }
  30973. private function splitStringByWidth($string, $width)
  30974. {
  30975. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  30976. return str_split($string, $width);
  30977. }
  30978. $utf8String = mb_convert_encoding($string, 'utf8', $encoding);
  30979. $lines = array();
  30980. $line = '';
  30981. foreach (preg_split('//u', $utf8String) as $char) {
  30982. if (mb_strwidth($line.$char, 'utf8') <= $width) {
  30983. $line .= $char;
  30984. continue;
  30985. }
  30986. $lines[] = str_pad($line, $width);
  30987. $line = $char;
  30988. }
  30989. $lines[] = count($lines) ? str_pad($line, $width) : $line;
  30990. mb_convert_variables($encoding, 'utf8', $lines);
  30991. return $lines;
  30992. }
  30993. private function extractAllNamespaces($name)
  30994. {
  30995. $parts = explode(':', $name, -1);
  30996. $namespaces = array();
  30997. foreach ($parts as $part) {
  30998. if (count($namespaces)) {
  30999. $namespaces[] = end($namespaces).':'.$part;
  31000. } else {
  31001. $namespaces[] = $part;
  31002. }
  31003. }
  31004. return $namespaces;
  31005. }
  31006. private function init()
  31007. {
  31008. if ($this->initialized) {
  31009. return;
  31010. }
  31011. $this->initialized = true;
  31012. foreach ($this->getDefaultCommands() as $command) {
  31013. $this->add($command);
  31014. }
  31015. }
  31016. }
  31017. <?php
  31018. namespace Symfony\Component\Console\Command;
  31019. use Symfony\Component\Console\Descriptor\TextDescriptor;
  31020. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  31021. use Symfony\Component\Console\Exception\ExceptionInterface;
  31022. use Symfony\Component\Console\Input\InputDefinition;
  31023. use Symfony\Component\Console\Input\InputOption;
  31024. use Symfony\Component\Console\Input\InputArgument;
  31025. use Symfony\Component\Console\Input\InputInterface;
  31026. use Symfony\Component\Console\Output\BufferedOutput;
  31027. use Symfony\Component\Console\Output\OutputInterface;
  31028. use Symfony\Component\Console\Application;
  31029. use Symfony\Component\Console\Helper\HelperSet;
  31030. use Symfony\Component\Console\Exception\InvalidArgumentException;
  31031. use Symfony\Component\Console\Exception\LogicException;
  31032. class Command
  31033. {
  31034. private $application;
  31035. private $name;
  31036. private $processTitle;
  31037. private $aliases = array();
  31038. private $definition;
  31039. private $help;
  31040. private $description;
  31041. private $ignoreValidationErrors = false;
  31042. private $applicationDefinitionMerged = false;
  31043. private $applicationDefinitionMergedWithArgs = false;
  31044. private $code;
  31045. private $synopsis = array();
  31046. private $usages = array();
  31047. private $helperSet;
  31048. public function __construct($name = null)
  31049. {
  31050. $this->definition = new InputDefinition();
  31051. if (null !== $name) {
  31052. $this->setName($name);
  31053. }
  31054. $this->configure();
  31055. if (!$this->name) {
  31056. throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', get_class($this)));
  31057. }
  31058. }
  31059. public function ignoreValidationErrors()
  31060. {
  31061. $this->ignoreValidationErrors = true;
  31062. }
  31063. public function setApplication(Application $application = null)
  31064. {
  31065. $this->application = $application;
  31066. if ($application) {
  31067. $this->setHelperSet($application->getHelperSet());
  31068. } else {
  31069. $this->helperSet = null;
  31070. }
  31071. }
  31072. public function setHelperSet(HelperSet $helperSet)
  31073. {
  31074. $this->helperSet = $helperSet;
  31075. }
  31076. public function getHelperSet()
  31077. {
  31078. return $this->helperSet;
  31079. }
  31080. public function getApplication()
  31081. {
  31082. return $this->application;
  31083. }
  31084. public function isEnabled()
  31085. {
  31086. return true;
  31087. }
  31088. protected function configure()
  31089. {
  31090. }
  31091. protected function execute(InputInterface $input, OutputInterface $output)
  31092. {
  31093. throw new LogicException('You must override the execute() method in the concrete command class.');
  31094. }
  31095. protected function interact(InputInterface $input, OutputInterface $output)
  31096. {
  31097. }
  31098. protected function initialize(InputInterface $input, OutputInterface $output)
  31099. {
  31100. }
  31101. public function run(InputInterface $input, OutputInterface $output)
  31102. {
  31103. $this->getSynopsis(true);
  31104. $this->getSynopsis(false);
  31105. $this->mergeApplicationDefinition();
  31106. try {
  31107. $input->bind($this->definition);
  31108. } catch (ExceptionInterface $e) {
  31109. if (!$this->ignoreValidationErrors) {
  31110. throw $e;
  31111. }
  31112. }
  31113. $this->initialize($input, $output);
  31114. if (null !== $this->processTitle) {
  31115. if (function_exists('cli_set_process_title')) {
  31116. if (false === @cli_set_process_title($this->processTitle)) {
  31117. if ('Darwin' === PHP_OS) {
  31118. $output->writeln('<comment>Running "cli_get_process_title" as an unprivileged user is not supported on MacOS.</comment>');
  31119. } else {
  31120. $error = error_get_last();
  31121. trigger_error($error['message'], E_USER_WARNING);
  31122. }
  31123. }
  31124. } elseif (function_exists('setproctitle')) {
  31125. setproctitle($this->processTitle);
  31126. } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
  31127. $output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
  31128. }
  31129. }
  31130. if ($input->isInteractive()) {
  31131. $this->interact($input, $output);
  31132. }
  31133. if ($input->hasArgument('command') && null === $input->getArgument('command')) {
  31134. $input->setArgument('command', $this->getName());
  31135. }
  31136. $input->validate();
  31137. if ($this->code) {
  31138. $statusCode = call_user_func($this->code, $input, $output);
  31139. } else {
  31140. $statusCode = $this->execute($input, $output);
  31141. }
  31142. return is_numeric($statusCode) ? (int) $statusCode : 0;
  31143. }
  31144. public function setCode($code)
  31145. {
  31146. if (!is_callable($code)) {
  31147. throw new InvalidArgumentException('Invalid callable provided to Command::setCode.');
  31148. }
  31149. if (PHP_VERSION_ID >= 50400 && $code instanceof \Closure) {
  31150. $r = new \ReflectionFunction($code);
  31151. if (null === $r->getClosureThis()) {
  31152. if (PHP_VERSION_ID < 70000) {
  31153. $code = @\Closure::bind($code, $this);
  31154. } else {
  31155. $code = \Closure::bind($code, $this);
  31156. }
  31157. }
  31158. }
  31159. $this->code = $code;
  31160. return $this;
  31161. }
  31162. public function mergeApplicationDefinition($mergeArgs = true)
  31163. {
  31164. if (null === $this->application || (true === $this->applicationDefinitionMerged && ($this->applicationDefinitionMergedWithArgs || !$mergeArgs))) {
  31165. return;
  31166. }
  31167. $this->definition->addOptions($this->application->getDefinition()->getOptions());
  31168. if ($mergeArgs) {
  31169. $currentArguments = $this->definition->getArguments();
  31170. $this->definition->setArguments($this->application->getDefinition()->getArguments());
  31171. $this->definition->addArguments($currentArguments);
  31172. }
  31173. $this->applicationDefinitionMerged = true;
  31174. if ($mergeArgs) {
  31175. $this->applicationDefinitionMergedWithArgs = true;
  31176. }
  31177. }
  31178. public function setDefinition($definition)
  31179. {
  31180. if ($definition instanceof InputDefinition) {
  31181. $this->definition = $definition;
  31182. } else {
  31183. $this->definition->setDefinition($definition);
  31184. }
  31185. $this->applicationDefinitionMerged = false;
  31186. return $this;
  31187. }
  31188. public function getDefinition()
  31189. {
  31190. return $this->definition;
  31191. }
  31192. public function getNativeDefinition()
  31193. {
  31194. return $this->getDefinition();
  31195. }
  31196. public function addArgument($name, $mode = null, $description = '', $default = null)
  31197. {
  31198. $this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
  31199. return $this;
  31200. }
  31201. public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
  31202. {
  31203. $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
  31204. return $this;
  31205. }
  31206. public function setName($name)
  31207. {
  31208. $this->validateName($name);
  31209. $this->name = $name;
  31210. return $this;
  31211. }
  31212. public function setProcessTitle($title)
  31213. {
  31214. $this->processTitle = $title;
  31215. return $this;
  31216. }
  31217. public function getName()
  31218. {
  31219. return $this->name;
  31220. }
  31221. public function setDescription($description)
  31222. {
  31223. $this->description = $description;
  31224. return $this;
  31225. }
  31226. public function getDescription()
  31227. {
  31228. return $this->description;
  31229. }
  31230. public function setHelp($help)
  31231. {
  31232. $this->help = $help;
  31233. return $this;
  31234. }
  31235. public function getHelp()
  31236. {
  31237. return $this->help;
  31238. }
  31239. public function getProcessedHelp()
  31240. {
  31241. $name = $this->name;
  31242. $placeholders = array(
  31243. '%command.name%',
  31244. '%command.full_name%',
  31245. );
  31246. $replacements = array(
  31247. $name,
  31248. $_SERVER['PHP_SELF'].' '.$name,
  31249. );
  31250. return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
  31251. }
  31252. public function setAliases($aliases)
  31253. {
  31254. if (!is_array($aliases) && !$aliases instanceof \Traversable) {
  31255. throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable');
  31256. }
  31257. foreach ($aliases as $alias) {
  31258. $this->validateName($alias);
  31259. }
  31260. $this->aliases = $aliases;
  31261. return $this;
  31262. }
  31263. public function getAliases()
  31264. {
  31265. return $this->aliases;
  31266. }
  31267. public function getSynopsis($short = false)
  31268. {
  31269. $key = $short ? 'short' : 'long';
  31270. if (!isset($this->synopsis[$key])) {
  31271. $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
  31272. }
  31273. return $this->synopsis[$key];
  31274. }
  31275. public function addUsage($usage)
  31276. {
  31277. if (0 !== strpos($usage, $this->name)) {
  31278. $usage = sprintf('%s %s', $this->name, $usage);
  31279. }
  31280. $this->usages[] = $usage;
  31281. return $this;
  31282. }
  31283. public function getUsages()
  31284. {
  31285. return $this->usages;
  31286. }
  31287. public function getHelper($name)
  31288. {
  31289. if (null === $this->helperSet) {
  31290. throw new LogicException(sprintf('Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name));
  31291. }
  31292. return $this->helperSet->get($name);
  31293. }
  31294. public function asText()
  31295. {
  31296. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  31297. $descriptor = new TextDescriptor();
  31298. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  31299. $descriptor->describe($output, $this, array('raw_output' => true));
  31300. return $output->fetch();
  31301. }
  31302. public function asXml($asDom = false)
  31303. {
  31304. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  31305. $descriptor = new XmlDescriptor();
  31306. if ($asDom) {
  31307. return $descriptor->getCommandDocument($this);
  31308. }
  31309. $output = new BufferedOutput();
  31310. $descriptor->describe($output, $this);
  31311. return $output->fetch();
  31312. }
  31313. private function validateName($name)
  31314. {
  31315. if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
  31316. throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
  31317. }
  31318. }
  31319. }
  31320. <?php
  31321. namespace Symfony\Component\Console\Command;
  31322. use Symfony\Component\Console\Helper\DescriptorHelper;
  31323. use Symfony\Component\Console\Input\InputArgument;
  31324. use Symfony\Component\Console\Input\InputOption;
  31325. use Symfony\Component\Console\Input\InputInterface;
  31326. use Symfony\Component\Console\Output\OutputInterface;
  31327. class HelpCommand extends Command
  31328. {
  31329. private $command;
  31330. protected function configure()
  31331. {
  31332. $this->ignoreValidationErrors();
  31333. $this
  31334. ->setName('help')
  31335. ->setDefinition(array(
  31336. new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
  31337. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
  31338. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  31339. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
  31340. ))
  31341. ->setDescription('Displays help for a command')
  31342. ->setHelp(<<<'EOF'
  31343. The <info>%command.name%</info> command displays help for a given command:
  31344. <info>php %command.full_name% list</info>
  31345. You can also output the help in other formats by using the <comment>--format</comment> option:
  31346. <info>php %command.full_name% --format=xml list</info>
  31347. To display the list of available commands, please use the <info>list</info> command.
  31348. EOF
  31349. )
  31350. ;
  31351. }
  31352. public function setCommand(Command $command)
  31353. {
  31354. $this->command = $command;
  31355. }
  31356. protected function execute(InputInterface $input, OutputInterface $output)
  31357. {
  31358. if (null === $this->command) {
  31359. $this->command = $this->getApplication()->find($input->getArgument('command_name'));
  31360. }
  31361. if ($input->getOption('xml')) {
  31362. @trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
  31363. $input->setOption('format', 'xml');
  31364. }
  31365. $helper = new DescriptorHelper();
  31366. $helper->describe($output, $this->command, array(
  31367. 'format' => $input->getOption('format'),
  31368. 'raw_text' => $input->getOption('raw'),
  31369. ));
  31370. $this->command = null;
  31371. }
  31372. }
  31373. <?php
  31374. namespace Symfony\Component\Console\Command;
  31375. use Symfony\Component\Console\Helper\DescriptorHelper;
  31376. use Symfony\Component\Console\Input\InputArgument;
  31377. use Symfony\Component\Console\Input\InputOption;
  31378. use Symfony\Component\Console\Input\InputInterface;
  31379. use Symfony\Component\Console\Output\OutputInterface;
  31380. use Symfony\Component\Console\Input\InputDefinition;
  31381. class ListCommand extends Command
  31382. {
  31383. protected function configure()
  31384. {
  31385. $this
  31386. ->setName('list')
  31387. ->setDefinition($this->createDefinition())
  31388. ->setDescription('Lists commands')
  31389. ->setHelp(<<<'EOF'
  31390. The <info>%command.name%</info> command lists all commands:
  31391. <info>php %command.full_name%</info>
  31392. You can also display the commands for a specific namespace:
  31393. <info>php %command.full_name% test</info>
  31394. You can also output the information in other formats by using the <comment>--format</comment> option:
  31395. <info>php %command.full_name% --format=xml</info>
  31396. It's also possible to get raw list of commands (useful for embedding command runner):
  31397. <info>php %command.full_name% --raw</info>
  31398. EOF
  31399. )
  31400. ;
  31401. }
  31402. public function getNativeDefinition()
  31403. {
  31404. return $this->createDefinition();
  31405. }
  31406. protected function execute(InputInterface $input, OutputInterface $output)
  31407. {
  31408. if ($input->getOption('xml')) {
  31409. @trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
  31410. $input->setOption('format', 'xml');
  31411. }
  31412. $helper = new DescriptorHelper();
  31413. $helper->describe($output, $this->getApplication(), array(
  31414. 'format' => $input->getOption('format'),
  31415. 'raw_text' => $input->getOption('raw'),
  31416. 'namespace' => $input->getArgument('namespace'),
  31417. ));
  31418. }
  31419. private function createDefinition()
  31420. {
  31421. return new InputDefinition(array(
  31422. new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
  31423. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output list as XML'),
  31424. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
  31425. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  31426. ));
  31427. }
  31428. }
  31429. <?php
  31430. namespace Symfony\Component\Console;
  31431. final class ConsoleEvents
  31432. {
  31433. const COMMAND = 'console.command';
  31434. const TERMINATE = 'console.terminate';
  31435. const EXCEPTION = 'console.exception';
  31436. }
  31437. <?php
  31438. namespace Symfony\Component\Console\Descriptor;
  31439. use Symfony\Component\Console\Application;
  31440. use Symfony\Component\Console\Command\Command;
  31441. use Symfony\Component\Console\Exception\CommandNotFoundException;
  31442. class ApplicationDescription
  31443. {
  31444. const GLOBAL_NAMESPACE = '_global';
  31445. private $application;
  31446. private $namespace;
  31447. private $namespaces;
  31448. private $commands;
  31449. private $aliases;
  31450. public function __construct(Application $application, $namespace = null)
  31451. {
  31452. $this->application = $application;
  31453. $this->namespace = $namespace;
  31454. }
  31455. public function getNamespaces()
  31456. {
  31457. if (null === $this->namespaces) {
  31458. $this->inspectApplication();
  31459. }
  31460. return $this->namespaces;
  31461. }
  31462. public function getCommands()
  31463. {
  31464. if (null === $this->commands) {
  31465. $this->inspectApplication();
  31466. }
  31467. return $this->commands;
  31468. }
  31469. public function getCommand($name)
  31470. {
  31471. if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
  31472. throw new CommandNotFoundException(sprintf('Command %s does not exist.', $name));
  31473. }
  31474. return isset($this->commands[$name]) ? $this->commands[$name] : $this->aliases[$name];
  31475. }
  31476. private function inspectApplication()
  31477. {
  31478. $this->commands = array();
  31479. $this->namespaces = array();
  31480. $all = $this->application->all($this->namespace ? $this->application->findNamespace($this->namespace) : null);
  31481. foreach ($this->sortCommands($all) as $namespace => $commands) {
  31482. $names = array();
  31483. foreach ($commands as $name => $command) {
  31484. if (!$command->getName()) {
  31485. continue;
  31486. }
  31487. if ($command->getName() === $name) {
  31488. $this->commands[$name] = $command;
  31489. } else {
  31490. $this->aliases[$name] = $command;
  31491. }
  31492. $names[] = $name;
  31493. }
  31494. $this->namespaces[$namespace] = array('id' => $namespace, 'commands' => $names);
  31495. }
  31496. }
  31497. private function sortCommands(array $commands)
  31498. {
  31499. $namespacedCommands = array();
  31500. $globalCommands = array();
  31501. foreach ($commands as $name => $command) {
  31502. $key = $this->application->extractNamespace($name, 1);
  31503. if (!$key) {
  31504. $globalCommands['_global'][$name] = $command;
  31505. } else {
  31506. $namespacedCommands[$key][$name] = $command;
  31507. }
  31508. }
  31509. ksort($namespacedCommands);
  31510. $namespacedCommands = array_merge($globalCommands, $namespacedCommands);
  31511. foreach ($namespacedCommands as &$commandsSet) {
  31512. ksort($commandsSet);
  31513. }
  31514. unset($commandsSet);
  31515. return $namespacedCommands;
  31516. }
  31517. }
  31518. <?php
  31519. namespace Symfony\Component\Console\Descriptor;
  31520. use Symfony\Component\Console\Application;
  31521. use Symfony\Component\Console\Command\Command;
  31522. use Symfony\Component\Console\Input\InputArgument;
  31523. use Symfony\Component\Console\Input\InputDefinition;
  31524. use Symfony\Component\Console\Input\InputOption;
  31525. use Symfony\Component\Console\Output\OutputInterface;
  31526. use Symfony\Component\Console\Exception\InvalidArgumentException;
  31527. abstract class Descriptor implements DescriptorInterface
  31528. {
  31529. private $output;
  31530. public function describe(OutputInterface $output, $object, array $options = array())
  31531. {
  31532. $this->output = $output;
  31533. switch (true) {
  31534. case $object instanceof InputArgument:
  31535. $this->describeInputArgument($object, $options);
  31536. break;
  31537. case $object instanceof InputOption:
  31538. $this->describeInputOption($object, $options);
  31539. break;
  31540. case $object instanceof InputDefinition:
  31541. $this->describeInputDefinition($object, $options);
  31542. break;
  31543. case $object instanceof Command:
  31544. $this->describeCommand($object, $options);
  31545. break;
  31546. case $object instanceof Application:
  31547. $this->describeApplication($object, $options);
  31548. break;
  31549. default:
  31550. throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_class($object)));
  31551. }
  31552. }
  31553. protected function write($content, $decorated = false)
  31554. {
  31555. $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
  31556. }
  31557. abstract protected function describeInputArgument(InputArgument $argument, array $options = array());
  31558. abstract protected function describeInputOption(InputOption $option, array $options = array());
  31559. abstract protected function describeInputDefinition(InputDefinition $definition, array $options = array());
  31560. abstract protected function describeCommand(Command $command, array $options = array());
  31561. abstract protected function describeApplication(Application $application, array $options = array());
  31562. }
  31563. <?php
  31564. namespace Symfony\Component\Console\Descriptor;
  31565. use Symfony\Component\Console\Output\OutputInterface;
  31566. interface DescriptorInterface
  31567. {
  31568. public function describe(OutputInterface $output, $object, array $options = array());
  31569. }
  31570. <?php
  31571. namespace Symfony\Component\Console\Descriptor;
  31572. use Symfony\Component\Console\Application;
  31573. use Symfony\Component\Console\Command\Command;
  31574. use Symfony\Component\Console\Input\InputArgument;
  31575. use Symfony\Component\Console\Input\InputDefinition;
  31576. use Symfony\Component\Console\Input\InputOption;
  31577. class JsonDescriptor extends Descriptor
  31578. {
  31579. protected function describeInputArgument(InputArgument $argument, array $options = array())
  31580. {
  31581. $this->writeData($this->getInputArgumentData($argument), $options);
  31582. }
  31583. protected function describeInputOption(InputOption $option, array $options = array())
  31584. {
  31585. $this->writeData($this->getInputOptionData($option), $options);
  31586. }
  31587. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  31588. {
  31589. $this->writeData($this->getInputDefinitionData($definition), $options);
  31590. }
  31591. protected function describeCommand(Command $command, array $options = array())
  31592. {
  31593. $this->writeData($this->getCommandData($command), $options);
  31594. }
  31595. protected function describeApplication(Application $application, array $options = array())
  31596. {
  31597. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  31598. $description = new ApplicationDescription($application, $describedNamespace);
  31599. $commands = array();
  31600. foreach ($description->getCommands() as $command) {
  31601. $commands[] = $this->getCommandData($command);
  31602. }
  31603. $data = $describedNamespace
  31604. ? array('commands' => $commands, 'namespace' => $describedNamespace)
  31605. : array('commands' => $commands, 'namespaces' => array_values($description->getNamespaces()));
  31606. $this->writeData($data, $options);
  31607. }
  31608. private function writeData(array $data, array $options)
  31609. {
  31610. $this->write(json_encode($data, isset($options['json_encoding']) ? $options['json_encoding'] : 0));
  31611. }
  31612. private function getInputArgumentData(InputArgument $argument)
  31613. {
  31614. return array(
  31615. 'name' => $argument->getName(),
  31616. 'is_required' => $argument->isRequired(),
  31617. 'is_array' => $argument->isArray(),
  31618. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
  31619. 'default' => INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
  31620. );
  31621. }
  31622. private function getInputOptionData(InputOption $option)
  31623. {
  31624. return array(
  31625. 'name' => '--'.$option->getName(),
  31626. 'shortcut' => $option->getShortcut() ? '-'.implode('|-', explode('|', $option->getShortcut())) : '',
  31627. 'accept_value' => $option->acceptValue(),
  31628. 'is_value_required' => $option->isValueRequired(),
  31629. 'is_multiple' => $option->isArray(),
  31630. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
  31631. 'default' => INF === $option->getDefault() ? 'INF' : $option->getDefault(),
  31632. );
  31633. }
  31634. private function getInputDefinitionData(InputDefinition $definition)
  31635. {
  31636. $inputArguments = array();
  31637. foreach ($definition->getArguments() as $name => $argument) {
  31638. $inputArguments[$name] = $this->getInputArgumentData($argument);
  31639. }
  31640. $inputOptions = array();
  31641. foreach ($definition->getOptions() as $name => $option) {
  31642. $inputOptions[$name] = $this->getInputOptionData($option);
  31643. }
  31644. return array('arguments' => $inputArguments, 'options' => $inputOptions);
  31645. }
  31646. private function getCommandData(Command $command)
  31647. {
  31648. $command->getSynopsis();
  31649. $command->mergeApplicationDefinition(false);
  31650. return array(
  31651. 'name' => $command->getName(),
  31652. 'usage' => array_merge(array($command->getSynopsis()), $command->getUsages(), $command->getAliases()),
  31653. 'description' => $command->getDescription(),
  31654. 'help' => $command->getProcessedHelp(),
  31655. 'definition' => $this->getInputDefinitionData($command->getNativeDefinition()),
  31656. );
  31657. }
  31658. }
  31659. <?php
  31660. namespace Symfony\Component\Console\Descriptor;
  31661. use Symfony\Component\Console\Application;
  31662. use Symfony\Component\Console\Command\Command;
  31663. use Symfony\Component\Console\Helper\Helper;
  31664. use Symfony\Component\Console\Input\InputArgument;
  31665. use Symfony\Component\Console\Input\InputDefinition;
  31666. use Symfony\Component\Console\Input\InputOption;
  31667. class MarkdownDescriptor extends Descriptor
  31668. {
  31669. protected function describeInputArgument(InputArgument $argument, array $options = array())
  31670. {
  31671. $this->write(
  31672. '**'.$argument->getName().':**'."\n\n"
  31673. .'* Name: '.($argument->getName() ?: '<none>')."\n"
  31674. .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
  31675. .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
  31676. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $argument->getDescription() ?: '<none>')."\n"
  31677. .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
  31678. );
  31679. }
  31680. protected function describeInputOption(InputOption $option, array $options = array())
  31681. {
  31682. $this->write(
  31683. '**'.$option->getName().':**'."\n\n"
  31684. .'* Name: `--'.$option->getName().'`'."\n"
  31685. .'* Shortcut: '.($option->getShortcut() ? '`-'.implode('|-', explode('|', $option->getShortcut())).'`' : '<none>')."\n"
  31686. .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
  31687. .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
  31688. .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
  31689. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $option->getDescription() ?: '<none>')."\n"
  31690. .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
  31691. );
  31692. }
  31693. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  31694. {
  31695. if ($showArguments = count($definition->getArguments()) > 0) {
  31696. $this->write('### Arguments:');
  31697. foreach ($definition->getArguments() as $argument) {
  31698. $this->write("\n\n");
  31699. $this->write($this->describeInputArgument($argument));
  31700. }
  31701. }
  31702. if (count($definition->getOptions()) > 0) {
  31703. if ($showArguments) {
  31704. $this->write("\n\n");
  31705. }
  31706. $this->write('### Options:');
  31707. foreach ($definition->getOptions() as $option) {
  31708. $this->write("\n\n");
  31709. $this->write($this->describeInputOption($option));
  31710. }
  31711. }
  31712. }
  31713. protected function describeCommand(Command $command, array $options = array())
  31714. {
  31715. $command->getSynopsis();
  31716. $command->mergeApplicationDefinition(false);
  31717. $this->write(
  31718. $command->getName()."\n"
  31719. .str_repeat('-', Helper::strlen($command->getName()))."\n\n"
  31720. .'* Description: '.($command->getDescription() ?: '<none>')."\n"
  31721. .'* Usage:'."\n\n"
  31722. .array_reduce(array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
  31723. return $carry.' * `'.$usage.'`'."\n";
  31724. })
  31725. );
  31726. if ($help = $command->getProcessedHelp()) {
  31727. $this->write("\n");
  31728. $this->write($help);
  31729. }
  31730. if ($command->getNativeDefinition()) {
  31731. $this->write("\n\n");
  31732. $this->describeInputDefinition($command->getNativeDefinition());
  31733. }
  31734. }
  31735. protected function describeApplication(Application $application, array $options = array())
  31736. {
  31737. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  31738. $description = new ApplicationDescription($application, $describedNamespace);
  31739. $this->write($application->getName()."\n".str_repeat('=', Helper::strlen($application->getName())));
  31740. foreach ($description->getNamespaces() as $namespace) {
  31741. if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  31742. $this->write("\n\n");
  31743. $this->write('**'.$namespace['id'].':**');
  31744. }
  31745. $this->write("\n\n");
  31746. $this->write(implode("\n", array_map(function ($commandName) {
  31747. return '* '.$commandName;
  31748. }, $namespace['commands'])));
  31749. }
  31750. foreach ($description->getCommands() as $command) {
  31751. $this->write("\n\n");
  31752. $this->write($this->describeCommand($command));
  31753. }
  31754. }
  31755. }
  31756. <?php
  31757. namespace Symfony\Component\Console\Descriptor;
  31758. use Symfony\Component\Console\Application;
  31759. use Symfony\Component\Console\Command\Command;
  31760. use Symfony\Component\Console\Formatter\OutputFormatter;
  31761. use Symfony\Component\Console\Helper\Helper;
  31762. use Symfony\Component\Console\Input\InputArgument;
  31763. use Symfony\Component\Console\Input\InputDefinition;
  31764. use Symfony\Component\Console\Input\InputOption;
  31765. class TextDescriptor extends Descriptor
  31766. {
  31767. protected function describeInputArgument(InputArgument $argument, array $options = array())
  31768. {
  31769. if (null !== $argument->getDefault() && (!is_array($argument->getDefault()) || count($argument->getDefault()))) {
  31770. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
  31771. } else {
  31772. $default = '';
  31773. }
  31774. $totalWidth = isset($options['total_width']) ? $options['total_width'] : Helper::strlen($argument->getName());
  31775. $spacingWidth = $totalWidth - strlen($argument->getName());
  31776. $this->writeText(sprintf(' <info>%s</info> %s%s%s',
  31777. $argument->getName(),
  31778. str_repeat(' ', $spacingWidth),
  31779. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()),
  31780. $default
  31781. ), $options);
  31782. }
  31783. protected function describeInputOption(InputOption $option, array $options = array())
  31784. {
  31785. if ($option->acceptValue() && null !== $option->getDefault() && (!is_array($option->getDefault()) || count($option->getDefault()))) {
  31786. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
  31787. } else {
  31788. $default = '';
  31789. }
  31790. $value = '';
  31791. if ($option->acceptValue()) {
  31792. $value = '='.strtoupper($option->getName());
  31793. if ($option->isValueOptional()) {
  31794. $value = '['.$value.']';
  31795. }
  31796. }
  31797. $totalWidth = isset($options['total_width']) ? $options['total_width'] : $this->calculateTotalWidthForOptions(array($option));
  31798. $synopsis = sprintf('%s%s',
  31799. $option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ',
  31800. sprintf('--%s%s', $option->getName(), $value)
  31801. );
  31802. $spacingWidth = $totalWidth - Helper::strlen($synopsis);
  31803. $this->writeText(sprintf(' <info>%s</info> %s%s%s%s',
  31804. $synopsis,
  31805. str_repeat(' ', $spacingWidth),
  31806. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $option->getDescription()),
  31807. $default,
  31808. $option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
  31809. ), $options);
  31810. }
  31811. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  31812. {
  31813. $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
  31814. foreach ($definition->getArguments() as $argument) {
  31815. $totalWidth = max($totalWidth, Helper::strlen($argument->getName()));
  31816. }
  31817. if ($definition->getArguments()) {
  31818. $this->writeText('<comment>Arguments:</comment>', $options);
  31819. $this->writeText("\n");
  31820. foreach ($definition->getArguments() as $argument) {
  31821. $this->describeInputArgument($argument, array_merge($options, array('total_width' => $totalWidth)));
  31822. $this->writeText("\n");
  31823. }
  31824. }
  31825. if ($definition->getArguments() && $definition->getOptions()) {
  31826. $this->writeText("\n");
  31827. }
  31828. if ($definition->getOptions()) {
  31829. $laterOptions = array();
  31830. $this->writeText('<comment>Options:</comment>', $options);
  31831. foreach ($definition->getOptions() as $option) {
  31832. if (strlen($option->getShortcut()) > 1) {
  31833. $laterOptions[] = $option;
  31834. continue;
  31835. }
  31836. $this->writeText("\n");
  31837. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  31838. }
  31839. foreach ($laterOptions as $option) {
  31840. $this->writeText("\n");
  31841. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  31842. }
  31843. }
  31844. }
  31845. protected function describeCommand(Command $command, array $options = array())
  31846. {
  31847. $command->getSynopsis(true);
  31848. $command->getSynopsis(false);
  31849. $command->mergeApplicationDefinition(false);
  31850. $this->writeText('<comment>Usage:</comment>', $options);
  31851. foreach (array_merge(array($command->getSynopsis(true)), $command->getAliases(), $command->getUsages()) as $usage) {
  31852. $this->writeText("\n");
  31853. $this->writeText(' '.OutputFormatter::escape($usage), $options);
  31854. }
  31855. $this->writeText("\n");
  31856. $definition = $command->getNativeDefinition();
  31857. if ($definition->getOptions() || $definition->getArguments()) {
  31858. $this->writeText("\n");
  31859. $this->describeInputDefinition($definition, $options);
  31860. $this->writeText("\n");
  31861. }
  31862. if ($help = $command->getProcessedHelp()) {
  31863. $this->writeText("\n");
  31864. $this->writeText('<comment>Help:</comment>', $options);
  31865. $this->writeText("\n");
  31866. $this->writeText(' '.str_replace("\n", "\n ", $help), $options);
  31867. $this->writeText("\n");
  31868. }
  31869. }
  31870. protected function describeApplication(Application $application, array $options = array())
  31871. {
  31872. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  31873. $description = new ApplicationDescription($application, $describedNamespace);
  31874. if (isset($options['raw_text']) && $options['raw_text']) {
  31875. $width = $this->getColumnWidth($description->getCommands());
  31876. foreach ($description->getCommands() as $command) {
  31877. $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
  31878. $this->writeText("\n");
  31879. }
  31880. } else {
  31881. if ('' != $help = $application->getHelp()) {
  31882. $this->writeText("$help\n\n", $options);
  31883. }
  31884. $this->writeText("<comment>Usage:</comment>\n", $options);
  31885. $this->writeText(" command [options] [arguments]\n\n", $options);
  31886. $this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);
  31887. $this->writeText("\n");
  31888. $this->writeText("\n");
  31889. $width = $this->getColumnWidth($description->getCommands());
  31890. if ($describedNamespace) {
  31891. $this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
  31892. } else {
  31893. $this->writeText('<comment>Available commands:</comment>', $options);
  31894. }
  31895. foreach ($description->getNamespaces() as $namespace) {
  31896. if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  31897. $this->writeText("\n");
  31898. $this->writeText(' <comment>'.$namespace['id'].'</comment>', $options);
  31899. }
  31900. foreach ($namespace['commands'] as $name) {
  31901. $this->writeText("\n");
  31902. $spacingWidth = $width - Helper::strlen($name);
  31903. $this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $description->getCommand($name)->getDescription()), $options);
  31904. }
  31905. }
  31906. $this->writeText("\n");
  31907. }
  31908. }
  31909. private function writeText($content, array $options = array())
  31910. {
  31911. $this->write(
  31912. isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
  31913. isset($options['raw_output']) ? !$options['raw_output'] : true
  31914. );
  31915. }
  31916. private function formatDefaultValue($default)
  31917. {
  31918. if (INF === $default) {
  31919. return 'INF';
  31920. }
  31921. if (is_string($default)) {
  31922. $default = OutputFormatter::escape($default);
  31923. } elseif (is_array($default)) {
  31924. foreach ($default as $key => $value) {
  31925. if (is_string($value)) {
  31926. $default[$key] = OutputFormatter::escape($value);
  31927. }
  31928. }
  31929. }
  31930. if (\PHP_VERSION_ID < 50400) {
  31931. return str_replace(array('\/', '\\\\'), array('/', '\\'), json_encode($default));
  31932. }
  31933. return str_replace('\\\\', '\\', json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
  31934. }
  31935. private function getColumnWidth(array $commands)
  31936. {
  31937. $widths = array();
  31938. foreach ($commands as $command) {
  31939. $widths[] = Helper::strlen($command->getName());
  31940. foreach ($command->getAliases() as $alias) {
  31941. $widths[] = Helper::strlen($alias);
  31942. }
  31943. }
  31944. return max($widths) + 2;
  31945. }
  31946. private function calculateTotalWidthForOptions(array $options)
  31947. {
  31948. $totalWidth = 0;
  31949. foreach ($options as $option) {
  31950. $nameLength = 1 + max(strlen($option->getShortcut()), 1) + 4 + Helper::strlen($option->getName());
  31951. if ($option->acceptValue()) {
  31952. $valueLength = 1 + Helper::strlen($option->getName());
  31953. $valueLength += $option->isValueOptional() ? 2 : 0;
  31954. $nameLength += $valueLength;
  31955. }
  31956. $totalWidth = max($totalWidth, $nameLength);
  31957. }
  31958. return $totalWidth;
  31959. }
  31960. }
  31961. <?php
  31962. namespace Symfony\Component\Console\Descriptor;
  31963. use Symfony\Component\Console\Application;
  31964. use Symfony\Component\Console\Command\Command;
  31965. use Symfony\Component\Console\Input\InputArgument;
  31966. use Symfony\Component\Console\Input\InputDefinition;
  31967. use Symfony\Component\Console\Input\InputOption;
  31968. class XmlDescriptor extends Descriptor
  31969. {
  31970. public function getInputDefinitionDocument(InputDefinition $definition)
  31971. {
  31972. $dom = new \DOMDocument('1.0', 'UTF-8');
  31973. $dom->appendChild($definitionXML = $dom->createElement('definition'));
  31974. $definitionXML->appendChild($argumentsXML = $dom->createElement('arguments'));
  31975. foreach ($definition->getArguments() as $argument) {
  31976. $this->appendDocument($argumentsXML, $this->getInputArgumentDocument($argument));
  31977. }
  31978. $definitionXML->appendChild($optionsXML = $dom->createElement('options'));
  31979. foreach ($definition->getOptions() as $option) {
  31980. $this->appendDocument($optionsXML, $this->getInputOptionDocument($option));
  31981. }
  31982. return $dom;
  31983. }
  31984. public function getCommandDocument(Command $command)
  31985. {
  31986. $dom = new \DOMDocument('1.0', 'UTF-8');
  31987. $dom->appendChild($commandXML = $dom->createElement('command'));
  31988. $command->getSynopsis();
  31989. $command->mergeApplicationDefinition(false);
  31990. $commandXML->setAttribute('id', $command->getName());
  31991. $commandXML->setAttribute('name', $command->getName());
  31992. $commandXML->appendChild($usagesXML = $dom->createElement('usages'));
  31993. foreach (array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()) as $usage) {
  31994. $usagesXML->appendChild($dom->createElement('usage', $usage));
  31995. }
  31996. $commandXML->appendChild($descriptionXML = $dom->createElement('description'));
  31997. $descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription())));
  31998. $commandXML->appendChild($helpXML = $dom->createElement('help'));
  31999. $helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getProcessedHelp())));
  32000. $definitionXML = $this->getInputDefinitionDocument($command->getNativeDefinition());
  32001. $this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0));
  32002. return $dom;
  32003. }
  32004. public function getApplicationDocument(Application $application, $namespace = null)
  32005. {
  32006. $dom = new \DOMDocument('1.0', 'UTF-8');
  32007. $dom->appendChild($rootXml = $dom->createElement('symfony'));
  32008. if ('UNKNOWN' !== $application->getName()) {
  32009. $rootXml->setAttribute('name', $application->getName());
  32010. if ('UNKNOWN' !== $application->getVersion()) {
  32011. $rootXml->setAttribute('version', $application->getVersion());
  32012. }
  32013. }
  32014. $rootXml->appendChild($commandsXML = $dom->createElement('commands'));
  32015. $description = new ApplicationDescription($application, $namespace);
  32016. if ($namespace) {
  32017. $commandsXML->setAttribute('namespace', $namespace);
  32018. }
  32019. foreach ($description->getCommands() as $command) {
  32020. $this->appendDocument($commandsXML, $this->getCommandDocument($command));
  32021. }
  32022. if (!$namespace) {
  32023. $rootXml->appendChild($namespacesXML = $dom->createElement('namespaces'));
  32024. foreach ($description->getNamespaces() as $namespaceDescription) {
  32025. $namespacesXML->appendChild($namespaceArrayXML = $dom->createElement('namespace'));
  32026. $namespaceArrayXML->setAttribute('id', $namespaceDescription['id']);
  32027. foreach ($namespaceDescription['commands'] as $name) {
  32028. $namespaceArrayXML->appendChild($commandXML = $dom->createElement('command'));
  32029. $commandXML->appendChild($dom->createTextNode($name));
  32030. }
  32031. }
  32032. }
  32033. return $dom;
  32034. }
  32035. protected function describeInputArgument(InputArgument $argument, array $options = array())
  32036. {
  32037. $this->writeDocument($this->getInputArgumentDocument($argument));
  32038. }
  32039. protected function describeInputOption(InputOption $option, array $options = array())
  32040. {
  32041. $this->writeDocument($this->getInputOptionDocument($option));
  32042. }
  32043. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  32044. {
  32045. $this->writeDocument($this->getInputDefinitionDocument($definition));
  32046. }
  32047. protected function describeCommand(Command $command, array $options = array())
  32048. {
  32049. $this->writeDocument($this->getCommandDocument($command));
  32050. }
  32051. protected function describeApplication(Application $application, array $options = array())
  32052. {
  32053. $this->writeDocument($this->getApplicationDocument($application, isset($options['namespace']) ? $options['namespace'] : null));
  32054. }
  32055. private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent)
  32056. {
  32057. foreach ($importedParent->childNodes as $childNode) {
  32058. $parentNode->appendChild($parentNode->ownerDocument->importNode($childNode, true));
  32059. }
  32060. }
  32061. private function writeDocument(\DOMDocument $dom)
  32062. {
  32063. $dom->formatOutput = true;
  32064. $this->write($dom->saveXML());
  32065. }
  32066. private function getInputArgumentDocument(InputArgument $argument)
  32067. {
  32068. $dom = new \DOMDocument('1.0', 'UTF-8');
  32069. $dom->appendChild($objectXML = $dom->createElement('argument'));
  32070. $objectXML->setAttribute('name', $argument->getName());
  32071. $objectXML->setAttribute('is_required', $argument->isRequired() ? 1 : 0);
  32072. $objectXML->setAttribute('is_array', $argument->isArray() ? 1 : 0);
  32073. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  32074. $descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));
  32075. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  32076. $defaults = is_array($argument->getDefault()) ? $argument->getDefault() : (is_bool($argument->getDefault()) ? array(var_export($argument->getDefault(), true)) : ($argument->getDefault() ? array($argument->getDefault()) : array()));
  32077. foreach ($defaults as $default) {
  32078. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  32079. $defaultXML->appendChild($dom->createTextNode($default));
  32080. }
  32081. return $dom;
  32082. }
  32083. private function getInputOptionDocument(InputOption $option)
  32084. {
  32085. $dom = new \DOMDocument('1.0', 'UTF-8');
  32086. $dom->appendChild($objectXML = $dom->createElement('option'));
  32087. $objectXML->setAttribute('name', '--'.$option->getName());
  32088. $pos = strpos($option->getShortcut(), '|');
  32089. if (false !== $pos) {
  32090. $objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
  32091. $objectXML->setAttribute('shortcuts', '-'.implode('|-', explode('|', $option->getShortcut())));
  32092. } else {
  32093. $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
  32094. }
  32095. $objectXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0);
  32096. $objectXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0);
  32097. $objectXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0);
  32098. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  32099. $descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
  32100. if ($option->acceptValue()) {
  32101. $defaults = is_array($option->getDefault()) ? $option->getDefault() : (is_bool($option->getDefault()) ? array(var_export($option->getDefault(), true)) : ($option->getDefault() ? array($option->getDefault()) : array()));
  32102. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  32103. if (!empty($defaults)) {
  32104. foreach ($defaults as $default) {
  32105. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  32106. $defaultXML->appendChild($dom->createTextNode($default));
  32107. }
  32108. }
  32109. }
  32110. return $dom;
  32111. }
  32112. }
  32113. <?php
  32114. namespace Symfony\Component\Console\Event;
  32115. class ConsoleCommandEvent extends ConsoleEvent
  32116. {
  32117. const RETURN_CODE_DISABLED = 113;
  32118. private $commandShouldRun = true;
  32119. public function disableCommand()
  32120. {
  32121. return $this->commandShouldRun = false;
  32122. }
  32123. public function enableCommand()
  32124. {
  32125. return $this->commandShouldRun = true;
  32126. }
  32127. public function commandShouldRun()
  32128. {
  32129. return $this->commandShouldRun;
  32130. }
  32131. }
  32132. <?php
  32133. namespace Symfony\Component\Console\Event;
  32134. use Symfony\Component\Console\Command\Command;
  32135. use Symfony\Component\Console\Input\InputInterface;
  32136. use Symfony\Component\Console\Output\OutputInterface;
  32137. use Symfony\Component\EventDispatcher\Event;
  32138. class ConsoleEvent extends Event
  32139. {
  32140. protected $command;
  32141. private $input;
  32142. private $output;
  32143. public function __construct(Command $command, InputInterface $input, OutputInterface $output)
  32144. {
  32145. $this->command = $command;
  32146. $this->input = $input;
  32147. $this->output = $output;
  32148. }
  32149. public function getCommand()
  32150. {
  32151. return $this->command;
  32152. }
  32153. public function getInput()
  32154. {
  32155. return $this->input;
  32156. }
  32157. public function getOutput()
  32158. {
  32159. return $this->output;
  32160. }
  32161. }
  32162. <?php
  32163. namespace Symfony\Component\Console\Event;
  32164. use Symfony\Component\Console\Command\Command;
  32165. use Symfony\Component\Console\Input\InputInterface;
  32166. use Symfony\Component\Console\Output\OutputInterface;
  32167. class ConsoleExceptionEvent extends ConsoleEvent
  32168. {
  32169. private $exception;
  32170. private $exitCode;
  32171. public function __construct(Command $command, InputInterface $input, OutputInterface $output, \Exception $exception, $exitCode)
  32172. {
  32173. parent::__construct($command, $input, $output);
  32174. $this->setException($exception);
  32175. $this->exitCode = (int) $exitCode;
  32176. }
  32177. public function getException()
  32178. {
  32179. return $this->exception;
  32180. }
  32181. public function setException(\Exception $exception)
  32182. {
  32183. $this->exception = $exception;
  32184. }
  32185. public function getExitCode()
  32186. {
  32187. return $this->exitCode;
  32188. }
  32189. }
  32190. <?php
  32191. namespace Symfony\Component\Console\Event;
  32192. use Symfony\Component\Console\Command\Command;
  32193. use Symfony\Component\Console\Input\InputInterface;
  32194. use Symfony\Component\Console\Output\OutputInterface;
  32195. class ConsoleTerminateEvent extends ConsoleEvent
  32196. {
  32197. private $exitCode;
  32198. public function __construct(Command $command, InputInterface $input, OutputInterface $output, $exitCode)
  32199. {
  32200. parent::__construct($command, $input, $output);
  32201. $this->setExitCode($exitCode);
  32202. }
  32203. public function setExitCode($exitCode)
  32204. {
  32205. $this->exitCode = (int) $exitCode;
  32206. }
  32207. public function getExitCode()
  32208. {
  32209. return $this->exitCode;
  32210. }
  32211. }
  32212. <?php
  32213. namespace Symfony\Component\Console\Exception;
  32214. class CommandNotFoundException extends \InvalidArgumentException implements ExceptionInterface
  32215. {
  32216. private $alternatives;
  32217. public function __construct($message, array $alternatives = array(), $code = 0, \Exception $previous = null)
  32218. {
  32219. parent::__construct($message, $code, $previous);
  32220. $this->alternatives = $alternatives;
  32221. }
  32222. public function getAlternatives()
  32223. {
  32224. return $this->alternatives;
  32225. }
  32226. }
  32227. <?php
  32228. namespace Symfony\Component\Console\Exception;
  32229. interface ExceptionInterface
  32230. {
  32231. }
  32232. <?php
  32233. namespace Symfony\Component\Console\Exception;
  32234. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  32235. {
  32236. }
  32237. <?php
  32238. namespace Symfony\Component\Console\Exception;
  32239. class InvalidOptionException extends \InvalidArgumentException implements ExceptionInterface
  32240. {
  32241. }
  32242. <?php
  32243. namespace Symfony\Component\Console\Exception;
  32244. class LogicException extends \LogicException implements ExceptionInterface
  32245. {
  32246. }
  32247. <?php
  32248. namespace Symfony\Component\Console\Exception;
  32249. class RuntimeException extends \RuntimeException implements ExceptionInterface
  32250. {
  32251. }
  32252. <?php
  32253. namespace Symfony\Component\Console\Formatter;
  32254. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32255. class OutputFormatter implements OutputFormatterInterface
  32256. {
  32257. private $decorated;
  32258. private $styles = array();
  32259. private $styleStack;
  32260. public static function escape($text)
  32261. {
  32262. $text = preg_replace('/([^\\\\]?)</', '$1\\<', $text);
  32263. return self::escapeTrailingBackslash($text);
  32264. }
  32265. public static function escapeTrailingBackslash($text)
  32266. {
  32267. if ('\\' === substr($text, -1)) {
  32268. $len = strlen($text);
  32269. $text = rtrim($text, '\\');
  32270. $text = str_replace("\0", '', $text);
  32271. $text .= str_repeat("\0", $len - strlen($text));
  32272. }
  32273. return $text;
  32274. }
  32275. public function __construct($decorated = false, array $styles = array())
  32276. {
  32277. $this->decorated = (bool) $decorated;
  32278. $this->setStyle('error', new OutputFormatterStyle('white', 'red'));
  32279. $this->setStyle('info', new OutputFormatterStyle('green'));
  32280. $this->setStyle('comment', new OutputFormatterStyle('yellow'));
  32281. $this->setStyle('question', new OutputFormatterStyle('black', 'cyan'));
  32282. foreach ($styles as $name => $style) {
  32283. $this->setStyle($name, $style);
  32284. }
  32285. $this->styleStack = new OutputFormatterStyleStack();
  32286. }
  32287. public function setDecorated($decorated)
  32288. {
  32289. $this->decorated = (bool) $decorated;
  32290. }
  32291. public function isDecorated()
  32292. {
  32293. return $this->decorated;
  32294. }
  32295. public function setStyle($name, OutputFormatterStyleInterface $style)
  32296. {
  32297. $this->styles[strtolower($name)] = $style;
  32298. }
  32299. public function hasStyle($name)
  32300. {
  32301. return isset($this->styles[strtolower($name)]);
  32302. }
  32303. public function getStyle($name)
  32304. {
  32305. if (!$this->hasStyle($name)) {
  32306. throw new InvalidArgumentException(sprintf('Undefined style: %s', $name));
  32307. }
  32308. return $this->styles[strtolower($name)];
  32309. }
  32310. public function format($message)
  32311. {
  32312. $message = (string) $message;
  32313. $offset = 0;
  32314. $output = '';
  32315. $tagRegex = '[a-z][a-z0-9_=;-]*+';
  32316. preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, PREG_OFFSET_CAPTURE);
  32317. foreach ($matches[0] as $i => $match) {
  32318. $pos = $match[1];
  32319. $text = $match[0];
  32320. if (0 != $pos && '\\' == $message[$pos - 1]) {
  32321. continue;
  32322. }
  32323. $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset));
  32324. $offset = $pos + strlen($text);
  32325. if ($open = '/' != $text[1]) {
  32326. $tag = $matches[1][$i][0];
  32327. } else {
  32328. $tag = isset($matches[3][$i][0]) ? $matches[3][$i][0] : '';
  32329. }
  32330. if (!$open && !$tag) {
  32331. $this->styleStack->pop();
  32332. } elseif (false === $style = $this->createStyleFromString(strtolower($tag))) {
  32333. $output .= $this->applyCurrentStyle($text);
  32334. } elseif ($open) {
  32335. $this->styleStack->push($style);
  32336. } else {
  32337. $this->styleStack->pop($style);
  32338. }
  32339. }
  32340. $output .= $this->applyCurrentStyle(substr($message, $offset));
  32341. if (false !== strpos($output, "\0")) {
  32342. return strtr($output, array("\0" => '\\', '\\<' => '<'));
  32343. }
  32344. return str_replace('\\<', '<', $output);
  32345. }
  32346. public function getStyleStack()
  32347. {
  32348. return $this->styleStack;
  32349. }
  32350. private function createStyleFromString($string)
  32351. {
  32352. if (isset($this->styles[$string])) {
  32353. return $this->styles[$string];
  32354. }
  32355. if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', strtolower($string), $matches, PREG_SET_ORDER)) {
  32356. return false;
  32357. }
  32358. $style = new OutputFormatterStyle();
  32359. foreach ($matches as $match) {
  32360. array_shift($match);
  32361. if ('fg' == $match[0]) {
  32362. $style->setForeground($match[1]);
  32363. } elseif ('bg' == $match[0]) {
  32364. $style->setBackground($match[1]);
  32365. } else {
  32366. try {
  32367. $style->setOption($match[1]);
  32368. } catch (\InvalidArgumentException $e) {
  32369. return false;
  32370. }
  32371. }
  32372. }
  32373. return $style;
  32374. }
  32375. private function applyCurrentStyle($text)
  32376. {
  32377. return $this->isDecorated() && strlen($text) > 0 ? $this->styleStack->getCurrent()->apply($text) : $text;
  32378. }
  32379. }
  32380. <?php
  32381. namespace Symfony\Component\Console\Formatter;
  32382. interface OutputFormatterInterface
  32383. {
  32384. public function setDecorated($decorated);
  32385. public function isDecorated();
  32386. public function setStyle($name, OutputFormatterStyleInterface $style);
  32387. public function hasStyle($name);
  32388. public function getStyle($name);
  32389. public function format($message);
  32390. }
  32391. <?php
  32392. namespace Symfony\Component\Console\Formatter;
  32393. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32394. class OutputFormatterStyle implements OutputFormatterStyleInterface
  32395. {
  32396. private static $availableForegroundColors = array(
  32397. 'black' => array('set' => 30, 'unset' => 39),
  32398. 'red' => array('set' => 31, 'unset' => 39),
  32399. 'green' => array('set' => 32, 'unset' => 39),
  32400. 'yellow' => array('set' => 33, 'unset' => 39),
  32401. 'blue' => array('set' => 34, 'unset' => 39),
  32402. 'magenta' => array('set' => 35, 'unset' => 39),
  32403. 'cyan' => array('set' => 36, 'unset' => 39),
  32404. 'white' => array('set' => 37, 'unset' => 39),
  32405. 'default' => array('set' => 39, 'unset' => 39),
  32406. );
  32407. private static $availableBackgroundColors = array(
  32408. 'black' => array('set' => 40, 'unset' => 49),
  32409. 'red' => array('set' => 41, 'unset' => 49),
  32410. 'green' => array('set' => 42, 'unset' => 49),
  32411. 'yellow' => array('set' => 43, 'unset' => 49),
  32412. 'blue' => array('set' => 44, 'unset' => 49),
  32413. 'magenta' => array('set' => 45, 'unset' => 49),
  32414. 'cyan' => array('set' => 46, 'unset' => 49),
  32415. 'white' => array('set' => 47, 'unset' => 49),
  32416. 'default' => array('set' => 49, 'unset' => 49),
  32417. );
  32418. private static $availableOptions = array(
  32419. 'bold' => array('set' => 1, 'unset' => 22),
  32420. 'underscore' => array('set' => 4, 'unset' => 24),
  32421. 'blink' => array('set' => 5, 'unset' => 25),
  32422. 'reverse' => array('set' => 7, 'unset' => 27),
  32423. 'conceal' => array('set' => 8, 'unset' => 28),
  32424. );
  32425. private $foreground;
  32426. private $background;
  32427. private $options = array();
  32428. public function __construct($foreground = null, $background = null, array $options = array())
  32429. {
  32430. if (null !== $foreground) {
  32431. $this->setForeground($foreground);
  32432. }
  32433. if (null !== $background) {
  32434. $this->setBackground($background);
  32435. }
  32436. if (count($options)) {
  32437. $this->setOptions($options);
  32438. }
  32439. }
  32440. public function setForeground($color = null)
  32441. {
  32442. if (null === $color) {
  32443. $this->foreground = null;
  32444. return;
  32445. }
  32446. if (!isset(static::$availableForegroundColors[$color])) {
  32447. throw new InvalidArgumentException(sprintf(
  32448. 'Invalid foreground color specified: "%s". Expected one of (%s)',
  32449. $color,
  32450. implode(', ', array_keys(static::$availableForegroundColors))
  32451. ));
  32452. }
  32453. $this->foreground = static::$availableForegroundColors[$color];
  32454. }
  32455. public function setBackground($color = null)
  32456. {
  32457. if (null === $color) {
  32458. $this->background = null;
  32459. return;
  32460. }
  32461. if (!isset(static::$availableBackgroundColors[$color])) {
  32462. throw new InvalidArgumentException(sprintf(
  32463. 'Invalid background color specified: "%s". Expected one of (%s)',
  32464. $color,
  32465. implode(', ', array_keys(static::$availableBackgroundColors))
  32466. ));
  32467. }
  32468. $this->background = static::$availableBackgroundColors[$color];
  32469. }
  32470. public function setOption($option)
  32471. {
  32472. if (!isset(static::$availableOptions[$option])) {
  32473. throw new InvalidArgumentException(sprintf(
  32474. 'Invalid option specified: "%s". Expected one of (%s)',
  32475. $option,
  32476. implode(', ', array_keys(static::$availableOptions))
  32477. ));
  32478. }
  32479. if (!in_array(static::$availableOptions[$option], $this->options)) {
  32480. $this->options[] = static::$availableOptions[$option];
  32481. }
  32482. }
  32483. public function unsetOption($option)
  32484. {
  32485. if (!isset(static::$availableOptions[$option])) {
  32486. throw new InvalidArgumentException(sprintf(
  32487. 'Invalid option specified: "%s". Expected one of (%s)',
  32488. $option,
  32489. implode(', ', array_keys(static::$availableOptions))
  32490. ));
  32491. }
  32492. $pos = array_search(static::$availableOptions[$option], $this->options);
  32493. if (false !== $pos) {
  32494. unset($this->options[$pos]);
  32495. }
  32496. }
  32497. public function setOptions(array $options)
  32498. {
  32499. $this->options = array();
  32500. foreach ($options as $option) {
  32501. $this->setOption($option);
  32502. }
  32503. }
  32504. public function apply($text)
  32505. {
  32506. $setCodes = array();
  32507. $unsetCodes = array();
  32508. if (null !== $this->foreground) {
  32509. $setCodes[] = $this->foreground['set'];
  32510. $unsetCodes[] = $this->foreground['unset'];
  32511. }
  32512. if (null !== $this->background) {
  32513. $setCodes[] = $this->background['set'];
  32514. $unsetCodes[] = $this->background['unset'];
  32515. }
  32516. if (count($this->options)) {
  32517. foreach ($this->options as $option) {
  32518. $setCodes[] = $option['set'];
  32519. $unsetCodes[] = $option['unset'];
  32520. }
  32521. }
  32522. if (0 === count($setCodes)) {
  32523. return $text;
  32524. }
  32525. return sprintf("\033[%sm%s\033[%sm", implode(';', $setCodes), $text, implode(';', $unsetCodes));
  32526. }
  32527. }
  32528. <?php
  32529. namespace Symfony\Component\Console\Formatter;
  32530. interface OutputFormatterStyleInterface
  32531. {
  32532. public function setForeground($color = null);
  32533. public function setBackground($color = null);
  32534. public function setOption($option);
  32535. public function unsetOption($option);
  32536. public function setOptions(array $options);
  32537. public function apply($text);
  32538. }
  32539. <?php
  32540. namespace Symfony\Component\Console\Formatter;
  32541. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32542. class OutputFormatterStyleStack
  32543. {
  32544. private $styles;
  32545. private $emptyStyle;
  32546. public function __construct(OutputFormatterStyleInterface $emptyStyle = null)
  32547. {
  32548. $this->emptyStyle = $emptyStyle ?: new OutputFormatterStyle();
  32549. $this->reset();
  32550. }
  32551. public function reset()
  32552. {
  32553. $this->styles = array();
  32554. }
  32555. public function push(OutputFormatterStyleInterface $style)
  32556. {
  32557. $this->styles[] = $style;
  32558. }
  32559. public function pop(OutputFormatterStyleInterface $style = null)
  32560. {
  32561. if (empty($this->styles)) {
  32562. return $this->emptyStyle;
  32563. }
  32564. if (null === $style) {
  32565. return array_pop($this->styles);
  32566. }
  32567. foreach (array_reverse($this->styles, true) as $index => $stackedStyle) {
  32568. if ($style->apply('') === $stackedStyle->apply('')) {
  32569. $this->styles = array_slice($this->styles, 0, $index);
  32570. return $stackedStyle;
  32571. }
  32572. }
  32573. throw new InvalidArgumentException('Incorrectly nested style tag found.');
  32574. }
  32575. public function getCurrent()
  32576. {
  32577. if (empty($this->styles)) {
  32578. return $this->emptyStyle;
  32579. }
  32580. return $this->styles[count($this->styles) - 1];
  32581. }
  32582. public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle)
  32583. {
  32584. $this->emptyStyle = $emptyStyle;
  32585. return $this;
  32586. }
  32587. public function getEmptyStyle()
  32588. {
  32589. return $this->emptyStyle;
  32590. }
  32591. }
  32592. <?php
  32593. namespace Symfony\Component\Console\Helper;
  32594. class DebugFormatterHelper extends Helper
  32595. {
  32596. private $colors = array('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default');
  32597. private $started = array();
  32598. private $count = -1;
  32599. public function start($id, $message, $prefix = 'RUN')
  32600. {
  32601. $this->started[$id] = array('border' => ++$this->count % count($this->colors));
  32602. return sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message);
  32603. }
  32604. public function progress($id, $buffer, $error = false, $prefix = 'OUT', $errorPrefix = 'ERR')
  32605. {
  32606. $message = '';
  32607. if ($error) {
  32608. if (isset($this->started[$id]['out'])) {
  32609. $message .= "\n";
  32610. unset($this->started[$id]['out']);
  32611. }
  32612. if (!isset($this->started[$id]['err'])) {
  32613. $message .= sprintf('%s<bg=red;fg=white> %s </> ', $this->getBorder($id), $errorPrefix);
  32614. $this->started[$id]['err'] = true;
  32615. }
  32616. $message .= str_replace("\n", sprintf("\n%s<bg=red;fg=white> %s </> ", $this->getBorder($id), $errorPrefix), $buffer);
  32617. } else {
  32618. if (isset($this->started[$id]['err'])) {
  32619. $message .= "\n";
  32620. unset($this->started[$id]['err']);
  32621. }
  32622. if (!isset($this->started[$id]['out'])) {
  32623. $message .= sprintf('%s<bg=green;fg=white> %s </> ', $this->getBorder($id), $prefix);
  32624. $this->started[$id]['out'] = true;
  32625. }
  32626. $message .= str_replace("\n", sprintf("\n%s<bg=green;fg=white> %s </> ", $this->getBorder($id), $prefix), $buffer);
  32627. }
  32628. return $message;
  32629. }
  32630. public function stop($id, $message, $successful, $prefix = 'RES')
  32631. {
  32632. $trailingEOL = isset($this->started[$id]['out']) || isset($this->started[$id]['err']) ? "\n" : '';
  32633. if ($successful) {
  32634. return sprintf("%s%s<bg=green;fg=white> %s </> <fg=green>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  32635. }
  32636. $message = sprintf("%s%s<bg=red;fg=white> %s </> <fg=red>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  32637. unset($this->started[$id]['out'], $this->started[$id]['err']);
  32638. return $message;
  32639. }
  32640. private function getBorder($id)
  32641. {
  32642. return sprintf('<bg=%s> </>', $this->colors[$this->started[$id]['border']]);
  32643. }
  32644. public function getName()
  32645. {
  32646. return 'debug_formatter';
  32647. }
  32648. }
  32649. <?php
  32650. namespace Symfony\Component\Console\Helper;
  32651. use Symfony\Component\Console\Descriptor\DescriptorInterface;
  32652. use Symfony\Component\Console\Descriptor\JsonDescriptor;
  32653. use Symfony\Component\Console\Descriptor\MarkdownDescriptor;
  32654. use Symfony\Component\Console\Descriptor\TextDescriptor;
  32655. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  32656. use Symfony\Component\Console\Output\OutputInterface;
  32657. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32658. class DescriptorHelper extends Helper
  32659. {
  32660. private $descriptors = array();
  32661. public function __construct()
  32662. {
  32663. $this
  32664. ->register('txt', new TextDescriptor())
  32665. ->register('xml', new XmlDescriptor())
  32666. ->register('json', new JsonDescriptor())
  32667. ->register('md', new MarkdownDescriptor())
  32668. ;
  32669. }
  32670. public function describe(OutputInterface $output, $object, array $options = array())
  32671. {
  32672. $options = array_merge(array(
  32673. 'raw_text' => false,
  32674. 'format' => 'txt',
  32675. ), $options);
  32676. if (!isset($this->descriptors[$options['format']])) {
  32677. throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $options['format']));
  32678. }
  32679. $descriptor = $this->descriptors[$options['format']];
  32680. $descriptor->describe($output, $object, $options);
  32681. }
  32682. public function register($format, DescriptorInterface $descriptor)
  32683. {
  32684. $this->descriptors[$format] = $descriptor;
  32685. return $this;
  32686. }
  32687. public function getName()
  32688. {
  32689. return 'descriptor';
  32690. }
  32691. }
  32692. <?php
  32693. namespace Symfony\Component\Console\Helper;
  32694. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32695. use Symfony\Component\Console\Exception\RuntimeException;
  32696. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  32697. use Symfony\Component\Console\Output\OutputInterface;
  32698. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  32699. class DialogHelper extends InputAwareHelper
  32700. {
  32701. private $inputStream;
  32702. private static $shell;
  32703. private static $stty;
  32704. public function __construct($triggerDeprecationError = true)
  32705. {
  32706. if ($triggerDeprecationError) {
  32707. @trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
  32708. }
  32709. }
  32710. public function select(OutputInterface $output, $question, $choices, $default = null, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  32711. {
  32712. if ($output instanceof ConsoleOutputInterface) {
  32713. $output = $output->getErrorOutput();
  32714. }
  32715. $width = max(array_map('strlen', array_keys($choices)));
  32716. $messages = (array) $question;
  32717. foreach ($choices as $key => $value) {
  32718. $messages[] = sprintf(" [<info>%-{$width}s</info>] %s", $key, $value);
  32719. }
  32720. $output->writeln($messages);
  32721. $result = $this->askAndValidate($output, '> ', function ($picked) use ($choices, $errorMessage, $multiselect) {
  32722. $selectedChoices = str_replace(' ', '', $picked);
  32723. if ($multiselect) {
  32724. if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
  32725. throw new InvalidArgumentException(sprintf($errorMessage, $picked));
  32726. }
  32727. $selectedChoices = explode(',', $selectedChoices);
  32728. } else {
  32729. $selectedChoices = array($picked);
  32730. }
  32731. $multiselectChoices = array();
  32732. foreach ($selectedChoices as $value) {
  32733. if (empty($choices[$value])) {
  32734. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  32735. }
  32736. $multiselectChoices[] = $value;
  32737. }
  32738. if ($multiselect) {
  32739. return $multiselectChoices;
  32740. }
  32741. return $picked;
  32742. }, $attempts, $default);
  32743. return $result;
  32744. }
  32745. public function ask(OutputInterface $output, $question, $default = null, array $autocomplete = null)
  32746. {
  32747. if ($this->input && !$this->input->isInteractive()) {
  32748. return $default;
  32749. }
  32750. if ($output instanceof ConsoleOutputInterface) {
  32751. $output = $output->getErrorOutput();
  32752. }
  32753. $output->write($question);
  32754. $inputStream = $this->inputStream ?: STDIN;
  32755. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  32756. $ret = fgets($inputStream, 4096);
  32757. if (false === $ret) {
  32758. throw new RuntimeException('Aborted');
  32759. }
  32760. $ret = trim($ret);
  32761. } else {
  32762. $ret = '';
  32763. $i = 0;
  32764. $ofs = -1;
  32765. $matches = $autocomplete;
  32766. $numMatches = count($matches);
  32767. $sttyMode = shell_exec('stty -g');
  32768. shell_exec('stty -icanon -echo');
  32769. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  32770. while (!feof($inputStream)) {
  32771. $c = fread($inputStream, 1);
  32772. if ("\177" === $c) {
  32773. if (0 === $numMatches && 0 !== $i) {
  32774. --$i;
  32775. $output->write("\033[1D");
  32776. }
  32777. if (0 === $i) {
  32778. $ofs = -1;
  32779. $matches = $autocomplete;
  32780. $numMatches = count($matches);
  32781. } else {
  32782. $numMatches = 0;
  32783. }
  32784. $ret = substr($ret, 0, $i);
  32785. } elseif ("\033" === $c) {
  32786. $c .= fread($inputStream, 2);
  32787. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  32788. if ('A' === $c[2] && -1 === $ofs) {
  32789. $ofs = 0;
  32790. }
  32791. if (0 === $numMatches) {
  32792. continue;
  32793. }
  32794. $ofs += ('A' === $c[2]) ? -1 : 1;
  32795. $ofs = ($numMatches + $ofs) % $numMatches;
  32796. }
  32797. } elseif (ord($c) < 32) {
  32798. if ("\t" === $c || "\n" === $c) {
  32799. if ($numMatches > 0 && -1 !== $ofs) {
  32800. $ret = $matches[$ofs];
  32801. $output->write(substr($ret, $i));
  32802. $i = strlen($ret);
  32803. }
  32804. if ("\n" === $c) {
  32805. $output->write($c);
  32806. break;
  32807. }
  32808. $numMatches = 0;
  32809. }
  32810. continue;
  32811. } else {
  32812. $output->write($c);
  32813. $ret .= $c;
  32814. ++$i;
  32815. $numMatches = 0;
  32816. $ofs = 0;
  32817. foreach ($autocomplete as $value) {
  32818. if (0 === strpos($value, $ret) && $i !== strlen($value)) {
  32819. $matches[$numMatches++] = $value;
  32820. }
  32821. }
  32822. }
  32823. $output->write("\033[K");
  32824. if ($numMatches > 0 && -1 !== $ofs) {
  32825. $output->write("\0337");
  32826. $output->write('<hl>'.substr($matches[$ofs], $i).'</hl>');
  32827. $output->write("\0338");
  32828. }
  32829. }
  32830. shell_exec(sprintf('stty %s', $sttyMode));
  32831. }
  32832. return strlen($ret) > 0 ? $ret : $default;
  32833. }
  32834. public function askConfirmation(OutputInterface $output, $question, $default = true)
  32835. {
  32836. $answer = 'z';
  32837. while ($answer && !in_array(strtolower($answer[0]), array('y', 'n'))) {
  32838. $answer = $this->ask($output, $question);
  32839. }
  32840. if (false === $default) {
  32841. return $answer && 'y' == strtolower($answer[0]);
  32842. }
  32843. return !$answer || 'y' == strtolower($answer[0]);
  32844. }
  32845. public function askHiddenResponse(OutputInterface $output, $question, $fallback = true)
  32846. {
  32847. if ($output instanceof ConsoleOutputInterface) {
  32848. $output = $output->getErrorOutput();
  32849. }
  32850. if ('\\' === DIRECTORY_SEPARATOR) {
  32851. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  32852. if ('phar:' === substr(__FILE__, 0, 5)) {
  32853. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  32854. copy($exe, $tmpExe);
  32855. $exe = $tmpExe;
  32856. }
  32857. $output->write($question);
  32858. $value = rtrim(shell_exec($exe));
  32859. $output->writeln('');
  32860. if (isset($tmpExe)) {
  32861. unlink($tmpExe);
  32862. }
  32863. return $value;
  32864. }
  32865. if ($this->hasSttyAvailable()) {
  32866. $output->write($question);
  32867. $sttyMode = shell_exec('stty -g');
  32868. shell_exec('stty -echo');
  32869. $value = fgets($this->inputStream ?: STDIN, 4096);
  32870. shell_exec(sprintf('stty %s', $sttyMode));
  32871. if (false === $value) {
  32872. throw new RuntimeException('Aborted');
  32873. }
  32874. $value = trim($value);
  32875. $output->writeln('');
  32876. return $value;
  32877. }
  32878. if (false !== $shell = $this->getShell()) {
  32879. $output->write($question);
  32880. $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
  32881. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  32882. $value = rtrim(shell_exec($command));
  32883. $output->writeln('');
  32884. return $value;
  32885. }
  32886. if ($fallback) {
  32887. return $this->ask($output, $question);
  32888. }
  32889. throw new RuntimeException('Unable to hide the response');
  32890. }
  32891. public function askAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $default = null, array $autocomplete = null)
  32892. {
  32893. $that = $this;
  32894. $interviewer = function () use ($output, $question, $default, $autocomplete, $that) {
  32895. return $that->ask($output, $question, $default, $autocomplete);
  32896. };
  32897. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  32898. }
  32899. public function askHiddenResponseAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $fallback = true)
  32900. {
  32901. $that = $this;
  32902. $interviewer = function () use ($output, $question, $fallback, $that) {
  32903. return $that->askHiddenResponse($output, $question, $fallback);
  32904. };
  32905. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  32906. }
  32907. public function setInputStream($stream)
  32908. {
  32909. $this->inputStream = $stream;
  32910. }
  32911. public function getInputStream()
  32912. {
  32913. return $this->inputStream;
  32914. }
  32915. public function getName()
  32916. {
  32917. return 'dialog';
  32918. }
  32919. private function getShell()
  32920. {
  32921. if (null !== self::$shell) {
  32922. return self::$shell;
  32923. }
  32924. self::$shell = false;
  32925. if (file_exists('/usr/bin/env')) {
  32926. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  32927. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  32928. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  32929. self::$shell = $sh;
  32930. break;
  32931. }
  32932. }
  32933. }
  32934. return self::$shell;
  32935. }
  32936. private function hasSttyAvailable()
  32937. {
  32938. if (null !== self::$stty) {
  32939. return self::$stty;
  32940. }
  32941. exec('stty 2>&1', $output, $exitcode);
  32942. return self::$stty = 0 === $exitcode;
  32943. }
  32944. private function validateAttempts($interviewer, OutputInterface $output, $validator, $attempts)
  32945. {
  32946. if ($output instanceof ConsoleOutputInterface) {
  32947. $output = $output->getErrorOutput();
  32948. }
  32949. $e = null;
  32950. while (false === $attempts || $attempts--) {
  32951. if (null !== $e) {
  32952. $output->writeln($this->getHelperSet()->get('formatter')->formatBlock($e->getMessage(), 'error'));
  32953. }
  32954. try {
  32955. return call_user_func($validator, $interviewer());
  32956. } catch (\Exception $e) {
  32957. }
  32958. }
  32959. throw $e;
  32960. }
  32961. }
  32962. <?php
  32963. namespace Symfony\Component\Console\Helper;
  32964. use Symfony\Component\Console\Formatter\OutputFormatter;
  32965. class FormatterHelper extends Helper
  32966. {
  32967. public function formatSection($section, $message, $style = 'info')
  32968. {
  32969. return sprintf('<%s>[%s]</%s> %s', $style, $section, $style, $message);
  32970. }
  32971. public function formatBlock($messages, $style, $large = false)
  32972. {
  32973. if (!is_array($messages)) {
  32974. $messages = array($messages);
  32975. }
  32976. $len = 0;
  32977. $lines = array();
  32978. foreach ($messages as $message) {
  32979. $message = OutputFormatter::escape($message);
  32980. $lines[] = sprintf($large ? ' %s ' : ' %s ', $message);
  32981. $len = max($this->strlen($message) + ($large ? 4 : 2), $len);
  32982. }
  32983. $messages = $large ? array(str_repeat(' ', $len)) : array();
  32984. for ($i = 0; isset($lines[$i]); ++$i) {
  32985. $messages[] = $lines[$i].str_repeat(' ', $len - $this->strlen($lines[$i]));
  32986. }
  32987. if ($large) {
  32988. $messages[] = str_repeat(' ', $len);
  32989. }
  32990. for ($i = 0; isset($messages[$i]); ++$i) {
  32991. $messages[$i] = sprintf('<%s>%s</%s>', $style, $messages[$i], $style);
  32992. }
  32993. return implode("\n", $messages);
  32994. }
  32995. public function getName()
  32996. {
  32997. return 'formatter';
  32998. }
  32999. }
  33000. <?php
  33001. namespace Symfony\Component\Console\Helper;
  33002. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  33003. abstract class Helper implements HelperInterface
  33004. {
  33005. protected $helperSet = null;
  33006. public function setHelperSet(HelperSet $helperSet = null)
  33007. {
  33008. $this->helperSet = $helperSet;
  33009. }
  33010. public function getHelperSet()
  33011. {
  33012. return $this->helperSet;
  33013. }
  33014. public static function strlen($string)
  33015. {
  33016. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  33017. return strlen($string);
  33018. }
  33019. return mb_strwidth($string, $encoding);
  33020. }
  33021. public static function formatTime($secs)
  33022. {
  33023. static $timeFormats = array(
  33024. array(0, '< 1 sec'),
  33025. array(1, '1 sec'),
  33026. array(2, 'secs', 1),
  33027. array(60, '1 min'),
  33028. array(120, 'mins', 60),
  33029. array(3600, '1 hr'),
  33030. array(7200, 'hrs', 3600),
  33031. array(86400, '1 day'),
  33032. array(172800, 'days', 86400),
  33033. );
  33034. foreach ($timeFormats as $index => $format) {
  33035. if ($secs >= $format[0]) {
  33036. if ((isset($timeFormats[$index + 1]) && $secs < $timeFormats[$index + 1][0])
  33037. || $index == count($timeFormats) - 1
  33038. ) {
  33039. if (2 == count($format)) {
  33040. return $format[1];
  33041. }
  33042. return floor($secs / $format[2]).' '.$format[1];
  33043. }
  33044. }
  33045. }
  33046. }
  33047. public static function formatMemory($memory)
  33048. {
  33049. if ($memory >= 1024 * 1024 * 1024) {
  33050. return sprintf('%.1f GiB', $memory / 1024 / 1024 / 1024);
  33051. }
  33052. if ($memory >= 1024 * 1024) {
  33053. return sprintf('%.1f MiB', $memory / 1024 / 1024);
  33054. }
  33055. if ($memory >= 1024) {
  33056. return sprintf('%d KiB', $memory / 1024);
  33057. }
  33058. return sprintf('%d B', $memory);
  33059. }
  33060. public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)
  33061. {
  33062. return self::strlen(self::removeDecoration($formatter, $string));
  33063. }
  33064. public static function removeDecoration(OutputFormatterInterface $formatter, $string)
  33065. {
  33066. $isDecorated = $formatter->isDecorated();
  33067. $formatter->setDecorated(false);
  33068. $string = $formatter->format($string);
  33069. $string = preg_replace("/\033\[[^m]*m/", '', $string);
  33070. $formatter->setDecorated($isDecorated);
  33071. return $string;
  33072. }
  33073. }
  33074. <?php
  33075. namespace Symfony\Component\Console\Helper;
  33076. interface HelperInterface
  33077. {
  33078. public function setHelperSet(HelperSet $helperSet = null);
  33079. public function getHelperSet();
  33080. public function getName();
  33081. }
  33082. <?php
  33083. namespace Symfony\Component\Console\Helper;
  33084. use Symfony\Component\Console\Command\Command;
  33085. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33086. class HelperSet implements \IteratorAggregate
  33087. {
  33088. private $helpers = array();
  33089. private $command;
  33090. public function __construct(array $helpers = array())
  33091. {
  33092. foreach ($helpers as $alias => $helper) {
  33093. $this->set($helper, is_int($alias) ? null : $alias);
  33094. }
  33095. }
  33096. public function set(HelperInterface $helper, $alias = null)
  33097. {
  33098. $this->helpers[$helper->getName()] = $helper;
  33099. if (null !== $alias) {
  33100. $this->helpers[$alias] = $helper;
  33101. }
  33102. $helper->setHelperSet($this);
  33103. }
  33104. public function has($name)
  33105. {
  33106. return isset($this->helpers[$name]);
  33107. }
  33108. public function get($name)
  33109. {
  33110. if (!$this->has($name)) {
  33111. throw new InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name));
  33112. }
  33113. if ('dialog' === $name && $this->helpers[$name] instanceof DialogHelper) {
  33114. @trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
  33115. } elseif ('progress' === $name && $this->helpers[$name] instanceof ProgressHelper) {
  33116. @trigger_error('"Symfony\Component\Console\Helper\ProgressHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\ProgressBar" instead.', E_USER_DEPRECATED);
  33117. } elseif ('table' === $name && $this->helpers[$name] instanceof TableHelper) {
  33118. @trigger_error('"Symfony\Component\Console\Helper\TableHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\Table" instead.', E_USER_DEPRECATED);
  33119. }
  33120. return $this->helpers[$name];
  33121. }
  33122. public function setCommand(Command $command = null)
  33123. {
  33124. $this->command = $command;
  33125. }
  33126. public function getCommand()
  33127. {
  33128. return $this->command;
  33129. }
  33130. public function getIterator()
  33131. {
  33132. return new \ArrayIterator($this->helpers);
  33133. }
  33134. }
  33135. <?php
  33136. namespace Symfony\Component\Console\Helper;
  33137. use Symfony\Component\Console\Input\InputInterface;
  33138. use Symfony\Component\Console\Input\InputAwareInterface;
  33139. abstract class InputAwareHelper extends Helper implements InputAwareInterface
  33140. {
  33141. protected $input;
  33142. public function setInput(InputInterface $input)
  33143. {
  33144. $this->input = $input;
  33145. }
  33146. }
  33147. <?php
  33148. namespace Symfony\Component\Console\Helper;
  33149. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  33150. use Symfony\Component\Console\Output\OutputInterface;
  33151. use Symfony\Component\Process\Exception\ProcessFailedException;
  33152. use Symfony\Component\Process\Process;
  33153. use Symfony\Component\Process\ProcessBuilder;
  33154. class ProcessHelper extends Helper
  33155. {
  33156. public function run(OutputInterface $output, $cmd, $error = null, $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)
  33157. {
  33158. if ($output instanceof ConsoleOutputInterface) {
  33159. $output = $output->getErrorOutput();
  33160. }
  33161. $formatter = $this->getHelperSet()->get('debug_formatter');
  33162. if (is_array($cmd)) {
  33163. $process = ProcessBuilder::create($cmd)->getProcess();
  33164. } elseif ($cmd instanceof Process) {
  33165. $process = $cmd;
  33166. } else {
  33167. $process = new Process($cmd);
  33168. }
  33169. if ($verbosity <= $output->getVerbosity()) {
  33170. $output->write($formatter->start(spl_object_hash($process), $this->escapeString($process->getCommandLine())));
  33171. }
  33172. if ($output->isDebug()) {
  33173. $callback = $this->wrapCallback($output, $process, $callback);
  33174. }
  33175. $process->run($callback);
  33176. if ($verbosity <= $output->getVerbosity()) {
  33177. $message = $process->isSuccessful() ? 'Command ran successfully' : sprintf('%s Command did not run successfully', $process->getExitCode());
  33178. $output->write($formatter->stop(spl_object_hash($process), $message, $process->isSuccessful()));
  33179. }
  33180. if (!$process->isSuccessful() && null !== $error) {
  33181. $output->writeln(sprintf('<error>%s</error>', $this->escapeString($error)));
  33182. }
  33183. return $process;
  33184. }
  33185. public function mustRun(OutputInterface $output, $cmd, $error = null, $callback = null)
  33186. {
  33187. $process = $this->run($output, $cmd, $error, $callback);
  33188. if (!$process->isSuccessful()) {
  33189. throw new ProcessFailedException($process);
  33190. }
  33191. return $process;
  33192. }
  33193. public function wrapCallback(OutputInterface $output, Process $process, $callback = null)
  33194. {
  33195. if ($output instanceof ConsoleOutputInterface) {
  33196. $output = $output->getErrorOutput();
  33197. }
  33198. $formatter = $this->getHelperSet()->get('debug_formatter');
  33199. $that = $this;
  33200. return function ($type, $buffer) use ($output, $process, $callback, $formatter, $that) {
  33201. $output->write($formatter->progress(spl_object_hash($process), $that->escapeString($buffer), Process::ERR === $type));
  33202. if (null !== $callback) {
  33203. call_user_func($callback, $type, $buffer);
  33204. }
  33205. };
  33206. }
  33207. public function escapeString($str)
  33208. {
  33209. return str_replace('<', '\\<', $str);
  33210. }
  33211. public function getName()
  33212. {
  33213. return 'process';
  33214. }
  33215. }
  33216. <?php
  33217. namespace Symfony\Component\Console\Helper;
  33218. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  33219. use Symfony\Component\Console\Output\OutputInterface;
  33220. use Symfony\Component\Console\Exception\LogicException;
  33221. class ProgressBar
  33222. {
  33223. private $barWidth = 28;
  33224. private $barChar;
  33225. private $emptyBarChar = '-';
  33226. private $progressChar = '>';
  33227. private $format;
  33228. private $internalFormat;
  33229. private $redrawFreq = 1;
  33230. private $output;
  33231. private $step = 0;
  33232. private $max;
  33233. private $startTime;
  33234. private $stepWidth;
  33235. private $percent = 0.0;
  33236. private $formatLineCount;
  33237. private $messages = array();
  33238. private $overwrite = true;
  33239. private $firstRun = true;
  33240. private static $formatters;
  33241. private static $formats;
  33242. public function __construct(OutputInterface $output, $max = 0)
  33243. {
  33244. if ($output instanceof ConsoleOutputInterface) {
  33245. $output = $output->getErrorOutput();
  33246. }
  33247. $this->output = $output;
  33248. $this->setMaxSteps($max);
  33249. if (!$this->output->isDecorated()) {
  33250. $this->overwrite = false;
  33251. $this->setRedrawFrequency($max / 10);
  33252. }
  33253. $this->startTime = time();
  33254. }
  33255. public static function setPlaceholderFormatterDefinition($name, $callable)
  33256. {
  33257. if (!self::$formatters) {
  33258. self::$formatters = self::initPlaceholderFormatters();
  33259. }
  33260. self::$formatters[$name] = $callable;
  33261. }
  33262. public static function getPlaceholderFormatterDefinition($name)
  33263. {
  33264. if (!self::$formatters) {
  33265. self::$formatters = self::initPlaceholderFormatters();
  33266. }
  33267. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  33268. }
  33269. public static function setFormatDefinition($name, $format)
  33270. {
  33271. if (!self::$formats) {
  33272. self::$formats = self::initFormats();
  33273. }
  33274. self::$formats[$name] = $format;
  33275. }
  33276. public static function getFormatDefinition($name)
  33277. {
  33278. if (!self::$formats) {
  33279. self::$formats = self::initFormats();
  33280. }
  33281. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  33282. }
  33283. public function setMessage($message, $name = 'message')
  33284. {
  33285. $this->messages[$name] = $message;
  33286. }
  33287. public function getMessage($name = 'message')
  33288. {
  33289. return $this->messages[$name];
  33290. }
  33291. public function getStartTime()
  33292. {
  33293. return $this->startTime;
  33294. }
  33295. public function getMaxSteps()
  33296. {
  33297. return $this->max;
  33298. }
  33299. public function getStep()
  33300. {
  33301. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the getProgress() method instead.', E_USER_DEPRECATED);
  33302. return $this->getProgress();
  33303. }
  33304. public function getProgress()
  33305. {
  33306. return $this->step;
  33307. }
  33308. public function getStepWidth()
  33309. {
  33310. return $this->stepWidth;
  33311. }
  33312. public function getProgressPercent()
  33313. {
  33314. return $this->percent;
  33315. }
  33316. public function setBarWidth($size)
  33317. {
  33318. $this->barWidth = (int) $size;
  33319. }
  33320. public function getBarWidth()
  33321. {
  33322. return $this->barWidth;
  33323. }
  33324. public function setBarCharacter($char)
  33325. {
  33326. $this->barChar = $char;
  33327. }
  33328. public function getBarCharacter()
  33329. {
  33330. if (null === $this->barChar) {
  33331. return $this->max ? '=' : $this->emptyBarChar;
  33332. }
  33333. return $this->barChar;
  33334. }
  33335. public function setEmptyBarCharacter($char)
  33336. {
  33337. $this->emptyBarChar = $char;
  33338. }
  33339. public function getEmptyBarCharacter()
  33340. {
  33341. return $this->emptyBarChar;
  33342. }
  33343. public function setProgressCharacter($char)
  33344. {
  33345. $this->progressChar = $char;
  33346. }
  33347. public function getProgressCharacter()
  33348. {
  33349. return $this->progressChar;
  33350. }
  33351. public function setFormat($format)
  33352. {
  33353. $this->format = null;
  33354. $this->internalFormat = $format;
  33355. }
  33356. public function setRedrawFrequency($freq)
  33357. {
  33358. $this->redrawFreq = max((int) $freq, 1);
  33359. }
  33360. public function start($max = null)
  33361. {
  33362. $this->startTime = time();
  33363. $this->step = 0;
  33364. $this->percent = 0.0;
  33365. if (null !== $max) {
  33366. $this->setMaxSteps($max);
  33367. }
  33368. $this->display();
  33369. }
  33370. public function advance($step = 1)
  33371. {
  33372. $this->setProgress($this->step + $step);
  33373. }
  33374. public function setCurrent($step)
  33375. {
  33376. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the setProgress() method instead.', E_USER_DEPRECATED);
  33377. $this->setProgress($step);
  33378. }
  33379. public function setOverwrite($overwrite)
  33380. {
  33381. $this->overwrite = (bool) $overwrite;
  33382. }
  33383. public function setProgress($step)
  33384. {
  33385. $step = (int) $step;
  33386. if ($step < $this->step) {
  33387. throw new LogicException('You can\'t regress the progress bar.');
  33388. }
  33389. if ($this->max && $step > $this->max) {
  33390. $this->max = $step;
  33391. }
  33392. $prevPeriod = (int) ($this->step / $this->redrawFreq);
  33393. $currPeriod = (int) ($step / $this->redrawFreq);
  33394. $this->step = $step;
  33395. $this->percent = $this->max ? (float) $this->step / $this->max : 0;
  33396. if ($prevPeriod !== $currPeriod || $this->max === $step) {
  33397. $this->display();
  33398. }
  33399. }
  33400. public function finish()
  33401. {
  33402. if (!$this->max) {
  33403. $this->max = $this->step;
  33404. }
  33405. if ($this->step === $this->max && !$this->overwrite) {
  33406. return;
  33407. }
  33408. $this->setProgress($this->max);
  33409. }
  33410. public function display()
  33411. {
  33412. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  33413. return;
  33414. }
  33415. if (null === $this->format) {
  33416. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  33417. }
  33418. $self = $this;
  33419. $output = $this->output;
  33420. $messages = $this->messages;
  33421. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self, $output, $messages) {
  33422. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  33423. $text = call_user_func($formatter, $self, $output);
  33424. } elseif (isset($messages[$matches[1]])) {
  33425. $text = $messages[$matches[1]];
  33426. } else {
  33427. return $matches[0];
  33428. }
  33429. if (isset($matches[2])) {
  33430. $text = sprintf('%'.$matches[2], $text);
  33431. }
  33432. return $text;
  33433. }, $this->format));
  33434. }
  33435. public function clear()
  33436. {
  33437. if (!$this->overwrite) {
  33438. return;
  33439. }
  33440. if (null === $this->format) {
  33441. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  33442. }
  33443. $this->overwrite('');
  33444. }
  33445. private function setRealFormat($format)
  33446. {
  33447. if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) {
  33448. $this->format = self::getFormatDefinition($format.'_nomax');
  33449. } elseif (null !== self::getFormatDefinition($format)) {
  33450. $this->format = self::getFormatDefinition($format);
  33451. } else {
  33452. $this->format = $format;
  33453. }
  33454. $this->formatLineCount = substr_count($this->format, "\n");
  33455. }
  33456. private function setMaxSteps($max)
  33457. {
  33458. $this->max = max(0, (int) $max);
  33459. $this->stepWidth = $this->max ? Helper::strlen($this->max) : 4;
  33460. }
  33461. private function overwrite($message)
  33462. {
  33463. if ($this->overwrite) {
  33464. if (!$this->firstRun) {
  33465. $this->output->write("\x0D");
  33466. $this->output->write("\x1B[2K");
  33467. if ($this->formatLineCount > 0) {
  33468. $this->output->write(str_repeat("\x1B[1A\x1B[2K", $this->formatLineCount));
  33469. }
  33470. }
  33471. } elseif ($this->step > 0) {
  33472. $this->output->writeln('');
  33473. }
  33474. $this->firstRun = false;
  33475. $this->output->write($message);
  33476. }
  33477. private function determineBestFormat()
  33478. {
  33479. switch ($this->output->getVerbosity()) {
  33480. case OutputInterface::VERBOSITY_VERBOSE:
  33481. return $this->max ? 'verbose' : 'verbose_nomax';
  33482. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  33483. return $this->max ? 'very_verbose' : 'very_verbose_nomax';
  33484. case OutputInterface::VERBOSITY_DEBUG:
  33485. return $this->max ? 'debug' : 'debug_nomax';
  33486. default:
  33487. return $this->max ? 'normal' : 'normal_nomax';
  33488. }
  33489. }
  33490. private static function initPlaceholderFormatters()
  33491. {
  33492. return array(
  33493. 'bar' => function (ProgressBar $bar, OutputInterface $output) {
  33494. $completeBars = floor($bar->getMaxSteps() > 0 ? $bar->getProgressPercent() * $bar->getBarWidth() : $bar->getProgress() % $bar->getBarWidth());
  33495. $display = str_repeat($bar->getBarCharacter(), $completeBars);
  33496. if ($completeBars < $bar->getBarWidth()) {
  33497. $emptyBars = $bar->getBarWidth() - $completeBars - Helper::strlenWithoutDecoration($output->getFormatter(), $bar->getProgressCharacter());
  33498. $display .= $bar->getProgressCharacter().str_repeat($bar->getEmptyBarCharacter(), $emptyBars);
  33499. }
  33500. return $display;
  33501. },
  33502. 'elapsed' => function (ProgressBar $bar) {
  33503. return Helper::formatTime(time() - $bar->getStartTime());
  33504. },
  33505. 'remaining' => function (ProgressBar $bar) {
  33506. if (!$bar->getMaxSteps()) {
  33507. throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.');
  33508. }
  33509. if (!$bar->getProgress()) {
  33510. $remaining = 0;
  33511. } else {
  33512. $remaining = round((time() - $bar->getStartTime()) / $bar->getProgress() * ($bar->getMaxSteps() - $bar->getProgress()));
  33513. }
  33514. return Helper::formatTime($remaining);
  33515. },
  33516. 'estimated' => function (ProgressBar $bar) {
  33517. if (!$bar->getMaxSteps()) {
  33518. throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.');
  33519. }
  33520. if (!$bar->getProgress()) {
  33521. $estimated = 0;
  33522. } else {
  33523. $estimated = round((time() - $bar->getStartTime()) / $bar->getProgress() * $bar->getMaxSteps());
  33524. }
  33525. return Helper::formatTime($estimated);
  33526. },
  33527. 'memory' => function (ProgressBar $bar) {
  33528. return Helper::formatMemory(memory_get_usage(true));
  33529. },
  33530. 'current' => function (ProgressBar $bar) {
  33531. return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', STR_PAD_LEFT);
  33532. },
  33533. 'max' => function (ProgressBar $bar) {
  33534. return $bar->getMaxSteps();
  33535. },
  33536. 'percent' => function (ProgressBar $bar) {
  33537. return floor($bar->getProgressPercent() * 100);
  33538. },
  33539. );
  33540. }
  33541. private static function initFormats()
  33542. {
  33543. return array(
  33544. 'normal' => ' %current%/%max% [%bar%] %percent:3s%%',
  33545. 'normal_nomax' => ' %current% [%bar%]',
  33546. 'verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%',
  33547. 'verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  33548. 'very_verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%',
  33549. 'very_verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  33550. 'debug' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%',
  33551. 'debug_nomax' => ' %current% [%bar%] %elapsed:6s% %memory:6s%',
  33552. );
  33553. }
  33554. }
  33555. <?php
  33556. namespace Symfony\Component\Console\Helper;
  33557. use Symfony\Component\Console\Output\NullOutput;
  33558. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  33559. use Symfony\Component\Console\Output\OutputInterface;
  33560. use Symfony\Component\Console\Exception\LogicException;
  33561. class ProgressHelper extends Helper
  33562. {
  33563. const FORMAT_QUIET = ' %percent%%';
  33564. const FORMAT_NORMAL = ' %current%/%max% [%bar%] %percent%%';
  33565. const FORMAT_VERBOSE = ' %current%/%max% [%bar%] %percent%% Elapsed: %elapsed%';
  33566. const FORMAT_QUIET_NOMAX = ' %current%';
  33567. const FORMAT_NORMAL_NOMAX = ' %current% [%bar%]';
  33568. const FORMAT_VERBOSE_NOMAX = ' %current% [%bar%] Elapsed: %elapsed%';
  33569. private $barWidth = 28;
  33570. private $barChar = '=';
  33571. private $emptyBarChar = '-';
  33572. private $progressChar = '>';
  33573. private $format = null;
  33574. private $redrawFreq = 1;
  33575. private $lastMessagesLength;
  33576. private $barCharOriginal;
  33577. private $output;
  33578. private $current;
  33579. private $max;
  33580. private $startTime;
  33581. private $defaultFormatVars = array(
  33582. 'current',
  33583. 'max',
  33584. 'bar',
  33585. 'percent',
  33586. 'elapsed',
  33587. );
  33588. private $formatVars;
  33589. private $widths = array(
  33590. 'current' => 4,
  33591. 'max' => 4,
  33592. 'percent' => 3,
  33593. 'elapsed' => 6,
  33594. );
  33595. private $timeFormats = array(
  33596. array(0, '???'),
  33597. array(2, '1 sec'),
  33598. array(59, 'secs', 1),
  33599. array(60, '1 min'),
  33600. array(3600, 'mins', 60),
  33601. array(5400, '1 hr'),
  33602. array(86400, 'hrs', 3600),
  33603. array(129600, '1 day'),
  33604. array(604800, 'days', 86400),
  33605. );
  33606. public function __construct($triggerDeprecationError = true)
  33607. {
  33608. if ($triggerDeprecationError) {
  33609. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\ProgressBar class instead.', E_USER_DEPRECATED);
  33610. }
  33611. }
  33612. public function setBarWidth($size)
  33613. {
  33614. $this->barWidth = (int) $size;
  33615. }
  33616. public function setBarCharacter($char)
  33617. {
  33618. $this->barChar = $char;
  33619. }
  33620. public function setEmptyBarCharacter($char)
  33621. {
  33622. $this->emptyBarChar = $char;
  33623. }
  33624. public function setProgressCharacter($char)
  33625. {
  33626. $this->progressChar = $char;
  33627. }
  33628. public function setFormat($format)
  33629. {
  33630. $this->format = $format;
  33631. }
  33632. public function setRedrawFrequency($freq)
  33633. {
  33634. $this->redrawFreq = (int) $freq;
  33635. }
  33636. public function start(OutputInterface $output, $max = null)
  33637. {
  33638. if ($output instanceof ConsoleOutputInterface) {
  33639. $output = $output->getErrorOutput();
  33640. }
  33641. $this->startTime = time();
  33642. $this->current = 0;
  33643. $this->max = (int) $max;
  33644. $this->output = $output->isDecorated() ? $output : new NullOutput();
  33645. $this->lastMessagesLength = 0;
  33646. $this->barCharOriginal = '';
  33647. if (null === $this->format) {
  33648. switch ($output->getVerbosity()) {
  33649. case OutputInterface::VERBOSITY_QUIET:
  33650. $this->format = self::FORMAT_QUIET_NOMAX;
  33651. if ($this->max > 0) {
  33652. $this->format = self::FORMAT_QUIET;
  33653. }
  33654. break;
  33655. case OutputInterface::VERBOSITY_VERBOSE:
  33656. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  33657. case OutputInterface::VERBOSITY_DEBUG:
  33658. $this->format = self::FORMAT_VERBOSE_NOMAX;
  33659. if ($this->max > 0) {
  33660. $this->format = self::FORMAT_VERBOSE;
  33661. }
  33662. break;
  33663. default:
  33664. $this->format = self::FORMAT_NORMAL_NOMAX;
  33665. if ($this->max > 0) {
  33666. $this->format = self::FORMAT_NORMAL;
  33667. }
  33668. break;
  33669. }
  33670. }
  33671. $this->initialize();
  33672. }
  33673. public function advance($step = 1, $redraw = false)
  33674. {
  33675. $this->setCurrent($this->current + $step, $redraw);
  33676. }
  33677. public function setCurrent($current, $redraw = false)
  33678. {
  33679. if (null === $this->startTime) {
  33680. throw new LogicException('You must start the progress bar before calling setCurrent().');
  33681. }
  33682. $current = (int) $current;
  33683. if ($current < $this->current) {
  33684. throw new LogicException('You can\'t regress the progress bar');
  33685. }
  33686. if (0 === $this->current) {
  33687. $redraw = true;
  33688. }
  33689. $prevPeriod = (int) ($this->current / $this->redrawFreq);
  33690. $this->current = $current;
  33691. $currPeriod = (int) ($this->current / $this->redrawFreq);
  33692. if ($redraw || $prevPeriod !== $currPeriod || $this->max === $this->current) {
  33693. $this->display();
  33694. }
  33695. }
  33696. public function display($finish = false)
  33697. {
  33698. if (null === $this->startTime) {
  33699. throw new LogicException('You must start the progress bar before calling display().');
  33700. }
  33701. $message = $this->format;
  33702. foreach ($this->generate($finish) as $name => $value) {
  33703. $message = str_replace("%{$name}%", $value, $message);
  33704. }
  33705. $this->overwrite($this->output, $message);
  33706. }
  33707. public function clear()
  33708. {
  33709. $this->overwrite($this->output, '');
  33710. }
  33711. public function finish()
  33712. {
  33713. if (null === $this->startTime) {
  33714. throw new LogicException('You must start the progress bar before calling finish().');
  33715. }
  33716. if (null !== $this->startTime) {
  33717. if (!$this->max) {
  33718. $this->barChar = $this->barCharOriginal;
  33719. $this->display(true);
  33720. }
  33721. $this->startTime = null;
  33722. $this->output->writeln('');
  33723. $this->output = null;
  33724. }
  33725. }
  33726. private function initialize()
  33727. {
  33728. $this->formatVars = array();
  33729. foreach ($this->defaultFormatVars as $var) {
  33730. if (false !== strpos($this->format, "%{$var}%")) {
  33731. $this->formatVars[$var] = true;
  33732. }
  33733. }
  33734. if ($this->max > 0) {
  33735. $this->widths['max'] = $this->strlen($this->max);
  33736. $this->widths['current'] = $this->widths['max'];
  33737. } else {
  33738. $this->barCharOriginal = $this->barChar;
  33739. $this->barChar = $this->emptyBarChar;
  33740. }
  33741. }
  33742. private function generate($finish = false)
  33743. {
  33744. $vars = array();
  33745. $percent = 0;
  33746. if ($this->max > 0) {
  33747. $percent = (float) $this->current / $this->max;
  33748. }
  33749. if (isset($this->formatVars['bar'])) {
  33750. if ($this->max > 0) {
  33751. $completeBars = floor($percent * $this->barWidth);
  33752. } else {
  33753. if (!$finish) {
  33754. $completeBars = floor($this->current % $this->barWidth);
  33755. } else {
  33756. $completeBars = $this->barWidth;
  33757. }
  33758. }
  33759. $emptyBars = $this->barWidth - $completeBars - $this->strlen($this->progressChar);
  33760. $bar = str_repeat($this->barChar, $completeBars);
  33761. if ($completeBars < $this->barWidth) {
  33762. $bar .= $this->progressChar;
  33763. $bar .= str_repeat($this->emptyBarChar, $emptyBars);
  33764. }
  33765. $vars['bar'] = $bar;
  33766. }
  33767. if (isset($this->formatVars['elapsed'])) {
  33768. $elapsed = time() - $this->startTime;
  33769. $vars['elapsed'] = str_pad($this->humaneTime($elapsed), $this->widths['elapsed'], ' ', STR_PAD_LEFT);
  33770. }
  33771. if (isset($this->formatVars['current'])) {
  33772. $vars['current'] = str_pad($this->current, $this->widths['current'], ' ', STR_PAD_LEFT);
  33773. }
  33774. if (isset($this->formatVars['max'])) {
  33775. $vars['max'] = $this->max;
  33776. }
  33777. if (isset($this->formatVars['percent'])) {
  33778. $vars['percent'] = str_pad(floor($percent * 100), $this->widths['percent'], ' ', STR_PAD_LEFT);
  33779. }
  33780. return $vars;
  33781. }
  33782. private function humaneTime($secs)
  33783. {
  33784. $text = '';
  33785. foreach ($this->timeFormats as $format) {
  33786. if ($secs < $format[0]) {
  33787. if (2 == count($format)) {
  33788. $text = $format[1];
  33789. break;
  33790. } else {
  33791. $text = ceil($secs / $format[2]).' '.$format[1];
  33792. break;
  33793. }
  33794. }
  33795. }
  33796. return $text;
  33797. }
  33798. private function overwrite(OutputInterface $output, $message)
  33799. {
  33800. $length = $this->strlen($message);
  33801. if (null !== $this->lastMessagesLength && $this->lastMessagesLength > $length) {
  33802. $message = str_pad($message, $this->lastMessagesLength, "\x20", STR_PAD_RIGHT);
  33803. }
  33804. $output->write("\x0D");
  33805. $output->write($message);
  33806. $this->lastMessagesLength = $this->strlen($message);
  33807. }
  33808. public function getName()
  33809. {
  33810. return 'progress';
  33811. }
  33812. }
  33813. <?php
  33814. namespace Symfony\Component\Console\Helper;
  33815. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33816. use Symfony\Component\Console\Exception\LogicException;
  33817. use Symfony\Component\Console\Output\OutputInterface;
  33818. class ProgressIndicator
  33819. {
  33820. private $output;
  33821. private $startTime;
  33822. private $format;
  33823. private $message;
  33824. private $indicatorValues;
  33825. private $indicatorCurrent;
  33826. private $indicatorChangeInterval;
  33827. private $indicatorUpdateTime;
  33828. private $started = false;
  33829. private static $formatters;
  33830. private static $formats;
  33831. public function __construct(OutputInterface $output, $format = null, $indicatorChangeInterval = 100, $indicatorValues = null)
  33832. {
  33833. $this->output = $output;
  33834. if (null === $format) {
  33835. $format = $this->determineBestFormat();
  33836. }
  33837. if (null === $indicatorValues) {
  33838. $indicatorValues = array('-', '\\', '|', '/');
  33839. }
  33840. $indicatorValues = array_values($indicatorValues);
  33841. if (2 > count($indicatorValues)) {
  33842. throw new InvalidArgumentException('Must have at least 2 indicator value characters.');
  33843. }
  33844. $this->format = self::getFormatDefinition($format);
  33845. $this->indicatorChangeInterval = $indicatorChangeInterval;
  33846. $this->indicatorValues = $indicatorValues;
  33847. $this->startTime = time();
  33848. }
  33849. public function setMessage($message)
  33850. {
  33851. $this->message = $message;
  33852. $this->display();
  33853. }
  33854. public function getMessage()
  33855. {
  33856. return $this->message;
  33857. }
  33858. public function getStartTime()
  33859. {
  33860. return $this->startTime;
  33861. }
  33862. public function getCurrentValue()
  33863. {
  33864. return $this->indicatorValues[$this->indicatorCurrent % count($this->indicatorValues)];
  33865. }
  33866. public function start($message)
  33867. {
  33868. if ($this->started) {
  33869. throw new LogicException('Progress indicator already started.');
  33870. }
  33871. $this->message = $message;
  33872. $this->started = true;
  33873. $this->startTime = time();
  33874. $this->indicatorUpdateTime = $this->getCurrentTimeInMilliseconds() + $this->indicatorChangeInterval;
  33875. $this->indicatorCurrent = 0;
  33876. $this->display();
  33877. }
  33878. public function advance()
  33879. {
  33880. if (!$this->started) {
  33881. throw new LogicException('Progress indicator has not yet been started.');
  33882. }
  33883. if (!$this->output->isDecorated()) {
  33884. return;
  33885. }
  33886. $currentTime = $this->getCurrentTimeInMilliseconds();
  33887. if ($currentTime < $this->indicatorUpdateTime) {
  33888. return;
  33889. }
  33890. $this->indicatorUpdateTime = $currentTime + $this->indicatorChangeInterval;
  33891. ++$this->indicatorCurrent;
  33892. $this->display();
  33893. }
  33894. public function finish($message)
  33895. {
  33896. if (!$this->started) {
  33897. throw new LogicException('Progress indicator has not yet been started.');
  33898. }
  33899. $this->message = $message;
  33900. $this->display();
  33901. $this->output->writeln('');
  33902. $this->started = false;
  33903. }
  33904. public static function getFormatDefinition($name)
  33905. {
  33906. if (!self::$formats) {
  33907. self::$formats = self::initFormats();
  33908. }
  33909. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  33910. }
  33911. public static function setPlaceholderFormatterDefinition($name, $callable)
  33912. {
  33913. if (!self::$formatters) {
  33914. self::$formatters = self::initPlaceholderFormatters();
  33915. }
  33916. self::$formatters[$name] = $callable;
  33917. }
  33918. public static function getPlaceholderFormatterDefinition($name)
  33919. {
  33920. if (!self::$formatters) {
  33921. self::$formatters = self::initPlaceholderFormatters();
  33922. }
  33923. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  33924. }
  33925. private function display()
  33926. {
  33927. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  33928. return;
  33929. }
  33930. $self = $this;
  33931. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self) {
  33932. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  33933. return call_user_func($formatter, $self);
  33934. }
  33935. return $matches[0];
  33936. }, $this->format));
  33937. }
  33938. private function determineBestFormat()
  33939. {
  33940. switch ($this->output->getVerbosity()) {
  33941. case OutputInterface::VERBOSITY_VERBOSE:
  33942. return $this->output->isDecorated() ? 'verbose' : 'verbose_no_ansi';
  33943. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  33944. case OutputInterface::VERBOSITY_DEBUG:
  33945. return $this->output->isDecorated() ? 'very_verbose' : 'very_verbose_no_ansi';
  33946. default:
  33947. return $this->output->isDecorated() ? 'normal' : 'normal_no_ansi';
  33948. }
  33949. }
  33950. private function overwrite($message)
  33951. {
  33952. if ($this->output->isDecorated()) {
  33953. $this->output->write("\x0D\x1B[2K");
  33954. $this->output->write($message);
  33955. } else {
  33956. $this->output->writeln($message);
  33957. }
  33958. }
  33959. private function getCurrentTimeInMilliseconds()
  33960. {
  33961. return round(microtime(true) * 1000);
  33962. }
  33963. private static function initPlaceholderFormatters()
  33964. {
  33965. return array(
  33966. 'indicator' => function (ProgressIndicator $indicator) {
  33967. return $indicator->getCurrentValue();
  33968. },
  33969. 'message' => function (ProgressIndicator $indicator) {
  33970. return $indicator->getMessage();
  33971. },
  33972. 'elapsed' => function (ProgressIndicator $indicator) {
  33973. return Helper::formatTime(time() - $indicator->getStartTime());
  33974. },
  33975. 'memory' => function () {
  33976. return Helper::formatMemory(memory_get_usage(true));
  33977. },
  33978. );
  33979. }
  33980. private static function initFormats()
  33981. {
  33982. return array(
  33983. 'normal' => ' %indicator% %message%',
  33984. 'normal_no_ansi' => ' %message%',
  33985. 'verbose' => ' %indicator% %message% (%elapsed:6s%)',
  33986. 'verbose_no_ansi' => ' %message% (%elapsed:6s%)',
  33987. 'very_verbose' => ' %indicator% %message% (%elapsed:6s%, %memory:6s%)',
  33988. 'very_verbose_no_ansi' => ' %message% (%elapsed:6s%, %memory:6s%)',
  33989. );
  33990. }
  33991. }
  33992. <?php
  33993. namespace Symfony\Component\Console\Helper;
  33994. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33995. use Symfony\Component\Console\Exception\RuntimeException;
  33996. use Symfony\Component\Console\Formatter\OutputFormatter;
  33997. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  33998. use Symfony\Component\Console\Input\InputInterface;
  33999. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  34000. use Symfony\Component\Console\Output\OutputInterface;
  34001. use Symfony\Component\Console\Question\Question;
  34002. use Symfony\Component\Console\Question\ChoiceQuestion;
  34003. class QuestionHelper extends Helper
  34004. {
  34005. private $inputStream;
  34006. private static $shell;
  34007. private static $stty;
  34008. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  34009. {
  34010. if ($output instanceof ConsoleOutputInterface) {
  34011. $output = $output->getErrorOutput();
  34012. }
  34013. if (!$input->isInteractive()) {
  34014. if ($question instanceof ChoiceQuestion) {
  34015. $choices = $question->getChoices();
  34016. return $choices[$question->getDefault()];
  34017. }
  34018. return $question->getDefault();
  34019. }
  34020. if (!$question->getValidator()) {
  34021. return $this->doAsk($output, $question);
  34022. }
  34023. $that = $this;
  34024. $interviewer = function () use ($output, $question, $that) {
  34025. return $that->doAsk($output, $question);
  34026. };
  34027. return $this->validateAttempts($interviewer, $output, $question);
  34028. }
  34029. public function setInputStream($stream)
  34030. {
  34031. if (!is_resource($stream)) {
  34032. throw new InvalidArgumentException('Input stream must be a valid resource.');
  34033. }
  34034. $this->inputStream = $stream;
  34035. }
  34036. public function getInputStream()
  34037. {
  34038. return $this->inputStream;
  34039. }
  34040. public function getName()
  34041. {
  34042. return 'question';
  34043. }
  34044. public function doAsk(OutputInterface $output, Question $question)
  34045. {
  34046. $this->writePrompt($output, $question);
  34047. $inputStream = $this->inputStream ?: STDIN;
  34048. $autocomplete = $question->getAutocompleterValues();
  34049. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  34050. $ret = false;
  34051. if ($question->isHidden()) {
  34052. try {
  34053. $ret = trim($this->getHiddenResponse($output, $inputStream));
  34054. } catch (RuntimeException $e) {
  34055. if (!$question->isHiddenFallback()) {
  34056. throw $e;
  34057. }
  34058. }
  34059. }
  34060. if (false === $ret) {
  34061. $ret = fgets($inputStream, 4096);
  34062. if (false === $ret) {
  34063. throw new RuntimeException('Aborted');
  34064. }
  34065. $ret = trim($ret);
  34066. }
  34067. } else {
  34068. $ret = trim($this->autocomplete($output, $question, $inputStream, is_array($autocomplete) ? $autocomplete : iterator_to_array($autocomplete, false)));
  34069. }
  34070. $ret = strlen($ret) > 0 ? $ret : $question->getDefault();
  34071. if ($normalizer = $question->getNormalizer()) {
  34072. return $normalizer($ret);
  34073. }
  34074. return $ret;
  34075. }
  34076. protected function writePrompt(OutputInterface $output, Question $question)
  34077. {
  34078. $message = $question->getQuestion();
  34079. if ($question instanceof ChoiceQuestion) {
  34080. $maxWidth = max(array_map(array($this, 'strlen'), array_keys($question->getChoices())));
  34081. $messages = (array) $question->getQuestion();
  34082. foreach ($question->getChoices() as $key => $value) {
  34083. $width = $maxWidth - $this->strlen($key);
  34084. $messages[] = ' [<info>'.$key.str_repeat(' ', $width).'</info>] '.$value;
  34085. }
  34086. $output->writeln($messages);
  34087. $message = $question->getPrompt();
  34088. }
  34089. $output->write($message);
  34090. }
  34091. protected function writeError(OutputInterface $output, \Exception $error)
  34092. {
  34093. if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) {
  34094. $message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error');
  34095. } else {
  34096. $message = '<error>'.$error->getMessage().'</error>';
  34097. }
  34098. $output->writeln($message);
  34099. }
  34100. private function autocomplete(OutputInterface $output, Question $question, $inputStream, array $autocomplete)
  34101. {
  34102. $ret = '';
  34103. $i = 0;
  34104. $ofs = -1;
  34105. $matches = $autocomplete;
  34106. $numMatches = count($matches);
  34107. $sttyMode = shell_exec('stty -g');
  34108. shell_exec('stty -icanon -echo');
  34109. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  34110. while (!feof($inputStream)) {
  34111. $c = fread($inputStream, 1);
  34112. if ("\177" === $c) {
  34113. if (0 === $numMatches && 0 !== $i) {
  34114. --$i;
  34115. $output->write("\033[1D");
  34116. }
  34117. if (0 === $i) {
  34118. $ofs = -1;
  34119. $matches = $autocomplete;
  34120. $numMatches = count($matches);
  34121. } else {
  34122. $numMatches = 0;
  34123. }
  34124. $ret = substr($ret, 0, $i);
  34125. } elseif ("\033" === $c) {
  34126. $c .= fread($inputStream, 2);
  34127. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  34128. if ('A' === $c[2] && -1 === $ofs) {
  34129. $ofs = 0;
  34130. }
  34131. if (0 === $numMatches) {
  34132. continue;
  34133. }
  34134. $ofs += ('A' === $c[2]) ? -1 : 1;
  34135. $ofs = ($numMatches + $ofs) % $numMatches;
  34136. }
  34137. } elseif (ord($c) < 32) {
  34138. if ("\t" === $c || "\n" === $c) {
  34139. if ($numMatches > 0 && -1 !== $ofs) {
  34140. $ret = $matches[$ofs];
  34141. $output->write(substr($ret, $i));
  34142. $i = strlen($ret);
  34143. }
  34144. if ("\n" === $c) {
  34145. $output->write($c);
  34146. break;
  34147. }
  34148. $numMatches = 0;
  34149. }
  34150. continue;
  34151. } else {
  34152. $output->write($c);
  34153. $ret .= $c;
  34154. ++$i;
  34155. $numMatches = 0;
  34156. $ofs = 0;
  34157. foreach ($autocomplete as $value) {
  34158. if (0 === strpos($value, $ret) && $i !== strlen($value)) {
  34159. $matches[$numMatches++] = $value;
  34160. }
  34161. }
  34162. }
  34163. $output->write("\033[K");
  34164. if ($numMatches > 0 && -1 !== $ofs) {
  34165. $output->write("\0337");
  34166. $output->write('<hl>'.OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs], $i)).'</hl>');
  34167. $output->write("\0338");
  34168. }
  34169. }
  34170. shell_exec(sprintf('stty %s', $sttyMode));
  34171. return $ret;
  34172. }
  34173. private function getHiddenResponse(OutputInterface $output, $inputStream)
  34174. {
  34175. if ('\\' === DIRECTORY_SEPARATOR) {
  34176. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  34177. if ('phar:' === substr(__FILE__, 0, 5)) {
  34178. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  34179. copy($exe, $tmpExe);
  34180. $exe = $tmpExe;
  34181. }
  34182. $value = rtrim(shell_exec($exe));
  34183. $output->writeln('');
  34184. if (isset($tmpExe)) {
  34185. unlink($tmpExe);
  34186. }
  34187. return $value;
  34188. }
  34189. if ($this->hasSttyAvailable()) {
  34190. $sttyMode = shell_exec('stty -g');
  34191. shell_exec('stty -echo');
  34192. $value = fgets($inputStream, 4096);
  34193. shell_exec(sprintf('stty %s', $sttyMode));
  34194. if (false === $value) {
  34195. throw new RuntimeException('Aborted');
  34196. }
  34197. $value = trim($value);
  34198. $output->writeln('');
  34199. return $value;
  34200. }
  34201. if (false !== $shell = $this->getShell()) {
  34202. $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
  34203. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  34204. $value = rtrim(shell_exec($command));
  34205. $output->writeln('');
  34206. return $value;
  34207. }
  34208. throw new RuntimeException('Unable to hide the response.');
  34209. }
  34210. private function validateAttempts($interviewer, OutputInterface $output, Question $question)
  34211. {
  34212. $error = null;
  34213. $attempts = $question->getMaxAttempts();
  34214. while (null === $attempts || $attempts--) {
  34215. if (null !== $error) {
  34216. $this->writeError($output, $error);
  34217. }
  34218. try {
  34219. return call_user_func($question->getValidator(), $interviewer());
  34220. } catch (RuntimeException $e) {
  34221. throw $e;
  34222. } catch (\Exception $error) {
  34223. }
  34224. }
  34225. throw $error;
  34226. }
  34227. private function getShell()
  34228. {
  34229. if (null !== self::$shell) {
  34230. return self::$shell;
  34231. }
  34232. self::$shell = false;
  34233. if (file_exists('/usr/bin/env')) {
  34234. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  34235. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  34236. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  34237. self::$shell = $sh;
  34238. break;
  34239. }
  34240. }
  34241. }
  34242. return self::$shell;
  34243. }
  34244. private function hasSttyAvailable()
  34245. {
  34246. if (null !== self::$stty) {
  34247. return self::$stty;
  34248. }
  34249. exec('stty 2>&1', $output, $exitcode);
  34250. return self::$stty = 0 === $exitcode;
  34251. }
  34252. }
  34253. <?php
  34254. namespace Symfony\Component\Console\Helper;
  34255. use Symfony\Component\Console\Exception\LogicException;
  34256. use Symfony\Component\Console\Input\InputInterface;
  34257. use Symfony\Component\Console\Output\OutputInterface;
  34258. use Symfony\Component\Console\Question\ChoiceQuestion;
  34259. use Symfony\Component\Console\Question\ConfirmationQuestion;
  34260. use Symfony\Component\Console\Question\Question;
  34261. use Symfony\Component\Console\Style\SymfonyStyle;
  34262. use Symfony\Component\Console\Formatter\OutputFormatter;
  34263. class SymfonyQuestionHelper extends QuestionHelper
  34264. {
  34265. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  34266. {
  34267. $validator = $question->getValidator();
  34268. $question->setValidator(function ($value) use ($validator) {
  34269. if (null !== $validator) {
  34270. $value = $validator($value);
  34271. } else {
  34272. if (!is_array($value) && !is_bool($value) && 0 === strlen($value)) {
  34273. throw new LogicException('A value is required.');
  34274. }
  34275. }
  34276. return $value;
  34277. });
  34278. return parent::ask($input, $output, $question);
  34279. }
  34280. protected function writePrompt(OutputInterface $output, Question $question)
  34281. {
  34282. $text = OutputFormatter::escapeTrailingBackslash($question->getQuestion());
  34283. $default = $question->getDefault();
  34284. switch (true) {
  34285. case null === $default:
  34286. $text = sprintf(' <info>%s</info>:', $text);
  34287. break;
  34288. case $question instanceof ConfirmationQuestion:
  34289. $text = sprintf(' <info>%s (yes/no)</info> [<comment>%s</comment>]:', $text, $default ? 'yes' : 'no');
  34290. break;
  34291. case $question instanceof ChoiceQuestion && $question->isMultiselect():
  34292. $choices = $question->getChoices();
  34293. $default = explode(',', $default);
  34294. foreach ($default as $key => $value) {
  34295. $default[$key] = $choices[trim($value)];
  34296. }
  34297. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(implode(', ', $default)));
  34298. break;
  34299. case $question instanceof ChoiceQuestion:
  34300. $choices = $question->getChoices();
  34301. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($choices[$default]));
  34302. break;
  34303. default:
  34304. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($default));
  34305. }
  34306. $output->writeln($text);
  34307. if ($question instanceof ChoiceQuestion) {
  34308. $width = max(array_map('strlen', array_keys($question->getChoices())));
  34309. foreach ($question->getChoices() as $key => $value) {
  34310. $output->writeln(sprintf(" [<comment>%-${width}s</comment>] %s", $key, $value));
  34311. }
  34312. }
  34313. $output->write(' > ');
  34314. }
  34315. protected function writeError(OutputInterface $output, \Exception $error)
  34316. {
  34317. if ($output instanceof SymfonyStyle) {
  34318. $output->newLine();
  34319. $output->error($error->getMessage());
  34320. return;
  34321. }
  34322. parent::writeError($output, $error);
  34323. }
  34324. }
  34325. <?php
  34326. namespace Symfony\Component\Console\Helper;
  34327. use Symfony\Component\Console\Output\OutputInterface;
  34328. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34329. class Table
  34330. {
  34331. private $headers = array();
  34332. private $rows = array();
  34333. private $columnWidths = array();
  34334. private $numberOfColumns;
  34335. private $output;
  34336. private $style;
  34337. private $columnStyles = array();
  34338. private static $styles;
  34339. public function __construct(OutputInterface $output)
  34340. {
  34341. $this->output = $output;
  34342. if (!self::$styles) {
  34343. self::$styles = self::initStyles();
  34344. }
  34345. $this->setStyle('default');
  34346. }
  34347. public static function setStyleDefinition($name, TableStyle $style)
  34348. {
  34349. if (!self::$styles) {
  34350. self::$styles = self::initStyles();
  34351. }
  34352. self::$styles[$name] = $style;
  34353. }
  34354. public static function getStyleDefinition($name)
  34355. {
  34356. if (!self::$styles) {
  34357. self::$styles = self::initStyles();
  34358. }
  34359. if (isset(self::$styles[$name])) {
  34360. return self::$styles[$name];
  34361. }
  34362. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  34363. }
  34364. public function setStyle($name)
  34365. {
  34366. $this->style = $this->resolveStyle($name);
  34367. return $this;
  34368. }
  34369. public function getStyle()
  34370. {
  34371. return $this->style;
  34372. }
  34373. public function setColumnStyle($columnIndex, $name)
  34374. {
  34375. $columnIndex = (int) $columnIndex;
  34376. $this->columnStyles[$columnIndex] = $this->resolveStyle($name);
  34377. return $this;
  34378. }
  34379. public function getColumnStyle($columnIndex)
  34380. {
  34381. if (isset($this->columnStyles[$columnIndex])) {
  34382. return $this->columnStyles[$columnIndex];
  34383. }
  34384. return $this->getStyle();
  34385. }
  34386. public function setHeaders(array $headers)
  34387. {
  34388. $headers = array_values($headers);
  34389. if (!empty($headers) && !is_array($headers[0])) {
  34390. $headers = array($headers);
  34391. }
  34392. $this->headers = $headers;
  34393. return $this;
  34394. }
  34395. public function setRows(array $rows)
  34396. {
  34397. $this->rows = array();
  34398. return $this->addRows($rows);
  34399. }
  34400. public function addRows(array $rows)
  34401. {
  34402. foreach ($rows as $row) {
  34403. $this->addRow($row);
  34404. }
  34405. return $this;
  34406. }
  34407. public function addRow($row)
  34408. {
  34409. if ($row instanceof TableSeparator) {
  34410. $this->rows[] = $row;
  34411. return $this;
  34412. }
  34413. if (!is_array($row)) {
  34414. throw new InvalidArgumentException('A row must be an array or a TableSeparator instance.');
  34415. }
  34416. $this->rows[] = array_values($row);
  34417. return $this;
  34418. }
  34419. public function setRow($column, array $row)
  34420. {
  34421. $this->rows[$column] = $row;
  34422. return $this;
  34423. }
  34424. public function render()
  34425. {
  34426. $this->calculateNumberOfColumns();
  34427. $rows = $this->buildTableRows($this->rows);
  34428. $headers = $this->buildTableRows($this->headers);
  34429. $this->calculateColumnsWidth(array_merge($headers, $rows));
  34430. $this->renderRowSeparator();
  34431. if (!empty($headers)) {
  34432. foreach ($headers as $header) {
  34433. $this->renderRow($header, $this->style->getCellHeaderFormat());
  34434. $this->renderRowSeparator();
  34435. }
  34436. }
  34437. foreach ($rows as $row) {
  34438. if ($row instanceof TableSeparator) {
  34439. $this->renderRowSeparator();
  34440. } else {
  34441. $this->renderRow($row, $this->style->getCellRowFormat());
  34442. }
  34443. }
  34444. if (!empty($rows)) {
  34445. $this->renderRowSeparator();
  34446. }
  34447. $this->cleanup();
  34448. }
  34449. private function renderRowSeparator()
  34450. {
  34451. if (0 === $count = $this->numberOfColumns) {
  34452. return;
  34453. }
  34454. if (!$this->style->getHorizontalBorderChar() && !$this->style->getCrossingChar()) {
  34455. return;
  34456. }
  34457. $markup = $this->style->getCrossingChar();
  34458. for ($column = 0; $column < $count; ++$column) {
  34459. $markup .= str_repeat($this->style->getHorizontalBorderChar(), $this->columnWidths[$column]).$this->style->getCrossingChar();
  34460. }
  34461. $this->output->writeln(sprintf($this->style->getBorderFormat(), $markup));
  34462. }
  34463. private function renderColumnSeparator()
  34464. {
  34465. return sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar());
  34466. }
  34467. private function renderRow(array $row, $cellFormat)
  34468. {
  34469. if (empty($row)) {
  34470. return;
  34471. }
  34472. $rowContent = $this->renderColumnSeparator();
  34473. foreach ($this->getRowColumns($row) as $column) {
  34474. $rowContent .= $this->renderCell($row, $column, $cellFormat);
  34475. $rowContent .= $this->renderColumnSeparator();
  34476. }
  34477. $this->output->writeln($rowContent);
  34478. }
  34479. private function renderCell(array $row, $column, $cellFormat)
  34480. {
  34481. $cell = isset($row[$column]) ? $row[$column] : '';
  34482. $width = $this->columnWidths[$column];
  34483. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  34484. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $nextColumn) {
  34485. $width += $this->getColumnSeparatorWidth() + $this->columnWidths[$nextColumn];
  34486. }
  34487. }
  34488. if (false !== $encoding = mb_detect_encoding($cell, null, true)) {
  34489. $width += strlen($cell) - mb_strwidth($cell, $encoding);
  34490. }
  34491. $style = $this->getColumnStyle($column);
  34492. if ($cell instanceof TableSeparator) {
  34493. return sprintf($style->getBorderFormat(), str_repeat($style->getHorizontalBorderChar(), $width));
  34494. }
  34495. $width += Helper::strlen($cell) - Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  34496. $content = sprintf($style->getCellRowContentFormat(), $cell);
  34497. return sprintf($cellFormat, str_pad($content, $width, $style->getPaddingChar(), $style->getPadType()));
  34498. }
  34499. private function calculateNumberOfColumns()
  34500. {
  34501. if (null !== $this->numberOfColumns) {
  34502. return;
  34503. }
  34504. $columns = array(0);
  34505. foreach (array_merge($this->headers, $this->rows) as $row) {
  34506. if ($row instanceof TableSeparator) {
  34507. continue;
  34508. }
  34509. $columns[] = $this->getNumberOfColumns($row);
  34510. }
  34511. $this->numberOfColumns = max($columns);
  34512. }
  34513. private function buildTableRows($rows)
  34514. {
  34515. $unmergedRows = array();
  34516. for ($rowKey = 0; $rowKey < count($rows); ++$rowKey) {
  34517. $rows = $this->fillNextRows($rows, $rowKey);
  34518. foreach ($rows[$rowKey] as $column => $cell) {
  34519. if (!strstr($cell, "\n")) {
  34520. continue;
  34521. }
  34522. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  34523. foreach ($lines as $lineKey => $line) {
  34524. if ($cell instanceof TableCell) {
  34525. $line = new TableCell($line, array('colspan' => $cell->getColspan()));
  34526. }
  34527. if (0 === $lineKey) {
  34528. $rows[$rowKey][$column] = $line;
  34529. } else {
  34530. $unmergedRows[$rowKey][$lineKey][$column] = $line;
  34531. }
  34532. }
  34533. }
  34534. }
  34535. $tableRows = array();
  34536. foreach ($rows as $rowKey => $row) {
  34537. $tableRows[] = $this->fillCells($row);
  34538. if (isset($unmergedRows[$rowKey])) {
  34539. $tableRows = array_merge($tableRows, $unmergedRows[$rowKey]);
  34540. }
  34541. }
  34542. return $tableRows;
  34543. }
  34544. private function fillNextRows(array $rows, $line)
  34545. {
  34546. $unmergedRows = array();
  34547. foreach ($rows[$line] as $column => $cell) {
  34548. if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
  34549. $nbLines = $cell->getRowspan() - 1;
  34550. $lines = array($cell);
  34551. if (strstr($cell, "\n")) {
  34552. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  34553. $nbLines = count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines;
  34554. $rows[$line][$column] = new TableCell($lines[0], array('colspan' => $cell->getColspan()));
  34555. unset($lines[0]);
  34556. }
  34557. $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, array()), $unmergedRows);
  34558. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  34559. $value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : '';
  34560. $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, array('colspan' => $cell->getColspan()));
  34561. if ($nbLines === $unmergedRowKey - $line) {
  34562. break;
  34563. }
  34564. }
  34565. }
  34566. }
  34567. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  34568. if (isset($rows[$unmergedRowKey]) && is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) {
  34569. foreach ($unmergedRow as $cellKey => $cell) {
  34570. array_splice($rows[$unmergedRowKey], $cellKey, 0, array($cell));
  34571. }
  34572. } else {
  34573. $row = $this->copyRow($rows, $unmergedRowKey - 1);
  34574. foreach ($unmergedRow as $column => $cell) {
  34575. if (!empty($cell)) {
  34576. $row[$column] = $unmergedRow[$column];
  34577. }
  34578. }
  34579. array_splice($rows, $unmergedRowKey, 0, array($row));
  34580. }
  34581. }
  34582. return $rows;
  34583. }
  34584. private function fillCells($row)
  34585. {
  34586. $newRow = array();
  34587. foreach ($row as $column => $cell) {
  34588. $newRow[] = $cell;
  34589. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  34590. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $position) {
  34591. $newRow[] = '';
  34592. }
  34593. }
  34594. }
  34595. return $newRow ?: $row;
  34596. }
  34597. private function copyRow(array $rows, $line)
  34598. {
  34599. $row = $rows[$line];
  34600. foreach ($row as $cellKey => $cellValue) {
  34601. $row[$cellKey] = '';
  34602. if ($cellValue instanceof TableCell) {
  34603. $row[$cellKey] = new TableCell('', array('colspan' => $cellValue->getColspan()));
  34604. }
  34605. }
  34606. return $row;
  34607. }
  34608. private function getNumberOfColumns(array $row)
  34609. {
  34610. $columns = count($row);
  34611. foreach ($row as $column) {
  34612. $columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0;
  34613. }
  34614. return $columns;
  34615. }
  34616. private function getRowColumns(array $row)
  34617. {
  34618. $columns = range(0, $this->numberOfColumns - 1);
  34619. foreach ($row as $cellKey => $cell) {
  34620. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  34621. $columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1));
  34622. }
  34623. }
  34624. return $columns;
  34625. }
  34626. private function calculateColumnsWidth($rows)
  34627. {
  34628. for ($column = 0; $column < $this->numberOfColumns; ++$column) {
  34629. $lengths = array();
  34630. foreach ($rows as $row) {
  34631. if ($row instanceof TableSeparator) {
  34632. continue;
  34633. }
  34634. foreach ($row as $i => $cell) {
  34635. if ($cell instanceof TableCell) {
  34636. $textContent = Helper::removeDecoration($this->output->getFormatter(), $cell);
  34637. $textLength = Helper::strlen($textContent);
  34638. if ($textLength > 0) {
  34639. $contentColumns = str_split($textContent, ceil($textLength / $cell->getColspan()));
  34640. foreach ($contentColumns as $position => $content) {
  34641. $row[$i + $position] = $content;
  34642. }
  34643. }
  34644. }
  34645. }
  34646. $lengths[] = $this->getCellWidth($row, $column);
  34647. }
  34648. $this->columnWidths[$column] = max($lengths) + strlen($this->style->getCellRowContentFormat()) - 2;
  34649. }
  34650. }
  34651. private function getColumnSeparatorWidth()
  34652. {
  34653. return strlen(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar()));
  34654. }
  34655. private function getCellWidth(array $row, $column)
  34656. {
  34657. if (isset($row[$column])) {
  34658. $cell = $row[$column];
  34659. $cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  34660. return $cellWidth;
  34661. }
  34662. return 0;
  34663. }
  34664. private function cleanup()
  34665. {
  34666. $this->columnWidths = array();
  34667. $this->numberOfColumns = null;
  34668. }
  34669. private static function initStyles()
  34670. {
  34671. $borderless = new TableStyle();
  34672. $borderless
  34673. ->setHorizontalBorderChar('=')
  34674. ->setVerticalBorderChar(' ')
  34675. ->setCrossingChar(' ')
  34676. ;
  34677. $compact = new TableStyle();
  34678. $compact
  34679. ->setHorizontalBorderChar('')
  34680. ->setVerticalBorderChar(' ')
  34681. ->setCrossingChar('')
  34682. ->setCellRowContentFormat('%s')
  34683. ;
  34684. $styleGuide = new TableStyle();
  34685. $styleGuide
  34686. ->setHorizontalBorderChar('-')
  34687. ->setVerticalBorderChar(' ')
  34688. ->setCrossingChar(' ')
  34689. ->setCellHeaderFormat('%s')
  34690. ;
  34691. return array(
  34692. 'default' => new TableStyle(),
  34693. 'borderless' => $borderless,
  34694. 'compact' => $compact,
  34695. 'symfony-style-guide' => $styleGuide,
  34696. );
  34697. }
  34698. private function resolveStyle($name)
  34699. {
  34700. if ($name instanceof TableStyle) {
  34701. return $name;
  34702. }
  34703. if (isset(self::$styles[$name])) {
  34704. return self::$styles[$name];
  34705. }
  34706. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  34707. }
  34708. }
  34709. <?php
  34710. namespace Symfony\Component\Console\Helper;
  34711. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34712. class TableCell
  34713. {
  34714. private $value;
  34715. private $options = array(
  34716. 'rowspan' => 1,
  34717. 'colspan' => 1,
  34718. );
  34719. public function __construct($value = '', array $options = array())
  34720. {
  34721. if (is_numeric($value) && !is_string($value)) {
  34722. $value = (string) $value;
  34723. }
  34724. $this->value = $value;
  34725. if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
  34726. throw new InvalidArgumentException(sprintf('The TableCell does not support the following options: \'%s\'.', implode('\', \'', $diff)));
  34727. }
  34728. $this->options = array_merge($this->options, $options);
  34729. }
  34730. public function __toString()
  34731. {
  34732. return $this->value;
  34733. }
  34734. public function getColspan()
  34735. {
  34736. return (int) $this->options['colspan'];
  34737. }
  34738. public function getRowspan()
  34739. {
  34740. return (int) $this->options['rowspan'];
  34741. }
  34742. }
  34743. <?php
  34744. namespace Symfony\Component\Console\Helper;
  34745. use Symfony\Component\Console\Output\OutputInterface;
  34746. use Symfony\Component\Console\Output\NullOutput;
  34747. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34748. class TableHelper extends Helper
  34749. {
  34750. const LAYOUT_DEFAULT = 0;
  34751. const LAYOUT_BORDERLESS = 1;
  34752. const LAYOUT_COMPACT = 2;
  34753. private $table;
  34754. public function __construct($triggerDeprecationError = true)
  34755. {
  34756. if ($triggerDeprecationError) {
  34757. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\Table class instead.', E_USER_DEPRECATED);
  34758. }
  34759. $this->table = new Table(new NullOutput());
  34760. }
  34761. public function setLayout($layout)
  34762. {
  34763. switch ($layout) {
  34764. case self::LAYOUT_BORDERLESS:
  34765. $this->table->setStyle('borderless');
  34766. break;
  34767. case self::LAYOUT_COMPACT:
  34768. $this->table->setStyle('compact');
  34769. break;
  34770. case self::LAYOUT_DEFAULT:
  34771. $this->table->setStyle('default');
  34772. break;
  34773. default:
  34774. throw new InvalidArgumentException(sprintf('Invalid table layout "%s".', $layout));
  34775. }
  34776. return $this;
  34777. }
  34778. public function setHeaders(array $headers)
  34779. {
  34780. $this->table->setHeaders($headers);
  34781. return $this;
  34782. }
  34783. public function setRows(array $rows)
  34784. {
  34785. $this->table->setRows($rows);
  34786. return $this;
  34787. }
  34788. public function addRows(array $rows)
  34789. {
  34790. $this->table->addRows($rows);
  34791. return $this;
  34792. }
  34793. public function addRow(array $row)
  34794. {
  34795. $this->table->addRow($row);
  34796. return $this;
  34797. }
  34798. public function setRow($column, array $row)
  34799. {
  34800. $this->table->setRow($column, $row);
  34801. return $this;
  34802. }
  34803. public function setPaddingChar($paddingChar)
  34804. {
  34805. $this->table->getStyle()->setPaddingChar($paddingChar);
  34806. return $this;
  34807. }
  34808. public function setHorizontalBorderChar($horizontalBorderChar)
  34809. {
  34810. $this->table->getStyle()->setHorizontalBorderChar($horizontalBorderChar);
  34811. return $this;
  34812. }
  34813. public function setVerticalBorderChar($verticalBorderChar)
  34814. {
  34815. $this->table->getStyle()->setVerticalBorderChar($verticalBorderChar);
  34816. return $this;
  34817. }
  34818. public function setCrossingChar($crossingChar)
  34819. {
  34820. $this->table->getStyle()->setCrossingChar($crossingChar);
  34821. return $this;
  34822. }
  34823. public function setCellHeaderFormat($cellHeaderFormat)
  34824. {
  34825. $this->table->getStyle()->setCellHeaderFormat($cellHeaderFormat);
  34826. return $this;
  34827. }
  34828. public function setCellRowFormat($cellRowFormat)
  34829. {
  34830. $this->table->getStyle()->setCellHeaderFormat($cellRowFormat);
  34831. return $this;
  34832. }
  34833. public function setCellRowContentFormat($cellRowContentFormat)
  34834. {
  34835. $this->table->getStyle()->setCellRowContentFormat($cellRowContentFormat);
  34836. return $this;
  34837. }
  34838. public function setBorderFormat($borderFormat)
  34839. {
  34840. $this->table->getStyle()->setBorderFormat($borderFormat);
  34841. return $this;
  34842. }
  34843. public function setPadType($padType)
  34844. {
  34845. $this->table->getStyle()->setPadType($padType);
  34846. return $this;
  34847. }
  34848. public function render(OutputInterface $output)
  34849. {
  34850. $p = new \ReflectionProperty($this->table, 'output');
  34851. $p->setAccessible(true);
  34852. $p->setValue($this->table, $output);
  34853. $this->table->render();
  34854. }
  34855. public function getName()
  34856. {
  34857. return 'table';
  34858. }
  34859. }
  34860. <?php
  34861. namespace Symfony\Component\Console\Helper;
  34862. class TableSeparator extends TableCell
  34863. {
  34864. public function __construct(array $options = array())
  34865. {
  34866. parent::__construct('', $options);
  34867. }
  34868. }
  34869. <?php
  34870. namespace Symfony\Component\Console\Helper;
  34871. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34872. use Symfony\Component\Console\Exception\LogicException;
  34873. class TableStyle
  34874. {
  34875. private $paddingChar = ' ';
  34876. private $horizontalBorderChar = '-';
  34877. private $verticalBorderChar = '|';
  34878. private $crossingChar = '+';
  34879. private $cellHeaderFormat = '<info>%s</info>';
  34880. private $cellRowFormat = '%s';
  34881. private $cellRowContentFormat = ' %s ';
  34882. private $borderFormat = '%s';
  34883. private $padType = STR_PAD_RIGHT;
  34884. public function setPaddingChar($paddingChar)
  34885. {
  34886. if (!$paddingChar) {
  34887. throw new LogicException('The padding char must not be empty');
  34888. }
  34889. $this->paddingChar = $paddingChar;
  34890. return $this;
  34891. }
  34892. public function getPaddingChar()
  34893. {
  34894. return $this->paddingChar;
  34895. }
  34896. public function setHorizontalBorderChar($horizontalBorderChar)
  34897. {
  34898. $this->horizontalBorderChar = $horizontalBorderChar;
  34899. return $this;
  34900. }
  34901. public function getHorizontalBorderChar()
  34902. {
  34903. return $this->horizontalBorderChar;
  34904. }
  34905. public function setVerticalBorderChar($verticalBorderChar)
  34906. {
  34907. $this->verticalBorderChar = $verticalBorderChar;
  34908. return $this;
  34909. }
  34910. public function getVerticalBorderChar()
  34911. {
  34912. return $this->verticalBorderChar;
  34913. }
  34914. public function setCrossingChar($crossingChar)
  34915. {
  34916. $this->crossingChar = $crossingChar;
  34917. return $this;
  34918. }
  34919. public function getCrossingChar()
  34920. {
  34921. return $this->crossingChar;
  34922. }
  34923. public function setCellHeaderFormat($cellHeaderFormat)
  34924. {
  34925. $this->cellHeaderFormat = $cellHeaderFormat;
  34926. return $this;
  34927. }
  34928. public function getCellHeaderFormat()
  34929. {
  34930. return $this->cellHeaderFormat;
  34931. }
  34932. public function setCellRowFormat($cellRowFormat)
  34933. {
  34934. $this->cellRowFormat = $cellRowFormat;
  34935. return $this;
  34936. }
  34937. public function getCellRowFormat()
  34938. {
  34939. return $this->cellRowFormat;
  34940. }
  34941. public function setCellRowContentFormat($cellRowContentFormat)
  34942. {
  34943. $this->cellRowContentFormat = $cellRowContentFormat;
  34944. return $this;
  34945. }
  34946. public function getCellRowContentFormat()
  34947. {
  34948. return $this->cellRowContentFormat;
  34949. }
  34950. public function setBorderFormat($borderFormat)
  34951. {
  34952. $this->borderFormat = $borderFormat;
  34953. return $this;
  34954. }
  34955. public function getBorderFormat()
  34956. {
  34957. return $this->borderFormat;
  34958. }
  34959. public function setPadType($padType)
  34960. {
  34961. if (!in_array($padType, array(STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH), true)) {
  34962. throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
  34963. }
  34964. $this->padType = $padType;
  34965. return $this;
  34966. }
  34967. public function getPadType()
  34968. {
  34969. return $this->padType;
  34970. }
  34971. }
  34972. <?php
  34973. namespace Symfony\Component\Console\Input;
  34974. use Symfony\Component\Console\Exception\RuntimeException;
  34975. class ArgvInput extends Input
  34976. {
  34977. private $tokens;
  34978. private $parsed;
  34979. public function __construct(array $argv = null, InputDefinition $definition = null)
  34980. {
  34981. if (null === $argv) {
  34982. $argv = $_SERVER['argv'];
  34983. }
  34984. array_shift($argv);
  34985. $this->tokens = $argv;
  34986. parent::__construct($definition);
  34987. }
  34988. protected function setTokens(array $tokens)
  34989. {
  34990. $this->tokens = $tokens;
  34991. }
  34992. protected function parse()
  34993. {
  34994. $parseOptions = true;
  34995. $this->parsed = $this->tokens;
  34996. while (null !== $token = array_shift($this->parsed)) {
  34997. if ($parseOptions && '' == $token) {
  34998. $this->parseArgument($token);
  34999. } elseif ($parseOptions && '--' == $token) {
  35000. $parseOptions = false;
  35001. } elseif ($parseOptions && 0 === strpos($token, '--')) {
  35002. $this->parseLongOption($token);
  35003. } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
  35004. $this->parseShortOption($token);
  35005. } else {
  35006. $this->parseArgument($token);
  35007. }
  35008. }
  35009. }
  35010. private function parseShortOption($token)
  35011. {
  35012. $name = substr($token, 1);
  35013. if (strlen($name) > 1) {
  35014. if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptValue()) {
  35015. $this->addShortOption($name[0], substr($name, 1));
  35016. } else {
  35017. $this->parseShortOptionSet($name);
  35018. }
  35019. } else {
  35020. $this->addShortOption($name, null);
  35021. }
  35022. }
  35023. private function parseShortOptionSet($name)
  35024. {
  35025. $len = strlen($name);
  35026. for ($i = 0; $i < $len; ++$i) {
  35027. if (!$this->definition->hasShortcut($name[$i])) {
  35028. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $name[$i]));
  35029. }
  35030. $option = $this->definition->getOptionForShortcut($name[$i]);
  35031. if ($option->acceptValue()) {
  35032. $this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1));
  35033. break;
  35034. } else {
  35035. $this->addLongOption($option->getName(), null);
  35036. }
  35037. }
  35038. }
  35039. private function parseLongOption($token)
  35040. {
  35041. $name = substr($token, 2);
  35042. if (false !== $pos = strpos($name, '=')) {
  35043. if (0 === strlen($value = substr($name, $pos + 1))) {
  35044. array_unshift($this->parsed, null);
  35045. }
  35046. $this->addLongOption(substr($name, 0, $pos), $value);
  35047. } else {
  35048. $this->addLongOption($name, null);
  35049. }
  35050. }
  35051. private function parseArgument($token)
  35052. {
  35053. $c = count($this->arguments);
  35054. if ($this->definition->hasArgument($c)) {
  35055. $arg = $this->definition->getArgument($c);
  35056. $this->arguments[$arg->getName()] = $arg->isArray() ? array($token) : $token;
  35057. } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
  35058. $arg = $this->definition->getArgument($c - 1);
  35059. $this->arguments[$arg->getName()][] = $token;
  35060. } else {
  35061. $all = $this->definition->getArguments();
  35062. if (count($all)) {
  35063. throw new RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all))));
  35064. }
  35065. throw new RuntimeException(sprintf('No arguments expected, got "%s".', $token));
  35066. }
  35067. }
  35068. private function addShortOption($shortcut, $value)
  35069. {
  35070. if (!$this->definition->hasShortcut($shortcut)) {
  35071. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
  35072. }
  35073. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  35074. }
  35075. private function addLongOption($name, $value)
  35076. {
  35077. if (!$this->definition->hasOption($name)) {
  35078. throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name));
  35079. }
  35080. $option = $this->definition->getOption($name);
  35081. if (!isset($value[0])) {
  35082. $value = null;
  35083. }
  35084. if (null !== $value && !$option->acceptValue()) {
  35085. throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
  35086. }
  35087. if (null === $value && $option->acceptValue() && count($this->parsed)) {
  35088. $next = array_shift($this->parsed);
  35089. if (isset($next[0]) && '-' !== $next[0]) {
  35090. $value = $next;
  35091. } elseif (empty($next)) {
  35092. $value = null;
  35093. } else {
  35094. array_unshift($this->parsed, $next);
  35095. }
  35096. }
  35097. if (null === $value) {
  35098. if ($option->isValueRequired()) {
  35099. throw new RuntimeException(sprintf('The "--%s" option requires a value.', $name));
  35100. }
  35101. if (!$option->isArray()) {
  35102. $value = $option->isValueOptional() ? $option->getDefault() : true;
  35103. }
  35104. }
  35105. if ($option->isArray()) {
  35106. $this->options[$name][] = $value;
  35107. } else {
  35108. $this->options[$name] = $value;
  35109. }
  35110. }
  35111. public function getFirstArgument()
  35112. {
  35113. foreach ($this->tokens as $token) {
  35114. if ($token && '-' === $token[0]) {
  35115. continue;
  35116. }
  35117. return $token;
  35118. }
  35119. }
  35120. public function hasParameterOption($values)
  35121. {
  35122. $values = (array) $values;
  35123. foreach ($this->tokens as $token) {
  35124. foreach ($values as $value) {
  35125. $leading = 0 === strpos($value, '--') ? $value.'=' : $value;
  35126. if ($token === $value || '' !== $leading && 0 === strpos($token, $leading)) {
  35127. return true;
  35128. }
  35129. }
  35130. }
  35131. return false;
  35132. }
  35133. public function getParameterOption($values, $default = false)
  35134. {
  35135. $values = (array) $values;
  35136. $tokens = $this->tokens;
  35137. while (0 < count($tokens)) {
  35138. $token = array_shift($tokens);
  35139. foreach ($values as $value) {
  35140. if ($token === $value) {
  35141. return array_shift($tokens);
  35142. }
  35143. $leading = 0 === strpos($value, '--') ? $value.'=' : $value;
  35144. if ('' !== $leading && 0 === strpos($token, $leading)) {
  35145. return substr($token, strlen($leading));
  35146. }
  35147. }
  35148. }
  35149. return $default;
  35150. }
  35151. public function __toString()
  35152. {
  35153. $self = $this;
  35154. $tokens = array_map(function ($token) use ($self) {
  35155. if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
  35156. return $match[1].$self->escapeToken($match[2]);
  35157. }
  35158. if ($token && '-' !== $token[0]) {
  35159. return $self->escapeToken($token);
  35160. }
  35161. return $token;
  35162. }, $this->tokens);
  35163. return implode(' ', $tokens);
  35164. }
  35165. }
  35166. <?php
  35167. namespace Symfony\Component\Console\Input;
  35168. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35169. use Symfony\Component\Console\Exception\InvalidOptionException;
  35170. class ArrayInput extends Input
  35171. {
  35172. private $parameters;
  35173. public function __construct(array $parameters, InputDefinition $definition = null)
  35174. {
  35175. $this->parameters = $parameters;
  35176. parent::__construct($definition);
  35177. }
  35178. public function getFirstArgument()
  35179. {
  35180. foreach ($this->parameters as $key => $value) {
  35181. if ($key && '-' === $key[0]) {
  35182. continue;
  35183. }
  35184. return $value;
  35185. }
  35186. }
  35187. public function hasParameterOption($values)
  35188. {
  35189. $values = (array) $values;
  35190. foreach ($this->parameters as $k => $v) {
  35191. if (!is_int($k)) {
  35192. $v = $k;
  35193. }
  35194. if (in_array($v, $values)) {
  35195. return true;
  35196. }
  35197. }
  35198. return false;
  35199. }
  35200. public function getParameterOption($values, $default = false)
  35201. {
  35202. $values = (array) $values;
  35203. foreach ($this->parameters as $k => $v) {
  35204. if (is_int($k)) {
  35205. if (in_array($v, $values)) {
  35206. return true;
  35207. }
  35208. } elseif (in_array($k, $values)) {
  35209. return $v;
  35210. }
  35211. }
  35212. return $default;
  35213. }
  35214. public function __toString()
  35215. {
  35216. $params = array();
  35217. foreach ($this->parameters as $param => $val) {
  35218. if ($param && '-' === $param[0]) {
  35219. if (is_array($val)) {
  35220. foreach ($val as $v) {
  35221. $params[] = $param.('' != $v ? '='.$this->escapeToken($v) : '');
  35222. }
  35223. } else {
  35224. $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : '');
  35225. }
  35226. } else {
  35227. $params[] = is_array($val) ? implode(' ', array_map(array($this, 'escapeToken'), $val)) : $this->escapeToken($val);
  35228. }
  35229. }
  35230. return implode(' ', $params);
  35231. }
  35232. protected function parse()
  35233. {
  35234. foreach ($this->parameters as $key => $value) {
  35235. if (0 === strpos($key, '--')) {
  35236. $this->addLongOption(substr($key, 2), $value);
  35237. } elseif ('-' === $key[0]) {
  35238. $this->addShortOption(substr($key, 1), $value);
  35239. } else {
  35240. $this->addArgument($key, $value);
  35241. }
  35242. }
  35243. }
  35244. private function addShortOption($shortcut, $value)
  35245. {
  35246. if (!$this->definition->hasShortcut($shortcut)) {
  35247. throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut));
  35248. }
  35249. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  35250. }
  35251. private function addLongOption($name, $value)
  35252. {
  35253. if (!$this->definition->hasOption($name)) {
  35254. throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
  35255. }
  35256. $option = $this->definition->getOption($name);
  35257. if (null === $value) {
  35258. if ($option->isValueRequired()) {
  35259. throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name));
  35260. }
  35261. $value = $option->isValueOptional() ? $option->getDefault() : true;
  35262. }
  35263. $this->options[$name] = $value;
  35264. }
  35265. private function addArgument($name, $value)
  35266. {
  35267. if (!$this->definition->hasArgument($name)) {
  35268. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  35269. }
  35270. $this->arguments[$name] = $value;
  35271. }
  35272. }
  35273. <?php
  35274. namespace Symfony\Component\Console\Input;
  35275. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35276. use Symfony\Component\Console\Exception\RuntimeException;
  35277. abstract class Input implements InputInterface
  35278. {
  35279. protected $definition;
  35280. protected $options = array();
  35281. protected $arguments = array();
  35282. protected $interactive = true;
  35283. public function __construct(InputDefinition $definition = null)
  35284. {
  35285. if (null === $definition) {
  35286. $this->definition = new InputDefinition();
  35287. } else {
  35288. $this->bind($definition);
  35289. $this->validate();
  35290. }
  35291. }
  35292. public function bind(InputDefinition $definition)
  35293. {
  35294. $this->arguments = array();
  35295. $this->options = array();
  35296. $this->definition = $definition;
  35297. $this->parse();
  35298. }
  35299. abstract protected function parse();
  35300. public function validate()
  35301. {
  35302. $definition = $this->definition;
  35303. $givenArguments = $this->arguments;
  35304. $missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) {
  35305. return !array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired();
  35306. });
  35307. if (count($missingArguments) > 0) {
  35308. throw new RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments)));
  35309. }
  35310. }
  35311. public function isInteractive()
  35312. {
  35313. return $this->interactive;
  35314. }
  35315. public function setInteractive($interactive)
  35316. {
  35317. $this->interactive = (bool) $interactive;
  35318. }
  35319. public function getArguments()
  35320. {
  35321. return array_merge($this->definition->getArgumentDefaults(), $this->arguments);
  35322. }
  35323. public function getArgument($name)
  35324. {
  35325. if (!$this->definition->hasArgument($name)) {
  35326. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  35327. }
  35328. return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)->getDefault();
  35329. }
  35330. public function setArgument($name, $value)
  35331. {
  35332. if (!$this->definition->hasArgument($name)) {
  35333. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  35334. }
  35335. $this->arguments[$name] = $value;
  35336. }
  35337. public function hasArgument($name)
  35338. {
  35339. return $this->definition->hasArgument($name);
  35340. }
  35341. public function getOptions()
  35342. {
  35343. return array_merge($this->definition->getOptionDefaults(), $this->options);
  35344. }
  35345. public function getOption($name)
  35346. {
  35347. if (!$this->definition->hasOption($name)) {
  35348. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  35349. }
  35350. return isset($this->options[$name]) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
  35351. }
  35352. public function setOption($name, $value)
  35353. {
  35354. if (!$this->definition->hasOption($name)) {
  35355. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  35356. }
  35357. $this->options[$name] = $value;
  35358. }
  35359. public function hasOption($name)
  35360. {
  35361. return $this->definition->hasOption($name);
  35362. }
  35363. public function escapeToken($token)
  35364. {
  35365. return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token);
  35366. }
  35367. }
  35368. <?php
  35369. namespace Symfony\Component\Console\Input;
  35370. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35371. use Symfony\Component\Console\Exception\LogicException;
  35372. class InputArgument
  35373. {
  35374. const REQUIRED = 1;
  35375. const OPTIONAL = 2;
  35376. const IS_ARRAY = 4;
  35377. private $name;
  35378. private $mode;
  35379. private $default;
  35380. private $description;
  35381. public function __construct($name, $mode = null, $description = '', $default = null)
  35382. {
  35383. if (null === $mode) {
  35384. $mode = self::OPTIONAL;
  35385. } elseif (!is_int($mode) || $mode > 7 || $mode < 1) {
  35386. throw new InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode));
  35387. }
  35388. $this->name = $name;
  35389. $this->mode = $mode;
  35390. $this->description = $description;
  35391. $this->setDefault($default);
  35392. }
  35393. public function getName()
  35394. {
  35395. return $this->name;
  35396. }
  35397. public function isRequired()
  35398. {
  35399. return self::REQUIRED === (self::REQUIRED & $this->mode);
  35400. }
  35401. public function isArray()
  35402. {
  35403. return self::IS_ARRAY === (self::IS_ARRAY & $this->mode);
  35404. }
  35405. public function setDefault($default = null)
  35406. {
  35407. if (self::REQUIRED === $this->mode && null !== $default) {
  35408. throw new LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.');
  35409. }
  35410. if ($this->isArray()) {
  35411. if (null === $default) {
  35412. $default = array();
  35413. } elseif (!is_array($default)) {
  35414. throw new LogicException('A default value for an array argument must be an array.');
  35415. }
  35416. }
  35417. $this->default = $default;
  35418. }
  35419. public function getDefault()
  35420. {
  35421. return $this->default;
  35422. }
  35423. public function getDescription()
  35424. {
  35425. return $this->description;
  35426. }
  35427. }
  35428. <?php
  35429. namespace Symfony\Component\Console\Input;
  35430. interface InputAwareInterface
  35431. {
  35432. public function setInput(InputInterface $input);
  35433. }
  35434. <?php
  35435. namespace Symfony\Component\Console\Input;
  35436. use Symfony\Component\Console\Descriptor\TextDescriptor;
  35437. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  35438. use Symfony\Component\Console\Output\BufferedOutput;
  35439. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35440. use Symfony\Component\Console\Exception\LogicException;
  35441. class InputDefinition
  35442. {
  35443. private $arguments;
  35444. private $requiredCount;
  35445. private $hasAnArrayArgument = false;
  35446. private $hasOptional;
  35447. private $options;
  35448. private $shortcuts;
  35449. public function __construct(array $definition = array())
  35450. {
  35451. $this->setDefinition($definition);
  35452. }
  35453. public function setDefinition(array $definition)
  35454. {
  35455. $arguments = array();
  35456. $options = array();
  35457. foreach ($definition as $item) {
  35458. if ($item instanceof InputOption) {
  35459. $options[] = $item;
  35460. } else {
  35461. $arguments[] = $item;
  35462. }
  35463. }
  35464. $this->setArguments($arguments);
  35465. $this->setOptions($options);
  35466. }
  35467. public function setArguments($arguments = array())
  35468. {
  35469. $this->arguments = array();
  35470. $this->requiredCount = 0;
  35471. $this->hasOptional = false;
  35472. $this->hasAnArrayArgument = false;
  35473. $this->addArguments($arguments);
  35474. }
  35475. public function addArguments($arguments = array())
  35476. {
  35477. if (null !== $arguments) {
  35478. foreach ($arguments as $argument) {
  35479. $this->addArgument($argument);
  35480. }
  35481. }
  35482. }
  35483. public function addArgument(InputArgument $argument)
  35484. {
  35485. if (isset($this->arguments[$argument->getName()])) {
  35486. throw new LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
  35487. }
  35488. if ($this->hasAnArrayArgument) {
  35489. throw new LogicException('Cannot add an argument after an array argument.');
  35490. }
  35491. if ($argument->isRequired() && $this->hasOptional) {
  35492. throw new LogicException('Cannot add a required argument after an optional one.');
  35493. }
  35494. if ($argument->isArray()) {
  35495. $this->hasAnArrayArgument = true;
  35496. }
  35497. if ($argument->isRequired()) {
  35498. ++$this->requiredCount;
  35499. } else {
  35500. $this->hasOptional = true;
  35501. }
  35502. $this->arguments[$argument->getName()] = $argument;
  35503. }
  35504. public function getArgument($name)
  35505. {
  35506. if (!$this->hasArgument($name)) {
  35507. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  35508. }
  35509. $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;
  35510. return $arguments[$name];
  35511. }
  35512. public function hasArgument($name)
  35513. {
  35514. $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;
  35515. return isset($arguments[$name]);
  35516. }
  35517. public function getArguments()
  35518. {
  35519. return $this->arguments;
  35520. }
  35521. public function getArgumentCount()
  35522. {
  35523. return $this->hasAnArrayArgument ? PHP_INT_MAX : count($this->arguments);
  35524. }
  35525. public function getArgumentRequiredCount()
  35526. {
  35527. return $this->requiredCount;
  35528. }
  35529. public function getArgumentDefaults()
  35530. {
  35531. $values = array();
  35532. foreach ($this->arguments as $argument) {
  35533. $values[$argument->getName()] = $argument->getDefault();
  35534. }
  35535. return $values;
  35536. }
  35537. public function setOptions($options = array())
  35538. {
  35539. $this->options = array();
  35540. $this->shortcuts = array();
  35541. $this->addOptions($options);
  35542. }
  35543. public function addOptions($options = array())
  35544. {
  35545. foreach ($options as $option) {
  35546. $this->addOption($option);
  35547. }
  35548. }
  35549. public function addOption(InputOption $option)
  35550. {
  35551. if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
  35552. throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
  35553. }
  35554. if ($option->getShortcut()) {
  35555. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  35556. if (isset($this->shortcuts[$shortcut]) && !$option->equals($this->options[$this->shortcuts[$shortcut]])) {
  35557. throw new LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
  35558. }
  35559. }
  35560. }
  35561. $this->options[$option->getName()] = $option;
  35562. if ($option->getShortcut()) {
  35563. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  35564. $this->shortcuts[$shortcut] = $option->getName();
  35565. }
  35566. }
  35567. }
  35568. public function getOption($name)
  35569. {
  35570. if (!$this->hasOption($name)) {
  35571. throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name));
  35572. }
  35573. return $this->options[$name];
  35574. }
  35575. public function hasOption($name)
  35576. {
  35577. return isset($this->options[$name]);
  35578. }
  35579. public function getOptions()
  35580. {
  35581. return $this->options;
  35582. }
  35583. public function hasShortcut($name)
  35584. {
  35585. return isset($this->shortcuts[$name]);
  35586. }
  35587. public function getOptionForShortcut($shortcut)
  35588. {
  35589. return $this->getOption($this->shortcutToName($shortcut));
  35590. }
  35591. public function getOptionDefaults()
  35592. {
  35593. $values = array();
  35594. foreach ($this->options as $option) {
  35595. $values[$option->getName()] = $option->getDefault();
  35596. }
  35597. return $values;
  35598. }
  35599. private function shortcutToName($shortcut)
  35600. {
  35601. if (!isset($this->shortcuts[$shortcut])) {
  35602. throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
  35603. }
  35604. return $this->shortcuts[$shortcut];
  35605. }
  35606. public function getSynopsis($short = false)
  35607. {
  35608. $elements = array();
  35609. if ($short && $this->getOptions()) {
  35610. $elements[] = '[options]';
  35611. } elseif (!$short) {
  35612. foreach ($this->getOptions() as $option) {
  35613. $value = '';
  35614. if ($option->acceptValue()) {
  35615. $value = sprintf(
  35616. ' %s%s%s',
  35617. $option->isValueOptional() ? '[' : '',
  35618. strtoupper($option->getName()),
  35619. $option->isValueOptional() ? ']' : ''
  35620. );
  35621. }
  35622. $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
  35623. $elements[] = sprintf('[%s--%s%s]', $shortcut, $option->getName(), $value);
  35624. }
  35625. }
  35626. if (count($elements) && $this->getArguments()) {
  35627. $elements[] = '[--]';
  35628. }
  35629. foreach ($this->getArguments() as $argument) {
  35630. $element = '<'.$argument->getName().'>';
  35631. if (!$argument->isRequired()) {
  35632. $element = '['.$element.']';
  35633. } elseif ($argument->isArray()) {
  35634. $element = $element.' ('.$element.')';
  35635. }
  35636. if ($argument->isArray()) {
  35637. $element .= '...';
  35638. }
  35639. $elements[] = $element;
  35640. }
  35641. return implode(' ', $elements);
  35642. }
  35643. public function asText()
  35644. {
  35645. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  35646. $descriptor = new TextDescriptor();
  35647. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  35648. $descriptor->describe($output, $this, array('raw_output' => true));
  35649. return $output->fetch();
  35650. }
  35651. public function asXml($asDom = false)
  35652. {
  35653. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  35654. $descriptor = new XmlDescriptor();
  35655. if ($asDom) {
  35656. return $descriptor->getInputDefinitionDocument($this);
  35657. }
  35658. $output = new BufferedOutput();
  35659. $descriptor->describe($output, $this);
  35660. return $output->fetch();
  35661. }
  35662. }
  35663. <?php
  35664. namespace Symfony\Component\Console\Input;
  35665. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35666. use Symfony\Component\Console\Exception\RuntimeException;
  35667. interface InputInterface
  35668. {
  35669. public function getFirstArgument();
  35670. public function hasParameterOption($values);
  35671. public function getParameterOption($values, $default = false);
  35672. public function bind(InputDefinition $definition);
  35673. public function validate();
  35674. public function getArguments();
  35675. public function getArgument($name);
  35676. public function setArgument($name, $value);
  35677. public function hasArgument($name);
  35678. public function getOptions();
  35679. public function getOption($name);
  35680. public function setOption($name, $value);
  35681. public function hasOption($name);
  35682. public function isInteractive();
  35683. public function setInteractive($interactive);
  35684. }
  35685. <?php
  35686. namespace Symfony\Component\Console\Input;
  35687. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35688. use Symfony\Component\Console\Exception\LogicException;
  35689. class InputOption
  35690. {
  35691. const VALUE_NONE = 1;
  35692. const VALUE_REQUIRED = 2;
  35693. const VALUE_OPTIONAL = 4;
  35694. const VALUE_IS_ARRAY = 8;
  35695. private $name;
  35696. private $shortcut;
  35697. private $mode;
  35698. private $default;
  35699. private $description;
  35700. public function __construct($name, $shortcut = null, $mode = null, $description = '', $default = null)
  35701. {
  35702. if (0 === strpos($name, '--')) {
  35703. $name = substr($name, 2);
  35704. }
  35705. if (empty($name)) {
  35706. throw new InvalidArgumentException('An option name cannot be empty.');
  35707. }
  35708. if (empty($shortcut)) {
  35709. $shortcut = null;
  35710. }
  35711. if (null !== $shortcut) {
  35712. if (is_array($shortcut)) {
  35713. $shortcut = implode('|', $shortcut);
  35714. }
  35715. $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
  35716. $shortcuts = array_filter($shortcuts);
  35717. $shortcut = implode('|', $shortcuts);
  35718. if (empty($shortcut)) {
  35719. throw new InvalidArgumentException('An option shortcut cannot be empty.');
  35720. }
  35721. }
  35722. if (null === $mode) {
  35723. $mode = self::VALUE_NONE;
  35724. } elseif (!is_int($mode) || $mode > 15 || $mode < 1) {
  35725. throw new InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
  35726. }
  35727. $this->name = $name;
  35728. $this->shortcut = $shortcut;
  35729. $this->mode = $mode;
  35730. $this->description = $description;
  35731. if ($this->isArray() && !$this->acceptValue()) {
  35732. throw new InvalidArgumentException('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.');
  35733. }
  35734. $this->setDefault($default);
  35735. }
  35736. public function getShortcut()
  35737. {
  35738. return $this->shortcut;
  35739. }
  35740. public function getName()
  35741. {
  35742. return $this->name;
  35743. }
  35744. public function acceptValue()
  35745. {
  35746. return $this->isValueRequired() || $this->isValueOptional();
  35747. }
  35748. public function isValueRequired()
  35749. {
  35750. return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode);
  35751. }
  35752. public function isValueOptional()
  35753. {
  35754. return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode);
  35755. }
  35756. public function isArray()
  35757. {
  35758. return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode);
  35759. }
  35760. public function setDefault($default = null)
  35761. {
  35762. if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
  35763. throw new LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
  35764. }
  35765. if ($this->isArray()) {
  35766. if (null === $default) {
  35767. $default = array();
  35768. } elseif (!is_array($default)) {
  35769. throw new LogicException('A default value for an array option must be an array.');
  35770. }
  35771. }
  35772. $this->default = $this->acceptValue() ? $default : false;
  35773. }
  35774. public function getDefault()
  35775. {
  35776. return $this->default;
  35777. }
  35778. public function getDescription()
  35779. {
  35780. return $this->description;
  35781. }
  35782. public function equals(InputOption $option)
  35783. {
  35784. return $option->getName() === $this->getName()
  35785. && $option->getShortcut() === $this->getShortcut()
  35786. && $option->getDefault() === $this->getDefault()
  35787. && $option->isArray() === $this->isArray()
  35788. && $option->isValueRequired() === $this->isValueRequired()
  35789. && $option->isValueOptional() === $this->isValueOptional()
  35790. ;
  35791. }
  35792. }
  35793. <?php
  35794. namespace Symfony\Component\Console\Input;
  35795. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35796. class StringInput extends ArgvInput
  35797. {
  35798. const REGEX_STRING = '([^\s]+?)(?:\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
  35799. const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
  35800. public function __construct($input, InputDefinition $definition = null)
  35801. {
  35802. if ($definition) {
  35803. @trigger_error('The $definition argument of the '.__METHOD__.' method is deprecated and will be removed in 3.0. Set this parameter with the bind() method instead.', E_USER_DEPRECATED);
  35804. }
  35805. parent::__construct(array(), null);
  35806. $this->setTokens($this->tokenize($input));
  35807. if (null !== $definition) {
  35808. $this->bind($definition);
  35809. }
  35810. }
  35811. private function tokenize($input)
  35812. {
  35813. $tokens = array();
  35814. $length = strlen($input);
  35815. $cursor = 0;
  35816. while ($cursor < $length) {
  35817. if (preg_match('/\s+/A', $input, $match, null, $cursor)) {
  35818. } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) {
  35819. $tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, strlen($match[3]) - 2)));
  35820. } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) {
  35821. $tokens[] = stripcslashes(substr($match[0], 1, strlen($match[0]) - 2));
  35822. } elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) {
  35823. $tokens[] = stripcslashes($match[1]);
  35824. } else {
  35825. throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10)));
  35826. }
  35827. $cursor += strlen($match[0]);
  35828. }
  35829. return $tokens;
  35830. }
  35831. }
  35832. Copyright (c) 2004-2018 Fabien Potencier
  35833. Permission is hereby granted, free of charge, to any person obtaining a copy
  35834. of this software and associated documentation files (the "Software"), to deal
  35835. in the Software without restriction, including without limitation the rights
  35836. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  35837. copies of the Software, and to permit persons to whom the Software is furnished
  35838. to do so, subject to the following conditions:
  35839. The above copyright notice and this permission notice shall be included in all
  35840. copies or substantial portions of the Software.
  35841. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  35842. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  35843. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  35844. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  35845. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  35846. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  35847. THE SOFTWARE.
  35848. <?php
  35849. namespace Symfony\Component\Console\Logger;
  35850. use Psr\Log\AbstractLogger;
  35851. use Psr\Log\InvalidArgumentException;
  35852. use Psr\Log\LogLevel;
  35853. use Symfony\Component\Console\Output\OutputInterface;
  35854. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  35855. class ConsoleLogger extends AbstractLogger
  35856. {
  35857. const INFO = 'info';
  35858. const ERROR = 'error';
  35859. private $output;
  35860. private $verbosityLevelMap = array(
  35861. LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL,
  35862. LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL,
  35863. LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL,
  35864. LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL,
  35865. LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL,
  35866. LogLevel::NOTICE => OutputInterface::VERBOSITY_VERBOSE,
  35867. LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE,
  35868. LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  35869. );
  35870. private $formatLevelMap = array(
  35871. LogLevel::EMERGENCY => self::ERROR,
  35872. LogLevel::ALERT => self::ERROR,
  35873. LogLevel::CRITICAL => self::ERROR,
  35874. LogLevel::ERROR => self::ERROR,
  35875. LogLevel::WARNING => self::INFO,
  35876. LogLevel::NOTICE => self::INFO,
  35877. LogLevel::INFO => self::INFO,
  35878. LogLevel::DEBUG => self::INFO,
  35879. );
  35880. public function __construct(OutputInterface $output, array $verbosityLevelMap = array(), array $formatLevelMap = array())
  35881. {
  35882. $this->output = $output;
  35883. $this->verbosityLevelMap = $verbosityLevelMap + $this->verbosityLevelMap;
  35884. $this->formatLevelMap = $formatLevelMap + $this->formatLevelMap;
  35885. }
  35886. public function log($level, $message, array $context = array())
  35887. {
  35888. if (!isset($this->verbosityLevelMap[$level])) {
  35889. throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
  35890. }
  35891. if (self::ERROR === $this->formatLevelMap[$level] && $this->output instanceof ConsoleOutputInterface) {
  35892. $output = $this->output->getErrorOutput();
  35893. } else {
  35894. $output = $this->output;
  35895. }
  35896. if ($output->getVerbosity() >= $this->verbosityLevelMap[$level]) {
  35897. $output->writeln(sprintf('<%1$s>[%2$s] %3$s</%1$s>', $this->formatLevelMap[$level], $level, $this->interpolate($message, $context)));
  35898. }
  35899. }
  35900. private function interpolate($message, array $context)
  35901. {
  35902. $replace = array();
  35903. foreach ($context as $key => $val) {
  35904. if (!is_array($val) && (!is_object($val) || method_exists($val, '__toString'))) {
  35905. $replace[sprintf('{%s}', $key)] = $val;
  35906. }
  35907. }
  35908. return strtr($message, $replace);
  35909. }
  35910. }
  35911. <?php
  35912. namespace Symfony\Component\Console\Output;
  35913. class BufferedOutput extends Output
  35914. {
  35915. private $buffer = '';
  35916. public function fetch()
  35917. {
  35918. $content = $this->buffer;
  35919. $this->buffer = '';
  35920. return $content;
  35921. }
  35922. protected function doWrite($message, $newline)
  35923. {
  35924. $this->buffer .= $message;
  35925. if ($newline) {
  35926. $this->buffer .= PHP_EOL;
  35927. }
  35928. }
  35929. }
  35930. <?php
  35931. namespace Symfony\Component\Console\Output;
  35932. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  35933. class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
  35934. {
  35935. private $stderr;
  35936. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  35937. {
  35938. parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
  35939. $actualDecorated = $this->isDecorated();
  35940. $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
  35941. if (null === $decorated) {
  35942. $this->setDecorated($actualDecorated && $this->stderr->isDecorated());
  35943. }
  35944. }
  35945. public function setDecorated($decorated)
  35946. {
  35947. parent::setDecorated($decorated);
  35948. $this->stderr->setDecorated($decorated);
  35949. }
  35950. public function setFormatter(OutputFormatterInterface $formatter)
  35951. {
  35952. parent::setFormatter($formatter);
  35953. $this->stderr->setFormatter($formatter);
  35954. }
  35955. public function setVerbosity($level)
  35956. {
  35957. parent::setVerbosity($level);
  35958. $this->stderr->setVerbosity($level);
  35959. }
  35960. public function getErrorOutput()
  35961. {
  35962. return $this->stderr;
  35963. }
  35964. public function setErrorOutput(OutputInterface $error)
  35965. {
  35966. $this->stderr = $error;
  35967. }
  35968. protected function hasStdoutSupport()
  35969. {
  35970. return false === $this->isRunningOS400();
  35971. }
  35972. protected function hasStderrSupport()
  35973. {
  35974. return false === $this->isRunningOS400();
  35975. }
  35976. private function isRunningOS400()
  35977. {
  35978. $checks = array(
  35979. function_exists('php_uname') ? php_uname('s') : '',
  35980. getenv('OSTYPE'),
  35981. PHP_OS,
  35982. );
  35983. return false !== stripos(implode(';', $checks), 'OS400');
  35984. }
  35985. private function openOutputStream()
  35986. {
  35987. $outputStream = $this->hasStdoutSupport() ? 'php://stdout' : 'php://output';
  35988. return @fopen($outputStream, 'w') ?: fopen('php://output', 'w');
  35989. }
  35990. private function openErrorStream()
  35991. {
  35992. $errorStream = $this->hasStderrSupport() ? 'php://stderr' : 'php://output';
  35993. return fopen($errorStream, 'w');
  35994. }
  35995. }
  35996. <?php
  35997. namespace Symfony\Component\Console\Output;
  35998. interface ConsoleOutputInterface extends OutputInterface
  35999. {
  36000. public function getErrorOutput();
  36001. public function setErrorOutput(OutputInterface $error);
  36002. }
  36003. <?php
  36004. namespace Symfony\Component\Console\Output;
  36005. use Symfony\Component\Console\Formatter\OutputFormatter;
  36006. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  36007. class NullOutput implements OutputInterface
  36008. {
  36009. public function setFormatter(OutputFormatterInterface $formatter)
  36010. {
  36011. }
  36012. public function getFormatter()
  36013. {
  36014. return new OutputFormatter();
  36015. }
  36016. public function setDecorated($decorated)
  36017. {
  36018. }
  36019. public function isDecorated()
  36020. {
  36021. return false;
  36022. }
  36023. public function setVerbosity($level)
  36024. {
  36025. }
  36026. public function getVerbosity()
  36027. {
  36028. return self::VERBOSITY_QUIET;
  36029. }
  36030. public function isQuiet()
  36031. {
  36032. return true;
  36033. }
  36034. public function isVerbose()
  36035. {
  36036. return false;
  36037. }
  36038. public function isVeryVerbose()
  36039. {
  36040. return false;
  36041. }
  36042. public function isDebug()
  36043. {
  36044. return false;
  36045. }
  36046. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  36047. {
  36048. }
  36049. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  36050. {
  36051. }
  36052. }
  36053. <?php
  36054. namespace Symfony\Component\Console\Output;
  36055. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  36056. use Symfony\Component\Console\Formatter\OutputFormatter;
  36057. abstract class Output implements OutputInterface
  36058. {
  36059. private $verbosity;
  36060. private $formatter;
  36061. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = false, OutputFormatterInterface $formatter = null)
  36062. {
  36063. $this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
  36064. $this->formatter = $formatter ?: new OutputFormatter();
  36065. $this->formatter->setDecorated($decorated);
  36066. }
  36067. public function setFormatter(OutputFormatterInterface $formatter)
  36068. {
  36069. $this->formatter = $formatter;
  36070. }
  36071. public function getFormatter()
  36072. {
  36073. return $this->formatter;
  36074. }
  36075. public function setDecorated($decorated)
  36076. {
  36077. $this->formatter->setDecorated($decorated);
  36078. }
  36079. public function isDecorated()
  36080. {
  36081. return $this->formatter->isDecorated();
  36082. }
  36083. public function setVerbosity($level)
  36084. {
  36085. $this->verbosity = (int) $level;
  36086. }
  36087. public function getVerbosity()
  36088. {
  36089. return $this->verbosity;
  36090. }
  36091. public function isQuiet()
  36092. {
  36093. return self::VERBOSITY_QUIET === $this->verbosity;
  36094. }
  36095. public function isVerbose()
  36096. {
  36097. return self::VERBOSITY_VERBOSE <= $this->verbosity;
  36098. }
  36099. public function isVeryVerbose()
  36100. {
  36101. return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
  36102. }
  36103. public function isDebug()
  36104. {
  36105. return self::VERBOSITY_DEBUG <= $this->verbosity;
  36106. }
  36107. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  36108. {
  36109. $this->write($messages, true, $options);
  36110. }
  36111. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  36112. {
  36113. $messages = (array) $messages;
  36114. $types = self::OUTPUT_NORMAL | self::OUTPUT_RAW | self::OUTPUT_PLAIN;
  36115. $type = $types & $options ?: self::OUTPUT_NORMAL;
  36116. $verbosities = self::VERBOSITY_QUIET | self::VERBOSITY_NORMAL | self::VERBOSITY_VERBOSE | self::VERBOSITY_VERY_VERBOSE | self::VERBOSITY_DEBUG;
  36117. $verbosity = $verbosities & $options ?: self::VERBOSITY_NORMAL;
  36118. if ($verbosity > $this->getVerbosity()) {
  36119. return;
  36120. }
  36121. foreach ($messages as $message) {
  36122. switch ($type) {
  36123. case OutputInterface::OUTPUT_NORMAL:
  36124. $message = $this->formatter->format($message);
  36125. break;
  36126. case OutputInterface::OUTPUT_RAW:
  36127. break;
  36128. case OutputInterface::OUTPUT_PLAIN:
  36129. $message = strip_tags($this->formatter->format($message));
  36130. break;
  36131. }
  36132. $this->doWrite($message, $newline);
  36133. }
  36134. }
  36135. abstract protected function doWrite($message, $newline);
  36136. }
  36137. <?php
  36138. namespace Symfony\Component\Console\Output;
  36139. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  36140. interface OutputInterface
  36141. {
  36142. const VERBOSITY_QUIET = 16;
  36143. const VERBOSITY_NORMAL = 32;
  36144. const VERBOSITY_VERBOSE = 64;
  36145. const VERBOSITY_VERY_VERBOSE = 128;
  36146. const VERBOSITY_DEBUG = 256;
  36147. const OUTPUT_NORMAL = 1;
  36148. const OUTPUT_RAW = 2;
  36149. const OUTPUT_PLAIN = 4;
  36150. public function write($messages, $newline = false, $options = 0);
  36151. public function writeln($messages, $options = 0);
  36152. public function setVerbosity($level);
  36153. public function getVerbosity();
  36154. public function setDecorated($decorated);
  36155. public function isDecorated();
  36156. public function setFormatter(OutputFormatterInterface $formatter);
  36157. public function getFormatter();
  36158. }
  36159. <?php
  36160. namespace Symfony\Component\Console\Output;
  36161. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36162. use Symfony\Component\Console\Exception\RuntimeException;
  36163. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  36164. class StreamOutput extends Output
  36165. {
  36166. private $stream;
  36167. public function __construct($stream, $verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  36168. {
  36169. if (!is_resource($stream) || 'stream' !== get_resource_type($stream)) {
  36170. throw new InvalidArgumentException('The StreamOutput class needs a stream as its first argument.');
  36171. }
  36172. $this->stream = $stream;
  36173. if (null === $decorated) {
  36174. $decorated = $this->hasColorSupport();
  36175. }
  36176. parent::__construct($verbosity, $decorated, $formatter);
  36177. }
  36178. public function getStream()
  36179. {
  36180. return $this->stream;
  36181. }
  36182. protected function doWrite($message, $newline)
  36183. {
  36184. if (false === @fwrite($this->stream, $message) || ($newline && (false === @fwrite($this->stream, PHP_EOL)))) {
  36185. throw new RuntimeException('Unable to write output.');
  36186. }
  36187. fflush($this->stream);
  36188. }
  36189. protected function hasColorSupport()
  36190. {
  36191. if (DIRECTORY_SEPARATOR === '\\') {
  36192. return
  36193. function_exists('sapi_windows_vt100_support') && @sapi_windows_vt100_support($this->stream)
  36194. || '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD
  36195. || false !== getenv('ANSICON')
  36196. || 'ON' === getenv('ConEmuANSI')
  36197. || 'xterm' === getenv('TERM');
  36198. }
  36199. return function_exists('posix_isatty') && @posix_isatty($this->stream);
  36200. }
  36201. }
  36202. <?php
  36203. namespace Symfony\Component\Console\Question;
  36204. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36205. class ChoiceQuestion extends Question
  36206. {
  36207. private $choices;
  36208. private $multiselect = false;
  36209. private $prompt = ' > ';
  36210. private $errorMessage = 'Value "%s" is invalid';
  36211. public function __construct($question, array $choices, $default = null)
  36212. {
  36213. if (!$choices) {
  36214. throw new \LogicException('Choice question must have at least 1 choice available.');
  36215. }
  36216. parent::__construct($question, $default);
  36217. $this->choices = $choices;
  36218. $this->setValidator($this->getDefaultValidator());
  36219. $this->setAutocompleterValues($choices);
  36220. }
  36221. public function getChoices()
  36222. {
  36223. return $this->choices;
  36224. }
  36225. public function setMultiselect($multiselect)
  36226. {
  36227. $this->multiselect = $multiselect;
  36228. $this->setValidator($this->getDefaultValidator());
  36229. return $this;
  36230. }
  36231. public function isMultiselect()
  36232. {
  36233. return $this->multiselect;
  36234. }
  36235. public function getPrompt()
  36236. {
  36237. return $this->prompt;
  36238. }
  36239. public function setPrompt($prompt)
  36240. {
  36241. $this->prompt = $prompt;
  36242. return $this;
  36243. }
  36244. public function setErrorMessage($errorMessage)
  36245. {
  36246. $this->errorMessage = $errorMessage;
  36247. $this->setValidator($this->getDefaultValidator());
  36248. return $this;
  36249. }
  36250. private function getDefaultValidator()
  36251. {
  36252. $choices = $this->choices;
  36253. $errorMessage = $this->errorMessage;
  36254. $multiselect = $this->multiselect;
  36255. $isAssoc = $this->isAssoc($choices);
  36256. return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) {
  36257. $selectedChoices = str_replace(' ', '', $selected);
  36258. if ($multiselect) {
  36259. if (!preg_match('/^[^,]+(?:,[^,]+)*$/', $selectedChoices, $matches)) {
  36260. throw new InvalidArgumentException(sprintf($errorMessage, $selected));
  36261. }
  36262. $selectedChoices = explode(',', $selectedChoices);
  36263. } else {
  36264. $selectedChoices = array($selected);
  36265. }
  36266. $multiselectChoices = array();
  36267. foreach ($selectedChoices as $value) {
  36268. $results = array();
  36269. foreach ($choices as $key => $choice) {
  36270. if ($choice === $value) {
  36271. $results[] = $key;
  36272. }
  36273. }
  36274. if (count($results) > 1) {
  36275. throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of %s.', implode(' or ', $results)));
  36276. }
  36277. $result = array_search($value, $choices);
  36278. if (!$isAssoc) {
  36279. if (false !== $result) {
  36280. $result = $choices[$result];
  36281. } elseif (isset($choices[$value])) {
  36282. $result = $choices[$value];
  36283. }
  36284. } elseif (false === $result && isset($choices[$value])) {
  36285. $result = $value;
  36286. }
  36287. if (false === $result) {
  36288. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  36289. }
  36290. $multiselectChoices[] = (string) $result;
  36291. }
  36292. if ($multiselect) {
  36293. return $multiselectChoices;
  36294. }
  36295. return current($multiselectChoices);
  36296. };
  36297. }
  36298. }
  36299. <?php
  36300. namespace Symfony\Component\Console\Question;
  36301. class ConfirmationQuestion extends Question
  36302. {
  36303. private $trueAnswerRegex;
  36304. public function __construct($question, $default = true, $trueAnswerRegex = '/^y/i')
  36305. {
  36306. parent::__construct($question, (bool) $default);
  36307. $this->trueAnswerRegex = $trueAnswerRegex;
  36308. $this->setNormalizer($this->getDefaultNormalizer());
  36309. }
  36310. private function getDefaultNormalizer()
  36311. {
  36312. $default = $this->getDefault();
  36313. $regex = $this->trueAnswerRegex;
  36314. return function ($answer) use ($default, $regex) {
  36315. if (is_bool($answer)) {
  36316. return $answer;
  36317. }
  36318. $answerIsTrue = (bool) preg_match($regex, $answer);
  36319. if (false === $default) {
  36320. return $answer && $answerIsTrue;
  36321. }
  36322. return !$answer || $answerIsTrue;
  36323. };
  36324. }
  36325. }
  36326. <?php
  36327. namespace Symfony\Component\Console\Question;
  36328. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36329. use Symfony\Component\Console\Exception\LogicException;
  36330. class Question
  36331. {
  36332. private $question;
  36333. private $attempts;
  36334. private $hidden = false;
  36335. private $hiddenFallback = true;
  36336. private $autocompleterValues;
  36337. private $validator;
  36338. private $default;
  36339. private $normalizer;
  36340. public function __construct($question, $default = null)
  36341. {
  36342. $this->question = $question;
  36343. $this->default = $default;
  36344. }
  36345. public function getQuestion()
  36346. {
  36347. return $this->question;
  36348. }
  36349. public function getDefault()
  36350. {
  36351. return $this->default;
  36352. }
  36353. public function isHidden()
  36354. {
  36355. return $this->hidden;
  36356. }
  36357. public function setHidden($hidden)
  36358. {
  36359. if ($this->autocompleterValues) {
  36360. throw new LogicException('A hidden question cannot use the autocompleter.');
  36361. }
  36362. $this->hidden = (bool) $hidden;
  36363. return $this;
  36364. }
  36365. public function isHiddenFallback()
  36366. {
  36367. return $this->hiddenFallback;
  36368. }
  36369. public function setHiddenFallback($fallback)
  36370. {
  36371. $this->hiddenFallback = (bool) $fallback;
  36372. return $this;
  36373. }
  36374. public function getAutocompleterValues()
  36375. {
  36376. return $this->autocompleterValues;
  36377. }
  36378. public function setAutocompleterValues($values)
  36379. {
  36380. if (is_array($values)) {
  36381. $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values);
  36382. }
  36383. if (null !== $values && !is_array($values) && !$values instanceof \Traversable) {
  36384. throw new InvalidArgumentException('Autocompleter values can be either an array, `null` or a `Traversable` object.');
  36385. }
  36386. if ($this->hidden) {
  36387. throw new LogicException('A hidden question cannot use the autocompleter.');
  36388. }
  36389. $this->autocompleterValues = $values;
  36390. return $this;
  36391. }
  36392. public function setValidator($validator)
  36393. {
  36394. $this->validator = $validator;
  36395. return $this;
  36396. }
  36397. public function getValidator()
  36398. {
  36399. return $this->validator;
  36400. }
  36401. public function setMaxAttempts($attempts)
  36402. {
  36403. if (null !== $attempts && $attempts < 1) {
  36404. throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
  36405. }
  36406. $this->attempts = $attempts;
  36407. return $this;
  36408. }
  36409. public function getMaxAttempts()
  36410. {
  36411. return $this->attempts;
  36412. }
  36413. public function setNormalizer($normalizer)
  36414. {
  36415. $this->normalizer = $normalizer;
  36416. return $this;
  36417. }
  36418. public function getNormalizer()
  36419. {
  36420. return $this->normalizer;
  36421. }
  36422. protected function isAssoc($array)
  36423. {
  36424. return (bool) count(array_filter(array_keys($array), 'is_string'));
  36425. }
  36426. }
  36427. <?php
  36428. namespace Symfony\Component\Console;
  36429. use Symfony\Component\Console\Exception\RuntimeException;
  36430. use Symfony\Component\Console\Input\StringInput;
  36431. use Symfony\Component\Console\Output\ConsoleOutput;
  36432. use Symfony\Component\Process\ProcessBuilder;
  36433. use Symfony\Component\Process\PhpExecutableFinder;
  36434. class Shell
  36435. {
  36436. private $application;
  36437. private $history;
  36438. private $output;
  36439. private $hasReadline;
  36440. private $processIsolation = false;
  36441. public function __construct(Application $application)
  36442. {
  36443. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  36444. $this->hasReadline = function_exists('readline');
  36445. $this->application = $application;
  36446. $this->history = getenv('HOME').'/.history_'.$application->getName();
  36447. $this->output = new ConsoleOutput();
  36448. }
  36449. public function run()
  36450. {
  36451. $this->application->setAutoExit(false);
  36452. $this->application->setCatchExceptions(true);
  36453. if ($this->hasReadline) {
  36454. readline_read_history($this->history);
  36455. readline_completion_function(array($this, 'autocompleter'));
  36456. }
  36457. $this->output->writeln($this->getHeader());
  36458. $php = null;
  36459. if ($this->processIsolation) {
  36460. $finder = new PhpExecutableFinder();
  36461. $php = $finder->find();
  36462. $this->output->writeln(<<<'EOF'
  36463. <info>Running with process isolation, you should consider this:</info>
  36464. * each command is executed as separate process,
  36465. * commands don't support interactivity, all params must be passed explicitly,
  36466. * commands output is not colorized.
  36467. EOF
  36468. );
  36469. }
  36470. while (true) {
  36471. $command = $this->readline();
  36472. if (false === $command) {
  36473. $this->output->writeln("\n");
  36474. break;
  36475. }
  36476. if ($this->hasReadline) {
  36477. readline_add_history($command);
  36478. readline_write_history($this->history);
  36479. }
  36480. if ($this->processIsolation) {
  36481. $pb = new ProcessBuilder();
  36482. $process = $pb
  36483. ->add($php)
  36484. ->add($_SERVER['argv'][0])
  36485. ->add($command)
  36486. ->inheritEnvironmentVariables(true)
  36487. ->getProcess()
  36488. ;
  36489. $output = $this->output;
  36490. $process->run(function ($type, $data) use ($output) {
  36491. $output->writeln($data);
  36492. });
  36493. $ret = $process->getExitCode();
  36494. } else {
  36495. $ret = $this->application->run(new StringInput($command), $this->output);
  36496. }
  36497. if (0 !== $ret) {
  36498. $this->output->writeln(sprintf('<error>The command terminated with an error status (%s)</error>', $ret));
  36499. }
  36500. }
  36501. }
  36502. protected function getHeader()
  36503. {
  36504. return <<<EOF
  36505. Welcome to the <info>{$this->application->getName()}</info> shell (<comment>{$this->application->getVersion()}</comment>).
  36506. At the prompt, type <comment>help</comment> for some help,
  36507. or <comment>list</comment> to get a list of available commands.
  36508. To exit the shell, type <comment>^D</comment>.
  36509. EOF;
  36510. }
  36511. protected function getPrompt()
  36512. {
  36513. return $this->output->getFormatter()->format($this->application->getName().' > ');
  36514. }
  36515. protected function getOutput()
  36516. {
  36517. return $this->output;
  36518. }
  36519. protected function getApplication()
  36520. {
  36521. return $this->application;
  36522. }
  36523. private function autocompleter($text)
  36524. {
  36525. $info = readline_info();
  36526. $text = substr($info['line_buffer'], 0, $info['end']);
  36527. if ($info['point'] !== $info['end']) {
  36528. return true;
  36529. }
  36530. if (false === strpos($text, ' ') || !$text) {
  36531. return array_keys($this->application->all());
  36532. }
  36533. try {
  36534. $command = $this->application->find(substr($text, 0, strpos($text, ' ')));
  36535. } catch (\Exception $e) {
  36536. return true;
  36537. }
  36538. $list = array('--help');
  36539. foreach ($command->getDefinition()->getOptions() as $option) {
  36540. $list[] = '--'.$option->getName();
  36541. }
  36542. return $list;
  36543. }
  36544. private function readline()
  36545. {
  36546. if ($this->hasReadline) {
  36547. $line = readline($this->getPrompt());
  36548. } else {
  36549. $this->output->write($this->getPrompt());
  36550. $line = fgets(STDIN, 1024);
  36551. $line = (false === $line || '' === $line) ? false : rtrim($line);
  36552. }
  36553. return $line;
  36554. }
  36555. public function getProcessIsolation()
  36556. {
  36557. return $this->processIsolation;
  36558. }
  36559. public function setProcessIsolation($processIsolation)
  36560. {
  36561. $this->processIsolation = (bool) $processIsolation;
  36562. if ($this->processIsolation && !class_exists('Symfony\\Component\\Process\\Process')) {
  36563. throw new RuntimeException('Unable to isolate processes as the Symfony Process Component is not installed.');
  36564. }
  36565. }
  36566. }
  36567. <?php
  36568. namespace Symfony\Component\Console\Style;
  36569. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  36570. use Symfony\Component\Console\Helper\ProgressBar;
  36571. use Symfony\Component\Console\Output\OutputInterface;
  36572. abstract class OutputStyle implements OutputInterface, StyleInterface
  36573. {
  36574. private $output;
  36575. public function __construct(OutputInterface $output)
  36576. {
  36577. $this->output = $output;
  36578. }
  36579. public function newLine($count = 1)
  36580. {
  36581. $this->output->write(str_repeat(PHP_EOL, $count));
  36582. }
  36583. public function createProgressBar($max = 0)
  36584. {
  36585. return new ProgressBar($this->output, $max);
  36586. }
  36587. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  36588. {
  36589. $this->output->write($messages, $newline, $type);
  36590. }
  36591. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  36592. {
  36593. $this->output->writeln($messages, $type);
  36594. }
  36595. public function setVerbosity($level)
  36596. {
  36597. $this->output->setVerbosity($level);
  36598. }
  36599. public function getVerbosity()
  36600. {
  36601. return $this->output->getVerbosity();
  36602. }
  36603. public function setDecorated($decorated)
  36604. {
  36605. $this->output->setDecorated($decorated);
  36606. }
  36607. public function isDecorated()
  36608. {
  36609. return $this->output->isDecorated();
  36610. }
  36611. public function setFormatter(OutputFormatterInterface $formatter)
  36612. {
  36613. $this->output->setFormatter($formatter);
  36614. }
  36615. public function getFormatter()
  36616. {
  36617. return $this->output->getFormatter();
  36618. }
  36619. }
  36620. <?php
  36621. namespace Symfony\Component\Console\Style;
  36622. interface StyleInterface
  36623. {
  36624. public function title($message);
  36625. public function section($message);
  36626. public function listing(array $elements);
  36627. public function text($message);
  36628. public function success($message);
  36629. public function error($message);
  36630. public function warning($message);
  36631. public function note($message);
  36632. public function caution($message);
  36633. public function table(array $headers, array $rows);
  36634. public function ask($question, $default = null, $validator = null);
  36635. public function askHidden($question, $validator = null);
  36636. public function confirm($question, $default = true);
  36637. public function choice($question, array $choices, $default = null);
  36638. public function newLine($count = 1);
  36639. public function progressStart($max = 0);
  36640. public function progressAdvance($step = 1);
  36641. public function progressFinish();
  36642. }
  36643. <?php
  36644. namespace Symfony\Component\Console\Style;
  36645. use Symfony\Component\Console\Application;
  36646. use Symfony\Component\Console\Exception\RuntimeException;
  36647. use Symfony\Component\Console\Formatter\OutputFormatter;
  36648. use Symfony\Component\Console\Helper\Helper;
  36649. use Symfony\Component\Console\Helper\ProgressBar;
  36650. use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
  36651. use Symfony\Component\Console\Helper\Table;
  36652. use Symfony\Component\Console\Input\InputInterface;
  36653. use Symfony\Component\Console\Output\BufferedOutput;
  36654. use Symfony\Component\Console\Output\OutputInterface;
  36655. use Symfony\Component\Console\Question\ChoiceQuestion;
  36656. use Symfony\Component\Console\Question\ConfirmationQuestion;
  36657. use Symfony\Component\Console\Question\Question;
  36658. class SymfonyStyle extends OutputStyle
  36659. {
  36660. const MAX_LINE_LENGTH = 120;
  36661. private $input;
  36662. private $questionHelper;
  36663. private $progressBar;
  36664. private $lineLength;
  36665. private $bufferedOutput;
  36666. public function __construct(InputInterface $input, OutputInterface $output)
  36667. {
  36668. $this->input = $input;
  36669. $this->bufferedOutput = new BufferedOutput($output->getVerbosity(), false, clone $output->getFormatter());
  36670. $this->lineLength = min($this->getTerminalWidth() - (int) (DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
  36671. parent::__construct($output);
  36672. }
  36673. public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false)
  36674. {
  36675. $messages = is_array($messages) ? array_values($messages) : array($messages);
  36676. $this->autoPrependBlock();
  36677. $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, true));
  36678. $this->newLine();
  36679. }
  36680. public function title($message)
  36681. {
  36682. $this->autoPrependBlock();
  36683. $this->writeln(array(
  36684. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  36685. sprintf('<comment>%s</>', str_repeat('=', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  36686. ));
  36687. $this->newLine();
  36688. }
  36689. public function section($message)
  36690. {
  36691. $this->autoPrependBlock();
  36692. $this->writeln(array(
  36693. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  36694. sprintf('<comment>%s</>', str_repeat('-', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  36695. ));
  36696. $this->newLine();
  36697. }
  36698. public function listing(array $elements)
  36699. {
  36700. $this->autoPrependText();
  36701. $elements = array_map(function ($element) {
  36702. return sprintf(' * %s', $element);
  36703. }, $elements);
  36704. $this->writeln($elements);
  36705. $this->newLine();
  36706. }
  36707. public function text($message)
  36708. {
  36709. $this->autoPrependText();
  36710. $messages = is_array($message) ? array_values($message) : array($message);
  36711. foreach ($messages as $message) {
  36712. $this->writeln(sprintf(' %s', $message));
  36713. }
  36714. }
  36715. public function comment($message)
  36716. {
  36717. $messages = is_array($message) ? array_values($message) : array($message);
  36718. $this->autoPrependBlock();
  36719. $this->writeln($this->createBlock($messages, null, null, '<fg=default;bg=default> // </>'));
  36720. $this->newLine();
  36721. }
  36722. public function success($message)
  36723. {
  36724. $this->block($message, 'OK', 'fg=black;bg=green', ' ', true);
  36725. }
  36726. public function error($message)
  36727. {
  36728. $this->block($message, 'ERROR', 'fg=white;bg=red', ' ', true);
  36729. }
  36730. public function warning($message)
  36731. {
  36732. $this->block($message, 'WARNING', 'fg=white;bg=red', ' ', true);
  36733. }
  36734. public function note($message)
  36735. {
  36736. $this->block($message, 'NOTE', 'fg=yellow', ' ! ');
  36737. }
  36738. public function caution($message)
  36739. {
  36740. $this->block($message, 'CAUTION', 'fg=white;bg=red', ' ! ', true);
  36741. }
  36742. public function table(array $headers, array $rows)
  36743. {
  36744. $style = clone Table::getStyleDefinition('symfony-style-guide');
  36745. $style->setCellHeaderFormat('<info>%s</info>');
  36746. $table = new Table($this);
  36747. $table->setHeaders($headers);
  36748. $table->setRows($rows);
  36749. $table->setStyle($style);
  36750. $table->render();
  36751. $this->newLine();
  36752. }
  36753. public function ask($question, $default = null, $validator = null)
  36754. {
  36755. $question = new Question($question, $default);
  36756. $question->setValidator($validator);
  36757. return $this->askQuestion($question);
  36758. }
  36759. public function askHidden($question, $validator = null)
  36760. {
  36761. $question = new Question($question);
  36762. $question->setHidden(true);
  36763. $question->setValidator($validator);
  36764. return $this->askQuestion($question);
  36765. }
  36766. public function confirm($question, $default = true)
  36767. {
  36768. return $this->askQuestion(new ConfirmationQuestion($question, $default));
  36769. }
  36770. public function choice($question, array $choices, $default = null)
  36771. {
  36772. if (null !== $default) {
  36773. $values = array_flip($choices);
  36774. $default = $values[$default];
  36775. }
  36776. return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
  36777. }
  36778. public function progressStart($max = 0)
  36779. {
  36780. $this->progressBar = $this->createProgressBar($max);
  36781. $this->progressBar->start();
  36782. }
  36783. public function progressAdvance($step = 1)
  36784. {
  36785. $this->getProgressBar()->advance($step);
  36786. }
  36787. public function progressFinish()
  36788. {
  36789. $this->getProgressBar()->finish();
  36790. $this->newLine(2);
  36791. $this->progressBar = null;
  36792. }
  36793. public function createProgressBar($max = 0)
  36794. {
  36795. $progressBar = parent::createProgressBar($max);
  36796. if ('\\' !== DIRECTORY_SEPARATOR) {
  36797. $progressBar->setEmptyBarCharacter('â–‘');
  36798. $progressBar->setProgressCharacter('');
  36799. $progressBar->setBarCharacter('â–“');
  36800. }
  36801. return $progressBar;
  36802. }
  36803. public function askQuestion(Question $question)
  36804. {
  36805. if ($this->input->isInteractive()) {
  36806. $this->autoPrependBlock();
  36807. }
  36808. if (!$this->questionHelper) {
  36809. $this->questionHelper = new SymfonyQuestionHelper();
  36810. }
  36811. $answer = $this->questionHelper->ask($this->input, $this, $question);
  36812. if ($this->input->isInteractive()) {
  36813. $this->newLine();
  36814. $this->bufferedOutput->write("\n");
  36815. }
  36816. return $answer;
  36817. }
  36818. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  36819. {
  36820. parent::writeln($messages, $type);
  36821. $this->bufferedOutput->writeln($this->reduceBuffer($messages), $type);
  36822. }
  36823. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  36824. {
  36825. parent::write($messages, $newline, $type);
  36826. $this->bufferedOutput->write($this->reduceBuffer($messages), $newline, $type);
  36827. }
  36828. public function newLine($count = 1)
  36829. {
  36830. parent::newLine($count);
  36831. $this->bufferedOutput->write(str_repeat("\n", $count));
  36832. }
  36833. private function getProgressBar()
  36834. {
  36835. if (!$this->progressBar) {
  36836. throw new RuntimeException('The ProgressBar is not started.');
  36837. }
  36838. return $this->progressBar;
  36839. }
  36840. private function getTerminalWidth()
  36841. {
  36842. $application = new Application();
  36843. $dimensions = $application->getTerminalDimensions();
  36844. return $dimensions[0] ?: self::MAX_LINE_LENGTH;
  36845. }
  36846. private function autoPrependBlock()
  36847. {
  36848. $chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
  36849. if (!isset($chars[0])) {
  36850. return $this->newLine();
  36851. }
  36852. $this->newLine(2 - substr_count($chars, "\n"));
  36853. }
  36854. private function autoPrependText()
  36855. {
  36856. $fetched = $this->bufferedOutput->fetch();
  36857. if ("\n" !== substr($fetched, -1)) {
  36858. $this->newLine();
  36859. }
  36860. }
  36861. private function reduceBuffer($messages)
  36862. {
  36863. return array_map(function ($value) {
  36864. return substr($value, -4);
  36865. }, array_merge(array($this->bufferedOutput->fetch()), (array) $messages));
  36866. }
  36867. private function createBlock($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = false)
  36868. {
  36869. $indentLength = 0;
  36870. $prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
  36871. $lines = array();
  36872. if (null !== $type) {
  36873. $type = sprintf('[%s] ', $type);
  36874. $indentLength = strlen($type);
  36875. $lineIndentation = str_repeat(' ', $indentLength);
  36876. }
  36877. foreach ($messages as $key => $message) {
  36878. if ($escape) {
  36879. $message = OutputFormatter::escape($message);
  36880. }
  36881. $lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, PHP_EOL, true)));
  36882. if (count($messages) > 1 && $key < count($messages) - 1) {
  36883. $lines[] = '';
  36884. }
  36885. }
  36886. $firstLineIndex = 0;
  36887. if ($padding && $this->isDecorated()) {
  36888. $firstLineIndex = 1;
  36889. array_unshift($lines, '');
  36890. $lines[] = '';
  36891. }
  36892. foreach ($lines as $i => &$line) {
  36893. if (null !== $type) {
  36894. $line = $firstLineIndex === $i ? $type.$line : $lineIndentation.$line;
  36895. }
  36896. $line = $prefix.$line;
  36897. $line .= str_repeat(' ', $this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line));
  36898. if ($style) {
  36899. $line = sprintf('<%s>%s</>', $style, $line);
  36900. }
  36901. }
  36902. return $lines;
  36903. }
  36904. }
  36905. <?php
  36906. namespace Symfony\Component\Console\Tester;
  36907. use Symfony\Component\Console\Application;
  36908. use Symfony\Component\Console\Input\ArrayInput;
  36909. use Symfony\Component\Console\Input\InputInterface;
  36910. use Symfony\Component\Console\Output\OutputInterface;
  36911. use Symfony\Component\Console\Output\StreamOutput;
  36912. class ApplicationTester
  36913. {
  36914. private $application;
  36915. private $input;
  36916. private $output;
  36917. private $statusCode;
  36918. public function __construct(Application $application)
  36919. {
  36920. $this->application = $application;
  36921. }
  36922. public function run(array $input, $options = array())
  36923. {
  36924. $this->input = new ArrayInput($input);
  36925. if (isset($options['interactive'])) {
  36926. $this->input->setInteractive($options['interactive']);
  36927. }
  36928. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  36929. if (isset($options['decorated'])) {
  36930. $this->output->setDecorated($options['decorated']);
  36931. }
  36932. if (isset($options['verbosity'])) {
  36933. $this->output->setVerbosity($options['verbosity']);
  36934. }
  36935. return $this->statusCode = $this->application->run($this->input, $this->output);
  36936. }
  36937. public function getDisplay($normalize = false)
  36938. {
  36939. rewind($this->output->getStream());
  36940. $display = stream_get_contents($this->output->getStream());
  36941. if ($normalize) {
  36942. $display = str_replace(PHP_EOL, "\n", $display);
  36943. }
  36944. return $display;
  36945. }
  36946. public function getInput()
  36947. {
  36948. return $this->input;
  36949. }
  36950. public function getOutput()
  36951. {
  36952. return $this->output;
  36953. }
  36954. public function getStatusCode()
  36955. {
  36956. return $this->statusCode;
  36957. }
  36958. }
  36959. <?php
  36960. namespace Symfony\Component\Console\Tester;
  36961. use Symfony\Component\Console\Command\Command;
  36962. use Symfony\Component\Console\Input\ArrayInput;
  36963. use Symfony\Component\Console\Output\StreamOutput;
  36964. use Symfony\Component\Console\Input\InputInterface;
  36965. use Symfony\Component\Console\Output\OutputInterface;
  36966. class CommandTester
  36967. {
  36968. private $command;
  36969. private $input;
  36970. private $output;
  36971. private $statusCode;
  36972. public function __construct(Command $command)
  36973. {
  36974. $this->command = $command;
  36975. }
  36976. public function execute(array $input, array $options = array())
  36977. {
  36978. if (!isset($input['command'])
  36979. && (null !== $application = $this->command->getApplication())
  36980. && $application->getDefinition()->hasArgument('command')
  36981. ) {
  36982. $input = array_merge(array('command' => $this->command->getName()), $input);
  36983. }
  36984. $this->input = new ArrayInput($input);
  36985. if (isset($options['interactive'])) {
  36986. $this->input->setInteractive($options['interactive']);
  36987. }
  36988. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  36989. $this->output->setDecorated(isset($options['decorated']) ? $options['decorated'] : false);
  36990. if (isset($options['verbosity'])) {
  36991. $this->output->setVerbosity($options['verbosity']);
  36992. }
  36993. return $this->statusCode = $this->command->run($this->input, $this->output);
  36994. }
  36995. public function getDisplay($normalize = false)
  36996. {
  36997. rewind($this->output->getStream());
  36998. $display = stream_get_contents($this->output->getStream());
  36999. if ($normalize) {
  37000. $display = str_replace(PHP_EOL, "\n", $display);
  37001. }
  37002. return $display;
  37003. }
  37004. public function getInput()
  37005. {
  37006. return $this->input;
  37007. }
  37008. public function getOutput()
  37009. {
  37010. return $this->output;
  37011. }
  37012. public function getStatusCode()
  37013. {
  37014. return $this->statusCode;
  37015. }
  37016. }
  37017. <?php
  37018. namespace Symfony\Component\Debug;
  37019. use Psr\Log\AbstractLogger;
  37020. class BufferingLogger extends AbstractLogger
  37021. {
  37022. private $logs = array();
  37023. public function log($level, $message, array $context = array())
  37024. {
  37025. $this->logs[] = array($level, $message, $context);
  37026. }
  37027. public function cleanLogs()
  37028. {
  37029. $logs = $this->logs;
  37030. $this->logs = array();
  37031. return $logs;
  37032. }
  37033. }
  37034. <?php
  37035. namespace Symfony\Component\Debug;
  37036. class Debug
  37037. {
  37038. private static $enabled = false;
  37039. public static function enable($errorReportingLevel = null, $displayErrors = true)
  37040. {
  37041. if (static::$enabled) {
  37042. return;
  37043. }
  37044. static::$enabled = true;
  37045. if (null !== $errorReportingLevel) {
  37046. error_reporting($errorReportingLevel);
  37047. } else {
  37048. error_reporting(-1);
  37049. }
  37050. if (!\in_array(PHP_SAPI, array('cli', 'phpdbg'), true)) {
  37051. ini_set('display_errors', 0);
  37052. ExceptionHandler::register();
  37053. } elseif ($displayErrors && (!ini_get('log_errors') || ini_get('error_log'))) {
  37054. ini_set('display_errors', 1);
  37055. }
  37056. if ($displayErrors) {
  37057. ErrorHandler::register(new ErrorHandler(new BufferingLogger()));
  37058. } else {
  37059. ErrorHandler::register()->throwAt(0, true);
  37060. }
  37061. DebugClassLoader::enable();
  37062. }
  37063. }
  37064. <?php
  37065. namespace Symfony\Component\Debug;
  37066. class DebugClassLoader
  37067. {
  37068. private $classLoader;
  37069. private $isFinder;
  37070. private $loaded = array();
  37071. private $wasFinder;
  37072. private static $caseCheck;
  37073. private static $deprecated = array();
  37074. private static $php7Reserved = array('int', 'float', 'bool', 'string', 'true', 'false', 'null');
  37075. private static $darwinCache = array('/' => array('/', array()));
  37076. public function __construct($classLoader)
  37077. {
  37078. $this->wasFinder = is_object($classLoader) && method_exists($classLoader, 'findFile');
  37079. if ($this->wasFinder) {
  37080. @trigger_error('The '.__METHOD__.' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED);
  37081. $this->classLoader = array($classLoader, 'loadClass');
  37082. $this->isFinder = true;
  37083. } else {
  37084. $this->classLoader = $classLoader;
  37085. $this->isFinder = is_array($classLoader) && method_exists($classLoader[0], 'findFile');
  37086. }
  37087. if (!isset(self::$caseCheck)) {
  37088. $file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), DIRECTORY_SEPARATOR);
  37089. $i = strrpos($file, DIRECTORY_SEPARATOR);
  37090. $dir = substr($file, 0, 1 + $i);
  37091. $file = substr($file, 1 + $i);
  37092. $test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
  37093. $test = realpath($dir.$test);
  37094. if (false === $test || false === $i) {
  37095. self::$caseCheck = 0;
  37096. } elseif (substr($test, -strlen($file)) === $file) {
  37097. self::$caseCheck = 1;
  37098. } elseif (false !== stripos(PHP_OS, 'darwin')) {
  37099. self::$caseCheck = 2;
  37100. } else {
  37101. self::$caseCheck = 0;
  37102. }
  37103. }
  37104. }
  37105. public function getClassLoader()
  37106. {
  37107. return $this->wasFinder ? $this->classLoader[0] : $this->classLoader;
  37108. }
  37109. public static function enable()
  37110. {
  37111. class_exists('Symfony\Component\Debug\ErrorHandler');
  37112. class_exists('Psr\Log\LogLevel');
  37113. if (!is_array($functions = spl_autoload_functions())) {
  37114. return;
  37115. }
  37116. foreach ($functions as $function) {
  37117. spl_autoload_unregister($function);
  37118. }
  37119. foreach ($functions as $function) {
  37120. if (!is_array($function) || !$function[0] instanceof self) {
  37121. $function = array(new static($function), 'loadClass');
  37122. }
  37123. spl_autoload_register($function);
  37124. }
  37125. }
  37126. public static function disable()
  37127. {
  37128. if (!is_array($functions = spl_autoload_functions())) {
  37129. return;
  37130. }
  37131. foreach ($functions as $function) {
  37132. spl_autoload_unregister($function);
  37133. }
  37134. foreach ($functions as $function) {
  37135. if (is_array($function) && $function[0] instanceof self) {
  37136. $function = $function[0]->getClassLoader();
  37137. }
  37138. spl_autoload_register($function);
  37139. }
  37140. }
  37141. public function findFile($class)
  37142. {
  37143. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  37144. if ($this->wasFinder) {
  37145. return $this->classLoader[0]->findFile($class);
  37146. }
  37147. }
  37148. public function loadClass($class)
  37149. {
  37150. ErrorHandler::stackErrors();
  37151. try {
  37152. if ($this->isFinder && !isset($this->loaded[$class])) {
  37153. $this->loaded[$class] = true;
  37154. if ($file = $this->classLoader[0]->findFile($class)) {
  37155. require $file;
  37156. }
  37157. } else {
  37158. call_user_func($this->classLoader, $class);
  37159. $file = false;
  37160. }
  37161. } catch (\Exception $e) {
  37162. ErrorHandler::unstackErrors();
  37163. throw $e;
  37164. } catch (\Throwable $e) {
  37165. ErrorHandler::unstackErrors();
  37166. throw $e;
  37167. }
  37168. ErrorHandler::unstackErrors();
  37169. $exists = class_exists($class, false) || interface_exists($class, false) || (function_exists('trait_exists') && trait_exists($class, false));
  37170. if ($class && '\\' === $class[0]) {
  37171. $class = substr($class, 1);
  37172. }
  37173. if ($exists) {
  37174. $refl = new \ReflectionClass($class);
  37175. $name = $refl->getName();
  37176. if ($name !== $class && 0 === strcasecmp($name, $class)) {
  37177. throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: %s vs %s', $class, $name));
  37178. }
  37179. if (in_array(strtolower($refl->getShortName()), self::$php7Reserved)) {
  37180. @trigger_error(sprintf('%s uses a reserved class name (%s) that will break on PHP 7 and higher', $name, $refl->getShortName()), E_USER_DEPRECATED);
  37181. } elseif (preg_match('#\n \* @deprecated (.*?)\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) {
  37182. self::$deprecated[$name] = preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]);
  37183. } else {
  37184. if (2 > $len = 1 + (strpos($name, '\\') ?: strpos($name, '_'))) {
  37185. $len = 0;
  37186. $ns = '';
  37187. } else {
  37188. $ns = substr($name, 0, $len);
  37189. }
  37190. $parent = get_parent_class($class);
  37191. if (!$parent || strncmp($ns, $parent, $len)) {
  37192. if ($parent && isset(self::$deprecated[$parent]) && strncmp($ns, $parent, $len)) {
  37193. @trigger_error(sprintf('The %s class extends %s that is deprecated %s', $name, $parent, self::$deprecated[$parent]), E_USER_DEPRECATED);
  37194. }
  37195. $parentInterfaces = array();
  37196. $deprecatedInterfaces = array();
  37197. if ($parent) {
  37198. foreach (class_implements($parent) as $interface) {
  37199. $parentInterfaces[$interface] = 1;
  37200. }
  37201. }
  37202. foreach ($refl->getInterfaceNames() as $interface) {
  37203. if (isset(self::$deprecated[$interface]) && strncmp($ns, $interface, $len)) {
  37204. $deprecatedInterfaces[] = $interface;
  37205. }
  37206. foreach (class_implements($interface) as $interface) {
  37207. $parentInterfaces[$interface] = 1;
  37208. }
  37209. }
  37210. foreach ($deprecatedInterfaces as $interface) {
  37211. if (!isset($parentInterfaces[$interface])) {
  37212. @trigger_error(sprintf('The %s %s %s that is deprecated %s', $name, $refl->isInterface() ? 'interface extends' : 'class implements', $interface, self::$deprecated[$interface]), E_USER_DEPRECATED);
  37213. }
  37214. }
  37215. }
  37216. }
  37217. }
  37218. if ($file) {
  37219. if (!$exists) {
  37220. if (false !== strpos($class, '/')) {
  37221. throw new \RuntimeException(sprintf('Trying to autoload a class with an invalid name "%s". Be careful that the namespace separator is "\" in PHP, not "/".', $class));
  37222. }
  37223. throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file));
  37224. }
  37225. if (self::$caseCheck) {
  37226. $real = explode('\\', $class.strrchr($file, '.'));
  37227. $tail = explode(DIRECTORY_SEPARATOR, str_replace('/', DIRECTORY_SEPARATOR, $file));
  37228. $i = count($tail) - 1;
  37229. $j = count($real) - 1;
  37230. while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) {
  37231. --$i;
  37232. --$j;
  37233. }
  37234. array_splice($tail, 0, $i + 1);
  37235. }
  37236. if (self::$caseCheck && $tail) {
  37237. $tail = DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, $tail);
  37238. $tailLen = strlen($tail);
  37239. $real = $refl->getFileName();
  37240. if (2 === self::$caseCheck) {
  37241. $i = 1 + strrpos($real, '/');
  37242. $file = substr($real, $i);
  37243. $real = substr($real, 0, $i);
  37244. if (isset(self::$darwinCache[$real])) {
  37245. $kDir = $real;
  37246. } else {
  37247. $kDir = strtolower($real);
  37248. if (isset(self::$darwinCache[$kDir])) {
  37249. $real = self::$darwinCache[$kDir][0];
  37250. } else {
  37251. $dir = getcwd();
  37252. chdir($real);
  37253. $real = getcwd().'/';
  37254. chdir($dir);
  37255. $dir = $real;
  37256. $k = $kDir;
  37257. $i = strlen($dir) - 1;
  37258. while (!isset(self::$darwinCache[$k])) {
  37259. self::$darwinCache[$k] = array($dir, array());
  37260. self::$darwinCache[$dir] = &self::$darwinCache[$k];
  37261. while ('/' !== $dir[--$i]) {
  37262. }
  37263. $k = substr($k, 0, ++$i);
  37264. $dir = substr($dir, 0, $i--);
  37265. }
  37266. }
  37267. }
  37268. $dirFiles = self::$darwinCache[$kDir][1];
  37269. if (isset($dirFiles[$file])) {
  37270. $kFile = $file;
  37271. } else {
  37272. $kFile = strtolower($file);
  37273. if (!isset($dirFiles[$kFile])) {
  37274. foreach (scandir($real, 2) as $f) {
  37275. if ('.' !== $f[0]) {
  37276. $dirFiles[$f] = $f;
  37277. if ($f === $file) {
  37278. $kFile = $k = $file;
  37279. } elseif ($f !== $k = strtolower($f)) {
  37280. $dirFiles[$k] = $f;
  37281. }
  37282. }
  37283. }
  37284. self::$darwinCache[$kDir][1] = $dirFiles;
  37285. }
  37286. }
  37287. $real .= $dirFiles[$kFile];
  37288. }
  37289. if (0 === substr_compare($real, $tail, -$tailLen, $tailLen, true)
  37290. && 0 !== substr_compare($real, $tail, -$tailLen, $tailLen, false)
  37291. ) {
  37292. throw new \RuntimeException(sprintf('Case mismatch between class and real file names: %s vs %s in %s', substr($tail, -$tailLen + 1), substr($real, -$tailLen + 1), substr($real, 0, -$tailLen + 1)));
  37293. }
  37294. }
  37295. return true;
  37296. }
  37297. }
  37298. }
  37299. <?php
  37300. namespace Symfony\Component\Debug;
  37301. use Psr\Log\LogLevel;
  37302. use Psr\Log\LoggerInterface;
  37303. use Symfony\Component\Debug\Exception\ContextErrorException;
  37304. use Symfony\Component\Debug\Exception\FatalErrorException;
  37305. use Symfony\Component\Debug\Exception\FatalThrowableError;
  37306. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  37307. use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler;
  37308. use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler;
  37309. use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler;
  37310. use Symfony\Component\Debug\FatalErrorHandler\FatalErrorHandlerInterface;
  37311. class ErrorHandler
  37312. {
  37313. const TYPE_DEPRECATION = -100;
  37314. private $levels = array(
  37315. E_DEPRECATED => 'Deprecated',
  37316. E_USER_DEPRECATED => 'User Deprecated',
  37317. E_NOTICE => 'Notice',
  37318. E_USER_NOTICE => 'User Notice',
  37319. E_STRICT => 'Runtime Notice',
  37320. E_WARNING => 'Warning',
  37321. E_USER_WARNING => 'User Warning',
  37322. E_COMPILE_WARNING => 'Compile Warning',
  37323. E_CORE_WARNING => 'Core Warning',
  37324. E_USER_ERROR => 'User Error',
  37325. E_RECOVERABLE_ERROR => 'Catchable Fatal Error',
  37326. E_COMPILE_ERROR => 'Compile Error',
  37327. E_PARSE => 'Parse Error',
  37328. E_ERROR => 'Error',
  37329. E_CORE_ERROR => 'Core Error',
  37330. );
  37331. private $loggers = array(
  37332. E_DEPRECATED => array(null, LogLevel::INFO),
  37333. E_USER_DEPRECATED => array(null, LogLevel::INFO),
  37334. E_NOTICE => array(null, LogLevel::WARNING),
  37335. E_USER_NOTICE => array(null, LogLevel::WARNING),
  37336. E_STRICT => array(null, LogLevel::WARNING),
  37337. E_WARNING => array(null, LogLevel::WARNING),
  37338. E_USER_WARNING => array(null, LogLevel::WARNING),
  37339. E_COMPILE_WARNING => array(null, LogLevel::WARNING),
  37340. E_CORE_WARNING => array(null, LogLevel::WARNING),
  37341. E_USER_ERROR => array(null, LogLevel::CRITICAL),
  37342. E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL),
  37343. E_COMPILE_ERROR => array(null, LogLevel::CRITICAL),
  37344. E_PARSE => array(null, LogLevel::CRITICAL),
  37345. E_ERROR => array(null, LogLevel::CRITICAL),
  37346. E_CORE_ERROR => array(null, LogLevel::CRITICAL),
  37347. );
  37348. private $thrownErrors = 0x1FFF;
  37349. private $scopedErrors = 0x1FFF;
  37350. private $tracedErrors = 0x77FB;
  37351. private $screamedErrors = 0x55;
  37352. private $loggedErrors = 0;
  37353. private $loggedTraces = array();
  37354. private $isRecursive = 0;
  37355. private $isRoot = false;
  37356. private $exceptionHandler;
  37357. private $bootstrappingLogger;
  37358. private static $reservedMemory;
  37359. private static $stackedErrors = array();
  37360. private static $stackedErrorLevels = array();
  37361. private static $toStringException = null;
  37362. private static $exitCode = 0;
  37363. private $displayErrors = 0x1FFF;
  37364. public static function register($handler = null, $replace = true)
  37365. {
  37366. if (null === self::$reservedMemory) {
  37367. self::$reservedMemory = str_repeat('x', 10240);
  37368. register_shutdown_function(__CLASS__.'::handleFatalError');
  37369. }
  37370. $levels = -1;
  37371. if ($handlerIsNew = !$handler instanceof self) {
  37372. if (null !== $handler) {
  37373. $levels = $replace ? $handler : 0;
  37374. $replace = true;
  37375. }
  37376. $handler = new static();
  37377. }
  37378. if (null === $prev = set_error_handler(array($handler, 'handleError'))) {
  37379. restore_error_handler();
  37380. set_error_handler(array($handler, 'handleError'), $handler->thrownErrors | $handler->loggedErrors);
  37381. $handler->isRoot = true;
  37382. }
  37383. if ($handlerIsNew && is_array($prev) && $prev[0] instanceof self) {
  37384. $handler = $prev[0];
  37385. $replace = false;
  37386. }
  37387. if (!$replace && $prev) {
  37388. restore_error_handler();
  37389. $handlerIsRegistered = is_array($prev) && $handler === $prev[0];
  37390. } else {
  37391. $handlerIsRegistered = true;
  37392. }
  37393. if (is_array($prev = set_exception_handler(array($handler, 'handleException'))) && $prev[0] instanceof self) {
  37394. restore_exception_handler();
  37395. if (!$handlerIsRegistered) {
  37396. $handler = $prev[0];
  37397. } elseif ($handler !== $prev[0] && $replace) {
  37398. set_exception_handler(array($handler, 'handleException'));
  37399. $p = $prev[0]->setExceptionHandler(null);
  37400. $handler->setExceptionHandler($p);
  37401. $prev[0]->setExceptionHandler($p);
  37402. }
  37403. } else {
  37404. $handler->setExceptionHandler($prev);
  37405. }
  37406. $handler->throwAt($levels & $handler->thrownErrors, true);
  37407. return $handler;
  37408. }
  37409. public function __construct(BufferingLogger $bootstrappingLogger = null)
  37410. {
  37411. if ($bootstrappingLogger) {
  37412. $this->bootstrappingLogger = $bootstrappingLogger;
  37413. $this->setDefaultLogger($bootstrappingLogger);
  37414. }
  37415. }
  37416. public function setDefaultLogger(LoggerInterface $logger, $levels = null, $replace = false)
  37417. {
  37418. $loggers = array();
  37419. if (is_array($levels)) {
  37420. foreach ($levels as $type => $logLevel) {
  37421. if (empty($this->loggers[$type][0]) || $replace || $this->loggers[$type][0] === $this->bootstrappingLogger) {
  37422. $loggers[$type] = array($logger, $logLevel);
  37423. }
  37424. }
  37425. } else {
  37426. if (null === $levels) {
  37427. $levels = E_ALL | E_STRICT;
  37428. }
  37429. foreach ($this->loggers as $type => $log) {
  37430. if (($type & $levels) && (empty($log[0]) || $replace || $log[0] === $this->bootstrappingLogger)) {
  37431. $log[0] = $logger;
  37432. $loggers[$type] = $log;
  37433. }
  37434. }
  37435. }
  37436. $this->setLoggers($loggers);
  37437. }
  37438. public function setLoggers(array $loggers)
  37439. {
  37440. $prevLogged = $this->loggedErrors;
  37441. $prev = $this->loggers;
  37442. $flush = array();
  37443. foreach ($loggers as $type => $log) {
  37444. if (!isset($prev[$type])) {
  37445. throw new \InvalidArgumentException('Unknown error type: '.$type);
  37446. }
  37447. if (!is_array($log)) {
  37448. $log = array($log);
  37449. } elseif (!array_key_exists(0, $log)) {
  37450. throw new \InvalidArgumentException('No logger provided');
  37451. }
  37452. if (null === $log[0]) {
  37453. $this->loggedErrors &= ~$type;
  37454. } elseif ($log[0] instanceof LoggerInterface) {
  37455. $this->loggedErrors |= $type;
  37456. } else {
  37457. throw new \InvalidArgumentException('Invalid logger provided');
  37458. }
  37459. $this->loggers[$type] = $log + $prev[$type];
  37460. if ($this->bootstrappingLogger && $prev[$type][0] === $this->bootstrappingLogger) {
  37461. $flush[$type] = $type;
  37462. }
  37463. }
  37464. $this->reRegister($prevLogged | $this->thrownErrors);
  37465. if ($flush) {
  37466. foreach ($this->bootstrappingLogger->cleanLogs() as $log) {
  37467. $type = $log[2]['type'];
  37468. if (!isset($flush[$type])) {
  37469. $this->bootstrappingLogger->log($log[0], $log[1], $log[2]);
  37470. } elseif ($this->loggers[$type][0]) {
  37471. $this->loggers[$type][0]->log($this->loggers[$type][1], $log[1], $log[2]);
  37472. }
  37473. }
  37474. }
  37475. return $prev;
  37476. }
  37477. public function setExceptionHandler($handler)
  37478. {
  37479. if (null !== $handler && !is_callable($handler)) {
  37480. throw new \LogicException('The exception handler must be a valid PHP callable.');
  37481. }
  37482. $prev = $this->exceptionHandler;
  37483. $this->exceptionHandler = $handler;
  37484. return $prev;
  37485. }
  37486. public function throwAt($levels, $replace = false)
  37487. {
  37488. $prev = $this->thrownErrors;
  37489. $this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED;
  37490. if (!$replace) {
  37491. $this->thrownErrors |= $prev;
  37492. }
  37493. $this->reRegister($prev | $this->loggedErrors);
  37494. $this->displayErrors = $this->thrownErrors;
  37495. return $prev;
  37496. }
  37497. public function scopeAt($levels, $replace = false)
  37498. {
  37499. $prev = $this->scopedErrors;
  37500. $this->scopedErrors = (int) $levels;
  37501. if (!$replace) {
  37502. $this->scopedErrors |= $prev;
  37503. }
  37504. return $prev;
  37505. }
  37506. public function traceAt($levels, $replace = false)
  37507. {
  37508. $prev = $this->tracedErrors;
  37509. $this->tracedErrors = (int) $levels;
  37510. if (!$replace) {
  37511. $this->tracedErrors |= $prev;
  37512. }
  37513. return $prev;
  37514. }
  37515. public function screamAt($levels, $replace = false)
  37516. {
  37517. $prev = $this->screamedErrors;
  37518. $this->screamedErrors = (int) $levels;
  37519. if (!$replace) {
  37520. $this->screamedErrors |= $prev;
  37521. }
  37522. return $prev;
  37523. }
  37524. private function reRegister($prev)
  37525. {
  37526. if ($prev !== $this->thrownErrors | $this->loggedErrors) {
  37527. $handler = set_error_handler('var_dump');
  37528. $handler = is_array($handler) ? $handler[0] : null;
  37529. restore_error_handler();
  37530. if ($handler === $this) {
  37531. restore_error_handler();
  37532. if ($this->isRoot) {
  37533. set_error_handler(array($this, 'handleError'), $this->thrownErrors | $this->loggedErrors);
  37534. } else {
  37535. set_error_handler(array($this, 'handleError'));
  37536. }
  37537. }
  37538. }
  37539. }
  37540. public function handleError($type, $message, $file, $line)
  37541. {
  37542. $level = error_reporting() | E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED;
  37543. $log = $this->loggedErrors & $type;
  37544. $throw = $this->thrownErrors & $type & $level;
  37545. $type &= $level | $this->screamedErrors;
  37546. if (!$type || (!$log && !$throw)) {
  37547. return $type && $log;
  37548. }
  37549. $scope = $this->scopedErrors & $type;
  37550. if (4 < $numArgs = func_num_args()) {
  37551. $context = $scope ? (func_get_arg(4) ?: array()) : array();
  37552. $backtrace = 5 < $numArgs ? func_get_arg(5) : null;
  37553. } else {
  37554. $context = array();
  37555. $backtrace = null;
  37556. }
  37557. if (isset($context['GLOBALS']) && $scope) {
  37558. $e = $context;
  37559. unset($e['GLOBALS'], $context);
  37560. $context = $e;
  37561. }
  37562. if (null !== $backtrace && $type & E_ERROR) {
  37563. $this->handleFatalError(compact('type', 'message', 'file', 'line', 'backtrace'));
  37564. return true;
  37565. }
  37566. if ($throw) {
  37567. if (null !== self::$toStringException) {
  37568. $throw = self::$toStringException;
  37569. self::$toStringException = null;
  37570. } elseif ($scope && class_exists('Symfony\Component\Debug\Exception\ContextErrorException')) {
  37571. $throw = new ContextErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line, $context);
  37572. } else {
  37573. $throw = new \ErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line);
  37574. }
  37575. if (\PHP_VERSION_ID <= 50407 && (\PHP_VERSION_ID >= 50400 || \PHP_VERSION_ID <= 50317)) {
  37576. $throw->errorHandlerCanary = new ErrorHandlerCanary();
  37577. }
  37578. if (E_USER_ERROR & $type) {
  37579. $backtrace = $backtrace ?: $throw->getTrace();
  37580. for ($i = 1; isset($backtrace[$i]); ++$i) {
  37581. if (isset($backtrace[$i]['function'], $backtrace[$i]['type'], $backtrace[$i - 1]['function'])
  37582. && '__toString' === $backtrace[$i]['function']
  37583. && '->' === $backtrace[$i]['type']
  37584. && !isset($backtrace[$i - 1]['class'])
  37585. && ('trigger_error' === $backtrace[$i - 1]['function'] || 'user_error' === $backtrace[$i - 1]['function'])
  37586. ) {
  37587. foreach ($context as $e) {
  37588. if (($e instanceof \Exception || $e instanceof \Throwable) && $e->__toString() === $message) {
  37589. if (1 === $i) {
  37590. $throw = $e;
  37591. break;
  37592. }
  37593. self::$toStringException = $e;
  37594. return true;
  37595. }
  37596. }
  37597. if (1 < $i) {
  37598. $this->handleException($throw);
  37599. return false;
  37600. }
  37601. }
  37602. }
  37603. }
  37604. throw $throw;
  37605. }
  37606. $e = md5("{$type}/{$line}/{$file}\x00{$message}", true);
  37607. $trace = true;
  37608. if (!($this->tracedErrors & $type) || isset($this->loggedTraces[$e])) {
  37609. $trace = false;
  37610. } else {
  37611. $this->loggedTraces[$e] = 1;
  37612. }
  37613. $e = compact('type', 'file', 'line', 'level');
  37614. if ($type & $level) {
  37615. if ($scope) {
  37616. $e['scope_vars'] = $context;
  37617. if ($trace) {
  37618. $e['stack'] = $backtrace ?: debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT);
  37619. }
  37620. } elseif ($trace) {
  37621. if (null === $backtrace) {
  37622. $e['stack'] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
  37623. } else {
  37624. foreach ($backtrace as &$frame) {
  37625. unset($frame['args'], $frame);
  37626. }
  37627. $e['stack'] = $backtrace;
  37628. }
  37629. }
  37630. }
  37631. if ($this->isRecursive) {
  37632. $log = 0;
  37633. } elseif (self::$stackedErrorLevels) {
  37634. self::$stackedErrors[] = array($this->loggers[$type][0], ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  37635. } else {
  37636. try {
  37637. $this->isRecursive = true;
  37638. $this->loggers[$type][0]->log(($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  37639. $this->isRecursive = false;
  37640. } catch (\Exception $e) {
  37641. $this->isRecursive = false;
  37642. throw $e;
  37643. } catch (\Throwable $e) {
  37644. $this->isRecursive = false;
  37645. throw $e;
  37646. }
  37647. }
  37648. return $type && $log;
  37649. }
  37650. public function handleException($exception, array $error = null)
  37651. {
  37652. if (null === $error) {
  37653. self::$exitCode = 255;
  37654. }
  37655. if (!$exception instanceof \Exception) {
  37656. $exception = new FatalThrowableError($exception);
  37657. }
  37658. $type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR;
  37659. $handlerException = null;
  37660. if (($this->loggedErrors & $type) || $exception instanceof FatalThrowableError) {
  37661. $e = array(
  37662. 'type' => $type,
  37663. 'file' => $exception->getFile(),
  37664. 'line' => $exception->getLine(),
  37665. 'level' => error_reporting(),
  37666. 'stack' => $exception->getTrace(),
  37667. );
  37668. if ($exception instanceof FatalErrorException) {
  37669. if ($exception instanceof FatalThrowableError) {
  37670. $error = array(
  37671. 'type' => $type,
  37672. 'message' => $message = $exception->getMessage(),
  37673. 'file' => $e['file'],
  37674. 'line' => $e['line'],
  37675. );
  37676. } else {
  37677. $message = 'Fatal '.$exception->getMessage();
  37678. }
  37679. } elseif ($exception instanceof \ErrorException) {
  37680. $message = 'Uncaught '.$exception->getMessage();
  37681. if ($exception instanceof ContextErrorException) {
  37682. $e['context'] = $exception->getContext();
  37683. }
  37684. } else {
  37685. $message = 'Uncaught Exception: '.$exception->getMessage();
  37686. }
  37687. }
  37688. if ($this->loggedErrors & $type) {
  37689. try {
  37690. $this->loggers[$type][0]->log($this->loggers[$type][1], $message, $e);
  37691. } catch (\Exception $handlerException) {
  37692. } catch (\Throwable $handlerException) {
  37693. }
  37694. }
  37695. if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) {
  37696. foreach ($this->getFatalErrorHandlers() as $handler) {
  37697. if ($e = $handler->handleError($error, $exception)) {
  37698. $exception = $e;
  37699. break;
  37700. }
  37701. }
  37702. }
  37703. $exceptionHandler = $this->exceptionHandler;
  37704. $this->exceptionHandler = null;
  37705. try {
  37706. if (null !== $exceptionHandler) {
  37707. return \call_user_func($exceptionHandler, $exception);
  37708. }
  37709. $handlerException = $handlerException ?: $exception;
  37710. } catch (\Exception $handlerException) {
  37711. } catch (\Throwable $handlerException) {
  37712. }
  37713. if ($exception === $handlerException) {
  37714. self::$reservedMemory = null;
  37715. throw $exception;
  37716. }
  37717. $this->handleException($handlerException);
  37718. }
  37719. public static function handleFatalError(array $error = null)
  37720. {
  37721. if (null === self::$reservedMemory) {
  37722. return;
  37723. }
  37724. $handler = self::$reservedMemory = null;
  37725. $handlers = array();
  37726. $previousHandler = null;
  37727. $sameHandlerLimit = 10;
  37728. while (!is_array($handler) || !$handler[0] instanceof self) {
  37729. $handler = set_exception_handler('var_dump');
  37730. restore_exception_handler();
  37731. if (!$handler) {
  37732. break;
  37733. }
  37734. restore_exception_handler();
  37735. if ($handler !== $previousHandler) {
  37736. array_unshift($handlers, $handler);
  37737. $previousHandler = $handler;
  37738. } elseif (0 === --$sameHandlerLimit) {
  37739. $handler = null;
  37740. break;
  37741. }
  37742. }
  37743. foreach ($handlers as $h) {
  37744. set_exception_handler($h);
  37745. }
  37746. if (!$handler) {
  37747. return;
  37748. }
  37749. if ($handler !== $h) {
  37750. $handler[0]->setExceptionHandler($h);
  37751. }
  37752. $handler = $handler[0];
  37753. $handlers = array();
  37754. if ($exit = null === $error) {
  37755. $error = error_get_last();
  37756. }
  37757. try {
  37758. while (self::$stackedErrorLevels) {
  37759. static::unstackErrors();
  37760. }
  37761. } catch (\Exception $exception) {
  37762. } catch (\Throwable $exception) {
  37763. }
  37764. if ($error && $error['type'] &= E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR) {
  37765. $handler->throwAt(0, true);
  37766. $trace = isset($error['backtrace']) ? $error['backtrace'] : null;
  37767. if (0 === strpos($error['message'], 'Allowed memory') || 0 === strpos($error['message'], 'Out of memory')) {
  37768. $exception = new OutOfMemoryException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, false, $trace);
  37769. } else {
  37770. $exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace);
  37771. }
  37772. }
  37773. try {
  37774. if (isset($exception)) {
  37775. self::$exitCode = 255;
  37776. $handler->handleException($exception, $error);
  37777. }
  37778. } catch (FatalErrorException $e) {
  37779. }
  37780. if ($exit && self::$exitCode) {
  37781. $exitCode = self::$exitCode;
  37782. register_shutdown_function('register_shutdown_function', function () use ($exitCode) { exit($exitCode); });
  37783. }
  37784. }
  37785. public static function stackErrors()
  37786. {
  37787. self::$stackedErrorLevels[] = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  37788. }
  37789. public static function unstackErrors()
  37790. {
  37791. $level = array_pop(self::$stackedErrorLevels);
  37792. if (null !== $level) {
  37793. $e = error_reporting($level);
  37794. if ($e !== ($level | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR)) {
  37795. error_reporting($e);
  37796. }
  37797. }
  37798. if (empty(self::$stackedErrorLevels)) {
  37799. $errors = self::$stackedErrors;
  37800. self::$stackedErrors = array();
  37801. foreach ($errors as $e) {
  37802. $e[0]->log($e[1], $e[2], $e[3]);
  37803. }
  37804. }
  37805. }
  37806. protected function getFatalErrorHandlers()
  37807. {
  37808. return array(
  37809. new UndefinedFunctionFatalErrorHandler(),
  37810. new UndefinedMethodFatalErrorHandler(),
  37811. new ClassNotFoundFatalErrorHandler(),
  37812. );
  37813. }
  37814. public function setLevel($level)
  37815. {
  37816. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);
  37817. $level = null === $level ? error_reporting() : $level;
  37818. $this->throwAt($level, true);
  37819. }
  37820. public function setDisplayErrors($displayErrors)
  37821. {
  37822. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);
  37823. if ($displayErrors) {
  37824. $this->throwAt($this->displayErrors, true);
  37825. } else {
  37826. $displayErrors = $this->displayErrors;
  37827. $this->throwAt(0, true);
  37828. $this->displayErrors = $displayErrors;
  37829. }
  37830. }
  37831. public static function setLogger(LoggerInterface $logger, $channel = 'deprecation')
  37832. {
  37833. @trigger_error('The '.__METHOD__.' static method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the setLoggers() or setDefaultLogger() methods instead.', E_USER_DEPRECATED);
  37834. $handler = set_error_handler('var_dump');
  37835. $handler = is_array($handler) ? $handler[0] : null;
  37836. restore_error_handler();
  37837. if (!$handler instanceof self) {
  37838. return;
  37839. }
  37840. if ('deprecation' === $channel) {
  37841. $handler->setDefaultLogger($logger, E_DEPRECATED | E_USER_DEPRECATED, true);
  37842. $handler->screamAt(E_DEPRECATED | E_USER_DEPRECATED);
  37843. } elseif ('scream' === $channel) {
  37844. $handler->setDefaultLogger($logger, E_ALL | E_STRICT, false);
  37845. $handler->screamAt(E_ALL | E_STRICT);
  37846. } elseif ('emergency' === $channel) {
  37847. $handler->setDefaultLogger($logger, E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR, true);
  37848. $handler->screamAt(E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  37849. }
  37850. }
  37851. public function handle($level, $message, $file = 'unknown', $line = 0, $context = array())
  37852. {
  37853. $this->handleError(E_USER_DEPRECATED, 'The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the handleError() method instead.', __FILE__, __LINE__, array());
  37854. return $this->handleError($level, $message, $file, $line, (array) $context);
  37855. }
  37856. public function handleFatal()
  37857. {
  37858. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the handleFatalError() method instead.', E_USER_DEPRECATED);
  37859. static::handleFatalError();
  37860. }
  37861. }
  37862. class ErrorHandlerCanary
  37863. {
  37864. private static $displayErrors = null;
  37865. public function __construct()
  37866. {
  37867. if (null === self::$displayErrors) {
  37868. self::$displayErrors = ini_set('display_errors', 1);
  37869. }
  37870. }
  37871. public function __destruct()
  37872. {
  37873. if (null !== self::$displayErrors) {
  37874. ini_set('display_errors', self::$displayErrors);
  37875. self::$displayErrors = null;
  37876. }
  37877. }
  37878. }
  37879. <?php
  37880. namespace Symfony\Component\Debug\Exception;
  37881. class ClassNotFoundException extends FatalErrorException
  37882. {
  37883. public function __construct($message, \ErrorException $previous)
  37884. {
  37885. parent::__construct(
  37886. $message,
  37887. $previous->getCode(),
  37888. $previous->getSeverity(),
  37889. $previous->getFile(),
  37890. $previous->getLine(),
  37891. $previous->getPrevious()
  37892. );
  37893. $this->setTrace($previous->getTrace());
  37894. }
  37895. }
  37896. <?php
  37897. namespace Symfony\Component\Debug\Exception;
  37898. class ContextErrorException extends \ErrorException
  37899. {
  37900. private $context = array();
  37901. public function __construct($message, $code, $severity, $filename, $lineno, $context = array())
  37902. {
  37903. parent::__construct($message, $code, $severity, $filename, $lineno);
  37904. $this->context = $context;
  37905. }
  37906. public function getContext()
  37907. {
  37908. return $this->context;
  37909. }
  37910. }
  37911. <?php
  37912. namespace Symfony\Component\Debug\Exception;
  37913. @trigger_error('The '.__NAMESPACE__.'\DummyException class is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  37914. class DummyException extends \ErrorException
  37915. {
  37916. }
  37917. <?php
  37918. namespace Symfony\Component\HttpKernel\Exception;
  37919. class FatalErrorException extends \ErrorException
  37920. {
  37921. }
  37922. namespace Symfony\Component\Debug\Exception;
  37923. use Symfony\Component\HttpKernel\Exception\FatalErrorException as LegacyFatalErrorException;
  37924. class FatalErrorException extends LegacyFatalErrorException
  37925. {
  37926. public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null)
  37927. {
  37928. parent::__construct($message, $code, $severity, $filename, $lineno);
  37929. if (null !== $trace) {
  37930. if (!$traceArgs) {
  37931. foreach ($trace as &$frame) {
  37932. unset($frame['args'], $frame['this'], $frame);
  37933. }
  37934. }
  37935. $this->setTrace($trace);
  37936. } elseif (null !== $traceOffset) {
  37937. if (function_exists('xdebug_get_function_stack')) {
  37938. $trace = xdebug_get_function_stack();
  37939. if (0 < $traceOffset) {
  37940. array_splice($trace, -$traceOffset);
  37941. }
  37942. foreach ($trace as &$frame) {
  37943. if (!isset($frame['type'])) {
  37944. if (isset($frame['class'])) {
  37945. $frame['type'] = '::';
  37946. }
  37947. } elseif ('dynamic' === $frame['type']) {
  37948. $frame['type'] = '->';
  37949. } elseif ('static' === $frame['type']) {
  37950. $frame['type'] = '::';
  37951. }
  37952. if (!$traceArgs) {
  37953. unset($frame['params'], $frame['args']);
  37954. } elseif (isset($frame['params']) && !isset($frame['args'])) {
  37955. $frame['args'] = $frame['params'];
  37956. unset($frame['params']);
  37957. }
  37958. }
  37959. unset($frame);
  37960. $trace = array_reverse($trace);
  37961. } elseif (function_exists('symfony_debug_backtrace')) {
  37962. $trace = symfony_debug_backtrace();
  37963. if (0 < $traceOffset) {
  37964. array_splice($trace, 0, $traceOffset);
  37965. }
  37966. } else {
  37967. $trace = array();
  37968. }
  37969. $this->setTrace($trace);
  37970. }
  37971. }
  37972. protected function setTrace($trace)
  37973. {
  37974. $traceReflector = new \ReflectionProperty('Exception', 'trace');
  37975. $traceReflector->setAccessible(true);
  37976. $traceReflector->setValue($this, $trace);
  37977. }
  37978. }
  37979. <?php
  37980. namespace Symfony\Component\Debug\Exception;
  37981. class FatalThrowableError extends FatalErrorException
  37982. {
  37983. public function __construct(\Throwable $e)
  37984. {
  37985. if ($e instanceof \ParseError) {
  37986. $message = 'Parse error: '.$e->getMessage();
  37987. $severity = E_PARSE;
  37988. } elseif ($e instanceof \TypeError) {
  37989. $message = 'Type error: '.$e->getMessage();
  37990. $severity = E_RECOVERABLE_ERROR;
  37991. } else {
  37992. $message = $e->getMessage();
  37993. $severity = E_ERROR;
  37994. }
  37995. \ErrorException::__construct(
  37996. $message,
  37997. $e->getCode(),
  37998. $severity,
  37999. $e->getFile(),
  38000. $e->getLine(),
  38001. $e->getPrevious()
  38002. );
  38003. $this->setTrace($e->getTrace());
  38004. }
  38005. }
  38006. <?php
  38007. namespace Symfony\Component\HttpKernel\Exception;
  38008. use Symfony\Component\Debug\Exception\FlattenException as DebugFlattenException;
  38009. class FlattenException
  38010. {
  38011. private $handler;
  38012. public static function __callStatic($method, $args)
  38013. {
  38014. if (!method_exists('Symfony\Component\Debug\Exception\FlattenException', $method)) {
  38015. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_called_class(), $method));
  38016. }
  38017. return call_user_func_array(array('Symfony\Component\Debug\Exception\FlattenException', $method), $args);
  38018. }
  38019. public function __call($method, $args)
  38020. {
  38021. if (!isset($this->handler)) {
  38022. $this->handler = new DebugFlattenException();
  38023. }
  38024. if (!method_exists($this->handler, $method)) {
  38025. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_class($this), $method));
  38026. }
  38027. return call_user_func_array(array($this->handler, $method), $args);
  38028. }
  38029. }
  38030. namespace Symfony\Component\Debug\Exception;
  38031. use Symfony\Component\HttpKernel\Exception\FlattenException as LegacyFlattenException;
  38032. use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
  38033. class FlattenException extends LegacyFlattenException
  38034. {
  38035. private $message;
  38036. private $code;
  38037. private $previous;
  38038. private $trace;
  38039. private $class;
  38040. private $statusCode;
  38041. private $headers;
  38042. private $file;
  38043. private $line;
  38044. public static function create(\Exception $exception, $statusCode = null, array $headers = array())
  38045. {
  38046. $e = new static();
  38047. $e->setMessage($exception->getMessage());
  38048. $e->setCode($exception->getCode());
  38049. if ($exception instanceof HttpExceptionInterface) {
  38050. $statusCode = $exception->getStatusCode();
  38051. $headers = array_merge($headers, $exception->getHeaders());
  38052. }
  38053. if (null === $statusCode) {
  38054. $statusCode = 500;
  38055. }
  38056. $e->setStatusCode($statusCode);
  38057. $e->setHeaders($headers);
  38058. $e->setTraceFromException($exception);
  38059. $e->setClass(get_class($exception));
  38060. $e->setFile($exception->getFile());
  38061. $e->setLine($exception->getLine());
  38062. $previous = $exception->getPrevious();
  38063. if ($previous instanceof \Exception) {
  38064. $e->setPrevious(static::create($previous));
  38065. } elseif ($previous instanceof \Throwable) {
  38066. $e->setPrevious(static::create(new FatalThrowableError($previous)));
  38067. }
  38068. return $e;
  38069. }
  38070. public function toArray()
  38071. {
  38072. $exceptions = array();
  38073. foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) {
  38074. $exceptions[] = array(
  38075. 'message' => $exception->getMessage(),
  38076. 'class' => $exception->getClass(),
  38077. 'trace' => $exception->getTrace(),
  38078. );
  38079. }
  38080. return $exceptions;
  38081. }
  38082. public function getStatusCode()
  38083. {
  38084. return $this->statusCode;
  38085. }
  38086. public function setStatusCode($code)
  38087. {
  38088. $this->statusCode = $code;
  38089. }
  38090. public function getHeaders()
  38091. {
  38092. return $this->headers;
  38093. }
  38094. public function setHeaders(array $headers)
  38095. {
  38096. $this->headers = $headers;
  38097. }
  38098. public function getClass()
  38099. {
  38100. return $this->class;
  38101. }
  38102. public function setClass($class)
  38103. {
  38104. $this->class = $class;
  38105. }
  38106. public function getFile()
  38107. {
  38108. return $this->file;
  38109. }
  38110. public function setFile($file)
  38111. {
  38112. $this->file = $file;
  38113. }
  38114. public function getLine()
  38115. {
  38116. return $this->line;
  38117. }
  38118. public function setLine($line)
  38119. {
  38120. $this->line = $line;
  38121. }
  38122. public function getMessage()
  38123. {
  38124. return $this->message;
  38125. }
  38126. public function setMessage($message)
  38127. {
  38128. $this->message = $message;
  38129. }
  38130. public function getCode()
  38131. {
  38132. return $this->code;
  38133. }
  38134. public function setCode($code)
  38135. {
  38136. $this->code = $code;
  38137. }
  38138. public function getPrevious()
  38139. {
  38140. return $this->previous;
  38141. }
  38142. public function setPrevious(FlattenException $previous)
  38143. {
  38144. $this->previous = $previous;
  38145. }
  38146. public function getAllPrevious()
  38147. {
  38148. $exceptions = array();
  38149. $e = $this;
  38150. while ($e = $e->getPrevious()) {
  38151. $exceptions[] = $e;
  38152. }
  38153. return $exceptions;
  38154. }
  38155. public function getTrace()
  38156. {
  38157. return $this->trace;
  38158. }
  38159. public function setTraceFromException(\Exception $exception)
  38160. {
  38161. $this->setTrace($exception->getTrace(), $exception->getFile(), $exception->getLine());
  38162. }
  38163. public function setTrace($trace, $file, $line)
  38164. {
  38165. $this->trace = array();
  38166. $this->trace[] = array(
  38167. 'namespace' => '',
  38168. 'short_class' => '',
  38169. 'class' => '',
  38170. 'type' => '',
  38171. 'function' => '',
  38172. 'file' => $file,
  38173. 'line' => $line,
  38174. 'args' => array(),
  38175. );
  38176. foreach ($trace as $entry) {
  38177. $class = '';
  38178. $namespace = '';
  38179. if (isset($entry['class'])) {
  38180. $parts = explode('\\', $entry['class']);
  38181. $class = array_pop($parts);
  38182. $namespace = implode('\\', $parts);
  38183. }
  38184. $this->trace[] = array(
  38185. 'namespace' => $namespace,
  38186. 'short_class' => $class,
  38187. 'class' => isset($entry['class']) ? $entry['class'] : '',
  38188. 'type' => isset($entry['type']) ? $entry['type'] : '',
  38189. 'function' => isset($entry['function']) ? $entry['function'] : null,
  38190. 'file' => isset($entry['file']) ? $entry['file'] : null,
  38191. 'line' => isset($entry['line']) ? $entry['line'] : null,
  38192. 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(),
  38193. );
  38194. }
  38195. }
  38196. private function flattenArgs($args, $level = 0, &$count = 0)
  38197. {
  38198. $result = array();
  38199. foreach ($args as $key => $value) {
  38200. if (++$count > 1e4) {
  38201. return array('array', '*SKIPPED over 10000 entries*');
  38202. }
  38203. if ($value instanceof \__PHP_Incomplete_Class) {
  38204. $result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value));
  38205. } elseif (is_object($value)) {
  38206. $result[$key] = array('object', get_class($value));
  38207. } elseif (is_array($value)) {
  38208. if ($level > 10) {
  38209. $result[$key] = array('array', '*DEEP NESTED ARRAY*');
  38210. } else {
  38211. $result[$key] = array('array', $this->flattenArgs($value, $level + 1, $count));
  38212. }
  38213. } elseif (null === $value) {
  38214. $result[$key] = array('null', null);
  38215. } elseif (is_bool($value)) {
  38216. $result[$key] = array('boolean', $value);
  38217. } elseif (is_resource($value)) {
  38218. $result[$key] = array('resource', get_resource_type($value));
  38219. } else {
  38220. $result[$key] = array('string', (string) $value);
  38221. }
  38222. }
  38223. return $result;
  38224. }
  38225. private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value)
  38226. {
  38227. $array = new \ArrayObject($value);
  38228. return $array['__PHP_Incomplete_Class_Name'];
  38229. }
  38230. }
  38231. <?php
  38232. namespace Symfony\Component\Debug\Exception;
  38233. class OutOfMemoryException extends FatalErrorException
  38234. {
  38235. }
  38236. <?php
  38237. namespace Symfony\Component\Debug\Exception;
  38238. class UndefinedFunctionException extends FatalErrorException
  38239. {
  38240. public function __construct($message, \ErrorException $previous)
  38241. {
  38242. parent::__construct(
  38243. $message,
  38244. $previous->getCode(),
  38245. $previous->getSeverity(),
  38246. $previous->getFile(),
  38247. $previous->getLine(),
  38248. $previous->getPrevious()
  38249. );
  38250. $this->setTrace($previous->getTrace());
  38251. }
  38252. }
  38253. <?php
  38254. namespace Symfony\Component\Debug\Exception;
  38255. class UndefinedMethodException extends FatalErrorException
  38256. {
  38257. public function __construct($message, \ErrorException $previous)
  38258. {
  38259. parent::__construct(
  38260. $message,
  38261. $previous->getCode(),
  38262. $previous->getSeverity(),
  38263. $previous->getFile(),
  38264. $previous->getLine(),
  38265. $previous->getPrevious()
  38266. );
  38267. $this->setTrace($previous->getTrace());
  38268. }
  38269. }
  38270. <?php
  38271. namespace Symfony\Component\Debug;
  38272. use Symfony\Component\HttpFoundation\Response;
  38273. use Symfony\Component\Debug\Exception\FlattenException;
  38274. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  38275. class ExceptionHandler
  38276. {
  38277. private $debug;
  38278. private $charset;
  38279. private $handler;
  38280. private $caughtBuffer;
  38281. private $caughtLength;
  38282. private $fileLinkFormat;
  38283. public function __construct($debug = true, $charset = null, $fileLinkFormat = null)
  38284. {
  38285. if (false !== strpos($charset, '%')) {
  38286. @trigger_error('Providing $fileLinkFormat as second argument to '.__METHOD__.' is deprecated since Symfony 2.8 and will be unsupported in 3.0. Please provide it as third argument, after $charset.', E_USER_DEPRECATED);
  38287. $pivot = $fileLinkFormat;
  38288. $fileLinkFormat = $charset;
  38289. $charset = $pivot;
  38290. }
  38291. $this->debug = $debug;
  38292. $this->charset = $charset ?: ini_get('default_charset') ?: 'UTF-8';
  38293. $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
  38294. }
  38295. public static function register($debug = true, $charset = null, $fileLinkFormat = null)
  38296. {
  38297. $handler = new static($debug, $charset, $fileLinkFormat);
  38298. $prev = set_exception_handler(array($handler, 'handle'));
  38299. if (is_array($prev) && $prev[0] instanceof ErrorHandler) {
  38300. restore_exception_handler();
  38301. $prev[0]->setExceptionHandler(array($handler, 'handle'));
  38302. }
  38303. return $handler;
  38304. }
  38305. public function setHandler($handler)
  38306. {
  38307. if (null !== $handler && !is_callable($handler)) {
  38308. throw new \LogicException('The exception handler must be a valid PHP callable.');
  38309. }
  38310. $old = $this->handler;
  38311. $this->handler = $handler;
  38312. return $old;
  38313. }
  38314. public function setFileLinkFormat($format)
  38315. {
  38316. $old = $this->fileLinkFormat;
  38317. $this->fileLinkFormat = $format;
  38318. return $old;
  38319. }
  38320. public function handle(\Exception $exception)
  38321. {
  38322. if (null === $this->handler || $exception instanceof OutOfMemoryException) {
  38323. $this->failSafeHandle($exception);
  38324. return;
  38325. }
  38326. $caughtLength = $this->caughtLength = 0;
  38327. ob_start(array($this, 'catchOutput'));
  38328. $this->failSafeHandle($exception);
  38329. while (null === $this->caughtBuffer && ob_end_flush()) {
  38330. }
  38331. if (isset($this->caughtBuffer[0])) {
  38332. ob_start(array($this, 'cleanOutput'));
  38333. echo $this->caughtBuffer;
  38334. $caughtLength = ob_get_length();
  38335. }
  38336. $this->caughtBuffer = null;
  38337. try {
  38338. call_user_func($this->handler, $exception);
  38339. $this->caughtLength = $caughtLength;
  38340. } catch (\Exception $e) {
  38341. if (!$caughtLength) {
  38342. throw $exception;
  38343. }
  38344. }
  38345. }
  38346. private function failSafeHandle(\Exception $exception)
  38347. {
  38348. if (class_exists('Symfony\Component\HttpFoundation\Response', false)
  38349. && __CLASS__ !== get_class($this)
  38350. && ($reflector = new \ReflectionMethod($this, 'createResponse'))
  38351. && __CLASS__ !== $reflector->class
  38352. ) {
  38353. $response = $this->createResponse($exception);
  38354. $response->sendHeaders();
  38355. $response->sendContent();
  38356. @trigger_error(sprintf("The %s::createResponse method is deprecated since Symfony 2.8 and won't be called anymore when handling an exception in 3.0.", $reflector->class), E_USER_DEPRECATED);
  38357. return;
  38358. }
  38359. $this->sendPhpResponse($exception);
  38360. }
  38361. public function sendPhpResponse($exception)
  38362. {
  38363. if (!$exception instanceof FlattenException) {
  38364. $exception = FlattenException::create($exception);
  38365. }
  38366. if (!headers_sent()) {
  38367. header(sprintf('HTTP/1.0 %s', $exception->getStatusCode()));
  38368. foreach ($exception->getHeaders() as $name => $value) {
  38369. header($name.': '.$value, false);
  38370. }
  38371. header('Content-Type: text/html; charset='.$this->charset);
  38372. }
  38373. echo $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  38374. }
  38375. public function createResponse($exception)
  38376. {
  38377. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  38378. if (!$exception instanceof FlattenException) {
  38379. $exception = FlattenException::create($exception);
  38380. }
  38381. return Response::create($this->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders())->setCharset($this->charset);
  38382. }
  38383. public function getHtml($exception)
  38384. {
  38385. if (!$exception instanceof FlattenException) {
  38386. $exception = FlattenException::create($exception);
  38387. }
  38388. return $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  38389. }
  38390. public function getContent(FlattenException $exception)
  38391. {
  38392. switch ($exception->getStatusCode()) {
  38393. case 404:
  38394. $title = 'Sorry, the page you are looking for could not be found.';
  38395. break;
  38396. default:
  38397. $title = 'Whoops, looks like something went wrong.';
  38398. }
  38399. $content = '';
  38400. if ($this->debug) {
  38401. try {
  38402. $count = count($exception->getAllPrevious());
  38403. $total = $count + 1;
  38404. foreach ($exception->toArray() as $position => $e) {
  38405. $ind = $count - $position + 1;
  38406. $class = $this->formatClass($e['class']);
  38407. $message = nl2br($this->escapeHtml($e['message']));
  38408. $content .= sprintf(<<<'EOF'
  38409. <h2 class="block_exception clear_fix">
  38410. <span class="exception_counter">%d/%d</span>
  38411. <span class="exception_title">%s%s:</span>
  38412. <span class="exception_message">%s</span>
  38413. </h2>
  38414. <div class="block">
  38415. <ol class="traces list_exception">
  38416. EOF
  38417. , $ind, $total, $class, $this->formatPath($e['trace'][0]['file'], $e['trace'][0]['line']), $message);
  38418. foreach ($e['trace'] as $trace) {
  38419. $content .= ' <li>';
  38420. if ($trace['function']) {
  38421. $content .= sprintf('at %s%s%s(%s)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args']));
  38422. }
  38423. if (isset($trace['file']) && isset($trace['line'])) {
  38424. $content .= $this->formatPath($trace['file'], $trace['line']);
  38425. }
  38426. $content .= "</li>\n";
  38427. }
  38428. $content .= " </ol>\n</div>\n";
  38429. }
  38430. } catch (\Exception $e) {
  38431. if ($this->debug) {
  38432. $title = sprintf('Exception thrown when handling an exception (%s: %s)', get_class($e), $this->escapeHtml($e->getMessage()));
  38433. } else {
  38434. $title = 'Whoops, looks like something went wrong.';
  38435. }
  38436. }
  38437. }
  38438. return <<<EOF
  38439. <div id="sf-resetcontent" class="sf-reset">
  38440. <h1>$title</h1>
  38441. $content
  38442. </div>
  38443. EOF;
  38444. }
  38445. public function getStylesheet(FlattenException $exception)
  38446. {
  38447. return <<<'EOF'
  38448. .sf-reset { font: 11px Verdana, Arial, sans-serif; color: #333 }
  38449. .sf-reset .clear { clear:both; height:0; font-size:0; line-height:0; }
  38450. .sf-reset .clear_fix:after { display:block; height:0; clear:both; visibility:hidden; }
  38451. .sf-reset .clear_fix { display:inline-block; }
  38452. .sf-reset * html .clear_fix { height:1%; }
  38453. .sf-reset .clear_fix { display:block; }
  38454. .sf-reset, .sf-reset .block { margin: auto }
  38455. .sf-reset abbr { border-bottom: 1px dotted #000; cursor: help; }
  38456. .sf-reset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px }
  38457. .sf-reset strong { font-weight:bold; }
  38458. .sf-reset a { color:#6c6159; cursor: default; }
  38459. .sf-reset a img { border:none; }
  38460. .sf-reset a:hover { text-decoration:underline; }
  38461. .sf-reset em { font-style:italic; }
  38462. .sf-reset h1, .sf-reset h2 { font: 20px Georgia, "Times New Roman", Times, serif }
  38463. .sf-reset .exception_counter { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; float: left; display: block; }
  38464. .sf-reset .exception_title { margin-left: 3em; margin-bottom: 0.7em; display: block; }
  38465. .sf-reset .exception_message { margin-left: 3em; display: block; }
  38466. .sf-reset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; }
  38467. .sf-reset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px;
  38468. -webkit-border-bottom-right-radius: 16px;
  38469. -webkit-border-bottom-left-radius: 16px;
  38470. -moz-border-radius-bottomright: 16px;
  38471. -moz-border-radius-bottomleft: 16px;
  38472. border-bottom-right-radius: 16px;
  38473. border-bottom-left-radius: 16px;
  38474. border-bottom:1px solid #ccc;
  38475. border-right:1px solid #ccc;
  38476. border-left:1px solid #ccc;
  38477. word-wrap: break-word;
  38478. }
  38479. .sf-reset .block_exception { background-color:#ddd; color: #333; padding:20px;
  38480. -webkit-border-top-left-radius: 16px;
  38481. -webkit-border-top-right-radius: 16px;
  38482. -moz-border-radius-topleft: 16px;
  38483. -moz-border-radius-topright: 16px;
  38484. border-top-left-radius: 16px;
  38485. border-top-right-radius: 16px;
  38486. border-top:1px solid #ccc;
  38487. border-right:1px solid #ccc;
  38488. border-left:1px solid #ccc;
  38489. overflow: hidden;
  38490. word-wrap: break-word;
  38491. }
  38492. .sf-reset a { background:none; color:#868686; text-decoration:none; }
  38493. .sf-reset a:hover { background:none; color:#313131; text-decoration:underline; }
  38494. .sf-reset ol { padding: 10px 0; }
  38495. .sf-reset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px;
  38496. -webkit-border-radius: 10px;
  38497. -moz-border-radius: 10px;
  38498. border-radius: 10px;
  38499. border: 1px solid #ccc;
  38500. }
  38501. EOF;
  38502. }
  38503. private function decorate($content, $css)
  38504. {
  38505. return <<<EOF
  38506. <!DOCTYPE html>
  38507. <html>
  38508. <head>
  38509. <meta charset="{$this->charset}" />
  38510. <meta name="robots" content="noindex,nofollow" />
  38511. <style>
  38512. /* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */
  38513. html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}
  38514. html { background: #eee; padding: 10px }
  38515. img { border: 0; }
  38516. #sf-resetcontent { width:970px; margin:0 auto; }
  38517. $css
  38518. </style>
  38519. </head>
  38520. <body>
  38521. $content
  38522. </body>
  38523. </html>
  38524. EOF;
  38525. }
  38526. private function formatClass($class)
  38527. {
  38528. $parts = explode('\\', $class);
  38529. return sprintf('<abbr title="%s">%s</abbr>', $class, array_pop($parts));
  38530. }
  38531. private function formatPath($path, $line)
  38532. {
  38533. $path = $this->escapeHtml($path);
  38534. $file = preg_match('#[^/\\\\]*$#', $path, $file) ? $file[0] : $path;
  38535. if ($linkFormat = $this->fileLinkFormat) {
  38536. $link = strtr($this->escapeHtml($linkFormat), array('%f' => $path, '%l' => (int) $line));
  38537. return sprintf(' in <a href="%s" title="Go to source">%s line %d</a>', $link, $file, $line);
  38538. }
  38539. return sprintf(' in <a title="%s line %3$d" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">%s line %d</a>', $path, $file, $line);
  38540. }
  38541. private function formatArgs(array $args)
  38542. {
  38543. $result = array();
  38544. foreach ($args as $key => $item) {
  38545. if ('object' === $item[0]) {
  38546. $formattedValue = sprintf('<em>object</em>(%s)', $this->formatClass($item[1]));
  38547. } elseif ('array' === $item[0]) {
  38548. $formattedValue = sprintf('<em>array</em>(%s)', is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
  38549. } elseif ('string' === $item[0]) {
  38550. $formattedValue = sprintf("'%s'", $this->escapeHtml($item[1]));
  38551. } elseif ('null' === $item[0]) {
  38552. $formattedValue = '<em>null</em>';
  38553. } elseif ('boolean' === $item[0]) {
  38554. $formattedValue = '<em>'.strtolower(var_export($item[1], true)).'</em>';
  38555. } elseif ('resource' === $item[0]) {
  38556. $formattedValue = '<em>resource</em>';
  38557. } else {
  38558. $formattedValue = str_replace("\n", '', var_export($this->escapeHtml((string) $item[1]), true));
  38559. }
  38560. $result[] = is_int($key) ? $formattedValue : sprintf("'%s' => %s", $this->escapeHtml($key), $formattedValue);
  38561. }
  38562. return implode(', ', $result);
  38563. }
  38564. protected static function utf8Htmlize($str)
  38565. {
  38566. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
  38567. return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8');
  38568. }
  38569. private function escapeHtml($str)
  38570. {
  38571. return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), $this->charset);
  38572. }
  38573. public function catchOutput($buffer)
  38574. {
  38575. $this->caughtBuffer = $buffer;
  38576. return '';
  38577. }
  38578. public function cleanOutput($buffer)
  38579. {
  38580. if ($this->caughtLength) {
  38581. $cleanBuffer = substr_replace($buffer, '', 0, $this->caughtLength);
  38582. if (isset($cleanBuffer[0])) {
  38583. $buffer = $cleanBuffer;
  38584. }
  38585. }
  38586. return $buffer;
  38587. }
  38588. }
  38589. <?php
  38590. namespace Symfony\Component\Debug\FatalErrorHandler;
  38591. use Symfony\Component\Debug\Exception\ClassNotFoundException;
  38592. use Symfony\Component\Debug\Exception\FatalErrorException;
  38593. use Symfony\Component\Debug\DebugClassLoader;
  38594. use Composer\Autoload\ClassLoader as ComposerClassLoader;
  38595. use Symfony\Component\ClassLoader\ClassLoader as SymfonyClassLoader;
  38596. use Symfony\Component\ClassLoader\UniversalClassLoader as SymfonyUniversalClassLoader;
  38597. class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
  38598. {
  38599. public function handleError(array $error, FatalErrorException $exception)
  38600. {
  38601. $messageLen = strlen($error['message']);
  38602. $notFoundSuffix = '\' not found';
  38603. $notFoundSuffixLen = strlen($notFoundSuffix);
  38604. if ($notFoundSuffixLen > $messageLen) {
  38605. return;
  38606. }
  38607. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  38608. return;
  38609. }
  38610. foreach (array('class', 'interface', 'trait') as $typeName) {
  38611. $prefix = ucfirst($typeName).' \'';
  38612. $prefixLen = strlen($prefix);
  38613. if (0 !== strpos($error['message'], $prefix)) {
  38614. continue;
  38615. }
  38616. $fullyQualifiedClassName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  38617. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedClassName, '\\')) {
  38618. $className = substr($fullyQualifiedClassName, $namespaceSeparatorIndex + 1);
  38619. $namespacePrefix = substr($fullyQualifiedClassName, 0, $namespaceSeparatorIndex);
  38620. $message = sprintf('Attempted to load %s "%s" from namespace "%s".', $typeName, $className, $namespacePrefix);
  38621. $tail = ' for another namespace?';
  38622. } else {
  38623. $className = $fullyQualifiedClassName;
  38624. $message = sprintf('Attempted to load %s "%s" from the global namespace.', $typeName, $className);
  38625. $tail = '?';
  38626. }
  38627. if ($candidates = $this->getClassCandidates($className)) {
  38628. $tail = array_pop($candidates).'"?';
  38629. if ($candidates) {
  38630. $tail = ' for e.g. "'.implode('", "', $candidates).'" or "'.$tail;
  38631. } else {
  38632. $tail = ' for "'.$tail;
  38633. }
  38634. }
  38635. $message .= "\nDid you forget a \"use\" statement".$tail;
  38636. return new ClassNotFoundException($message, $exception);
  38637. }
  38638. }
  38639. private function getClassCandidates($class)
  38640. {
  38641. if (!is_array($functions = spl_autoload_functions())) {
  38642. return array();
  38643. }
  38644. $classes = array();
  38645. foreach ($functions as $function) {
  38646. if (!is_array($function)) {
  38647. continue;
  38648. }
  38649. if ($function[0] instanceof DebugClassLoader) {
  38650. $function = $function[0]->getClassLoader();
  38651. if (is_object($function)) {
  38652. $function = array($function);
  38653. }
  38654. if (!is_array($function)) {
  38655. continue;
  38656. }
  38657. }
  38658. if ($function[0] instanceof ComposerClassLoader || $function[0] instanceof SymfonyClassLoader || $function[0] instanceof SymfonyUniversalClassLoader) {
  38659. foreach ($function[0]->getPrefixes() as $prefix => $paths) {
  38660. foreach ($paths as $path) {
  38661. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  38662. }
  38663. }
  38664. }
  38665. if ($function[0] instanceof ComposerClassLoader) {
  38666. foreach ($function[0]->getPrefixesPsr4() as $prefix => $paths) {
  38667. foreach ($paths as $path) {
  38668. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  38669. }
  38670. }
  38671. }
  38672. }
  38673. return array_unique($classes);
  38674. }
  38675. private function findClassInPath($path, $class, $prefix)
  38676. {
  38677. if (!$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path)) {
  38678. return array();
  38679. }
  38680. $classes = array();
  38681. $filename = $class.'.php';
  38682. foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
  38683. if ($filename == $file->getFileName() && $class = $this->convertFileToClass($path, $file->getPathName(), $prefix)) {
  38684. $classes[] = $class;
  38685. }
  38686. }
  38687. return $classes;
  38688. }
  38689. private function convertFileToClass($path, $file, $prefix)
  38690. {
  38691. $candidates = array(
  38692. $namespacedClass = str_replace(array($path.DIRECTORY_SEPARATOR, '.php', '/'), array('', '', '\\'), $file),
  38693. $prefix.$namespacedClass,
  38694. $prefix.'\\'.$namespacedClass,
  38695. str_replace('\\', '_', $namespacedClass),
  38696. str_replace('\\', '_', $prefix.$namespacedClass),
  38697. str_replace('\\', '_', $prefix.'\\'.$namespacedClass),
  38698. );
  38699. if ($prefix) {
  38700. $candidates = array_filter($candidates, function ($candidate) use ($prefix) { return 0 === strpos($candidate, $prefix); });
  38701. }
  38702. foreach ($candidates as $candidate) {
  38703. if ($this->classExists($candidate)) {
  38704. return $candidate;
  38705. }
  38706. }
  38707. require_once $file;
  38708. foreach ($candidates as $candidate) {
  38709. if ($this->classExists($candidate)) {
  38710. return $candidate;
  38711. }
  38712. }
  38713. }
  38714. private function classExists($class)
  38715. {
  38716. return class_exists($class, false) || interface_exists($class, false) || (function_exists('trait_exists') && trait_exists($class, false));
  38717. }
  38718. }
  38719. <?php
  38720. namespace Symfony\Component\Debug\FatalErrorHandler;
  38721. use Symfony\Component\Debug\Exception\FatalErrorException;
  38722. interface FatalErrorHandlerInterface
  38723. {
  38724. public function handleError(array $error, FatalErrorException $exception);
  38725. }
  38726. <?php
  38727. namespace Symfony\Component\Debug\FatalErrorHandler;
  38728. use Symfony\Component\Debug\Exception\UndefinedFunctionException;
  38729. use Symfony\Component\Debug\Exception\FatalErrorException;
  38730. class UndefinedFunctionFatalErrorHandler implements FatalErrorHandlerInterface
  38731. {
  38732. public function handleError(array $error, FatalErrorException $exception)
  38733. {
  38734. $messageLen = strlen($error['message']);
  38735. $notFoundSuffix = '()';
  38736. $notFoundSuffixLen = strlen($notFoundSuffix);
  38737. if ($notFoundSuffixLen > $messageLen) {
  38738. return;
  38739. }
  38740. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  38741. return;
  38742. }
  38743. $prefix = 'Call to undefined function ';
  38744. $prefixLen = strlen($prefix);
  38745. if (0 !== strpos($error['message'], $prefix)) {
  38746. return;
  38747. }
  38748. $fullyQualifiedFunctionName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  38749. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedFunctionName, '\\')) {
  38750. $functionName = substr($fullyQualifiedFunctionName, $namespaceSeparatorIndex + 1);
  38751. $namespacePrefix = substr($fullyQualifiedFunctionName, 0, $namespaceSeparatorIndex);
  38752. $message = sprintf('Attempted to call function "%s" from namespace "%s".', $functionName, $namespacePrefix);
  38753. } else {
  38754. $functionName = $fullyQualifiedFunctionName;
  38755. $message = sprintf('Attempted to call function "%s" from the global namespace.', $functionName);
  38756. }
  38757. $candidates = array();
  38758. foreach (get_defined_functions() as $type => $definedFunctionNames) {
  38759. foreach ($definedFunctionNames as $definedFunctionName) {
  38760. if (false !== $namespaceSeparatorIndex = strrpos($definedFunctionName, '\\')) {
  38761. $definedFunctionNameBasename = substr($definedFunctionName, $namespaceSeparatorIndex + 1);
  38762. } else {
  38763. $definedFunctionNameBasename = $definedFunctionName;
  38764. }
  38765. if ($definedFunctionNameBasename === $functionName) {
  38766. $candidates[] = '\\'.$definedFunctionName;
  38767. }
  38768. }
  38769. }
  38770. if ($candidates) {
  38771. sort($candidates);
  38772. $last = array_pop($candidates).'"?';
  38773. if ($candidates) {
  38774. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  38775. } else {
  38776. $candidates = '"'.$last;
  38777. }
  38778. $message .= "\nDid you mean to call ".$candidates;
  38779. }
  38780. return new UndefinedFunctionException($message, $exception);
  38781. }
  38782. }
  38783. <?php
  38784. namespace Symfony\Component\Debug\FatalErrorHandler;
  38785. use Symfony\Component\Debug\Exception\FatalErrorException;
  38786. use Symfony\Component\Debug\Exception\UndefinedMethodException;
  38787. class UndefinedMethodFatalErrorHandler implements FatalErrorHandlerInterface
  38788. {
  38789. public function handleError(array $error, FatalErrorException $exception)
  38790. {
  38791. preg_match('/^Call to undefined method (.*)::(.*)\(\)$/', $error['message'], $matches);
  38792. if (!$matches) {
  38793. return;
  38794. }
  38795. $className = $matches[1];
  38796. $methodName = $matches[2];
  38797. $message = sprintf('Attempted to call an undefined method named "%s" of class "%s".', $methodName, $className);
  38798. if (!class_exists($className) || null === $methods = get_class_methods($className)) {
  38799. return new UndefinedMethodException($message, $exception);
  38800. }
  38801. $candidates = array();
  38802. foreach ($methods as $definedMethodName) {
  38803. $lev = levenshtein($methodName, $definedMethodName);
  38804. if ($lev <= strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) {
  38805. $candidates[] = $definedMethodName;
  38806. }
  38807. }
  38808. if ($candidates) {
  38809. sort($candidates);
  38810. $last = array_pop($candidates).'"?';
  38811. if ($candidates) {
  38812. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  38813. } else {
  38814. $candidates = '"'.$last;
  38815. }
  38816. $message .= "\nDid you mean to call ".$candidates;
  38817. }
  38818. return new UndefinedMethodException($message, $exception);
  38819. }
  38820. }
  38821. Copyright (c) 2004-2018 Fabien Potencier
  38822. Permission is hereby granted, free of charge, to any person obtaining a copy
  38823. of this software and associated documentation files (the "Software"), to deal
  38824. in the Software without restriction, including without limitation the rights
  38825. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  38826. copies of the Software, and to permit persons to whom the Software is furnished
  38827. to do so, subject to the following conditions:
  38828. The above copyright notice and this permission notice shall be included in all
  38829. copies or substantial portions of the Software.
  38830. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  38831. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  38832. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  38833. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  38834. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  38835. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  38836. THE SOFTWARE.
  38837. <?php
  38838. namespace Symfony\Component\Filesystem\Exception;
  38839. interface ExceptionInterface
  38840. {
  38841. }
  38842. <?php
  38843. namespace Symfony\Component\Filesystem\Exception;
  38844. class FileNotFoundException extends IOException
  38845. {
  38846. public function __construct($message = null, $code = 0, \Exception $previous = null, $path = null)
  38847. {
  38848. if (null === $message) {
  38849. if (null === $path) {
  38850. $message = 'File could not be found.';
  38851. } else {
  38852. $message = sprintf('File "%s" could not be found.', $path);
  38853. }
  38854. }
  38855. parent::__construct($message, $code, $previous, $path);
  38856. }
  38857. }
  38858. <?php
  38859. namespace Symfony\Component\Filesystem\Exception;
  38860. class IOException extends \RuntimeException implements IOExceptionInterface
  38861. {
  38862. private $path;
  38863. public function __construct($message, $code = 0, \Exception $previous = null, $path = null)
  38864. {
  38865. $this->path = $path;
  38866. parent::__construct($message, $code, $previous);
  38867. }
  38868. public function getPath()
  38869. {
  38870. return $this->path;
  38871. }
  38872. }
  38873. <?php
  38874. namespace Symfony\Component\Filesystem\Exception;
  38875. interface IOExceptionInterface extends ExceptionInterface
  38876. {
  38877. public function getPath();
  38878. }
  38879. <?php
  38880. namespace Symfony\Component\Filesystem;
  38881. use Symfony\Component\Filesystem\Exception\IOException;
  38882. use Symfony\Component\Filesystem\Exception\FileNotFoundException;
  38883. class Filesystem
  38884. {
  38885. public function copy($originFile, $targetFile, $overwriteNewerFiles = false)
  38886. {
  38887. $originIsLocal = stream_is_local($originFile) || 0 === stripos($originFile, 'file://');
  38888. if ($originIsLocal && !is_file($originFile)) {
  38889. throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
  38890. }
  38891. $this->mkdir(dirname($targetFile));
  38892. $doCopy = true;
  38893. if (!$overwriteNewerFiles && null === parse_url($originFile, PHP_URL_HOST) && is_file($targetFile)) {
  38894. $doCopy = filemtime($originFile) > filemtime($targetFile);
  38895. }
  38896. if ($doCopy) {
  38897. if (false === $source = @fopen($originFile, 'r')) {
  38898. throw new IOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading.', $originFile, $targetFile), 0, null, $originFile);
  38899. }
  38900. if (false === $target = @fopen($targetFile, 'w', null, stream_context_create(array('ftp' => array('overwrite' => true))))) {
  38901. throw new IOException(sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing.', $originFile, $targetFile), 0, null, $originFile);
  38902. }
  38903. $bytesCopied = stream_copy_to_stream($source, $target);
  38904. fclose($source);
  38905. fclose($target);
  38906. unset($source, $target);
  38907. if (!is_file($targetFile)) {
  38908. throw new IOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile);
  38909. }
  38910. if ($originIsLocal) {
  38911. @chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
  38912. if ($bytesCopied !== $bytesOrigin = filesize($originFile)) {
  38913. throw new IOException(sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile);
  38914. }
  38915. }
  38916. }
  38917. }
  38918. public function mkdir($dirs, $mode = 0777)
  38919. {
  38920. foreach ($this->toIterator($dirs) as $dir) {
  38921. if (is_dir($dir)) {
  38922. continue;
  38923. }
  38924. if (true !== @mkdir($dir, $mode, true)) {
  38925. $error = error_get_last();
  38926. if (!is_dir($dir)) {
  38927. if ($error) {
  38928. throw new IOException(sprintf('Failed to create "%s": %s.', $dir, $error['message']), 0, null, $dir);
  38929. }
  38930. throw new IOException(sprintf('Failed to create "%s"', $dir), 0, null, $dir);
  38931. }
  38932. }
  38933. }
  38934. }
  38935. public function exists($files)
  38936. {
  38937. $maxPathLength = PHP_MAXPATHLEN - 2;
  38938. foreach ($this->toIterator($files) as $file) {
  38939. if (strlen($file) > $maxPathLength) {
  38940. throw new IOException(sprintf('Could not check if file exist because path length exceeds %d characters.', $maxPathLength), 0, null, $file);
  38941. }
  38942. if (!file_exists($file)) {
  38943. return false;
  38944. }
  38945. }
  38946. return true;
  38947. }
  38948. public function touch($files, $time = null, $atime = null)
  38949. {
  38950. foreach ($this->toIterator($files) as $file) {
  38951. $touch = $time ? @touch($file, $time, $atime) : @touch($file);
  38952. if (true !== $touch) {
  38953. throw new IOException(sprintf('Failed to touch "%s".', $file), 0, null, $file);
  38954. }
  38955. }
  38956. }
  38957. public function remove($files)
  38958. {
  38959. if ($files instanceof \Traversable) {
  38960. $files = iterator_to_array($files, false);
  38961. } elseif (!is_array($files)) {
  38962. $files = array($files);
  38963. }
  38964. $files = array_reverse($files);
  38965. foreach ($files as $file) {
  38966. if (is_link($file)) {
  38967. if (!@(unlink($file) || '\\' !== DIRECTORY_SEPARATOR || rmdir($file)) && file_exists($file)) {
  38968. $error = error_get_last();
  38969. throw new IOException(sprintf('Failed to remove symlink "%s": %s.', $file, $error['message']));
  38970. }
  38971. } elseif (is_dir($file)) {
  38972. $this->remove(new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS));
  38973. if (!@rmdir($file) && file_exists($file)) {
  38974. $error = error_get_last();
  38975. throw new IOException(sprintf('Failed to remove directory "%s": %s.', $file, $error['message']));
  38976. }
  38977. } elseif (!@unlink($file) && file_exists($file)) {
  38978. $error = error_get_last();
  38979. throw new IOException(sprintf('Failed to remove file "%s": %s.', $file, $error['message']));
  38980. }
  38981. }
  38982. }
  38983. public function chmod($files, $mode, $umask = 0000, $recursive = false)
  38984. {
  38985. foreach ($this->toIterator($files) as $file) {
  38986. if (true !== @chmod($file, $mode & ~$umask)) {
  38987. throw new IOException(sprintf('Failed to chmod file "%s".', $file), 0, null, $file);
  38988. }
  38989. if ($recursive && is_dir($file) && !is_link($file)) {
  38990. $this->chmod(new \FilesystemIterator($file), $mode, $umask, true);
  38991. }
  38992. }
  38993. }
  38994. public function chown($files, $user, $recursive = false)
  38995. {
  38996. foreach ($this->toIterator($files) as $file) {
  38997. if ($recursive && is_dir($file) && !is_link($file)) {
  38998. $this->chown(new \FilesystemIterator($file), $user, true);
  38999. }
  39000. if (is_link($file) && function_exists('lchown')) {
  39001. if (true !== @lchown($file, $user)) {
  39002. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  39003. }
  39004. } else {
  39005. if (true !== @chown($file, $user)) {
  39006. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  39007. }
  39008. }
  39009. }
  39010. }
  39011. public function chgrp($files, $group, $recursive = false)
  39012. {
  39013. foreach ($this->toIterator($files) as $file) {
  39014. if ($recursive && is_dir($file) && !is_link($file)) {
  39015. $this->chgrp(new \FilesystemIterator($file), $group, true);
  39016. }
  39017. if (is_link($file) && function_exists('lchgrp')) {
  39018. if (true !== @lchgrp($file, $group) || (defined('HHVM_VERSION') && !posix_getgrnam($group))) {
  39019. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  39020. }
  39021. } else {
  39022. if (true !== @chgrp($file, $group)) {
  39023. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  39024. }
  39025. }
  39026. }
  39027. }
  39028. public function rename($origin, $target, $overwrite = false)
  39029. {
  39030. if (!$overwrite && $this->isReadable($target)) {
  39031. throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target);
  39032. }
  39033. if (true !== @rename($origin, $target)) {
  39034. if (is_dir($origin)) {
  39035. $this->mirror($origin, $target, null, array('override' => $overwrite, 'delete' => $overwrite));
  39036. $this->remove($origin);
  39037. return;
  39038. }
  39039. throw new IOException(sprintf('Cannot rename "%s" to "%s".', $origin, $target), 0, null, $target);
  39040. }
  39041. }
  39042. private function isReadable($filename)
  39043. {
  39044. $maxPathLength = PHP_MAXPATHLEN - 2;
  39045. if (strlen($filename) > $maxPathLength) {
  39046. throw new IOException(sprintf('Could not check if file is readable because path length exceeds %d characters.', $maxPathLength), 0, null, $filename);
  39047. }
  39048. return is_readable($filename);
  39049. }
  39050. public function symlink($originDir, $targetDir, $copyOnWindows = false)
  39051. {
  39052. if ('\\' === DIRECTORY_SEPARATOR) {
  39053. $originDir = strtr($originDir, '/', '\\');
  39054. $targetDir = strtr($targetDir, '/', '\\');
  39055. if ($copyOnWindows) {
  39056. $this->mirror($originDir, $targetDir);
  39057. return;
  39058. }
  39059. }
  39060. $this->mkdir(dirname($targetDir));
  39061. $ok = false;
  39062. if (is_link($targetDir)) {
  39063. if (readlink($targetDir) != $originDir) {
  39064. $this->remove($targetDir);
  39065. } else {
  39066. $ok = true;
  39067. }
  39068. }
  39069. if (!$ok && true !== @symlink($originDir, $targetDir)) {
  39070. $report = error_get_last();
  39071. if (is_array($report)) {
  39072. if ('\\' === DIRECTORY_SEPARATOR && false !== strpos($report['message'], 'error code(1314)')) {
  39073. throw new IOException('Unable to create symlink due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?', 0, null, $targetDir);
  39074. }
  39075. }
  39076. throw new IOException(sprintf('Failed to create symbolic link from "%s" to "%s".', $originDir, $targetDir), 0, null, $targetDir);
  39077. }
  39078. }
  39079. public function makePathRelative($endPath, $startPath)
  39080. {
  39081. if ('\\' === DIRECTORY_SEPARATOR) {
  39082. $endPath = str_replace('\\', '/', $endPath);
  39083. $startPath = str_replace('\\', '/', $startPath);
  39084. }
  39085. $stripDriveLetter = function ($path) {
  39086. if (strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && ctype_alpha($path[0])) {
  39087. return substr($path, 2);
  39088. }
  39089. return $path;
  39090. };
  39091. $endPath = $stripDriveLetter($endPath);
  39092. $startPath = $stripDriveLetter($startPath);
  39093. $startPathArr = explode('/', trim($startPath, '/'));
  39094. $endPathArr = explode('/', trim($endPath, '/'));
  39095. $normalizePathArray = function ($pathSegments, $absolute) {
  39096. $result = array();
  39097. foreach ($pathSegments as $segment) {
  39098. if ('..' === $segment && ($absolute || count($result))) {
  39099. array_pop($result);
  39100. } elseif ('.' !== $segment) {
  39101. $result[] = $segment;
  39102. }
  39103. }
  39104. return $result;
  39105. };
  39106. $startPathArr = $normalizePathArray($startPathArr, static::isAbsolutePath($startPath));
  39107. $endPathArr = $normalizePathArray($endPathArr, static::isAbsolutePath($endPath));
  39108. $index = 0;
  39109. while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
  39110. ++$index;
  39111. }
  39112. if (1 === count($startPathArr) && '' === $startPathArr[0]) {
  39113. $depth = 0;
  39114. } else {
  39115. $depth = count($startPathArr) - $index;
  39116. }
  39117. $traverser = str_repeat('../', $depth);
  39118. $endPathRemainder = implode('/', array_slice($endPathArr, $index));
  39119. $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : '');
  39120. return '' === $relativePath ? './' : $relativePath;
  39121. }
  39122. public function mirror($originDir, $targetDir, \Traversable $iterator = null, $options = array())
  39123. {
  39124. $targetDir = rtrim($targetDir, '/\\');
  39125. $originDir = rtrim($originDir, '/\\');
  39126. $originDirLen = strlen($originDir);
  39127. if ($this->exists($targetDir) && isset($options['delete']) && $options['delete']) {
  39128. $deleteIterator = $iterator;
  39129. if (null === $deleteIterator) {
  39130. $flags = \FilesystemIterator::SKIP_DOTS;
  39131. $deleteIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($targetDir, $flags), \RecursiveIteratorIterator::CHILD_FIRST);
  39132. }
  39133. $targetDirLen = strlen($targetDir);
  39134. foreach ($deleteIterator as $file) {
  39135. $origin = $originDir.substr($file->getPathname(), $targetDirLen);
  39136. if (!$this->exists($origin)) {
  39137. $this->remove($file);
  39138. }
  39139. }
  39140. }
  39141. $copyOnWindows = false;
  39142. if (isset($options['copy_on_windows'])) {
  39143. $copyOnWindows = $options['copy_on_windows'];
  39144. }
  39145. if (null === $iterator) {
  39146. $flags = $copyOnWindows ? \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS : \FilesystemIterator::SKIP_DOTS;
  39147. $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, $flags), \RecursiveIteratorIterator::SELF_FIRST);
  39148. }
  39149. if ($this->exists($originDir)) {
  39150. $this->mkdir($targetDir);
  39151. }
  39152. foreach ($iterator as $file) {
  39153. $target = $targetDir.substr($file->getPathname(), $originDirLen);
  39154. if ($copyOnWindows) {
  39155. if (is_file($file)) {
  39156. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  39157. } elseif (is_dir($file)) {
  39158. $this->mkdir($target);
  39159. } else {
  39160. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  39161. }
  39162. } else {
  39163. if (is_link($file)) {
  39164. $this->symlink($file->getLinkTarget(), $target);
  39165. } elseif (is_dir($file)) {
  39166. $this->mkdir($target);
  39167. } elseif (is_file($file)) {
  39168. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  39169. } else {
  39170. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  39171. }
  39172. }
  39173. }
  39174. }
  39175. public function isAbsolutePath($file)
  39176. {
  39177. return strspn($file, '/\\', 0, 1)
  39178. || (strlen($file) > 3 && ctype_alpha($file[0])
  39179. && ':' === substr($file, 1, 1)
  39180. && strspn($file, '/\\', 2, 1)
  39181. )
  39182. || null !== parse_url($file, PHP_URL_SCHEME)
  39183. ;
  39184. }
  39185. public function tempnam($dir, $prefix)
  39186. {
  39187. list($scheme, $hierarchy) = $this->getSchemeAndHierarchy($dir);
  39188. if (null === $scheme || 'file' === $scheme || 'gs' === $scheme) {
  39189. $tmpFile = @tempnam($hierarchy, $prefix);
  39190. if (false !== $tmpFile) {
  39191. if (null !== $scheme && 'gs' !== $scheme) {
  39192. return $scheme.'://'.$tmpFile;
  39193. }
  39194. return $tmpFile;
  39195. }
  39196. throw new IOException('A temporary file could not be created.');
  39197. }
  39198. for ($i = 0; $i < 10; ++$i) {
  39199. $tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true);
  39200. $handle = @fopen($tmpFile, 'x+');
  39201. if (false === $handle) {
  39202. continue;
  39203. }
  39204. @fclose($handle);
  39205. return $tmpFile;
  39206. }
  39207. throw new IOException('A temporary file could not be created.');
  39208. }
  39209. public function dumpFile($filename, $content, $mode = 0666)
  39210. {
  39211. $dir = dirname($filename);
  39212. if (!is_dir($dir)) {
  39213. $this->mkdir($dir);
  39214. }
  39215. if (!is_writable($dir)) {
  39216. throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir);
  39217. }
  39218. $tmpFile = $this->tempnam($dir, basename($filename));
  39219. if (false === @file_put_contents($tmpFile, $content)) {
  39220. throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename);
  39221. }
  39222. if (null !== $mode) {
  39223. if (func_num_args() > 2) {
  39224. @trigger_error('Support for modifying file permissions is deprecated since Symfony 2.3.12 and will be removed in 3.0.', E_USER_DEPRECATED);
  39225. }
  39226. $this->chmod($tmpFile, $mode);
  39227. } elseif (file_exists($filename)) {
  39228. @chmod($tmpFile, fileperms($filename));
  39229. }
  39230. $this->rename($tmpFile, $filename, true);
  39231. }
  39232. private function toIterator($files)
  39233. {
  39234. if (!$files instanceof \Traversable) {
  39235. $files = new \ArrayObject(is_array($files) ? $files : array($files));
  39236. }
  39237. return $files;
  39238. }
  39239. private function getSchemeAndHierarchy($filename)
  39240. {
  39241. $components = explode('://', $filename, 2);
  39242. return 2 === count($components) ? array($components[0], $components[1]) : array(null, $components[0]);
  39243. }
  39244. }
  39245. Copyright (c) 2004-2018 Fabien Potencier
  39246. Permission is hereby granted, free of charge, to any person obtaining a copy
  39247. of this software and associated documentation files (the "Software"), to deal
  39248. in the Software without restriction, including without limitation the rights
  39249. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  39250. copies of the Software, and to permit persons to whom the Software is furnished
  39251. to do so, subject to the following conditions:
  39252. The above copyright notice and this permission notice shall be included in all
  39253. copies or substantial portions of the Software.
  39254. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  39255. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  39256. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  39257. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  39258. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  39259. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  39260. THE SOFTWARE.
  39261. <?php
  39262. namespace Symfony\Component\Filesystem;
  39263. use Symfony\Component\Filesystem\Exception\IOException;
  39264. class LockHandler
  39265. {
  39266. private $file;
  39267. private $handle;
  39268. public function __construct($name, $lockPath = null)
  39269. {
  39270. $lockPath = $lockPath ?: sys_get_temp_dir();
  39271. if (!is_dir($lockPath)) {
  39272. $fs = new Filesystem();
  39273. $fs->mkdir($lockPath);
  39274. }
  39275. if (!is_writable($lockPath)) {
  39276. throw new IOException(sprintf('The directory "%s" is not writable.', $lockPath), 0, null, $lockPath);
  39277. }
  39278. $this->file = sprintf('%s/sf.%s.%s.lock', $lockPath, preg_replace('/[^a-z0-9\._-]+/i', '-', $name), hash('sha256', $name));
  39279. }
  39280. public function lock($blocking = false)
  39281. {
  39282. if ($this->handle) {
  39283. return true;
  39284. }
  39285. $error = null;
  39286. set_error_handler(function ($errno, $msg) use (&$error) {
  39287. $error = $msg;
  39288. });
  39289. if (!$this->handle = fopen($this->file, 'r')) {
  39290. if ($this->handle = fopen($this->file, 'x')) {
  39291. chmod($this->file, 0444);
  39292. } elseif (!$this->handle = fopen($this->file, 'r')) {
  39293. usleep(100);
  39294. $this->handle = fopen($this->file, 'r');
  39295. }
  39296. }
  39297. restore_error_handler();
  39298. if (!$this->handle) {
  39299. throw new IOException($error, 0, null, $this->file);
  39300. }
  39301. if (!flock($this->handle, LOCK_EX | ($blocking ? 0 : LOCK_NB))) {
  39302. fclose($this->handle);
  39303. $this->handle = null;
  39304. return false;
  39305. }
  39306. return true;
  39307. }
  39308. public function release()
  39309. {
  39310. if ($this->handle) {
  39311. flock($this->handle, LOCK_UN | LOCK_NB);
  39312. fclose($this->handle);
  39313. $this->handle = null;
  39314. }
  39315. }
  39316. }
  39317. <?php
  39318. namespace Symfony\Component\Finder\Adapter;
  39319. @trigger_error('The '.__NAMESPACE__.'\AbstractAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  39320. abstract class AbstractAdapter implements AdapterInterface
  39321. {
  39322. protected $followLinks = false;
  39323. protected $mode = 0;
  39324. protected $minDepth = 0;
  39325. protected $maxDepth = PHP_INT_MAX;
  39326. protected $exclude = array();
  39327. protected $names = array();
  39328. protected $notNames = array();
  39329. protected $contains = array();
  39330. protected $notContains = array();
  39331. protected $sizes = array();
  39332. protected $dates = array();
  39333. protected $filters = array();
  39334. protected $sort = false;
  39335. protected $paths = array();
  39336. protected $notPaths = array();
  39337. protected $ignoreUnreadableDirs = false;
  39338. private static $areSupported = array();
  39339. public function isSupported()
  39340. {
  39341. $name = $this->getName();
  39342. if (!array_key_exists($name, self::$areSupported)) {
  39343. self::$areSupported[$name] = $this->canBeUsed();
  39344. }
  39345. return self::$areSupported[$name];
  39346. }
  39347. public function setFollowLinks($followLinks)
  39348. {
  39349. $this->followLinks = $followLinks;
  39350. return $this;
  39351. }
  39352. public function setMode($mode)
  39353. {
  39354. $this->mode = $mode;
  39355. return $this;
  39356. }
  39357. public function setDepths(array $depths)
  39358. {
  39359. $this->minDepth = 0;
  39360. $this->maxDepth = PHP_INT_MAX;
  39361. foreach ($depths as $comparator) {
  39362. switch ($comparator->getOperator()) {
  39363. case '>':
  39364. $this->minDepth = $comparator->getTarget() + 1;
  39365. break;
  39366. case '>=':
  39367. $this->minDepth = $comparator->getTarget();
  39368. break;
  39369. case '<':
  39370. $this->maxDepth = $comparator->getTarget() - 1;
  39371. break;
  39372. case '<=':
  39373. $this->maxDepth = $comparator->getTarget();
  39374. break;
  39375. default:
  39376. $this->minDepth = $this->maxDepth = $comparator->getTarget();
  39377. }
  39378. }
  39379. return $this;
  39380. }
  39381. public function setExclude(array $exclude)
  39382. {
  39383. $this->exclude = $exclude;
  39384. return $this;
  39385. }
  39386. public function setNames(array $names)
  39387. {
  39388. $this->names = $names;
  39389. return $this;
  39390. }
  39391. public function setNotNames(array $notNames)
  39392. {
  39393. $this->notNames = $notNames;
  39394. return $this;
  39395. }
  39396. public function setContains(array $contains)
  39397. {
  39398. $this->contains = $contains;
  39399. return $this;
  39400. }
  39401. public function setNotContains(array $notContains)
  39402. {
  39403. $this->notContains = $notContains;
  39404. return $this;
  39405. }
  39406. public function setSizes(array $sizes)
  39407. {
  39408. $this->sizes = $sizes;
  39409. return $this;
  39410. }
  39411. public function setDates(array $dates)
  39412. {
  39413. $this->dates = $dates;
  39414. return $this;
  39415. }
  39416. public function setFilters(array $filters)
  39417. {
  39418. $this->filters = $filters;
  39419. return $this;
  39420. }
  39421. public function setSort($sort)
  39422. {
  39423. $this->sort = $sort;
  39424. return $this;
  39425. }
  39426. public function setPath(array $paths)
  39427. {
  39428. $this->paths = $paths;
  39429. return $this;
  39430. }
  39431. public function setNotPath(array $notPaths)
  39432. {
  39433. $this->notPaths = $notPaths;
  39434. return $this;
  39435. }
  39436. public function ignoreUnreadableDirs($ignore = true)
  39437. {
  39438. $this->ignoreUnreadableDirs = (bool) $ignore;
  39439. return $this;
  39440. }
  39441. abstract protected function canBeUsed();
  39442. }
  39443. <?php
  39444. namespace Symfony\Component\Finder\Adapter;
  39445. @trigger_error('The '.__NAMESPACE__.'\AbstractFindAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  39446. use Symfony\Component\Finder\Exception\AccessDeniedException;
  39447. use Symfony\Component\Finder\Iterator;
  39448. use Symfony\Component\Finder\Shell\Shell;
  39449. use Symfony\Component\Finder\Expression\Expression;
  39450. use Symfony\Component\Finder\Shell\Command;
  39451. use Symfony\Component\Finder\Comparator\NumberComparator;
  39452. use Symfony\Component\Finder\Comparator\DateComparator;
  39453. abstract class AbstractFindAdapter extends AbstractAdapter
  39454. {
  39455. protected $shell;
  39456. public function __construct()
  39457. {
  39458. $this->shell = new Shell();
  39459. }
  39460. public function searchInDirectory($dir)
  39461. {
  39462. $dir = realpath($dir);
  39463. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode && ($this->contains || $this->notContains)) {
  39464. return new Iterator\FilePathsIterator(array(), $dir);
  39465. }
  39466. $command = Command::create();
  39467. $find = $this->buildFindCommand($command, $dir);
  39468. if ($this->followLinks) {
  39469. $find->add('-follow');
  39470. }
  39471. $find->add('-mindepth')->add($this->minDepth + 1);
  39472. if (PHP_INT_MAX !== $this->maxDepth) {
  39473. $find->add('-maxdepth')->add($this->maxDepth + 1);
  39474. }
  39475. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode) {
  39476. $find->add('-type d');
  39477. } elseif (Iterator\FileTypeFilterIterator::ONLY_FILES === $this->mode) {
  39478. $find->add('-type f');
  39479. }
  39480. $this->buildNamesFiltering($find, $this->names);
  39481. $this->buildNamesFiltering($find, $this->notNames, true);
  39482. $this->buildPathsFiltering($find, $dir, $this->paths);
  39483. $this->buildPathsFiltering($find, $dir, $this->notPaths, true);
  39484. $this->buildSizesFiltering($find, $this->sizes);
  39485. $this->buildDatesFiltering($find, $this->dates);
  39486. $useGrep = $this->shell->testCommand('grep') && $this->shell->testCommand('xargs');
  39487. $useSort = is_int($this->sort) && $this->shell->testCommand('sort') && $this->shell->testCommand('cut');
  39488. if ($useGrep && ($this->contains || $this->notContains)) {
  39489. $grep = $command->ins('grep');
  39490. $this->buildContentFiltering($grep, $this->contains);
  39491. $this->buildContentFiltering($grep, $this->notContains, true);
  39492. }
  39493. if ($useSort) {
  39494. $this->buildSorting($command, $this->sort);
  39495. }
  39496. $command->setErrorHandler(
  39497. $this->ignoreUnreadableDirs
  39498. ? function ($stderr) { }
  39499. : function ($stderr) { throw new AccessDeniedException($stderr); }
  39500. );
  39501. $paths = $this->shell->testCommand('uniq') ? $command->add('| uniq')->execute() : array_unique($command->execute());
  39502. $iterator = new Iterator\FilePathsIterator($paths, $dir);
  39503. if ($this->exclude) {
  39504. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  39505. }
  39506. if (!$useGrep && ($this->contains || $this->notContains)) {
  39507. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  39508. }
  39509. if ($this->filters) {
  39510. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  39511. }
  39512. if (!$useSort && $this->sort) {
  39513. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  39514. $iterator = $iteratorAggregate->getIterator();
  39515. }
  39516. return $iterator;
  39517. }
  39518. protected function canBeUsed()
  39519. {
  39520. return $this->shell->testCommand('find');
  39521. }
  39522. protected function buildFindCommand(Command $command, $dir)
  39523. {
  39524. return $command
  39525. ->ins('find')
  39526. ->add('find ')
  39527. ->arg($dir)
  39528. ->add('-noleaf');
  39529. }
  39530. private function buildNamesFiltering(Command $command, array $names, $not = false)
  39531. {
  39532. if (0 === count($names)) {
  39533. return;
  39534. }
  39535. $command->add($not ? '-not' : null)->cmd('(');
  39536. foreach ($names as $i => $name) {
  39537. $expr = Expression::create($name);
  39538. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  39539. $expr = Expression::create($expr->getGlob()->toRegex(false));
  39540. }
  39541. if ($expr->isRegex()) {
  39542. $regex = $expr->getRegex();
  39543. $regex->prepend($regex->hasStartFlag() ? '/' : '/[^/]*')
  39544. ->setStartFlag(false)
  39545. ->setStartJoker(true)
  39546. ->replaceJokers('[^/]');
  39547. if (!$regex->hasEndFlag() || $regex->hasEndJoker()) {
  39548. $regex->setEndJoker(false)->append('[^/]*');
  39549. }
  39550. }
  39551. $command
  39552. ->add($i > 0 ? '-or' : null)
  39553. ->add($expr->isRegex()
  39554. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  39555. : ($expr->isCaseSensitive() ? '-name' : '-iname')
  39556. )
  39557. ->arg($expr->renderPattern());
  39558. }
  39559. $command->cmd(')');
  39560. }
  39561. private function buildPathsFiltering(Command $command, $dir, array $paths, $not = false)
  39562. {
  39563. if (0 === count($paths)) {
  39564. return;
  39565. }
  39566. $command->add($not ? '-not' : null)->cmd('(');
  39567. foreach ($paths as $i => $path) {
  39568. $expr = Expression::create($path);
  39569. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  39570. $expr = Expression::create($expr->getGlob()->toRegex(false));
  39571. }
  39572. if ($expr->isRegex()) {
  39573. $regex = $expr->getRegex();
  39574. $regex->prepend($regex->hasStartFlag() ? preg_quote($dir).DIRECTORY_SEPARATOR : '.*')->setEndJoker(!$regex->hasEndFlag());
  39575. } else {
  39576. $expr->prepend('*')->append('*');
  39577. }
  39578. $command
  39579. ->add($i > 0 ? '-or' : null)
  39580. ->add($expr->isRegex()
  39581. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  39582. : ($expr->isCaseSensitive() ? '-path' : '-ipath')
  39583. )
  39584. ->arg($expr->renderPattern());
  39585. }
  39586. $command->cmd(')');
  39587. }
  39588. private function buildSizesFiltering(Command $command, array $sizes)
  39589. {
  39590. foreach ($sizes as $i => $size) {
  39591. $command->add($i > 0 ? '-and' : null);
  39592. switch ($size->getOperator()) {
  39593. case '<=':
  39594. $command->add('-size -'.($size->getTarget() + 1).'c');
  39595. break;
  39596. case '>=':
  39597. $command->add('-size +'.($size->getTarget() - 1).'c');
  39598. break;
  39599. case '>':
  39600. $command->add('-size +'.$size->getTarget().'c');
  39601. break;
  39602. case '!=':
  39603. $command->add('-size -'.$size->getTarget().'c');
  39604. $command->add('-size +'.$size->getTarget().'c');
  39605. break;
  39606. case '<':
  39607. default:
  39608. $command->add('-size -'.$size->getTarget().'c');
  39609. }
  39610. }
  39611. }
  39612. private function buildDatesFiltering(Command $command, array $dates)
  39613. {
  39614. foreach ($dates as $i => $date) {
  39615. $command->add($i > 0 ? '-and' : null);
  39616. $mins = (int) round((time() - $date->getTarget()) / 60);
  39617. if (0 > $mins) {
  39618. $command->add(' -mmin -0');
  39619. return;
  39620. }
  39621. switch ($date->getOperator()) {
  39622. case '<=':
  39623. $command->add('-mmin +'.($mins - 1));
  39624. break;
  39625. case '>=':
  39626. $command->add('-mmin -'.($mins + 1));
  39627. break;
  39628. case '>':
  39629. $command->add('-mmin -'.$mins);
  39630. break;
  39631. case '!=':
  39632. $command->add('-mmin +'.$mins.' -or -mmin -'.$mins);
  39633. break;
  39634. case '<':
  39635. default:
  39636. $command->add('-mmin +'.$mins);
  39637. }
  39638. }
  39639. }
  39640. private function buildSorting(Command $command, $sort)
  39641. {
  39642. $this->buildFormatSorting($command, $sort);
  39643. }
  39644. abstract protected function buildFormatSorting(Command $command, $sort);
  39645. abstract protected function buildContentFiltering(Command $command, array $contains, $not = false);
  39646. }
  39647. <?php
  39648. namespace Symfony\Component\Finder\Adapter;
  39649. interface AdapterInterface
  39650. {
  39651. public function setFollowLinks($followLinks);
  39652. public function setMode($mode);
  39653. public function setExclude(array $exclude);
  39654. public function setDepths(array $depths);
  39655. public function setNames(array $names);
  39656. public function setNotNames(array $notNames);
  39657. public function setContains(array $contains);
  39658. public function setNotContains(array $notContains);
  39659. public function setSizes(array $sizes);
  39660. public function setDates(array $dates);
  39661. public function setFilters(array $filters);
  39662. public function setSort($sort);
  39663. public function setPath(array $paths);
  39664. public function setNotPath(array $notPaths);
  39665. public function ignoreUnreadableDirs($ignore = true);
  39666. public function searchInDirectory($dir);
  39667. public function isSupported();
  39668. public function getName();
  39669. }
  39670. <?php
  39671. namespace Symfony\Component\Finder\Adapter;
  39672. @trigger_error('The '.__NAMESPACE__.'\BsdFindAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  39673. use Symfony\Component\Finder\Shell\Shell;
  39674. use Symfony\Component\Finder\Shell\Command;
  39675. use Symfony\Component\Finder\Iterator\SortableIterator;
  39676. use Symfony\Component\Finder\Expression\Expression;
  39677. class BsdFindAdapter extends AbstractFindAdapter
  39678. {
  39679. public function getName()
  39680. {
  39681. return 'bsd_find';
  39682. }
  39683. protected function canBeUsed()
  39684. {
  39685. return in_array($this->shell->getType(), array(Shell::TYPE_BSD, Shell::TYPE_DARWIN)) && parent::canBeUsed();
  39686. }
  39687. protected function buildFormatSorting(Command $command, $sort)
  39688. {
  39689. switch ($sort) {
  39690. case SortableIterator::SORT_BY_NAME:
  39691. $command->ins('sort')->add('| sort');
  39692. return;
  39693. case SortableIterator::SORT_BY_TYPE:
  39694. $format = '%HT';
  39695. break;
  39696. case SortableIterator::SORT_BY_ACCESSED_TIME:
  39697. $format = '%a';
  39698. break;
  39699. case SortableIterator::SORT_BY_CHANGED_TIME:
  39700. $format = '%c';
  39701. break;
  39702. case SortableIterator::SORT_BY_MODIFIED_TIME:
  39703. $format = '%m';
  39704. break;
  39705. default:
  39706. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  39707. }
  39708. $command
  39709. ->add('-print0 | xargs -0 stat -f')
  39710. ->arg($format.'%t%N')
  39711. ->add('| sort | cut -f 2');
  39712. }
  39713. protected function buildFindCommand(Command $command, $dir)
  39714. {
  39715. parent::buildFindCommand($command, $dir)->addAtIndex('-E', 1);
  39716. return $command;
  39717. }
  39718. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  39719. {
  39720. foreach ($contains as $contain) {
  39721. $expr = Expression::create($contain);
  39722. $command
  39723. ->add('| grep -v \'^$\'')
  39724. ->add('| xargs -I{} grep -I')
  39725. ->add($expr->isCaseSensitive() ? null : '-i')
  39726. ->add($not ? '-L' : '-l')
  39727. ->add('-Ee')->arg($expr->renderPattern())
  39728. ->add('{}')
  39729. ;
  39730. }
  39731. }
  39732. }
  39733. <?php
  39734. namespace Symfony\Component\Finder\Adapter;
  39735. @trigger_error('The '.__NAMESPACE__.'\GnuFindAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  39736. use Symfony\Component\Finder\Shell\Shell;
  39737. use Symfony\Component\Finder\Shell\Command;
  39738. use Symfony\Component\Finder\Iterator\SortableIterator;
  39739. use Symfony\Component\Finder\Expression\Expression;
  39740. class GnuFindAdapter extends AbstractFindAdapter
  39741. {
  39742. public function getName()
  39743. {
  39744. return 'gnu_find';
  39745. }
  39746. protected function buildFormatSorting(Command $command, $sort)
  39747. {
  39748. switch ($sort) {
  39749. case SortableIterator::SORT_BY_NAME:
  39750. $command->ins('sort')->add('| sort');
  39751. return;
  39752. case SortableIterator::SORT_BY_TYPE:
  39753. $format = '%y';
  39754. break;
  39755. case SortableIterator::SORT_BY_ACCESSED_TIME:
  39756. $format = '%A@';
  39757. break;
  39758. case SortableIterator::SORT_BY_CHANGED_TIME:
  39759. $format = '%C@';
  39760. break;
  39761. case SortableIterator::SORT_BY_MODIFIED_TIME:
  39762. $format = '%T@';
  39763. break;
  39764. default:
  39765. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  39766. }
  39767. $command
  39768. ->get('find')
  39769. ->add('-printf')
  39770. ->arg($format.' %h/%f\\n')
  39771. ->add('| sort | cut')
  39772. ->arg('-d ')
  39773. ->arg('-f2-')
  39774. ;
  39775. }
  39776. protected function canBeUsed()
  39777. {
  39778. return Shell::TYPE_UNIX === $this->shell->getType() && parent::canBeUsed();
  39779. }
  39780. protected function buildFindCommand(Command $command, $dir)
  39781. {
  39782. return parent::buildFindCommand($command, $dir)->add('-regextype posix-extended');
  39783. }
  39784. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  39785. {
  39786. foreach ($contains as $contain) {
  39787. $expr = Expression::create($contain);
  39788. $command
  39789. ->add('| xargs -I{} -r grep -I')
  39790. ->add($expr->isCaseSensitive() ? null : '-i')
  39791. ->add($not ? '-L' : '-l')
  39792. ->add('-Ee')->arg($expr->renderPattern())
  39793. ->add('{}')
  39794. ;
  39795. }
  39796. }
  39797. }
  39798. <?php
  39799. namespace Symfony\Component\Finder\Adapter;
  39800. @trigger_error('The '.__NAMESPACE__.'\PhpAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  39801. use Symfony\Component\Finder\Iterator;
  39802. class PhpAdapter extends AbstractAdapter
  39803. {
  39804. public function searchInDirectory($dir)
  39805. {
  39806. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  39807. if ($this->followLinks) {
  39808. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  39809. }
  39810. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  39811. if ($this->exclude) {
  39812. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  39813. }
  39814. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  39815. if ($this->minDepth > 0 || $this->maxDepth < PHP_INT_MAX) {
  39816. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $this->minDepth, $this->maxDepth);
  39817. }
  39818. if ($this->mode) {
  39819. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  39820. }
  39821. if ($this->names || $this->notNames) {
  39822. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  39823. }
  39824. if ($this->contains || $this->notContains) {
  39825. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  39826. }
  39827. if ($this->sizes) {
  39828. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  39829. }
  39830. if ($this->dates) {
  39831. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  39832. }
  39833. if ($this->filters) {
  39834. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  39835. }
  39836. if ($this->paths || $this->notPaths) {
  39837. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  39838. }
  39839. if ($this->sort) {
  39840. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  39841. $iterator = $iteratorAggregate->getIterator();
  39842. }
  39843. return $iterator;
  39844. }
  39845. public function getName()
  39846. {
  39847. return 'php';
  39848. }
  39849. protected function canBeUsed()
  39850. {
  39851. return true;
  39852. }
  39853. }
  39854. <?php
  39855. namespace Symfony\Component\Finder\Comparator;
  39856. class Comparator
  39857. {
  39858. private $target;
  39859. private $operator = '==';
  39860. public function getTarget()
  39861. {
  39862. return $this->target;
  39863. }
  39864. public function setTarget($target)
  39865. {
  39866. $this->target = $target;
  39867. }
  39868. public function getOperator()
  39869. {
  39870. return $this->operator;
  39871. }
  39872. public function setOperator($operator)
  39873. {
  39874. if (!$operator) {
  39875. $operator = '==';
  39876. }
  39877. if (!in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) {
  39878. throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
  39879. }
  39880. $this->operator = $operator;
  39881. }
  39882. public function test($test)
  39883. {
  39884. switch ($this->operator) {
  39885. case '>':
  39886. return $test > $this->target;
  39887. case '>=':
  39888. return $test >= $this->target;
  39889. case '<':
  39890. return $test < $this->target;
  39891. case '<=':
  39892. return $test <= $this->target;
  39893. case '!=':
  39894. return $test != $this->target;
  39895. }
  39896. return $test == $this->target;
  39897. }
  39898. }
  39899. <?php
  39900. namespace Symfony\Component\Finder\Comparator;
  39901. class DateComparator extends Comparator
  39902. {
  39903. public function __construct($test)
  39904. {
  39905. if (!preg_match('#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i', $test, $matches)) {
  39906. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a date test.', $test));
  39907. }
  39908. try {
  39909. $date = new \DateTime($matches[2]);
  39910. $target = $date->format('U');
  39911. } catch (\Exception $e) {
  39912. throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
  39913. }
  39914. $operator = isset($matches[1]) ? $matches[1] : '==';
  39915. if ('since' === $operator || 'after' === $operator) {
  39916. $operator = '>';
  39917. }
  39918. if ('until' === $operator || 'before' === $operator) {
  39919. $operator = '<';
  39920. }
  39921. $this->setOperator($operator);
  39922. $this->setTarget($target);
  39923. }
  39924. }
  39925. <?php
  39926. namespace Symfony\Component\Finder\Comparator;
  39927. class NumberComparator extends Comparator
  39928. {
  39929. public function __construct($test)
  39930. {
  39931. if (!preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
  39932. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test));
  39933. }
  39934. $target = $matches[2];
  39935. if (!is_numeric($target)) {
  39936. throw new \InvalidArgumentException(sprintf('Invalid number "%s".', $target));
  39937. }
  39938. if (isset($matches[3])) {
  39939. switch (strtolower($matches[3])) {
  39940. case 'k':
  39941. $target *= 1000;
  39942. break;
  39943. case 'ki':
  39944. $target *= 1024;
  39945. break;
  39946. case 'm':
  39947. $target *= 1000000;
  39948. break;
  39949. case 'mi':
  39950. $target *= 1024 * 1024;
  39951. break;
  39952. case 'g':
  39953. $target *= 1000000000;
  39954. break;
  39955. case 'gi':
  39956. $target *= 1024 * 1024 * 1024;
  39957. break;
  39958. }
  39959. }
  39960. $this->setTarget($target);
  39961. $this->setOperator(isset($matches[1]) ? $matches[1] : '==');
  39962. }
  39963. }
  39964. <?php
  39965. namespace Symfony\Component\Finder\Exception;
  39966. class AccessDeniedException extends \UnexpectedValueException
  39967. {
  39968. }
  39969. <?php
  39970. namespace Symfony\Component\Finder\Exception;
  39971. @trigger_error('The '.__NAMESPACE__.'\AdapterFailureException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  39972. use Symfony\Component\Finder\Adapter\AdapterInterface;
  39973. class AdapterFailureException extends \RuntimeException implements ExceptionInterface
  39974. {
  39975. private $adapter;
  39976. public function __construct(AdapterInterface $adapter, $message = null, \Exception $previous = null)
  39977. {
  39978. $this->adapter = $adapter;
  39979. parent::__construct($message ?: 'Search failed with "'.$adapter->getName().'" adapter.', $previous);
  39980. }
  39981. public function getAdapter()
  39982. {
  39983. return $this->adapter;
  39984. }
  39985. }
  39986. <?php
  39987. namespace Symfony\Component\Finder\Exception;
  39988. interface ExceptionInterface
  39989. {
  39990. public function getAdapter();
  39991. }
  39992. <?php
  39993. namespace Symfony\Component\Finder\Exception;
  39994. @trigger_error('The '.__NAMESPACE__.'\OperationNotPermitedException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  39995. class OperationNotPermitedException extends AdapterFailureException
  39996. {
  39997. }
  39998. <?php
  39999. namespace Symfony\Component\Finder\Exception;
  40000. @trigger_error('The '.__NAMESPACE__.'\ShellCommandFailureException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40001. use Symfony\Component\Finder\Adapter\AdapterInterface;
  40002. use Symfony\Component\Finder\Shell\Command;
  40003. class ShellCommandFailureException extends AdapterFailureException
  40004. {
  40005. private $command;
  40006. public function __construct(AdapterInterface $adapter, Command $command, \Exception $previous = null)
  40007. {
  40008. $this->command = $command;
  40009. parent::__construct($adapter, 'Shell command failed: "'.$command->join().'".', $previous);
  40010. }
  40011. public function getCommand()
  40012. {
  40013. return $this->command;
  40014. }
  40015. }
  40016. <?php
  40017. namespace Symfony\Component\Finder\Expression;
  40018. @trigger_error('The '.__NAMESPACE__.'\Expression class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40019. class Expression implements ValueInterface
  40020. {
  40021. const TYPE_REGEX = 1;
  40022. const TYPE_GLOB = 2;
  40023. private $value;
  40024. public static function create($expr)
  40025. {
  40026. return new self($expr);
  40027. }
  40028. public function __construct($expr)
  40029. {
  40030. try {
  40031. $this->value = Regex::create($expr);
  40032. } catch (\InvalidArgumentException $e) {
  40033. $this->value = new Glob($expr);
  40034. }
  40035. }
  40036. public function __toString()
  40037. {
  40038. return $this->render();
  40039. }
  40040. public function render()
  40041. {
  40042. return $this->value->render();
  40043. }
  40044. public function renderPattern()
  40045. {
  40046. return $this->value->renderPattern();
  40047. }
  40048. public function isCaseSensitive()
  40049. {
  40050. return $this->value->isCaseSensitive();
  40051. }
  40052. public function getType()
  40053. {
  40054. return $this->value->getType();
  40055. }
  40056. public function prepend($expr)
  40057. {
  40058. $this->value->prepend($expr);
  40059. return $this;
  40060. }
  40061. public function append($expr)
  40062. {
  40063. $this->value->append($expr);
  40064. return $this;
  40065. }
  40066. public function isRegex()
  40067. {
  40068. return self::TYPE_REGEX === $this->value->getType();
  40069. }
  40070. public function isGlob()
  40071. {
  40072. return self::TYPE_GLOB === $this->value->getType();
  40073. }
  40074. public function getGlob()
  40075. {
  40076. if (self::TYPE_GLOB !== $this->value->getType()) {
  40077. throw new \LogicException('Regex can\'t be transformed to glob.');
  40078. }
  40079. return $this->value;
  40080. }
  40081. public function getRegex()
  40082. {
  40083. return self::TYPE_REGEX === $this->value->getType() ? $this->value : $this->value->toRegex();
  40084. }
  40085. }
  40086. <?php
  40087. namespace Symfony\Component\Finder\Expression;
  40088. @trigger_error('The '.__NAMESPACE__.'\Glob class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40089. use Symfony\Component\Finder\Glob as FinderGlob;
  40090. class Glob implements ValueInterface
  40091. {
  40092. private $pattern;
  40093. public function __construct($pattern)
  40094. {
  40095. $this->pattern = $pattern;
  40096. }
  40097. public function render()
  40098. {
  40099. return $this->pattern;
  40100. }
  40101. public function renderPattern()
  40102. {
  40103. return $this->pattern;
  40104. }
  40105. public function getType()
  40106. {
  40107. return Expression::TYPE_GLOB;
  40108. }
  40109. public function isCaseSensitive()
  40110. {
  40111. return true;
  40112. }
  40113. public function prepend($expr)
  40114. {
  40115. $this->pattern = $expr.$this->pattern;
  40116. return $this;
  40117. }
  40118. public function append($expr)
  40119. {
  40120. $this->pattern .= $expr;
  40121. return $this;
  40122. }
  40123. public function isExpandable()
  40124. {
  40125. return false !== strpos($this->pattern, '{')
  40126. && false !== strpos($this->pattern, '}');
  40127. }
  40128. public function toRegex($strictLeadingDot = true, $strictWildcardSlash = true)
  40129. {
  40130. $regex = FinderGlob::toRegex($this->pattern, $strictLeadingDot, $strictWildcardSlash, '');
  40131. return new Regex($regex);
  40132. }
  40133. }
  40134. <?php
  40135. namespace Symfony\Component\Finder\Expression;
  40136. @trigger_error('The '.__NAMESPACE__.'\Regex class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40137. class Regex implements ValueInterface
  40138. {
  40139. const START_FLAG = '^';
  40140. const END_FLAG = '$';
  40141. const BOUNDARY = '~';
  40142. const JOKER = '.*';
  40143. const ESCAPING = '\\';
  40144. private $pattern;
  40145. private $options;
  40146. private $startFlag;
  40147. private $endFlag;
  40148. private $startJoker;
  40149. private $endJoker;
  40150. public static function create($expr)
  40151. {
  40152. if (preg_match('/^(.{3,}?)([imsxuADU]*)$/', $expr, $m)) {
  40153. $start = substr($m[1], 0, 1);
  40154. $end = substr($m[1], -1);
  40155. if (
  40156. ($start === $end && !preg_match('/[*?[:alnum:] \\\\]/', $start))
  40157. || ('{' === $start && '}' === $end)
  40158. || ('(' === $start && ')' === $end)
  40159. ) {
  40160. return new self(substr($m[1], 1, -1), $m[2], $end);
  40161. }
  40162. }
  40163. throw new \InvalidArgumentException('Given expression is not a regex.');
  40164. }
  40165. public function __construct($pattern, $options = '', $delimiter = null)
  40166. {
  40167. if (null !== $delimiter) {
  40168. $pattern = str_replace('\\'.$delimiter, $delimiter, $pattern);
  40169. }
  40170. $this->parsePattern($pattern);
  40171. $this->options = $options;
  40172. }
  40173. public function __toString()
  40174. {
  40175. return $this->render();
  40176. }
  40177. public function render()
  40178. {
  40179. return self::BOUNDARY
  40180. .$this->renderPattern()
  40181. .self::BOUNDARY
  40182. .$this->options;
  40183. }
  40184. public function renderPattern()
  40185. {
  40186. return ($this->startFlag ? self::START_FLAG : '')
  40187. .($this->startJoker ? self::JOKER : '')
  40188. .str_replace(self::BOUNDARY, '\\'.self::BOUNDARY, $this->pattern)
  40189. .($this->endJoker ? self::JOKER : '')
  40190. .($this->endFlag ? self::END_FLAG : '');
  40191. }
  40192. public function isCaseSensitive()
  40193. {
  40194. return !$this->hasOption('i');
  40195. }
  40196. public function getType()
  40197. {
  40198. return Expression::TYPE_REGEX;
  40199. }
  40200. public function prepend($expr)
  40201. {
  40202. $this->pattern = $expr.$this->pattern;
  40203. return $this;
  40204. }
  40205. public function append($expr)
  40206. {
  40207. $this->pattern .= $expr;
  40208. return $this;
  40209. }
  40210. public function hasOption($option)
  40211. {
  40212. return false !== strpos($this->options, $option);
  40213. }
  40214. public function addOption($option)
  40215. {
  40216. if (!$this->hasOption($option)) {
  40217. $this->options .= $option;
  40218. }
  40219. return $this;
  40220. }
  40221. public function removeOption($option)
  40222. {
  40223. $this->options = str_replace($option, '', $this->options);
  40224. return $this;
  40225. }
  40226. public function setStartFlag($startFlag)
  40227. {
  40228. $this->startFlag = $startFlag;
  40229. return $this;
  40230. }
  40231. public function hasStartFlag()
  40232. {
  40233. return $this->startFlag;
  40234. }
  40235. public function setEndFlag($endFlag)
  40236. {
  40237. $this->endFlag = (bool) $endFlag;
  40238. return $this;
  40239. }
  40240. public function hasEndFlag()
  40241. {
  40242. return $this->endFlag;
  40243. }
  40244. public function setStartJoker($startJoker)
  40245. {
  40246. $this->startJoker = $startJoker;
  40247. return $this;
  40248. }
  40249. public function hasStartJoker()
  40250. {
  40251. return $this->startJoker;
  40252. }
  40253. public function setEndJoker($endJoker)
  40254. {
  40255. $this->endJoker = (bool) $endJoker;
  40256. return $this;
  40257. }
  40258. public function hasEndJoker()
  40259. {
  40260. return $this->endJoker;
  40261. }
  40262. public function replaceJokers($replacement)
  40263. {
  40264. $replace = function ($subject) use ($replacement) {
  40265. $subject = $subject[0];
  40266. $replace = 0 === substr_count($subject, '\\') % 2;
  40267. return $replace ? str_replace('.', $replacement, $subject) : $subject;
  40268. };
  40269. $this->pattern = preg_replace_callback('~[\\\\]*\\.~', $replace, $this->pattern);
  40270. return $this;
  40271. }
  40272. private function parsePattern($pattern)
  40273. {
  40274. if ($this->startFlag = self::START_FLAG === substr($pattern, 0, 1)) {
  40275. $pattern = substr($pattern, 1);
  40276. }
  40277. if ($this->startJoker = self::JOKER === substr($pattern, 0, 2)) {
  40278. $pattern = substr($pattern, 2);
  40279. }
  40280. if ($this->endFlag = (self::END_FLAG === substr($pattern, -1) && self::ESCAPING !== substr($pattern, -2, -1))) {
  40281. $pattern = substr($pattern, 0, -1);
  40282. }
  40283. if ($this->endJoker = (self::JOKER === substr($pattern, -2) && self::ESCAPING !== substr($pattern, -3, -2))) {
  40284. $pattern = substr($pattern, 0, -2);
  40285. }
  40286. $this->pattern = $pattern;
  40287. }
  40288. }
  40289. <?php
  40290. namespace Symfony\Component\Finder\Expression;
  40291. @trigger_error('The '.__NAMESPACE__.'\ValueInterface interface is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40292. interface ValueInterface
  40293. {
  40294. public function render();
  40295. public function renderPattern();
  40296. public function isCaseSensitive();
  40297. public function getType();
  40298. public function prepend($expr);
  40299. public function append($expr);
  40300. }
  40301. <?php
  40302. namespace Symfony\Component\Finder;
  40303. use Symfony\Component\Finder\Adapter\AdapterInterface;
  40304. use Symfony\Component\Finder\Adapter\GnuFindAdapter;
  40305. use Symfony\Component\Finder\Adapter\BsdFindAdapter;
  40306. use Symfony\Component\Finder\Adapter\PhpAdapter;
  40307. use Symfony\Component\Finder\Comparator\DateComparator;
  40308. use Symfony\Component\Finder\Comparator\NumberComparator;
  40309. use Symfony\Component\Finder\Exception\ExceptionInterface;
  40310. use Symfony\Component\Finder\Iterator\CustomFilterIterator;
  40311. use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
  40312. use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator;
  40313. use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator;
  40314. use Symfony\Component\Finder\Iterator\FilecontentFilterIterator;
  40315. use Symfony\Component\Finder\Iterator\FilenameFilterIterator;
  40316. use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
  40317. use Symfony\Component\Finder\Iterator\SortableIterator;
  40318. class Finder implements \IteratorAggregate, \Countable
  40319. {
  40320. const IGNORE_VCS_FILES = 1;
  40321. const IGNORE_DOT_FILES = 2;
  40322. private $mode = 0;
  40323. private $names = array();
  40324. private $notNames = array();
  40325. private $exclude = array();
  40326. private $filters = array();
  40327. private $depths = array();
  40328. private $sizes = array();
  40329. private $followLinks = false;
  40330. private $sort = false;
  40331. private $ignore = 0;
  40332. private $dirs = array();
  40333. private $dates = array();
  40334. private $iterators = array();
  40335. private $contains = array();
  40336. private $notContains = array();
  40337. private $adapters = null;
  40338. private $paths = array();
  40339. private $notPaths = array();
  40340. private $ignoreUnreadableDirs = false;
  40341. private static $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg');
  40342. public function __construct()
  40343. {
  40344. $this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES;
  40345. }
  40346. public static function create()
  40347. {
  40348. return new static();
  40349. }
  40350. public function addAdapter(AdapterInterface $adapter, $priority = 0)
  40351. {
  40352. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40353. $this->initDefaultAdapters();
  40354. $this->adapters[$adapter->getName()] = array(
  40355. 'adapter' => $adapter,
  40356. 'priority' => $priority,
  40357. 'selected' => false,
  40358. );
  40359. return $this->sortAdapters();
  40360. }
  40361. public function useBestAdapter()
  40362. {
  40363. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40364. $this->initDefaultAdapters();
  40365. $this->resetAdapterSelection();
  40366. return $this->sortAdapters();
  40367. }
  40368. public function setAdapter($name)
  40369. {
  40370. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40371. $this->initDefaultAdapters();
  40372. if (!isset($this->adapters[$name])) {
  40373. throw new \InvalidArgumentException(sprintf('Adapter "%s" does not exist.', $name));
  40374. }
  40375. $this->resetAdapterSelection();
  40376. $this->adapters[$name]['selected'] = true;
  40377. return $this->sortAdapters();
  40378. }
  40379. public function removeAdapters()
  40380. {
  40381. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40382. $this->adapters = array();
  40383. return $this;
  40384. }
  40385. public function getAdapters()
  40386. {
  40387. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40388. $this->initDefaultAdapters();
  40389. return array_values(array_map(function (array $adapter) {
  40390. return $adapter['adapter'];
  40391. }, $this->adapters));
  40392. }
  40393. public function directories()
  40394. {
  40395. $this->mode = Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES;
  40396. return $this;
  40397. }
  40398. public function files()
  40399. {
  40400. $this->mode = Iterator\FileTypeFilterIterator::ONLY_FILES;
  40401. return $this;
  40402. }
  40403. public function depth($level)
  40404. {
  40405. $this->depths[] = new Comparator\NumberComparator($level);
  40406. return $this;
  40407. }
  40408. public function date($date)
  40409. {
  40410. $this->dates[] = new Comparator\DateComparator($date);
  40411. return $this;
  40412. }
  40413. public function name($pattern)
  40414. {
  40415. $this->names[] = $pattern;
  40416. return $this;
  40417. }
  40418. public function notName($pattern)
  40419. {
  40420. $this->notNames[] = $pattern;
  40421. return $this;
  40422. }
  40423. public function contains($pattern)
  40424. {
  40425. $this->contains[] = $pattern;
  40426. return $this;
  40427. }
  40428. public function notContains($pattern)
  40429. {
  40430. $this->notContains[] = $pattern;
  40431. return $this;
  40432. }
  40433. public function path($pattern)
  40434. {
  40435. $this->paths[] = $pattern;
  40436. return $this;
  40437. }
  40438. public function notPath($pattern)
  40439. {
  40440. $this->notPaths[] = $pattern;
  40441. return $this;
  40442. }
  40443. public function size($size)
  40444. {
  40445. $this->sizes[] = new Comparator\NumberComparator($size);
  40446. return $this;
  40447. }
  40448. public function exclude($dirs)
  40449. {
  40450. $this->exclude = array_merge($this->exclude, (array) $dirs);
  40451. return $this;
  40452. }
  40453. public function ignoreDotFiles($ignoreDotFiles)
  40454. {
  40455. if ($ignoreDotFiles) {
  40456. $this->ignore |= static::IGNORE_DOT_FILES;
  40457. } else {
  40458. $this->ignore &= ~static::IGNORE_DOT_FILES;
  40459. }
  40460. return $this;
  40461. }
  40462. public function ignoreVCS($ignoreVCS)
  40463. {
  40464. if ($ignoreVCS) {
  40465. $this->ignore |= static::IGNORE_VCS_FILES;
  40466. } else {
  40467. $this->ignore &= ~static::IGNORE_VCS_FILES;
  40468. }
  40469. return $this;
  40470. }
  40471. public static function addVCSPattern($pattern)
  40472. {
  40473. foreach ((array) $pattern as $p) {
  40474. self::$vcsPatterns[] = $p;
  40475. }
  40476. self::$vcsPatterns = array_unique(self::$vcsPatterns);
  40477. }
  40478. public function sort(\Closure $closure)
  40479. {
  40480. $this->sort = $closure;
  40481. return $this;
  40482. }
  40483. public function sortByName()
  40484. {
  40485. $this->sort = Iterator\SortableIterator::SORT_BY_NAME;
  40486. return $this;
  40487. }
  40488. public function sortByType()
  40489. {
  40490. $this->sort = Iterator\SortableIterator::SORT_BY_TYPE;
  40491. return $this;
  40492. }
  40493. public function sortByAccessedTime()
  40494. {
  40495. $this->sort = Iterator\SortableIterator::SORT_BY_ACCESSED_TIME;
  40496. return $this;
  40497. }
  40498. public function sortByChangedTime()
  40499. {
  40500. $this->sort = Iterator\SortableIterator::SORT_BY_CHANGED_TIME;
  40501. return $this;
  40502. }
  40503. public function sortByModifiedTime()
  40504. {
  40505. $this->sort = Iterator\SortableIterator::SORT_BY_MODIFIED_TIME;
  40506. return $this;
  40507. }
  40508. public function filter(\Closure $closure)
  40509. {
  40510. $this->filters[] = $closure;
  40511. return $this;
  40512. }
  40513. public function followLinks()
  40514. {
  40515. $this->followLinks = true;
  40516. return $this;
  40517. }
  40518. public function ignoreUnreadableDirs($ignore = true)
  40519. {
  40520. $this->ignoreUnreadableDirs = (bool) $ignore;
  40521. return $this;
  40522. }
  40523. public function in($dirs)
  40524. {
  40525. $resolvedDirs = array();
  40526. foreach ((array) $dirs as $dir) {
  40527. if (is_dir($dir)) {
  40528. $resolvedDirs[] = $this->normalizeDir($dir);
  40529. } elseif ($glob = glob($dir, (defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
  40530. $resolvedDirs = array_merge($resolvedDirs, array_map(array($this, 'normalizeDir'), $glob));
  40531. } else {
  40532. throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
  40533. }
  40534. }
  40535. $this->dirs = array_merge($this->dirs, $resolvedDirs);
  40536. return $this;
  40537. }
  40538. public function getIterator()
  40539. {
  40540. if (0 === count($this->dirs) && 0 === count($this->iterators)) {
  40541. throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
  40542. }
  40543. if (1 === count($this->dirs) && 0 === count($this->iterators)) {
  40544. return $this->searchInDirectory($this->dirs[0]);
  40545. }
  40546. $iterator = new \AppendIterator();
  40547. foreach ($this->dirs as $dir) {
  40548. $iterator->append($this->searchInDirectory($dir));
  40549. }
  40550. foreach ($this->iterators as $it) {
  40551. $iterator->append($it);
  40552. }
  40553. return $iterator;
  40554. }
  40555. public function append($iterator)
  40556. {
  40557. if ($iterator instanceof \IteratorAggregate) {
  40558. $this->iterators[] = $iterator->getIterator();
  40559. } elseif ($iterator instanceof \Iterator) {
  40560. $this->iterators[] = $iterator;
  40561. } elseif ($iterator instanceof \Traversable || is_array($iterator)) {
  40562. $it = new \ArrayIterator();
  40563. foreach ($iterator as $file) {
  40564. $it->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file));
  40565. }
  40566. $this->iterators[] = $it;
  40567. } else {
  40568. throw new \InvalidArgumentException('Finder::append() method wrong argument type.');
  40569. }
  40570. return $this;
  40571. }
  40572. public function count()
  40573. {
  40574. return iterator_count($this->getIterator());
  40575. }
  40576. private function sortAdapters()
  40577. {
  40578. uasort($this->adapters, function (array $a, array $b) {
  40579. if ($a['selected'] || $b['selected']) {
  40580. return $a['selected'] ? -1 : 1;
  40581. }
  40582. return $a['priority'] > $b['priority'] ? -1 : 1;
  40583. });
  40584. return $this;
  40585. }
  40586. private function searchInDirectory($dir)
  40587. {
  40588. if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) {
  40589. $this->exclude = array_merge($this->exclude, self::$vcsPatterns);
  40590. }
  40591. if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) {
  40592. $this->notPaths[] = '#(^|/)\..+(/|$)#';
  40593. }
  40594. if ($this->adapters) {
  40595. foreach ($this->adapters as $adapter) {
  40596. if ($adapter['adapter']->isSupported()) {
  40597. try {
  40598. return $this
  40599. ->buildAdapter($adapter['adapter'])
  40600. ->searchInDirectory($dir);
  40601. } catch (ExceptionInterface $e) {
  40602. }
  40603. }
  40604. }
  40605. }
  40606. $minDepth = 0;
  40607. $maxDepth = PHP_INT_MAX;
  40608. foreach ($this->depths as $comparator) {
  40609. switch ($comparator->getOperator()) {
  40610. case '>':
  40611. $minDepth = $comparator->getTarget() + 1;
  40612. break;
  40613. case '>=':
  40614. $minDepth = $comparator->getTarget();
  40615. break;
  40616. case '<':
  40617. $maxDepth = $comparator->getTarget() - 1;
  40618. break;
  40619. case '<=':
  40620. $maxDepth = $comparator->getTarget();
  40621. break;
  40622. default:
  40623. $minDepth = $maxDepth = $comparator->getTarget();
  40624. }
  40625. }
  40626. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  40627. if ($this->followLinks) {
  40628. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  40629. }
  40630. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  40631. if ($this->exclude) {
  40632. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  40633. }
  40634. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  40635. if ($minDepth > 0 || $maxDepth < PHP_INT_MAX) {
  40636. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $minDepth, $maxDepth);
  40637. }
  40638. if ($this->mode) {
  40639. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  40640. }
  40641. if ($this->names || $this->notNames) {
  40642. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  40643. }
  40644. if ($this->contains || $this->notContains) {
  40645. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  40646. }
  40647. if ($this->sizes) {
  40648. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  40649. }
  40650. if ($this->dates) {
  40651. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  40652. }
  40653. if ($this->filters) {
  40654. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  40655. }
  40656. if ($this->paths || $this->notPaths) {
  40657. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  40658. }
  40659. if ($this->sort) {
  40660. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  40661. $iterator = $iteratorAggregate->getIterator();
  40662. }
  40663. return $iterator;
  40664. }
  40665. private function buildAdapter(AdapterInterface $adapter)
  40666. {
  40667. return $adapter
  40668. ->setFollowLinks($this->followLinks)
  40669. ->setDepths($this->depths)
  40670. ->setMode($this->mode)
  40671. ->setExclude($this->exclude)
  40672. ->setNames($this->names)
  40673. ->setNotNames($this->notNames)
  40674. ->setContains($this->contains)
  40675. ->setNotContains($this->notContains)
  40676. ->setSizes($this->sizes)
  40677. ->setDates($this->dates)
  40678. ->setFilters($this->filters)
  40679. ->setSort($this->sort)
  40680. ->setPath($this->paths)
  40681. ->setNotPath($this->notPaths)
  40682. ->ignoreUnreadableDirs($this->ignoreUnreadableDirs);
  40683. }
  40684. private function resetAdapterSelection()
  40685. {
  40686. $this->adapters = array_map(function (array $properties) {
  40687. $properties['selected'] = false;
  40688. return $properties;
  40689. }, $this->adapters);
  40690. }
  40691. private function initDefaultAdapters()
  40692. {
  40693. if (null === $this->adapters) {
  40694. $this->adapters = array();
  40695. $this
  40696. ->addAdapter(new GnuFindAdapter())
  40697. ->addAdapter(new BsdFindAdapter())
  40698. ->addAdapter(new PhpAdapter(), -50)
  40699. ->setAdapter('php')
  40700. ;
  40701. }
  40702. }
  40703. private function normalizeDir($dir)
  40704. {
  40705. return rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
  40706. }
  40707. }
  40708. <?php
  40709. namespace Symfony\Component\Finder;
  40710. class Glob
  40711. {
  40712. public static function toRegex($glob, $strictLeadingDot = true, $strictWildcardSlash = true, $delimiter = '#')
  40713. {
  40714. $firstByte = true;
  40715. $escaping = false;
  40716. $inCurlies = 0;
  40717. $regex = '';
  40718. $sizeGlob = strlen($glob);
  40719. for ($i = 0; $i < $sizeGlob; ++$i) {
  40720. $car = $glob[$i];
  40721. if ($firstByte) {
  40722. if ($strictLeadingDot && '.' !== $car) {
  40723. $regex .= '(?=[^\.])';
  40724. }
  40725. $firstByte = false;
  40726. }
  40727. if ('/' === $car) {
  40728. $firstByte = true;
  40729. }
  40730. if ($delimiter === $car || '.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {
  40731. $regex .= "\\$car";
  40732. } elseif ('*' === $car) {
  40733. $regex .= $escaping ? '\\*' : ($strictWildcardSlash ? '[^/]*' : '.*');
  40734. } elseif ('?' === $car) {
  40735. $regex .= $escaping ? '\\?' : ($strictWildcardSlash ? '[^/]' : '.');
  40736. } elseif ('{' === $car) {
  40737. $regex .= $escaping ? '\\{' : '(';
  40738. if (!$escaping) {
  40739. ++$inCurlies;
  40740. }
  40741. } elseif ('}' === $car && $inCurlies) {
  40742. $regex .= $escaping ? '}' : ')';
  40743. if (!$escaping) {
  40744. --$inCurlies;
  40745. }
  40746. } elseif (',' === $car && $inCurlies) {
  40747. $regex .= $escaping ? ',' : '|';
  40748. } elseif ('\\' === $car) {
  40749. if ($escaping) {
  40750. $regex .= '\\\\';
  40751. $escaping = false;
  40752. } else {
  40753. $escaping = true;
  40754. }
  40755. continue;
  40756. } else {
  40757. $regex .= $car;
  40758. }
  40759. $escaping = false;
  40760. }
  40761. return $delimiter.'^'.$regex.'$'.$delimiter;
  40762. }
  40763. }
  40764. <?php
  40765. namespace Symfony\Component\Finder\Iterator;
  40766. class CustomFilterIterator extends FilterIterator
  40767. {
  40768. private $filters = array();
  40769. public function __construct(\Iterator $iterator, array $filters)
  40770. {
  40771. foreach ($filters as $filter) {
  40772. if (!is_callable($filter)) {
  40773. throw new \InvalidArgumentException('Invalid PHP callback.');
  40774. }
  40775. }
  40776. $this->filters = $filters;
  40777. parent::__construct($iterator);
  40778. }
  40779. public function accept()
  40780. {
  40781. $fileinfo = $this->current();
  40782. foreach ($this->filters as $filter) {
  40783. if (false === call_user_func($filter, $fileinfo)) {
  40784. return false;
  40785. }
  40786. }
  40787. return true;
  40788. }
  40789. }
  40790. <?php
  40791. namespace Symfony\Component\Finder\Iterator;
  40792. use Symfony\Component\Finder\Comparator\DateComparator;
  40793. class DateRangeFilterIterator extends FilterIterator
  40794. {
  40795. private $comparators = array();
  40796. public function __construct(\Iterator $iterator, array $comparators)
  40797. {
  40798. $this->comparators = $comparators;
  40799. parent::__construct($iterator);
  40800. }
  40801. public function accept()
  40802. {
  40803. $fileinfo = $this->current();
  40804. if (!file_exists($fileinfo->getPathname())) {
  40805. return false;
  40806. }
  40807. $filedate = $fileinfo->getMTime();
  40808. foreach ($this->comparators as $compare) {
  40809. if (!$compare->test($filedate)) {
  40810. return false;
  40811. }
  40812. }
  40813. return true;
  40814. }
  40815. }
  40816. <?php
  40817. namespace Symfony\Component\Finder\Iterator;
  40818. class DepthRangeFilterIterator extends FilterIterator
  40819. {
  40820. private $minDepth = 0;
  40821. public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = PHP_INT_MAX)
  40822. {
  40823. $this->minDepth = $minDepth;
  40824. $iterator->setMaxDepth(PHP_INT_MAX === $maxDepth ? -1 : $maxDepth);
  40825. parent::__construct($iterator);
  40826. }
  40827. public function accept()
  40828. {
  40829. return $this->getInnerIterator()->getDepth() >= $this->minDepth;
  40830. }
  40831. }
  40832. <?php
  40833. namespace Symfony\Component\Finder\Iterator;
  40834. class ExcludeDirectoryFilterIterator extends FilterIterator implements \RecursiveIterator
  40835. {
  40836. private $iterator;
  40837. private $isRecursive;
  40838. private $excludedDirs = array();
  40839. private $excludedPattern;
  40840. public function __construct(\Iterator $iterator, array $directories)
  40841. {
  40842. $this->iterator = $iterator;
  40843. $this->isRecursive = $iterator instanceof \RecursiveIterator;
  40844. $patterns = array();
  40845. foreach ($directories as $directory) {
  40846. $directory = rtrim($directory, '/');
  40847. if (!$this->isRecursive || false !== strpos($directory, '/')) {
  40848. $patterns[] = preg_quote($directory, '#');
  40849. } else {
  40850. $this->excludedDirs[$directory] = true;
  40851. }
  40852. }
  40853. if ($patterns) {
  40854. $this->excludedPattern = '#(?:^|/)(?:'.implode('|', $patterns).')(?:/|$)#';
  40855. }
  40856. parent::__construct($iterator);
  40857. }
  40858. public function accept()
  40859. {
  40860. if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) {
  40861. return false;
  40862. }
  40863. if ($this->excludedPattern) {
  40864. $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath();
  40865. $path = str_replace('\\', '/', $path);
  40866. return !preg_match($this->excludedPattern, $path);
  40867. }
  40868. return true;
  40869. }
  40870. public function hasChildren()
  40871. {
  40872. return $this->isRecursive && $this->iterator->hasChildren();
  40873. }
  40874. public function getChildren()
  40875. {
  40876. $children = new self($this->iterator->getChildren(), array());
  40877. $children->excludedDirs = $this->excludedDirs;
  40878. $children->excludedPattern = $this->excludedPattern;
  40879. return $children;
  40880. }
  40881. }
  40882. <?php
  40883. namespace Symfony\Component\Finder\Iterator;
  40884. @trigger_error('The '.__NAMESPACE__.'\FilePathsIterator class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40885. use Symfony\Component\Finder\SplFileInfo;
  40886. class FilePathsIterator extends \ArrayIterator
  40887. {
  40888. private $baseDir;
  40889. private $baseDirLength;
  40890. private $subPath;
  40891. private $subPathname;
  40892. private $current;
  40893. public function __construct(array $paths, $baseDir)
  40894. {
  40895. $this->baseDir = $baseDir;
  40896. $this->baseDirLength = strlen($baseDir);
  40897. parent::__construct($paths);
  40898. }
  40899. public function __call($name, array $arguments)
  40900. {
  40901. return call_user_func_array(array($this->current(), $name), $arguments);
  40902. }
  40903. public function current()
  40904. {
  40905. return $this->current;
  40906. }
  40907. public function key()
  40908. {
  40909. return $this->current->getPathname();
  40910. }
  40911. public function next()
  40912. {
  40913. parent::next();
  40914. $this->buildProperties();
  40915. }
  40916. public function rewind()
  40917. {
  40918. parent::rewind();
  40919. $this->buildProperties();
  40920. }
  40921. public function getSubPath()
  40922. {
  40923. return $this->subPath;
  40924. }
  40925. public function getSubPathname()
  40926. {
  40927. return $this->subPathname;
  40928. }
  40929. private function buildProperties()
  40930. {
  40931. $absolutePath = parent::current();
  40932. if ($this->baseDir === substr($absolutePath, 0, $this->baseDirLength)) {
  40933. $this->subPathname = ltrim(substr($absolutePath, $this->baseDirLength), '/\\');
  40934. $dir = dirname($this->subPathname);
  40935. $this->subPath = '.' === $dir ? '' : $dir;
  40936. } else {
  40937. $this->subPath = $this->subPathname = '';
  40938. }
  40939. $this->current = new SplFileInfo(parent::current(), $this->subPath, $this->subPathname);
  40940. }
  40941. }
  40942. <?php
  40943. namespace Symfony\Component\Finder\Iterator;
  40944. class FileTypeFilterIterator extends FilterIterator
  40945. {
  40946. const ONLY_FILES = 1;
  40947. const ONLY_DIRECTORIES = 2;
  40948. private $mode;
  40949. public function __construct(\Iterator $iterator, $mode)
  40950. {
  40951. $this->mode = $mode;
  40952. parent::__construct($iterator);
  40953. }
  40954. public function accept()
  40955. {
  40956. $fileinfo = $this->current();
  40957. if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) {
  40958. return false;
  40959. } elseif (self::ONLY_FILES === (self::ONLY_FILES & $this->mode) && $fileinfo->isDir()) {
  40960. return false;
  40961. }
  40962. return true;
  40963. }
  40964. }
  40965. <?php
  40966. namespace Symfony\Component\Finder\Iterator;
  40967. class FilecontentFilterIterator extends MultiplePcreFilterIterator
  40968. {
  40969. public function accept()
  40970. {
  40971. if (!$this->matchRegexps && !$this->noMatchRegexps) {
  40972. return true;
  40973. }
  40974. $fileinfo = $this->current();
  40975. if ($fileinfo->isDir() || !$fileinfo->isReadable()) {
  40976. return false;
  40977. }
  40978. $content = $fileinfo->getContents();
  40979. if (!$content) {
  40980. return false;
  40981. }
  40982. return $this->isAccepted($content);
  40983. }
  40984. protected function toRegex($str)
  40985. {
  40986. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  40987. }
  40988. }
  40989. <?php
  40990. namespace Symfony\Component\Finder\Iterator;
  40991. use Symfony\Component\Finder\Glob;
  40992. class FilenameFilterIterator extends MultiplePcreFilterIterator
  40993. {
  40994. public function accept()
  40995. {
  40996. return $this->isAccepted($this->current()->getFilename());
  40997. }
  40998. protected function toRegex($str)
  40999. {
  41000. return $this->isRegex($str) ? $str : Glob::toRegex($str);
  41001. }
  41002. }
  41003. <?php
  41004. namespace Symfony\Component\Finder\Iterator;
  41005. abstract class FilterIterator extends \FilterIterator
  41006. {
  41007. public function rewind()
  41008. {
  41009. if (\PHP_VERSION_ID > 50607 || (\PHP_VERSION_ID > 50523 && \PHP_VERSION_ID < 50600)) {
  41010. parent::rewind();
  41011. return;
  41012. }
  41013. $iterator = $this;
  41014. while ($iterator instanceof \OuterIterator) {
  41015. $innerIterator = $iterator->getInnerIterator();
  41016. if ($innerIterator instanceof RecursiveDirectoryIterator) {
  41017. if ($innerIterator->isRewindable()) {
  41018. $innerIterator->next();
  41019. $innerIterator->rewind();
  41020. }
  41021. } elseif ($innerIterator instanceof \FilesystemIterator) {
  41022. $innerIterator->next();
  41023. $innerIterator->rewind();
  41024. }
  41025. $iterator = $innerIterator;
  41026. }
  41027. parent::rewind();
  41028. }
  41029. }
  41030. <?php
  41031. namespace Symfony\Component\Finder\Iterator;
  41032. abstract class MultiplePcreFilterIterator extends FilterIterator
  41033. {
  41034. protected $matchRegexps = array();
  41035. protected $noMatchRegexps = array();
  41036. public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns)
  41037. {
  41038. foreach ($matchPatterns as $pattern) {
  41039. $this->matchRegexps[] = $this->toRegex($pattern);
  41040. }
  41041. foreach ($noMatchPatterns as $pattern) {
  41042. $this->noMatchRegexps[] = $this->toRegex($pattern);
  41043. }
  41044. parent::__construct($iterator);
  41045. }
  41046. protected function isAccepted($string)
  41047. {
  41048. foreach ($this->noMatchRegexps as $regex) {
  41049. if (preg_match($regex, $string)) {
  41050. return false;
  41051. }
  41052. }
  41053. if ($this->matchRegexps) {
  41054. foreach ($this->matchRegexps as $regex) {
  41055. if (preg_match($regex, $string)) {
  41056. return true;
  41057. }
  41058. }
  41059. return false;
  41060. }
  41061. return true;
  41062. }
  41063. protected function isRegex($str)
  41064. {
  41065. if (preg_match('/^(.{3,}?)[imsxuADU]*$/', $str, $m)) {
  41066. $start = substr($m[1], 0, 1);
  41067. $end = substr($m[1], -1);
  41068. if ($start === $end) {
  41069. return !preg_match('/[*?[:alnum:] \\\\]/', $start);
  41070. }
  41071. foreach (array(array('{', '}'), array('(', ')'), array('[', ']'), array('<', '>')) as $delimiters) {
  41072. if ($start === $delimiters[0] && $end === $delimiters[1]) {
  41073. return true;
  41074. }
  41075. }
  41076. }
  41077. return false;
  41078. }
  41079. abstract protected function toRegex($str);
  41080. }
  41081. <?php
  41082. namespace Symfony\Component\Finder\Iterator;
  41083. class PathFilterIterator extends MultiplePcreFilterIterator
  41084. {
  41085. public function accept()
  41086. {
  41087. $filename = $this->current()->getRelativePathname();
  41088. if ('\\' === DIRECTORY_SEPARATOR) {
  41089. $filename = str_replace('\\', '/', $filename);
  41090. }
  41091. return $this->isAccepted($filename);
  41092. }
  41093. protected function toRegex($str)
  41094. {
  41095. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  41096. }
  41097. }
  41098. <?php
  41099. namespace Symfony\Component\Finder\Iterator;
  41100. use Symfony\Component\Finder\Exception\AccessDeniedException;
  41101. use Symfony\Component\Finder\SplFileInfo;
  41102. class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
  41103. {
  41104. private $ignoreUnreadableDirs;
  41105. private $rewindable;
  41106. private $rootPath;
  41107. private $subPath;
  41108. private $directorySeparator = '/';
  41109. public function __construct($path, $flags, $ignoreUnreadableDirs = false)
  41110. {
  41111. if ($flags & (self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF)) {
  41112. throw new \RuntimeException('This iterator only support returning current as fileinfo.');
  41113. }
  41114. parent::__construct($path, $flags);
  41115. $this->ignoreUnreadableDirs = $ignoreUnreadableDirs;
  41116. $this->rootPath = (string) $path;
  41117. if ('/' !== DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) {
  41118. $this->directorySeparator = DIRECTORY_SEPARATOR;
  41119. }
  41120. }
  41121. public function current()
  41122. {
  41123. if (null === $subPathname = $this->subPath) {
  41124. $subPathname = $this->subPath = (string) $this->getSubPath();
  41125. }
  41126. if ('' !== $subPathname) {
  41127. $subPathname .= $this->directorySeparator;
  41128. }
  41129. $subPathname .= $this->getFilename();
  41130. return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname);
  41131. }
  41132. public function getChildren()
  41133. {
  41134. try {
  41135. $children = parent::getChildren();
  41136. if ($children instanceof self) {
  41137. $children->ignoreUnreadableDirs = $this->ignoreUnreadableDirs;
  41138. $children->rewindable = &$this->rewindable;
  41139. $children->rootPath = $this->rootPath;
  41140. }
  41141. return $children;
  41142. } catch (\UnexpectedValueException $e) {
  41143. if ($this->ignoreUnreadableDirs) {
  41144. return new \RecursiveArrayIterator(array());
  41145. } else {
  41146. throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
  41147. }
  41148. }
  41149. }
  41150. public function rewind()
  41151. {
  41152. if (false === $this->isRewindable()) {
  41153. return;
  41154. }
  41155. if (\PHP_VERSION_ID < 50523 || \PHP_VERSION_ID >= 50600 && \PHP_VERSION_ID < 50607) {
  41156. parent::next();
  41157. }
  41158. parent::rewind();
  41159. }
  41160. public function isRewindable()
  41161. {
  41162. if (null !== $this->rewindable) {
  41163. return $this->rewindable;
  41164. }
  41165. if ('' === $this->getPath()) {
  41166. return $this->rewindable = false;
  41167. }
  41168. if (false !== $stream = @opendir($this->getPath())) {
  41169. $infos = stream_get_meta_data($stream);
  41170. closedir($stream);
  41171. if ($infos['seekable']) {
  41172. return $this->rewindable = true;
  41173. }
  41174. }
  41175. return $this->rewindable = false;
  41176. }
  41177. }
  41178. <?php
  41179. namespace Symfony\Component\Finder\Iterator;
  41180. use Symfony\Component\Finder\Comparator\NumberComparator;
  41181. class SizeRangeFilterIterator extends FilterIterator
  41182. {
  41183. private $comparators = array();
  41184. public function __construct(\Iterator $iterator, array $comparators)
  41185. {
  41186. $this->comparators = $comparators;
  41187. parent::__construct($iterator);
  41188. }
  41189. public function accept()
  41190. {
  41191. $fileinfo = $this->current();
  41192. if (!$fileinfo->isFile()) {
  41193. return true;
  41194. }
  41195. $filesize = $fileinfo->getSize();
  41196. foreach ($this->comparators as $compare) {
  41197. if (!$compare->test($filesize)) {
  41198. return false;
  41199. }
  41200. }
  41201. return true;
  41202. }
  41203. }
  41204. <?php
  41205. namespace Symfony\Component\Finder\Iterator;
  41206. class SortableIterator implements \IteratorAggregate
  41207. {
  41208. const SORT_BY_NAME = 1;
  41209. const SORT_BY_TYPE = 2;
  41210. const SORT_BY_ACCESSED_TIME = 3;
  41211. const SORT_BY_CHANGED_TIME = 4;
  41212. const SORT_BY_MODIFIED_TIME = 5;
  41213. private $iterator;
  41214. private $sort;
  41215. public function __construct(\Traversable $iterator, $sort)
  41216. {
  41217. $this->iterator = $iterator;
  41218. if (self::SORT_BY_NAME === $sort) {
  41219. $this->sort = function ($a, $b) {
  41220. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  41221. };
  41222. } elseif (self::SORT_BY_TYPE === $sort) {
  41223. $this->sort = function ($a, $b) {
  41224. if ($a->isDir() && $b->isFile()) {
  41225. return -1;
  41226. } elseif ($a->isFile() && $b->isDir()) {
  41227. return 1;
  41228. }
  41229. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  41230. };
  41231. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  41232. $this->sort = function ($a, $b) {
  41233. return $a->getATime() - $b->getATime();
  41234. };
  41235. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  41236. $this->sort = function ($a, $b) {
  41237. return $a->getCTime() - $b->getCTime();
  41238. };
  41239. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  41240. $this->sort = function ($a, $b) {
  41241. return $a->getMTime() - $b->getMTime();
  41242. };
  41243. } elseif (is_callable($sort)) {
  41244. $this->sort = $sort;
  41245. } else {
  41246. throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
  41247. }
  41248. }
  41249. public function getIterator()
  41250. {
  41251. $array = iterator_to_array($this->iterator, true);
  41252. uasort($array, $this->sort);
  41253. return new \ArrayIterator($array);
  41254. }
  41255. }
  41256. Copyright (c) 2004-2018 Fabien Potencier
  41257. Permission is hereby granted, free of charge, to any person obtaining a copy
  41258. of this software and associated documentation files (the "Software"), to deal
  41259. in the Software without restriction, including without limitation the rights
  41260. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  41261. copies of the Software, and to permit persons to whom the Software is furnished
  41262. to do so, subject to the following conditions:
  41263. The above copyright notice and this permission notice shall be included in all
  41264. copies or substantial portions of the Software.
  41265. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  41266. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  41267. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  41268. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  41269. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  41270. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  41271. THE SOFTWARE.
  41272. <?php
  41273. namespace Symfony\Component\Finder\Shell;
  41274. @trigger_error('The '.__NAMESPACE__.'\Command class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41275. class Command
  41276. {
  41277. private $parent;
  41278. private $bits = array();
  41279. private $labels = array();
  41280. private $errorHandler;
  41281. public function __construct(Command $parent = null)
  41282. {
  41283. $this->parent = $parent;
  41284. }
  41285. public function __toString()
  41286. {
  41287. return $this->join();
  41288. }
  41289. public static function create(Command $parent = null)
  41290. {
  41291. return new self($parent);
  41292. }
  41293. public static function escape($input)
  41294. {
  41295. return escapeshellcmd($input);
  41296. }
  41297. public static function quote($input)
  41298. {
  41299. return escapeshellarg($input);
  41300. }
  41301. public function add($bit)
  41302. {
  41303. $this->bits[] = $bit;
  41304. return $this;
  41305. }
  41306. public function top($bit)
  41307. {
  41308. array_unshift($this->bits, $bit);
  41309. foreach ($this->labels as $label => $index) {
  41310. $this->labels[$label] += 1;
  41311. }
  41312. return $this;
  41313. }
  41314. public function arg($arg)
  41315. {
  41316. $this->bits[] = self::quote($arg);
  41317. return $this;
  41318. }
  41319. public function cmd($esc)
  41320. {
  41321. $this->bits[] = self::escape($esc);
  41322. return $this;
  41323. }
  41324. public function ins($label)
  41325. {
  41326. if (isset($this->labels[$label])) {
  41327. throw new \RuntimeException(sprintf('Label "%s" already exists.', $label));
  41328. }
  41329. $this->bits[] = self::create($this);
  41330. $this->labels[$label] = count($this->bits) - 1;
  41331. return $this->bits[$this->labels[$label]];
  41332. }
  41333. public function get($label)
  41334. {
  41335. if (!isset($this->labels[$label])) {
  41336. throw new \RuntimeException(sprintf('Label "%s" does not exist.', $label));
  41337. }
  41338. return $this->bits[$this->labels[$label]];
  41339. }
  41340. public function end()
  41341. {
  41342. if (null === $this->parent) {
  41343. throw new \RuntimeException('Calling end on root command doesn\'t make sense.');
  41344. }
  41345. return $this->parent;
  41346. }
  41347. public function length()
  41348. {
  41349. return count($this->bits);
  41350. }
  41351. public function setErrorHandler(\Closure $errorHandler)
  41352. {
  41353. $this->errorHandler = $errorHandler;
  41354. return $this;
  41355. }
  41356. public function getErrorHandler()
  41357. {
  41358. return $this->errorHandler;
  41359. }
  41360. public function execute()
  41361. {
  41362. if (null === $errorHandler = $this->errorHandler) {
  41363. exec($this->join(), $output);
  41364. } else {
  41365. $process = proc_open($this->join(), array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w')), $pipes);
  41366. $output = preg_split('~(\r\n|\r|\n)~', stream_get_contents($pipes[1]), -1, PREG_SPLIT_NO_EMPTY);
  41367. if ($error = stream_get_contents($pipes[2])) {
  41368. $errorHandler($error);
  41369. }
  41370. proc_close($process);
  41371. }
  41372. return $output ?: array();
  41373. }
  41374. public function join()
  41375. {
  41376. return implode(' ', array_filter(
  41377. array_map(function ($bit) {
  41378. return $bit instanceof Command ? $bit->join() : ($bit ?: null);
  41379. }, $this->bits),
  41380. function ($bit) { return null !== $bit; }
  41381. ));
  41382. }
  41383. public function addAtIndex($bit, $index)
  41384. {
  41385. array_splice($this->bits, $index, 0, $bit instanceof self ? array($bit) : $bit);
  41386. return $this;
  41387. }
  41388. }
  41389. <?php
  41390. namespace Symfony\Component\Finder\Shell;
  41391. @trigger_error('The '.__NAMESPACE__.'\Shell class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41392. class Shell
  41393. {
  41394. const TYPE_UNIX = 1;
  41395. const TYPE_DARWIN = 2;
  41396. const TYPE_CYGWIN = 3;
  41397. const TYPE_WINDOWS = 4;
  41398. const TYPE_BSD = 5;
  41399. private $type;
  41400. public function getType()
  41401. {
  41402. if (null === $this->type) {
  41403. $this->type = $this->guessType();
  41404. }
  41405. return $this->type;
  41406. }
  41407. public function testCommand($command)
  41408. {
  41409. if (!function_exists('exec')) {
  41410. return false;
  41411. }
  41412. $testCommand = 'which ';
  41413. if (self::TYPE_WINDOWS === $this->type) {
  41414. $testCommand = 'where ';
  41415. }
  41416. $command = escapeshellcmd($command);
  41417. exec($testCommand.$command, $output, $code);
  41418. return 0 === $code && count($output) > 0;
  41419. }
  41420. private function guessType()
  41421. {
  41422. $os = strtolower(PHP_OS);
  41423. if (false !== strpos($os, 'cygwin')) {
  41424. return self::TYPE_CYGWIN;
  41425. }
  41426. if (false !== strpos($os, 'darwin')) {
  41427. return self::TYPE_DARWIN;
  41428. }
  41429. if (false !== strpos($os, 'bsd')) {
  41430. return self::TYPE_BSD;
  41431. }
  41432. if (0 === strpos($os, 'win')) {
  41433. return self::TYPE_WINDOWS;
  41434. }
  41435. return self::TYPE_UNIX;
  41436. }
  41437. }
  41438. <?php
  41439. namespace Symfony\Component\Finder;
  41440. class SplFileInfo extends \SplFileInfo
  41441. {
  41442. private $relativePath;
  41443. private $relativePathname;
  41444. public function __construct($file, $relativePath, $relativePathname)
  41445. {
  41446. parent::__construct($file);
  41447. $this->relativePath = $relativePath;
  41448. $this->relativePathname = $relativePathname;
  41449. }
  41450. public function getRelativePath()
  41451. {
  41452. return $this->relativePath;
  41453. }
  41454. public function getRelativePathname()
  41455. {
  41456. return $this->relativePathname;
  41457. }
  41458. public function getContents()
  41459. {
  41460. $level = error_reporting(0);
  41461. $content = file_get_contents($this->getPathname());
  41462. error_reporting($level);
  41463. if (false === $content) {
  41464. $error = error_get_last();
  41465. throw new \RuntimeException($error['message']);
  41466. }
  41467. return $content;
  41468. }
  41469. }
  41470. Copyright (c) 2015-2018 Fabien Potencier
  41471. Permission is hereby granted, free of charge, to any person obtaining a copy
  41472. of this software and associated documentation files (the "Software"), to deal
  41473. in the Software without restriction, including without limitation the rights
  41474. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  41475. copies of the Software, and to permit persons to whom the Software is furnished
  41476. to do so, subject to the following conditions:
  41477. The above copyright notice and this permission notice shall be included in all
  41478. copies or substantial portions of the Software.
  41479. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  41480. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  41481. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  41482. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  41483. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  41484. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  41485. THE SOFTWARE.
  41486. <?php
  41487. namespace Symfony\Polyfill\Mbstring;
  41488. final class Mbstring
  41489. {
  41490. const MB_CASE_FOLD = PHP_INT_MAX;
  41491. private static $encodingList = array('ASCII', 'UTF-8');
  41492. private static $language = 'neutral';
  41493. private static $internalEncoding = 'UTF-8';
  41494. private static $caseFold = array(
  41495. array('µ','ſ',"\xCD\x85",'ς',"\xCF\x90","\xCF\x91","\xCF\x95","\xCF\x96","\xCF\xB0","\xCF\xB1","\xCF\xB5","\xE1\xBA\x9B","\xE1\xBE\xBE"),
  41496. array('μ','s','ι', 'σ','β', 'θ', 'φ', 'π', 'κ', '�', 'ε', "\xE1\xB9\xA1",'ι'),
  41497. );
  41498. public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
  41499. {
  41500. if (is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) {
  41501. $fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
  41502. } else {
  41503. $fromEncoding = self::getEncoding($fromEncoding);
  41504. }
  41505. $toEncoding = self::getEncoding($toEncoding);
  41506. if ('BASE64' === $fromEncoding) {
  41507. $s = base64_decode($s);
  41508. $fromEncoding = $toEncoding;
  41509. }
  41510. if ('BASE64' === $toEncoding) {
  41511. return base64_encode($s);
  41512. }
  41513. if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) {
  41514. if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) {
  41515. $fromEncoding = 'Windows-1252';
  41516. }
  41517. if ('UTF-8' !== $fromEncoding) {
  41518. $s = iconv($fromEncoding, 'UTF-8//IGNORE', $s);
  41519. }
  41520. return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s);
  41521. }
  41522. if ('HTML-ENTITIES' === $fromEncoding) {
  41523. $s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
  41524. $fromEncoding = 'UTF-8';
  41525. }
  41526. return iconv($fromEncoding, $toEncoding.'//IGNORE', $s);
  41527. }
  41528. public static function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null)
  41529. {
  41530. $vars = array(&$a, &$b, &$c, &$d, &$e, &$f);
  41531. $ok = true;
  41532. array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) {
  41533. if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
  41534. $ok = false;
  41535. }
  41536. });
  41537. return $ok ? $fromEncoding : false;
  41538. }
  41539. public static function mb_decode_mimeheader($s)
  41540. {
  41541. return iconv_mime_decode($s, 2, self::$internalEncoding);
  41542. }
  41543. public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
  41544. {
  41545. trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING);
  41546. }
  41547. public static function mb_decode_numericentity($s, $convmap, $encoding = null)
  41548. {
  41549. if (null !== $s && !is_scalar($s) && !(is_object($s) && method_exists($s, '__toString'))) {
  41550. trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.gettype($s).' given', E_USER_WARNING);
  41551. return null;
  41552. }
  41553. if (!is_array($convmap) || !$convmap) {
  41554. return false;
  41555. }
  41556. if (null !== $encoding && !is_scalar($encoding)) {
  41557. trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.gettype($s).' given', E_USER_WARNING);
  41558. return '';
  41559. }
  41560. $s = (string) $s;
  41561. if ('' === $s) {
  41562. return '';
  41563. }
  41564. $encoding = self::getEncoding($encoding);
  41565. if ('UTF-8' === $encoding) {
  41566. $encoding = null;
  41567. if (!preg_match('//u', $s)) {
  41568. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  41569. }
  41570. } else {
  41571. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  41572. }
  41573. $cnt = floor(count($convmap) / 4) * 4;
  41574. for ($i = 0; $i < $cnt; $i += 4) {
  41575. $convmap[$i] += $convmap[$i + 2];
  41576. $convmap[$i + 1] += $convmap[$i + 2];
  41577. }
  41578. $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use ($cnt, $convmap) {
  41579. $c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1];
  41580. for ($i = 0; $i < $cnt; $i += 4) {
  41581. if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) {
  41582. return Mbstring::mb_chr($c - $convmap[$i + 2]);
  41583. }
  41584. }
  41585. return $m[0];
  41586. }, $s);
  41587. if (null === $encoding) {
  41588. return $s;
  41589. }
  41590. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  41591. }
  41592. public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false)
  41593. {
  41594. if (null !== $s && !is_scalar($s) && !(is_object($s) && method_exists($s, '__toString'))) {
  41595. trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.gettype($s).' given', E_USER_WARNING);
  41596. return null;
  41597. }
  41598. if (!is_array($convmap) || !$convmap) {
  41599. return false;
  41600. }
  41601. if (null !== $encoding && !is_scalar($encoding)) {
  41602. trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.gettype($s).' given', E_USER_WARNING);
  41603. return null;
  41604. }
  41605. if (null !== $is_hex && !is_scalar($is_hex)) {
  41606. trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.gettype($s).' given', E_USER_WARNING);
  41607. return null;
  41608. }
  41609. $s = (string) $s;
  41610. if ('' === $s) {
  41611. return '';
  41612. }
  41613. $encoding = self::getEncoding($encoding);
  41614. if ('UTF-8' === $encoding) {
  41615. $encoding = null;
  41616. if (!preg_match('//u', $s)) {
  41617. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  41618. }
  41619. } else {
  41620. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  41621. }
  41622. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  41623. $cnt = floor(count($convmap) / 4) * 4;
  41624. $i = 0;
  41625. $len = strlen($s);
  41626. $result = '';
  41627. while ($i < $len) {
  41628. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  41629. $uchr = substr($s, $i, $ulen);
  41630. $i += $ulen;
  41631. $c = self::mb_ord($uchr);
  41632. for ($j = 0; $j < $cnt; $j += 4) {
  41633. if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) {
  41634. $cOffset = ($c + $convmap[$j + 2]) & $convmap[$j + 3];
  41635. $result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#'.$cOffset.';';
  41636. continue 2;
  41637. }
  41638. }
  41639. $result .= $uchr;
  41640. }
  41641. if (null === $encoding) {
  41642. return $result;
  41643. }
  41644. return iconv('UTF-8', $encoding.'//IGNORE', $result);
  41645. }
  41646. public static function mb_convert_case($s, $mode, $encoding = null)
  41647. {
  41648. $s = (string) $s;
  41649. if ('' === $s) {
  41650. return '';
  41651. }
  41652. $encoding = self::getEncoding($encoding);
  41653. if ('UTF-8' === $encoding) {
  41654. $encoding = null;
  41655. if (!preg_match('//u', $s)) {
  41656. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  41657. }
  41658. } else {
  41659. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  41660. }
  41661. if (MB_CASE_TITLE == $mode) {
  41662. $s = preg_replace_callback('/\b\p{Ll}/u', array(__CLASS__, 'title_case_upper'), $s);
  41663. $s = preg_replace_callback('/\B[\p{Lu}\p{Lt}]+/u', array(__CLASS__, 'title_case_lower'), $s);
  41664. } else {
  41665. if (MB_CASE_UPPER == $mode) {
  41666. static $upper = null;
  41667. if (null === $upper) {
  41668. $upper = self::getData('upperCase');
  41669. }
  41670. $map = $upper;
  41671. } else {
  41672. if (self::MB_CASE_FOLD === $mode) {
  41673. $s = str_replace(self::$caseFold[0], self::$caseFold[1], $s);
  41674. }
  41675. static $lower = null;
  41676. if (null === $lower) {
  41677. $lower = self::getData('lowerCase');
  41678. }
  41679. $map = $lower;
  41680. }
  41681. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  41682. $i = 0;
  41683. $len = strlen($s);
  41684. while ($i < $len) {
  41685. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  41686. $uchr = substr($s, $i, $ulen);
  41687. $i += $ulen;
  41688. if (isset($map[$uchr])) {
  41689. $uchr = $map[$uchr];
  41690. $nlen = strlen($uchr);
  41691. if ($nlen == $ulen) {
  41692. $nlen = $i;
  41693. do {
  41694. $s[--$nlen] = $uchr[--$ulen];
  41695. } while ($ulen);
  41696. } else {
  41697. $s = substr_replace($s, $uchr, $i - $ulen, $ulen);
  41698. $len += $nlen - $ulen;
  41699. $i += $nlen - $ulen;
  41700. }
  41701. }
  41702. }
  41703. }
  41704. if (null === $encoding) {
  41705. return $s;
  41706. }
  41707. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  41708. }
  41709. public static function mb_internal_encoding($encoding = null)
  41710. {
  41711. if (null === $encoding) {
  41712. return self::$internalEncoding;
  41713. }
  41714. $encoding = self::getEncoding($encoding);
  41715. if ('UTF-8' === $encoding || false !== @iconv($encoding, $encoding, ' ')) {
  41716. self::$internalEncoding = $encoding;
  41717. return true;
  41718. }
  41719. return false;
  41720. }
  41721. public static function mb_language($lang = null)
  41722. {
  41723. if (null === $lang) {
  41724. return self::$language;
  41725. }
  41726. switch ($lang = strtolower($lang)) {
  41727. case 'uni':
  41728. case 'neutral':
  41729. self::$language = $lang;
  41730. return true;
  41731. }
  41732. return false;
  41733. }
  41734. public static function mb_list_encodings()
  41735. {
  41736. return array('UTF-8');
  41737. }
  41738. public static function mb_encoding_aliases($encoding)
  41739. {
  41740. switch (strtoupper($encoding)) {
  41741. case 'UTF8':
  41742. case 'UTF-8':
  41743. return array('utf8');
  41744. }
  41745. return false;
  41746. }
  41747. public static function mb_check_encoding($var = null, $encoding = null)
  41748. {
  41749. if (null === $encoding) {
  41750. if (null === $var) {
  41751. return false;
  41752. }
  41753. $encoding = self::$internalEncoding;
  41754. }
  41755. return self::mb_detect_encoding($var, array($encoding)) || false !== @iconv($encoding, $encoding, $var);
  41756. }
  41757. public static function mb_detect_encoding($str, $encodingList = null, $strict = false)
  41758. {
  41759. if (null === $encodingList) {
  41760. $encodingList = self::$encodingList;
  41761. } else {
  41762. if (!is_array($encodingList)) {
  41763. $encodingList = array_map('trim', explode(',', $encodingList));
  41764. }
  41765. $encodingList = array_map('strtoupper', $encodingList);
  41766. }
  41767. foreach ($encodingList as $enc) {
  41768. switch ($enc) {
  41769. case 'ASCII':
  41770. if (!preg_match('/[\x80-\xFF]/', $str)) {
  41771. return $enc;
  41772. }
  41773. break;
  41774. case 'UTF8':
  41775. case 'UTF-8':
  41776. if (preg_match('//u', $str)) {
  41777. return 'UTF-8';
  41778. }
  41779. break;
  41780. default:
  41781. if (0 === strncmp($enc, 'ISO-8859-', 9)) {
  41782. return $enc;
  41783. }
  41784. }
  41785. }
  41786. return false;
  41787. }
  41788. public static function mb_detect_order($encodingList = null)
  41789. {
  41790. if (null === $encodingList) {
  41791. return self::$encodingList;
  41792. }
  41793. if (!is_array($encodingList)) {
  41794. $encodingList = array_map('trim', explode(',', $encodingList));
  41795. }
  41796. $encodingList = array_map('strtoupper', $encodingList);
  41797. foreach ($encodingList as $enc) {
  41798. switch ($enc) {
  41799. default:
  41800. if (strncmp($enc, 'ISO-8859-', 9)) {
  41801. return false;
  41802. }
  41803. case 'ASCII':
  41804. case 'UTF8':
  41805. case 'UTF-8':
  41806. }
  41807. }
  41808. self::$encodingList = $encodingList;
  41809. return true;
  41810. }
  41811. public static function mb_strlen($s, $encoding = null)
  41812. {
  41813. $encoding = self::getEncoding($encoding);
  41814. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  41815. return strlen($s);
  41816. }
  41817. return @iconv_strlen($s, $encoding);
  41818. }
  41819. public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null)
  41820. {
  41821. $encoding = self::getEncoding($encoding);
  41822. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  41823. return strpos($haystack, $needle, $offset);
  41824. }
  41825. $needle = (string) $needle;
  41826. if ('' === $needle) {
  41827. trigger_error(__METHOD__.': Empty delimiter', E_USER_WARNING);
  41828. return false;
  41829. }
  41830. return iconv_strpos($haystack, $needle, $offset, $encoding);
  41831. }
  41832. public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null)
  41833. {
  41834. $encoding = self::getEncoding($encoding);
  41835. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  41836. return strrpos($haystack, $needle, $offset);
  41837. }
  41838. if ($offset != (int) $offset) {
  41839. $offset = 0;
  41840. } elseif ($offset = (int) $offset) {
  41841. if ($offset < 0) {
  41842. $haystack = self::mb_substr($haystack, 0, $offset, $encoding);
  41843. $offset = 0;
  41844. } else {
  41845. $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
  41846. }
  41847. }
  41848. $pos = iconv_strrpos($haystack, $needle, $encoding);
  41849. return false !== $pos ? $offset + $pos : false;
  41850. }
  41851. public static function mb_strtolower($s, $encoding = null)
  41852. {
  41853. return self::mb_convert_case($s, MB_CASE_LOWER, $encoding);
  41854. }
  41855. public static function mb_strtoupper($s, $encoding = null)
  41856. {
  41857. return self::mb_convert_case($s, MB_CASE_UPPER, $encoding);
  41858. }
  41859. public static function mb_substitute_character($c = null)
  41860. {
  41861. if (0 === strcasecmp($c, 'none')) {
  41862. return true;
  41863. }
  41864. return null !== $c ? false : 'none';
  41865. }
  41866. public static function mb_substr($s, $start, $length = null, $encoding = null)
  41867. {
  41868. $encoding = self::getEncoding($encoding);
  41869. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  41870. return substr($s, $start, null === $length ? 2147483647 : $length);
  41871. }
  41872. if ($start < 0) {
  41873. $start = iconv_strlen($s, $encoding) + $start;
  41874. if ($start < 0) {
  41875. $start = 0;
  41876. }
  41877. }
  41878. if (null === $length) {
  41879. $length = 2147483647;
  41880. } elseif ($length < 0) {
  41881. $length = iconv_strlen($s, $encoding) + $length - $start;
  41882. if ($length < 0) {
  41883. return '';
  41884. }
  41885. }
  41886. return (string) iconv_substr($s, $start, $length, $encoding);
  41887. }
  41888. public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null)
  41889. {
  41890. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  41891. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  41892. return self::mb_strpos($haystack, $needle, $offset, $encoding);
  41893. }
  41894. public static function mb_stristr($haystack, $needle, $part = false, $encoding = null)
  41895. {
  41896. $pos = self::mb_stripos($haystack, $needle, 0, $encoding);
  41897. return self::getSubpart($pos, $part, $haystack, $encoding);
  41898. }
  41899. public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null)
  41900. {
  41901. $encoding = self::getEncoding($encoding);
  41902. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  41903. return strrchr($haystack, $needle, $part);
  41904. }
  41905. $needle = self::mb_substr($needle, 0, 1, $encoding);
  41906. $pos = iconv_strrpos($haystack, $needle, $encoding);
  41907. return self::getSubpart($pos, $part, $haystack, $encoding);
  41908. }
  41909. public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null)
  41910. {
  41911. $needle = self::mb_substr($needle, 0, 1, $encoding);
  41912. $pos = self::mb_strripos($haystack, $needle, $encoding);
  41913. return self::getSubpart($pos, $part, $haystack, $encoding);
  41914. }
  41915. public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null)
  41916. {
  41917. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  41918. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  41919. return self::mb_strrpos($haystack, $needle, $offset, $encoding);
  41920. }
  41921. public static function mb_strstr($haystack, $needle, $part = false, $encoding = null)
  41922. {
  41923. $pos = strpos($haystack, $needle);
  41924. if (false === $pos) {
  41925. return false;
  41926. }
  41927. if ($part) {
  41928. return substr($haystack, 0, $pos);
  41929. }
  41930. return substr($haystack, $pos);
  41931. }
  41932. public static function mb_get_info($type = 'all')
  41933. {
  41934. $info = array(
  41935. 'internal_encoding' => self::$internalEncoding,
  41936. 'http_output' => 'pass',
  41937. 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)',
  41938. 'func_overload' => 0,
  41939. 'func_overload_list' => 'no overload',
  41940. 'mail_charset' => 'UTF-8',
  41941. 'mail_header_encoding' => 'BASE64',
  41942. 'mail_body_encoding' => 'BASE64',
  41943. 'illegal_chars' => 0,
  41944. 'encoding_translation' => 'Off',
  41945. 'language' => self::$language,
  41946. 'detect_order' => self::$encodingList,
  41947. 'substitute_character' => 'none',
  41948. 'strict_detection' => 'Off',
  41949. );
  41950. if ('all' === $type) {
  41951. return $info;
  41952. }
  41953. if (isset($info[$type])) {
  41954. return $info[$type];
  41955. }
  41956. return false;
  41957. }
  41958. public static function mb_http_input($type = '')
  41959. {
  41960. return false;
  41961. }
  41962. public static function mb_http_output($encoding = null)
  41963. {
  41964. return null !== $encoding ? 'pass' === $encoding : 'pass';
  41965. }
  41966. public static function mb_strwidth($s, $encoding = null)
  41967. {
  41968. $encoding = self::getEncoding($encoding);
  41969. if ('UTF-8' !== $encoding) {
  41970. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  41971. }
  41972. $s = preg_replace('/[\x{1100}-\x{115F}\x{2329}\x{232A}\x{2E80}-\x{303E}\x{3040}-\x{A4CF}\x{AC00}-\x{D7A3}\x{F900}-\x{FAFF}\x{FE10}-\x{FE19}\x{FE30}-\x{FE6F}\x{FF00}-\x{FF60}\x{FFE0}-\x{FFE6}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}]/u', '', $s, -1, $wide);
  41973. return ($wide << 1) + iconv_strlen($s, 'UTF-8');
  41974. }
  41975. public static function mb_substr_count($haystack, $needle, $encoding = null)
  41976. {
  41977. return substr_count($haystack, $needle);
  41978. }
  41979. public static function mb_output_handler($contents, $status)
  41980. {
  41981. return $contents;
  41982. }
  41983. public static function mb_chr($code, $encoding = null)
  41984. {
  41985. if (0x80 > $code %= 0x200000) {
  41986. $s = chr($code);
  41987. } elseif (0x800 > $code) {
  41988. $s = chr(0xC0 | $code >> 6).chr(0x80 | $code & 0x3F);
  41989. } elseif (0x10000 > $code) {
  41990. $s = chr(0xE0 | $code >> 12).chr(0x80 | $code >> 6 & 0x3F).chr(0x80 | $code & 0x3F);
  41991. } else {
  41992. $s = chr(0xF0 | $code >> 18).chr(0x80 | $code >> 12 & 0x3F).chr(0x80 | $code >> 6 & 0x3F).chr(0x80 | $code & 0x3F);
  41993. }
  41994. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  41995. $s = mb_convert_encoding($s, $encoding, 'UTF-8');
  41996. }
  41997. return $s;
  41998. }
  41999. public static function mb_ord($s, $encoding = null)
  42000. {
  42001. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  42002. $s = mb_convert_encoding($s, 'UTF-8', $encoding);
  42003. }
  42004. $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0;
  42005. if (0xF0 <= $code) {
  42006. return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80;
  42007. }
  42008. if (0xE0 <= $code) {
  42009. return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80;
  42010. }
  42011. if (0xC0 <= $code) {
  42012. return (($code - 0xC0) << 6) + $s[2] - 0x80;
  42013. }
  42014. return $code;
  42015. }
  42016. private static function getSubpart($pos, $part, $haystack, $encoding)
  42017. {
  42018. if (false === $pos) {
  42019. return false;
  42020. }
  42021. if ($part) {
  42022. return self::mb_substr($haystack, 0, $pos, $encoding);
  42023. }
  42024. return self::mb_substr($haystack, $pos, null, $encoding);
  42025. }
  42026. private static function html_encoding_callback(array $m)
  42027. {
  42028. $i = 1;
  42029. $entities = '';
  42030. $m = unpack('C*', htmlentities($m[0], ENT_COMPAT, 'UTF-8'));
  42031. while (isset($m[$i])) {
  42032. if (0x80 > $m[$i]) {
  42033. $entities .= chr($m[$i++]);
  42034. continue;
  42035. }
  42036. if (0xF0 <= $m[$i]) {
  42037. $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  42038. } elseif (0xE0 <= $m[$i]) {
  42039. $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  42040. } else {
  42041. $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
  42042. }
  42043. $entities .= '&#'.$c.';';
  42044. }
  42045. return $entities;
  42046. }
  42047. private static function title_case_lower(array $s)
  42048. {
  42049. return self::mb_convert_case($s[0], MB_CASE_LOWER, 'UTF-8');
  42050. }
  42051. private static function title_case_upper(array $s)
  42052. {
  42053. return self::mb_convert_case($s[0], MB_CASE_UPPER, 'UTF-8');
  42054. }
  42055. private static function getData($file)
  42056. {
  42057. if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
  42058. return require $file;
  42059. }
  42060. return false;
  42061. }
  42062. private static function getEncoding($encoding)
  42063. {
  42064. if (null === $encoding) {
  42065. return self::$internalEncoding;
  42066. }
  42067. $encoding = strtoupper($encoding);
  42068. if ('8BIT' === $encoding || 'BINARY' === $encoding) {
  42069. return 'CP850';
  42070. }
  42071. if ('UTF8' === $encoding) {
  42072. return 'UTF-8';
  42073. }
  42074. return $encoding;
  42075. }
  42076. }
  42077. <?php
  42078. static $data = array (
  42079. 'A' => 'a',
  42080. 'B' => 'b',
  42081. 'C' => 'c',
  42082. 'D' => 'd',
  42083. 'E' => 'e',
  42084. 'F' => 'f',
  42085. 'G' => 'g',
  42086. 'H' => 'h',
  42087. 'I' => 'i',
  42088. 'J' => 'j',
  42089. 'K' => 'k',
  42090. 'L' => 'l',
  42091. 'M' => 'm',
  42092. 'N' => 'n',
  42093. 'O' => 'o',
  42094. 'P' => 'p',
  42095. 'Q' => 'q',
  42096. 'R' => 'r',
  42097. 'S' => 's',
  42098. 'T' => 't',
  42099. 'U' => 'u',
  42100. 'V' => 'v',
  42101. 'W' => 'w',
  42102. 'X' => 'x',
  42103. 'Y' => 'y',
  42104. 'Z' => 'z',
  42105. 'À' => 'à',
  42106. '�' => 'á',
  42107. 'Â' => 'â',
  42108. 'Ã' => 'ã',
  42109. 'Ä' => 'ä',
  42110. 'Ã…' => 'Ã¥',
  42111. 'Æ' => 'æ',
  42112. 'Ç' => 'ç',
  42113. 'È' => 'è',
  42114. 'É' => 'é',
  42115. 'Ê' => 'ê',
  42116. 'Ë' => 'ë',
  42117. 'Ì' => 'ì',
  42118. '�' => 'í',
  42119. 'Î' => 'î',
  42120. '�' => 'ï',
  42121. '�' => 'ð',
  42122. 'Ñ' => 'ñ',
  42123. 'Ò' => 'ò',
  42124. 'Ó' => 'ó',
  42125. 'Ô' => 'ô',
  42126. 'Õ' => 'õ',
  42127. 'Ö' => 'ö',
  42128. 'Ø' => 'ø',
  42129. 'Ù' => 'ù',
  42130. 'Ú' => 'ú',
  42131. 'Û' => 'û',
  42132. 'Ü' => 'ü',
  42133. '�' => 'ý',
  42134. 'Þ' => 'þ',
  42135. 'Ā' => '�',
  42136. 'Ă' => 'ă',
  42137. 'Ä„' => 'Ä…',
  42138. 'Ć' => 'ć',
  42139. 'Ĉ' => 'ĉ',
  42140. 'ÄŠ' => 'Ä‹',
  42141. 'Č' => '�',
  42142. 'Ď' => '�',
  42143. '�' => 'đ',
  42144. 'Ä’' => 'Ä“',
  42145. 'Ä”' => 'Ä•',
  42146. 'Ä–' => 'Ä—',
  42147. 'Ę' => 'ę',
  42148. 'Äš' => 'Ä›',
  42149. 'Ĝ' => '�',
  42150. 'Äž' => 'ÄŸ',
  42151. 'Ä ' => 'Ä¡',
  42152. 'Ä¢' => 'Ä£',
  42153. 'Ĥ' => 'ĥ',
  42154. 'Ħ' => 'ħ',
  42155. 'Ĩ' => 'ĩ',
  42156. 'Ī' => 'ī',
  42157. 'Ĭ' => 'ĭ',
  42158. 'Į' => 'į',
  42159. 'Ä°' => 'i',
  42160. 'IJ' => 'ij',
  42161. 'Ĵ' => 'ĵ',
  42162. 'Ķ' => 'ķ',
  42163. 'Ĺ' => 'ĺ',
  42164. 'Ļ' => 'ļ',
  42165. 'Ľ' => 'ľ',
  42166. 'Ä¿' => 'Å€',
  42167. '�' => 'ł',
  42168. 'Ń' => 'ń',
  42169. 'Ņ' => 'ņ',
  42170. 'Ň' => 'ň',
  42171. 'ÅŠ' => 'Å‹',
  42172. 'Ō' => '�',
  42173. 'Ŏ' => '�',
  42174. '�' => 'ő',
  42175. 'Å’' => 'Å“',
  42176. 'Å”' => 'Å•',
  42177. 'Å–' => 'Å—',
  42178. 'Ř' => 'ř',
  42179. 'Åš' => 'Å›',
  42180. 'Ŝ' => '�',
  42181. 'Åž' => 'ÅŸ',
  42182. 'Å ' => 'Å¡',
  42183. 'Å¢' => 'Å£',
  42184. 'Ť' => 'ť',
  42185. 'Ŧ' => 'ŧ',
  42186. 'Ũ' => 'ũ',
  42187. 'Ū' => 'ū',
  42188. 'Ŭ' => 'ŭ',
  42189. 'Ů' => 'ů',
  42190. 'Ű' => 'ű',
  42191. 'Ų' => 'ų',
  42192. 'Ŵ' => 'ŵ',
  42193. 'Ŷ' => 'ŷ',
  42194. 'Ÿ' => 'ÿ',
  42195. 'Ź' => 'ź',
  42196. 'Ż' => 'ż',
  42197. 'Ž' => 'ž',
  42198. '�' => 'ɓ',
  42199. 'Ƃ' => 'ƃ',
  42200. 'Æ„' => 'Æ…',
  42201. 'Ɔ' => 'ɔ',
  42202. 'Ƈ' => 'ƈ',
  42203. 'Ɖ' => 'ɖ',
  42204. 'ÆŠ' => 'É—',
  42205. 'Ƌ' => 'ƌ',
  42206. 'Ǝ' => '�',
  42207. '�' => 'ə',
  42208. '�' => 'ɛ',
  42209. 'Æ‘' => 'Æ’',
  42210. 'Æ“' => 'É ',
  42211. 'Æ”' => 'É£',
  42212. 'Æ–' => 'É©',
  42213. 'Ɨ' => 'ɨ',
  42214. 'Ƙ' => 'ƙ',
  42215. 'Ɯ' => 'ɯ',
  42216. '�' => 'ɲ',
  42217. 'Ɵ' => 'ɵ',
  42218. 'Æ ' => 'Æ¡',
  42219. 'Æ¢' => 'Æ£',
  42220. 'Ƥ' => 'ƥ',
  42221. 'Ʀ' => 'ʀ',
  42222. 'Ƨ' => 'ƨ',
  42223. 'Ʃ' => 'ʃ',
  42224. 'Ƭ' => 'ƭ',
  42225. 'Ʈ' => 'ʈ',
  42226. 'Ư' => 'ư',
  42227. 'Ʊ' => 'ʊ',
  42228. 'Ʋ' => 'ʋ',
  42229. 'Ƴ' => 'ƴ',
  42230. 'Ƶ' => 'ƶ',
  42231. 'Æ·' => 'Ê’',
  42232. 'Ƹ' => 'ƹ',
  42233. 'Ƽ' => 'ƽ',
  42234. 'DŽ' => 'dž',
  42235. 'Dž' => 'dž',
  42236. 'LJ' => 'lj',
  42237. 'Lj' => 'lj',
  42238. 'NJ' => 'nj',
  42239. 'Nj' => 'nj',
  42240. '�' => 'ǎ',
  42241. '�' => '�',
  42242. 'Ç‘' => 'Ç’',
  42243. 'Ç“' => 'Ç”',
  42244. 'Ç•' => 'Ç–',
  42245. 'Ǘ' => 'ǘ',
  42246. 'Ç™' => 'Çš',
  42247. 'Ǜ' => 'ǜ',
  42248. 'Çž' => 'ÇŸ',
  42249. 'Ç ' => 'Ç¡',
  42250. 'Ç¢' => 'Ç£',
  42251. 'Ǥ' => 'ǥ',
  42252. 'Ǧ' => 'ǧ',
  42253. 'Ǩ' => 'ǩ',
  42254. 'Ǫ' => 'ǫ',
  42255. 'Ǭ' => 'ǭ',
  42256. 'Ǯ' => 'ǯ',
  42257. 'DZ' => 'dz',
  42258. 'Dz' => 'dz',
  42259. 'Ǵ' => 'ǵ',
  42260. 'Ƕ' => 'ƕ',
  42261. 'Ç·' => 'Æ¿',
  42262. 'Ǹ' => 'ǹ',
  42263. 'Ǻ' => 'ǻ',
  42264. 'Ǽ' => 'ǽ',
  42265. 'Ǿ' => 'ǿ',
  42266. 'Ȁ' => '�',
  42267. 'Ȃ' => 'ȃ',
  42268. 'È„' => 'È…',
  42269. 'Ȇ' => 'ȇ',
  42270. 'Ȉ' => 'ȉ',
  42271. 'ÈŠ' => 'È‹',
  42272. 'Ȍ' => '�',
  42273. 'Ȏ' => '�',
  42274. '�' => 'ȑ',
  42275. 'È’' => 'È“',
  42276. 'È”' => 'È•',
  42277. 'È–' => 'È—',
  42278. 'Ș' => 'ș',
  42279. 'Èš' => 'È›',
  42280. 'Ȝ' => '�',
  42281. 'Èž' => 'ÈŸ',
  42282. 'È ' => 'Æž',
  42283. 'È¢' => 'È£',
  42284. 'Ȥ' => 'ȥ',
  42285. 'Ȧ' => 'ȧ',
  42286. 'Ȩ' => 'ȩ',
  42287. 'Ȫ' => 'ȫ',
  42288. 'Ȭ' => 'ȭ',
  42289. 'Ȯ' => 'ȯ',
  42290. 'Ȱ' => 'ȱ',
  42291. 'Ȳ' => 'ȳ',
  42292. 'Ⱥ' => 'ⱥ',
  42293. 'Ȼ' => 'ȼ',
  42294. 'Ƚ' => 'ƚ',
  42295. 'Ⱦ' => 'ⱦ',
  42296. '�' => 'ɂ',
  42297. 'Ƀ' => 'ƀ',
  42298. 'Ʉ' => 'ʉ',
  42299. 'Ʌ' => 'ʌ',
  42300. 'Ɇ' => 'ɇ',
  42301. 'Ɉ' => 'ɉ',
  42302. 'ÉŠ' => 'É‹',
  42303. 'Ɍ' => '�',
  42304. 'Ɏ' => '�',
  42305. 'Ͱ' => 'ͱ',
  42306. 'Ͳ' => 'ͳ',
  42307. 'Ͷ' => 'ͷ',
  42308. 'Ϳ' => 'ϳ',
  42309. 'Ά' => 'ά',
  42310. 'Έ' => 'έ',
  42311. 'Ή' => 'ή',
  42312. 'Ί' => 'ί',
  42313. 'Ό' => 'ό',
  42314. 'Ύ' => '�',
  42315. '�' => 'ώ',
  42316. 'Α' => 'α',
  42317. 'Β' => 'β',
  42318. 'Γ' => 'γ',
  42319. 'Δ' => 'δ',
  42320. 'Ε' => 'ε',
  42321. 'Ζ' => 'ζ',
  42322. 'Η' => 'η',
  42323. 'Θ' => 'θ',
  42324. 'Ι' => 'ι',
  42325. 'Κ' => 'κ',
  42326. 'Λ' => 'λ',
  42327. 'Μ' => 'μ',
  42328. '�' => 'ν',
  42329. 'Ξ' => 'ξ',
  42330. 'Ο' => 'ο',
  42331. 'Π' => 'π',
  42332. 'Ρ' => '�',
  42333. 'Σ' => 'σ',
  42334. 'Τ' => 'τ',
  42335. 'Î¥' => 'Ï…',
  42336. 'Φ' => 'φ',
  42337. 'Χ' => 'χ',
  42338. 'Ψ' => 'ψ',
  42339. 'Ω' => 'ω',
  42340. 'Ϊ' => 'ϊ',
  42341. 'Ϋ' => 'ϋ',
  42342. '�' => 'ϗ',
  42343. 'Ϙ' => 'ϙ',
  42344. 'Ïš' => 'Ï›',
  42345. 'Ϝ' => '�',
  42346. 'Ïž' => 'ÏŸ',
  42347. 'Ï ' => 'Ï¡',
  42348. 'Ï¢' => 'Ï£',
  42349. 'Ϥ' => 'ϥ',
  42350. 'Ϧ' => 'ϧ',
  42351. 'Ϩ' => 'ϩ',
  42352. 'Ϫ' => 'ϫ',
  42353. 'Ϭ' => 'ϭ',
  42354. 'Ϯ' => 'ϯ',
  42355. 'ϴ' => 'θ',
  42356. 'Ϸ' => 'ϸ',
  42357. 'Ϲ' => 'ϲ',
  42358. 'Ϻ' => 'ϻ',
  42359. 'Ͻ' => 'ͻ',
  42360. 'Ͼ' => 'ͼ',
  42361. 'Ͽ' => 'ͽ',
  42362. 'Ѐ' => '�',
  42363. '�' => 'ё',
  42364. 'Ђ' => 'ђ',
  42365. 'Ѓ' => 'ѓ',
  42366. 'Є' => 'є',
  42367. 'Ð…' => 'Ñ•',
  42368. 'І' => 'і',
  42369. 'Ї' => 'ї',
  42370. 'Ј' => 'ј',
  42371. 'Љ' => 'љ',
  42372. 'Њ' => 'њ',
  42373. 'Ћ' => 'ћ',
  42374. 'Ќ' => 'ќ',
  42375. '�' => '�',
  42376. 'ÐŽ' => 'Ñž',
  42377. '�' => 'џ',
  42378. '�' => 'а',
  42379. 'Б' => 'б',
  42380. 'В' => 'в',
  42381. 'Г' => 'г',
  42382. 'Д' => 'д',
  42383. 'Е' => 'е',
  42384. 'Ж' => 'ж',
  42385. 'З' => 'з',
  42386. 'И' => 'и',
  42387. 'Й' => 'й',
  42388. 'К' => 'к',
  42389. 'Л' => 'л',
  42390. 'М' => 'м',
  42391. '�' => 'н',
  42392. 'О' => 'о',
  42393. 'П' => 'п',
  42394. 'Р' => 'р',
  42395. 'С' => '�',
  42396. 'Т' => 'т',
  42397. 'У' => 'у',
  42398. 'Ф' => 'ф',
  42399. 'Ð¥' => 'Ñ…',
  42400. 'Ц' => 'ц',
  42401. 'Ч' => 'ч',
  42402. 'Ш' => 'ш',
  42403. 'Щ' => 'щ',
  42404. 'Ъ' => 'ъ',
  42405. 'Ы' => 'ы',
  42406. 'Ь' => 'ь',
  42407. 'Э' => '�',
  42408. 'Ю' => 'ю',
  42409. 'Я' => '�',
  42410. 'Ñ ' => 'Ñ¡',
  42411. 'Ñ¢' => 'Ñ£',
  42412. 'Ѥ' => 'ѥ',
  42413. 'Ѧ' => 'ѧ',
  42414. 'Ѩ' => 'ѩ',
  42415. 'Ѫ' => 'ѫ',
  42416. 'Ѭ' => 'ѭ',
  42417. 'Ѯ' => 'ѯ',
  42418. 'Ѱ' => 'ѱ',
  42419. 'Ѳ' => 'ѳ',
  42420. 'Ѵ' => 'ѵ',
  42421. 'Ѷ' => 'ѷ',
  42422. 'Ѹ' => 'ѹ',
  42423. 'Ѻ' => 'ѻ',
  42424. 'Ѽ' => 'ѽ',
  42425. 'Ѿ' => 'ѿ',
  42426. 'Ò€' => 'Ò�',
  42427. 'ÒŠ' => 'Ò‹',
  42428. 'Ҍ' => '�',
  42429. 'ÒŽ' => 'Ò�',
  42430. 'Ò�' => 'Ò‘',
  42431. 'Ò’' => 'Ò“',
  42432. 'Ò”' => 'Ò•',
  42433. 'Ò–' => 'Ò—',
  42434. 'Ò˜' => 'Ò™',
  42435. 'Òš' => 'Ò›',
  42436. 'Ҝ' => '�',
  42437. 'Òž' => 'ÒŸ',
  42438. 'Ò ' => 'Ò¡',
  42439. 'Ò¢' => 'Ò£',
  42440. 'Ò¤' => 'Ò¥',
  42441. 'Ò¦' => 'Ò§',
  42442. 'Ò¨' => 'Ò©',
  42443. 'Òª' => 'Ò«',
  42444. 'Ò¬' => 'Ò­',
  42445. 'Ò®' => 'Ò¯',
  42446. 'Ò°' => 'Ò±',
  42447. 'Ò²' => 'Ò³',
  42448. 'Ò´' => 'Òµ',
  42449. 'Ò¶' => 'Ò·',
  42450. 'Ò¸' => 'Ò¹',
  42451. 'Òº' => 'Ò»',
  42452. 'Ò¼' => 'Ò½',
  42453. 'Ò¾' => 'Ò¿',
  42454. 'Ó€' => 'Ó�',
  42455. 'Ó�' => 'Ó‚',
  42456. 'Óƒ' => 'Ó„',
  42457. 'Ó…' => 'Ó†',
  42458. 'Ó‡' => 'Óˆ',
  42459. 'Ó‰' => 'ÓŠ',
  42460. 'Ӌ' => 'ӌ',
  42461. 'Ó�' => 'ÓŽ',
  42462. 'Ó�' => 'Ó‘',
  42463. 'Ó’' => 'Ó“',
  42464. 'Ó”' => 'Ó•',
  42465. 'Ó–' => 'Ó—',
  42466. 'Ó˜' => 'Ó™',
  42467. 'Óš' => 'Ó›',
  42468. 'Ӝ' => '�',
  42469. 'Óž' => 'ÓŸ',
  42470. 'Ó ' => 'Ó¡',
  42471. 'Ó¢' => 'Ó£',
  42472. 'Ó¤' => 'Ó¥',
  42473. 'Ó¦' => 'Ó§',
  42474. 'Ó¨' => 'Ó©',
  42475. 'Óª' => 'Ó«',
  42476. 'Ó¬' => 'Ó­',
  42477. 'Ó®' => 'Ó¯',
  42478. 'Ó°' => 'Ó±',
  42479. 'Ó²' => 'Ó³',
  42480. 'Ó´' => 'Óµ',
  42481. 'Ó¶' => 'Ó·',
  42482. 'Ó¸' => 'Ó¹',
  42483. 'Óº' => 'Ó»',
  42484. 'Ó¼' => 'Ó½',
  42485. 'Ó¾' => 'Ó¿',
  42486. 'Ô€' => 'Ô�',
  42487. 'Ô‚' => 'Ôƒ',
  42488. 'Ô„' => 'Ô…',
  42489. 'Ô†' => 'Ô‡',
  42490. 'Ôˆ' => 'Ô‰',
  42491. 'ÔŠ' => 'Ô‹',
  42492. 'Ԍ' => '�',
  42493. 'ÔŽ' => 'Ô�',
  42494. 'Ô�' => 'Ô‘',
  42495. 'Ô’' => 'Ô“',
  42496. 'Ô”' => 'Ô•',
  42497. 'Ô–' => 'Ô—',
  42498. 'Ô˜' => 'Ô™',
  42499. 'Ôš' => 'Ô›',
  42500. 'Ԝ' => '�',
  42501. 'Ôž' => 'ÔŸ',
  42502. 'Ô ' => 'Ô¡',
  42503. 'Ô¢' => 'Ô£',
  42504. 'Ô¤' => 'Ô¥',
  42505. 'Ô¦' => 'Ô§',
  42506. 'Ô¨' => 'Ô©',
  42507. 'Ôª' => 'Ô«',
  42508. 'Ô¬' => 'Ô­',
  42509. 'Ô®' => 'Ô¯',
  42510. 'Ô±' => 'Õ¡',
  42511. 'Ô²' => 'Õ¢',
  42512. 'Ô³' => 'Õ£',
  42513. 'Ô´' => 'Õ¤',
  42514. 'Ôµ' => 'Õ¥',
  42515. 'Ô¶' => 'Õ¦',
  42516. 'Ô·' => 'Õ§',
  42517. 'Ô¸' => 'Õ¨',
  42518. 'Ô¹' => 'Õ©',
  42519. 'Ôº' => 'Õª',
  42520. 'Ô»' => 'Õ«',
  42521. 'Ô¼' => 'Õ¬',
  42522. 'Ô½' => 'Õ­',
  42523. 'Ô¾' => 'Õ®',
  42524. 'Ô¿' => 'Õ¯',
  42525. 'Õ€' => 'Õ°',
  42526. 'Õ�' => 'Õ±',
  42527. 'Õ‚' => 'Õ²',
  42528. 'Õƒ' => 'Õ³',
  42529. 'Õ„' => 'Õ´',
  42530. 'Õ…' => 'Õµ',
  42531. 'Õ†' => 'Õ¶',
  42532. 'Õ‡' => 'Õ·',
  42533. 'Õˆ' => 'Õ¸',
  42534. 'Õ‰' => 'Õ¹',
  42535. 'ÕŠ' => 'Õº',
  42536. 'Õ‹' => 'Õ»',
  42537. 'Ռ' => 'ռ',
  42538. 'Õ�' => 'Õ½',
  42539. 'ÕŽ' => 'Õ¾',
  42540. 'Õ�' => 'Õ¿',
  42541. 'Õ�' => 'Ö€',
  42542. 'Õ‘' => 'Ö�',
  42543. 'Õ’' => 'Ö‚',
  42544. 'Õ“' => 'Öƒ',
  42545. 'Õ”' => 'Ö„',
  42546. 'Õ•' => 'Ö…',
  42547. 'Õ–' => 'Ö†',
  42548. 'á‚ ' => 'â´€',
  42549. 'á‚¡' => 'â´�',
  42550. 'á‚¢' => 'â´‚',
  42551. 'á‚£' => 'â´ƒ',
  42552. 'Ⴄ' => 'ⴄ',
  42553. 'á‚¥' => 'â´…',
  42554. 'Ⴆ' => 'ⴆ',
  42555. 'Ⴇ' => 'ⴇ',
  42556. 'Ⴈ' => 'ⴈ',
  42557. 'á‚©' => 'â´‰',
  42558. 'Ⴊ' => 'ⴊ',
  42559. 'á‚«' => 'â´‹',
  42560. 'Ⴌ' => 'ⴌ',
  42561. 'á‚­' => 'â´�',
  42562. 'á‚®' => 'â´Ž',
  42563. 'Ⴏ' => '�',
  42564. 'á‚°' => 'â´�',
  42565. 'Ⴑ' => 'ⴑ',
  42566. 'Ⴒ' => 'ⴒ',
  42567. 'Ⴓ' => 'ⴓ',
  42568. 'á‚´' => 'â´”',
  42569. 'Ⴕ' => 'ⴕ',
  42570. 'Ⴖ' => 'ⴖ',
  42571. 'á‚·' => 'â´—',
  42572. 'Ⴘ' => 'ⴘ',
  42573. 'Ⴙ' => 'ⴙ',
  42574. 'Ⴚ' => 'ⴚ',
  42575. 'á‚»' => 'â´›',
  42576. 'Ⴜ' => 'ⴜ',
  42577. 'Ⴝ' => '�',
  42578. 'Ⴞ' => 'ⴞ',
  42579. 'á‚¿' => 'â´Ÿ',
  42580. 'Ⴠ' => 'ⴠ',
  42581. '�' => 'ⴡ',
  42582. 'Ⴢ' => 'ⴢ',
  42583. 'Ⴣ' => 'ⴣ',
  42584. 'Ⴤ' => 'ⴤ',
  42585. 'Ⴥ' => 'ⴥ',
  42586. 'Ⴧ' => 'ⴧ',
  42587. '�' => 'ⴭ',
  42588. 'Ḁ' => '�',
  42589. 'Ḃ' => 'ḃ',
  42590. 'Ḅ' => 'ḅ',
  42591. 'Ḇ' => 'ḇ',
  42592. 'Ḉ' => 'ḉ',
  42593. 'Ḋ' => 'ḋ',
  42594. 'Ḍ' => '�',
  42595. 'Ḏ' => '�',
  42596. '�' => 'ḑ',
  42597. 'Ḓ' => 'ḓ',
  42598. 'Ḕ' => 'ḕ',
  42599. 'Ḗ' => 'ḗ',
  42600. 'Ḙ' => 'ḙ',
  42601. 'Ḛ' => 'ḛ',
  42602. 'Ḝ' => '�',
  42603. 'Ḟ' => 'ḟ',
  42604. 'Ḡ' => 'ḡ',
  42605. 'Ḣ' => 'ḣ',
  42606. 'Ḥ' => 'ḥ',
  42607. 'Ḧ' => 'ḧ',
  42608. 'Ḩ' => 'ḩ',
  42609. 'Ḫ' => 'ḫ',
  42610. 'Ḭ' => 'ḭ',
  42611. 'Ḯ' => 'ḯ',
  42612. 'Ḱ' => 'ḱ',
  42613. 'Ḳ' => 'ḳ',
  42614. 'Ḵ' => 'ḵ',
  42615. 'Ḷ' => 'ḷ',
  42616. 'Ḹ' => 'ḹ',
  42617. 'Ḻ' => 'ḻ',
  42618. 'Ḽ' => 'ḽ',
  42619. 'Ḿ' => 'ḿ',
  42620. 'Ṁ' => '�',
  42621. 'Ṃ' => 'ṃ',
  42622. 'Ṅ' => 'ṅ',
  42623. 'Ṇ' => 'ṇ',
  42624. 'Ṉ' => 'ṉ',
  42625. 'Ṋ' => 'ṋ',
  42626. 'Ṍ' => '�',
  42627. 'Ṏ' => '�',
  42628. '�' => 'ṑ',
  42629. 'Ṓ' => 'ṓ',
  42630. 'Ṕ' => 'ṕ',
  42631. 'á¹–' => 'á¹—',
  42632. 'Ṙ' => 'ṙ',
  42633. 'Ṛ' => 'ṛ',
  42634. 'Ṝ' => '�',
  42635. 'Ṟ' => 'ṟ',
  42636. 'Ṡ' => 'ṡ',
  42637. 'á¹¢' => 'á¹£',
  42638. 'Ṥ' => 'ṥ',
  42639. 'Ṧ' => 'ṧ',
  42640. 'Ṩ' => 'ṩ',
  42641. 'Ṫ' => 'ṫ',
  42642. 'Ṭ' => 'ṭ',
  42643. 'Ṯ' => 'ṯ',
  42644. 'á¹°' => 'á¹±',
  42645. 'á¹²' => 'á¹³',
  42646. 'á¹´' => 'á¹µ',
  42647. 'Ṷ' => 'ṷ',
  42648. 'Ṹ' => 'ṹ',
  42649. 'Ṻ' => 'ṻ',
  42650. 'á¹¼' => 'á¹½',
  42651. 'Ṿ' => 'ṿ',
  42652. 'Ẁ' => '�',
  42653. 'Ẃ' => 'ẃ',
  42654. 'Ẅ' => 'ẅ',
  42655. 'Ẇ' => 'ẇ',
  42656. 'Ẉ' => 'ẉ',
  42657. 'Ẋ' => 'ẋ',
  42658. 'Ẍ' => '�',
  42659. 'Ẏ' => '�',
  42660. '�' => 'ẑ',
  42661. 'Ẓ' => 'ẓ',
  42662. 'Ẕ' => 'ẕ',
  42663. 'ẞ' => 'ß',
  42664. 'Ạ' => 'ạ',
  42665. 'Ả' => 'ả',
  42666. 'Ấ' => 'ấ',
  42667. 'Ầ' => 'ầ',
  42668. 'Ẩ' => 'ẩ',
  42669. 'Ẫ' => 'ẫ',
  42670. 'Ậ' => 'ậ',
  42671. 'Ắ' => 'ắ',
  42672. 'Ằ' => 'ằ',
  42673. 'Ẳ' => 'ẳ',
  42674. 'Ẵ' => 'ẵ',
  42675. 'Ặ' => 'ặ',
  42676. 'Ẹ' => 'ẹ',
  42677. 'Ẻ' => 'ẻ',
  42678. 'Ẽ' => 'ẽ',
  42679. 'Ế' => 'ế',
  42680. 'Ề' => '�',
  42681. 'Ể' => 'ể',
  42682. 'Ễ' => 'ễ',
  42683. 'Ệ' => 'ệ',
  42684. 'Ỉ' => 'ỉ',
  42685. 'Ị' => 'ị',
  42686. 'Ọ' => '�',
  42687. 'Ỏ' => '�',
  42688. '�' => 'ố',
  42689. 'Ồ' => 'ồ',
  42690. 'Ổ' => 'ổ',
  42691. 'á»–' => 'á»—',
  42692. 'Ộ' => 'ộ',
  42693. 'Ớ' => 'ớ',
  42694. 'Ờ' => '�',
  42695. 'Ở' => 'ở',
  42696. 'Ỡ' => 'ỡ',
  42697. 'Ợ' => 'ợ',
  42698. 'Ụ' => 'ụ',
  42699. 'Ủ' => 'ủ',
  42700. 'Ứ' => 'ứ',
  42701. 'Ừ' => 'ừ',
  42702. 'Ử' => 'ử',
  42703. 'Ữ' => 'ữ',
  42704. 'á»°' => 'á»±',
  42705. 'Ỳ' => 'ỳ',
  42706. 'Ỵ' => 'ỵ',
  42707. 'Ỷ' => 'ỷ',
  42708. 'Ỹ' => 'ỹ',
  42709. 'Ỻ' => 'ỻ',
  42710. 'Ỽ' => 'ỽ',
  42711. 'Ỿ' => 'ỿ',
  42712. 'Ἀ' => 'ἀ',
  42713. 'Ἁ' => '�',
  42714. 'Ἂ' => 'ἂ',
  42715. 'Ἃ' => 'ἃ',
  42716. 'Ἄ' => 'ἄ',
  42717. '�' => 'ἅ',
  42718. 'Ἆ' => 'ἆ',
  42719. '�' => 'ἇ',
  42720. 'Ἐ' => '�',
  42721. 'Ἑ' => 'ἑ',
  42722. 'Ἒ' => 'ἒ',
  42723. 'Ἓ' => 'ἓ',
  42724. 'Ἔ' => 'ἔ',
  42725. '�' => 'ἕ',
  42726. 'Ἠ' => 'ἠ',
  42727. 'Ἡ' => 'ἡ',
  42728. 'Ἢ' => 'ἢ',
  42729. 'Ἣ' => 'ἣ',
  42730. 'Ἤ' => 'ἤ',
  42731. 'á¼­' => 'á¼¥',
  42732. 'Ἦ' => 'ἦ',
  42733. 'Ἧ' => 'ἧ',
  42734. 'Ἰ' => 'ἰ',
  42735. 'á¼¹' => 'á¼±',
  42736. 'Ἲ' => 'ἲ',
  42737. 'á¼»' => 'á¼³',
  42738. 'á¼¼' => 'á¼´',
  42739. 'á¼½' => 'á¼µ',
  42740. 'Ἶ' => 'ἶ',
  42741. 'Ἷ' => 'ἷ',
  42742. 'Ὀ' => 'ὀ',
  42743. 'Ὁ' => '�',
  42744. 'Ὂ' => 'ὂ',
  42745. 'Ὃ' => 'ὃ',
  42746. 'Ὄ' => 'ὄ',
  42747. '�' => 'ὅ',
  42748. 'Ὑ' => 'ὑ',
  42749. 'Ὓ' => 'ὓ',
  42750. '�' => 'ὕ',
  42751. 'Ὗ' => 'ὗ',
  42752. 'Ὠ' => 'ὠ',
  42753. 'Ὡ' => 'ὡ',
  42754. 'Ὢ' => 'ὢ',
  42755. 'Ὣ' => 'ὣ',
  42756. 'Ὤ' => 'ὤ',
  42757. 'á½­' => 'á½¥',
  42758. 'Ὦ' => 'ὦ',
  42759. 'Ὧ' => 'ὧ',
  42760. 'ᾈ' => 'ᾀ',
  42761. 'ᾉ' => '�',
  42762. 'ᾊ' => 'ᾂ',
  42763. 'ᾋ' => 'ᾃ',
  42764. 'ᾌ' => 'ᾄ',
  42765. '�' => 'ᾅ',
  42766. 'ᾎ' => 'ᾆ',
  42767. '�' => 'ᾇ',
  42768. 'ᾘ' => '�',
  42769. 'ᾙ' => 'ᾑ',
  42770. 'ᾚ' => 'ᾒ',
  42771. 'ᾛ' => 'ᾓ',
  42772. 'ᾜ' => 'ᾔ',
  42773. '�' => 'ᾕ',
  42774. 'ᾞ' => 'ᾖ',
  42775. 'ᾟ' => 'ᾗ',
  42776. 'ᾨ' => 'ᾠ',
  42777. 'ᾩ' => 'ᾡ',
  42778. 'ᾪ' => 'ᾢ',
  42779. 'ᾫ' => 'ᾣ',
  42780. 'ᾬ' => 'ᾤ',
  42781. 'á¾­' => 'á¾¥',
  42782. 'ᾮ' => 'ᾦ',
  42783. 'ᾯ' => 'ᾧ',
  42784. 'Ᾰ' => 'ᾰ',
  42785. 'á¾¹' => 'á¾±',
  42786. 'Ὰ' => 'ὰ',
  42787. 'á¾»' => 'á½±',
  42788. 'á¾¼' => 'á¾³',
  42789. 'Ὲ' => 'ὲ',
  42790. 'Έ' => 'έ',
  42791. 'á¿Š' => 'á½´',
  42792. 'á¿‹' => 'á½µ',
  42793. 'ῌ' => 'ῃ',
  42794. 'Ῐ' => '�',
  42795. 'á¿™' => 'á¿‘',
  42796. 'Ὶ' => 'ὶ',
  42797. 'á¿›' => 'á½·',
  42798. 'Ῠ' => 'ῠ',
  42799. 'á¿©' => 'á¿¡',
  42800. 'Ὺ' => 'ὺ',
  42801. 'á¿«' => 'á½»',
  42802. 'Ῥ' => 'ῥ',
  42803. 'Ὸ' => 'ὸ',
  42804. 'Ό' => 'ό',
  42805. 'Ὼ' => 'ὼ',
  42806. 'á¿»' => 'á½½',
  42807. 'ῼ' => 'ῳ',
  42808. 'Ω' => 'ω',
  42809. 'K' => 'k',
  42810. 'â„«' => 'Ã¥',
  42811. 'Ⅎ' => 'ⅎ',
  42812. 'â… ' => 'â…°',
  42813. 'â…¡' => 'â…±',
  42814. 'â…¢' => 'â…²',
  42815. 'â…£' => 'â…³',
  42816. 'â…¤' => 'â…´',
  42817. 'â…¥' => 'â…µ',
  42818. 'â…¦' => 'â…¶',
  42819. 'â…§' => 'â…·',
  42820. 'â…¨' => 'â…¸',
  42821. 'â…©' => 'â…¹',
  42822. 'â…ª' => 'â…º',
  42823. 'â…«' => 'â…»',
  42824. 'â…¬' => 'â…¼',
  42825. 'â…­' => 'â…½',
  42826. 'â…®' => 'â…¾',
  42827. 'â…¯' => 'â…¿',
  42828. 'Ↄ' => 'ↄ',
  42829. 'Ⓐ' => '�',
  42830. 'â’·' => 'â“‘',
  42831. 'â’¸' => 'â“’',
  42832. 'â’¹' => 'â““',
  42833. 'â’º' => 'â“”',
  42834. 'â’»' => 'â“•',
  42835. 'â’¼' => 'â“–',
  42836. 'â’½' => 'â“—',
  42837. 'Ⓘ' => 'ⓘ',
  42838. 'â’¿' => 'â“™',
  42839. 'â“€' => 'â“š',
  42840. '�' => 'ⓛ',
  42841. 'Ⓜ' => 'ⓜ',
  42842. 'Ⓝ' => '�',
  42843. 'â“„' => 'â“ž',
  42844. 'â“…' => 'â“Ÿ',
  42845. 'Ⓠ' => 'ⓠ',
  42846. 'Ⓡ' => 'ⓡ',
  42847. 'Ⓢ' => 'ⓢ',
  42848. 'Ⓣ' => 'ⓣ',
  42849. 'Ⓤ' => 'ⓤ',
  42850. 'â“‹' => 'â“¥',
  42851. 'Ⓦ' => 'ⓦ',
  42852. '�' => 'ⓧ',
  42853. 'Ⓨ' => 'ⓨ',
  42854. '�' => 'ⓩ',
  42855. 'â°€' => 'â°°',
  42856. 'â°�' => 'â°±',
  42857. 'â°‚' => 'â°²',
  42858. 'â°ƒ' => 'â°³',
  42859. 'â°„' => 'â°´',
  42860. 'â°…' => 'â°µ',
  42861. 'â°†' => 'â°¶',
  42862. 'â°‡' => 'â°·',
  42863. 'â°ˆ' => 'â°¸',
  42864. 'â°‰' => 'â°¹',
  42865. 'â°Š' => 'â°º',
  42866. 'â°‹' => 'â°»',
  42867. 'Ⰼ' => 'ⰼ',
  42868. 'â°�' => 'â°½',
  42869. 'â°Ž' => 'â°¾',
  42870. 'â°�' => 'â°¿',
  42871. 'â°�' => 'â±€',
  42872. 'Ⱁ' => '�',
  42873. 'Ⱂ' => 'ⱂ',
  42874. 'Ⱃ' => 'ⱃ',
  42875. 'Ⱄ' => 'ⱄ',
  42876. 'â°•' => 'â±…',
  42877. 'Ⱆ' => 'ⱆ',
  42878. 'Ⱇ' => 'ⱇ',
  42879. 'Ⱈ' => 'ⱈ',
  42880. 'Ⱉ' => 'ⱉ',
  42881. 'Ⱊ' => 'ⱊ',
  42882. 'Ⱋ' => 'ⱋ',
  42883. 'Ⱌ' => 'ⱌ',
  42884. '�' => '�',
  42885. 'Ⱎ' => 'ⱎ',
  42886. 'Ⱏ' => '�',
  42887. 'Ⱐ' => '�',
  42888. 'Ⱑ' => 'ⱑ',
  42889. 'â°¢' => 'â±’',
  42890. 'Ⱓ' => 'ⱓ',
  42891. 'â°¤' => 'â±”',
  42892. 'Ⱕ' => 'ⱕ',
  42893. 'â°¦' => 'â±–',
  42894. 'â°§' => 'â±—',
  42895. 'Ⱘ' => 'ⱘ',
  42896. 'â°©' => 'â±™',
  42897. 'Ⱚ' => 'ⱚ',
  42898. 'â°«' => 'â±›',
  42899. 'Ⱜ' => 'ⱜ',
  42900. 'Ⱝ' => '�',
  42901. 'Ⱞ' => 'ⱞ',
  42902. 'Ⱡ' => 'ⱡ',
  42903. 'â±¢' => 'É«',
  42904. 'â±£' => 'áµ½',
  42905. 'Ɽ' => 'ɽ',
  42906. 'Ⱨ' => 'ⱨ',
  42907. 'Ⱪ' => 'ⱪ',
  42908. 'Ⱬ' => 'ⱬ',
  42909. 'â±­' => 'É‘',
  42910. 'Ɱ' => 'ɱ',
  42911. 'Ɐ' => '�',
  42912. 'â±°' => 'É’',
  42913. 'â±²' => 'â±³',
  42914. 'Ⱶ' => 'ⱶ',
  42915. 'â±¾' => 'È¿',
  42916. 'Ɀ' => 'ɀ',
  42917. 'Ⲁ' => '�',
  42918. 'Ⲃ' => 'ⲃ',
  42919. 'Ⲅ' => 'ⲅ',
  42920. 'Ⲇ' => 'ⲇ',
  42921. 'Ⲉ' => 'ⲉ',
  42922. 'Ⲋ' => 'ⲋ',
  42923. 'Ⲍ' => '�',
  42924. 'Ⲏ' => '�',
  42925. '�' => 'ⲑ',
  42926. 'Ⲓ' => 'ⲓ',
  42927. 'Ⲕ' => 'ⲕ',
  42928. 'â²–' => 'â²—',
  42929. 'Ⲙ' => 'ⲙ',
  42930. 'Ⲛ' => 'ⲛ',
  42931. 'Ⲝ' => '�',
  42932. 'Ⲟ' => 'ⲟ',
  42933. 'Ⲡ' => 'ⲡ',
  42934. 'â²¢' => 'â²£',
  42935. 'Ⲥ' => 'ⲥ',
  42936. 'Ⲧ' => 'ⲧ',
  42937. 'Ⲩ' => 'ⲩ',
  42938. 'Ⲫ' => 'ⲫ',
  42939. 'Ⲭ' => 'ⲭ',
  42940. 'Ⲯ' => 'ⲯ',
  42941. 'â²°' => 'â²±',
  42942. 'â²²' => 'â²³',
  42943. 'â²´' => 'â²µ',
  42944. 'Ⲷ' => 'ⲷ',
  42945. 'Ⲹ' => 'ⲹ',
  42946. 'Ⲻ' => 'ⲻ',
  42947. 'â²¼' => 'â²½',
  42948. 'Ⲿ' => 'ⲿ',
  42949. 'Ⳁ' => '�',
  42950. 'Ⳃ' => 'ⳃ',
  42951. 'Ⳅ' => 'ⳅ',
  42952. 'Ⳇ' => 'ⳇ',
  42953. 'Ⳉ' => 'ⳉ',
  42954. 'Ⳋ' => 'ⳋ',
  42955. 'Ⳍ' => '�',
  42956. 'Ⳏ' => '�',
  42957. '�' => 'ⳑ',
  42958. 'Ⳓ' => 'ⳓ',
  42959. 'Ⳕ' => 'ⳕ',
  42960. 'â³–' => 'â³—',
  42961. 'Ⳙ' => 'ⳙ',
  42962. 'Ⳛ' => 'ⳛ',
  42963. 'Ⳝ' => '�',
  42964. 'Ⳟ' => 'ⳟ',
  42965. 'Ⳡ' => 'ⳡ',
  42966. 'â³¢' => 'â³£',
  42967. 'Ⳬ' => 'ⳬ',
  42968. 'â³­' => 'â³®',
  42969. 'â³²' => 'â³³',
  42970. 'Ꙁ' => '�',
  42971. 'Ꙃ' => 'ꙃ',
  42972. 'Ꙅ' => 'ꙅ',
  42973. 'Ꙇ' => 'ꙇ',
  42974. 'Ꙉ' => 'ꙉ',
  42975. 'Ꙋ' => 'ꙋ',
  42976. 'Ꙍ' => '�',
  42977. 'Ꙏ' => '�',
  42978. '�' => 'ꙑ',
  42979. 'Ꙓ' => 'ꙓ',
  42980. 'Ꙕ' => 'ꙕ',
  42981. 'ê™–' => 'ê™—',
  42982. 'Ꙙ' => 'ꙙ',
  42983. 'Ꙛ' => 'ꙛ',
  42984. 'Ꙝ' => '�',
  42985. 'Ꙟ' => 'ꙟ',
  42986. 'Ꙡ' => 'ꙡ',
  42987. 'Ꙣ' => 'ꙣ',
  42988. 'Ꙥ' => 'ꙥ',
  42989. 'Ꙧ' => 'ꙧ',
  42990. 'Ꙩ' => 'ꙩ',
  42991. 'Ꙫ' => 'ꙫ',
  42992. 'Ꙭ' => 'ꙭ',
  42993. 'Ꚁ' => '�',
  42994. 'Ꚃ' => 'ꚃ',
  42995. 'êš„' => 'êš…',
  42996. 'Ꚇ' => 'ꚇ',
  42997. 'Ꚉ' => 'ꚉ',
  42998. 'Ꚋ' => 'ꚋ',
  42999. 'Ꚍ' => '�',
  43000. 'Ꚏ' => '�',
  43001. '�' => 'ꚑ',
  43002. 'êš’' => 'êš“',
  43003. 'êš”' => 'êš•',
  43004. 'êš–' => 'êš—',
  43005. 'Ꚙ' => 'ꚙ',
  43006. 'êšš' => 'êš›',
  43007. 'Ꜣ' => 'ꜣ',
  43008. 'Ꜥ' => 'ꜥ',
  43009. 'Ꜧ' => 'ꜧ',
  43010. 'Ꜩ' => 'ꜩ',
  43011. 'Ꜫ' => 'ꜫ',
  43012. 'Ꜭ' => 'ꜭ',
  43013. 'Ꜯ' => 'ꜯ',
  43014. 'Ꜳ' => 'ꜳ',
  43015. 'Ꜵ' => 'ꜵ',
  43016. 'Ꜷ' => 'ꜷ',
  43017. 'Ꜹ' => 'ꜹ',
  43018. 'Ꜻ' => 'ꜻ',
  43019. 'Ꜽ' => 'ꜽ',
  43020. 'Ꜿ' => 'ꜿ',
  43021. '�' => '�',
  43022. '�' => '�',
  43023. '�' => '�',
  43024. '�' => '�',
  43025. '�' => '�',
  43026. '�' => '�',
  43027. '�' => '�',
  43028. '�' => '�',
  43029. '�' => '�',
  43030. '�' => '�',
  43031. '�' => '�',
  43032. '�' => '�',
  43033. '�' => '�',
  43034. '�' => '�',
  43035. '�' => '�',
  43036. '�' => '�',
  43037. '�' => '�',
  43038. '�' => '�',
  43039. '�' => '�',
  43040. '�' => '�',
  43041. '�' => '�',
  43042. '�' => '�',
  43043. '�' => '�',
  43044. '�' => '�',
  43045. '�' => '�',
  43046. '�' => '�',
  43047. '�' => 'ᵹ',
  43048. '�' => '�',
  43049. 'Ꞁ' => '�',
  43050. 'Ꞃ' => 'ꞃ',
  43051. 'êž„' => 'êž…',
  43052. 'Ꞇ' => 'ꞇ',
  43053. 'Ꞌ' => 'ꞌ',
  43054. '�' => 'ɥ',
  43055. '�' => 'ꞑ',
  43056. 'êž’' => 'êž“',
  43057. 'êž–' => 'êž—',
  43058. 'Ꞙ' => 'ꞙ',
  43059. 'êžš' => 'êž›',
  43060. 'Ꞝ' => '�',
  43061. 'Ꞟ' => 'ꞟ',
  43062. 'êž ' => 'êž¡',
  43063. 'Ꞣ' => 'ꞣ',
  43064. 'Ꞥ' => 'ꞥ',
  43065. 'Ꞧ' => 'ꞧ',
  43066. 'Ꞩ' => 'ꞩ',
  43067. 'Ɦ' => 'ɦ',
  43068. 'Ɜ' => 'ɜ',
  43069. 'Ɡ' => 'ɡ',
  43070. 'Ɬ' => 'ɬ',
  43071. 'êž°' => 'Êž',
  43072. 'Ʇ' => 'ʇ',
  43073. 'A' => '�',
  43074. 'B' => 'b',
  43075. 'C' => 'c',
  43076. 'D' => 'd',
  43077. 'ï¼¥' => 'ï½…',
  43078. 'F' => 'f',
  43079. 'G' => 'g',
  43080. 'H' => 'h',
  43081. 'I' => 'i',
  43082. 'J' => 'j',
  43083. 'K' => 'k',
  43084. 'L' => 'l',
  43085. 'M' => '�',
  43086. 'N' => 'n',
  43087. 'O' => '�',
  43088. 'P' => '�',
  43089. 'Q' => 'q',
  43090. 'ï¼²' => 'ï½’',
  43091. 'S' => 's',
  43092. 'ï¼´' => 'ï½”',
  43093. 'U' => 'u',
  43094. 'V' => 'v',
  43095. 'ï¼·' => 'ï½—',
  43096. 'X' => 'x',
  43097. 'ï¼¹' => 'ï½™',
  43098. 'Z' => 'z',
  43099. '�' => '�',
  43100. '�' => '�',
  43101. '�' => '�',
  43102. '�' => '�',
  43103. '�' => '�',
  43104. '�' => '�',
  43105. '�' => '�',
  43106. '�' => '�',
  43107. '�' => '�',
  43108. '�' => '�',
  43109. '�' => '�',
  43110. '�' => '�',
  43111. '�' => '�',
  43112. '�' => '�',
  43113. '�' => '�',
  43114. '�' => '�',
  43115. '�' => '�',
  43116. '�' => '�',
  43117. '�' => '�',
  43118. '�' => '�',
  43119. '�' => '�',
  43120. '�' => '�',
  43121. '�' => '�',
  43122. '�' => '�',
  43123. '�' => '�',
  43124. '�' => '�',
  43125. '�' => '�',
  43126. '�' => '�',
  43127. '�' => '�',
  43128. '�' => '�',
  43129. '�' => '�',
  43130. '�' => '�',
  43131. '�' => '�',
  43132. '�' => '�',
  43133. '�' => '�',
  43134. '�' => '�',
  43135. '�' => '�',
  43136. '�' => '�',
  43137. '�' => '�',
  43138. '�' => '�',
  43139. 'ð‘¢ ' => 'ð‘£€',
  43140. '𑢡' => '�',
  43141. '𑢢' => '𑣂',
  43142. '𑢣' => '𑣃',
  43143. '𑢤' => '𑣄',
  43144. 'ð‘¢¥' => 'ð‘£…',
  43145. '𑢦' => '𑣆',
  43146. '𑢧' => '𑣇',
  43147. '𑢨' => '𑣈',
  43148. '𑢩' => '𑣉',
  43149. '𑢪' => '𑣊',
  43150. '𑢫' => '𑣋',
  43151. '𑢬' => '𑣌',
  43152. '𑢭' => '�',
  43153. '𑢮' => '𑣎',
  43154. '𑢯' => '�',
  43155. '𑢰' => '�',
  43156. '𑢱' => '𑣑',
  43157. 'ð‘¢²' => 'ð‘£’',
  43158. '𑢳' => '𑣓',
  43159. 'ð‘¢´' => 'ð‘£”',
  43160. '𑢵' => '𑣕',
  43161. '𑢶' => '𑣖',
  43162. 'ð‘¢·' => 'ð‘£—',
  43163. '𑢸' => '𑣘',
  43164. 'ð‘¢¹' => 'ð‘£™',
  43165. '𑢺' => '𑣚',
  43166. 'ð‘¢»' => 'ð‘£›',
  43167. '𑢼' => '𑣜',
  43168. '𑢽' => '�',
  43169. '𑢾' => '𑣞',
  43170. '𑢿' => '𑣟',
  43171. );
  43172. $result =& $data;
  43173. unset($data);
  43174. return $result;
  43175. <?php
  43176. static $data = array (
  43177. 'a' => 'A',
  43178. 'b' => 'B',
  43179. 'c' => 'C',
  43180. 'd' => 'D',
  43181. 'e' => 'E',
  43182. 'f' => 'F',
  43183. 'g' => 'G',
  43184. 'h' => 'H',
  43185. 'i' => 'I',
  43186. 'j' => 'J',
  43187. 'k' => 'K',
  43188. 'l' => 'L',
  43189. 'm' => 'M',
  43190. 'n' => 'N',
  43191. 'o' => 'O',
  43192. 'p' => 'P',
  43193. 'q' => 'Q',
  43194. 'r' => 'R',
  43195. 's' => 'S',
  43196. 't' => 'T',
  43197. 'u' => 'U',
  43198. 'v' => 'V',
  43199. 'w' => 'W',
  43200. 'x' => 'X',
  43201. 'y' => 'Y',
  43202. 'z' => 'Z',
  43203. 'µ' => 'Μ',
  43204. 'à' => 'À',
  43205. 'á' => '�',
  43206. 'â' => 'Â',
  43207. 'ã' => 'Ã',
  43208. 'ä' => 'Ä',
  43209. 'Ã¥' => 'Ã…',
  43210. 'æ' => 'Æ',
  43211. 'ç' => 'Ç',
  43212. 'è' => 'È',
  43213. 'é' => 'É',
  43214. 'ê' => 'Ê',
  43215. 'ë' => 'Ë',
  43216. 'ì' => 'Ì',
  43217. 'í' => '�',
  43218. 'î' => 'Î',
  43219. 'ï' => '�',
  43220. 'ð' => '�',
  43221. 'ñ' => 'Ñ',
  43222. 'ò' => 'Ò',
  43223. 'ó' => 'Ó',
  43224. 'ô' => 'Ô',
  43225. 'õ' => 'Õ',
  43226. 'ö' => 'Ö',
  43227. 'ø' => 'Ø',
  43228. 'ù' => 'Ù',
  43229. 'ú' => 'Ú',
  43230. 'û' => 'Û',
  43231. 'ü' => 'Ü',
  43232. 'ý' => '�',
  43233. 'þ' => 'Þ',
  43234. 'ÿ' => 'Ÿ',
  43235. '�' => 'Ā',
  43236. 'ă' => 'Ă',
  43237. 'Ä…' => 'Ä„',
  43238. 'ć' => 'Ć',
  43239. 'ĉ' => 'Ĉ',
  43240. 'Ä‹' => 'ÄŠ',
  43241. '�' => 'Č',
  43242. '�' => 'Ď',
  43243. 'đ' => '�',
  43244. 'Ä“' => 'Ä’',
  43245. 'Ä•' => 'Ä”',
  43246. 'Ä—' => 'Ä–',
  43247. 'ę' => 'Ę',
  43248. 'Ä›' => 'Äš',
  43249. '�' => 'Ĝ',
  43250. 'ÄŸ' => 'Äž',
  43251. 'Ä¡' => 'Ä ',
  43252. 'Ä£' => 'Ä¢',
  43253. 'ĥ' => 'Ĥ',
  43254. 'ħ' => 'Ħ',
  43255. 'ĩ' => 'Ĩ',
  43256. 'ī' => 'Ī',
  43257. 'ĭ' => 'Ĭ',
  43258. 'į' => 'Į',
  43259. 'ı' => 'I',
  43260. 'ij' => 'IJ',
  43261. 'ĵ' => 'Ĵ',
  43262. 'ķ' => 'Ķ',
  43263. 'ĺ' => 'Ĺ',
  43264. 'ļ' => 'Ļ',
  43265. 'ľ' => 'Ľ',
  43266. 'Å€' => 'Ä¿',
  43267. 'ł' => '�',
  43268. 'ń' => 'Ń',
  43269. 'ņ' => 'Ņ',
  43270. 'ň' => 'Ň',
  43271. 'Å‹' => 'ÅŠ',
  43272. '�' => 'Ō',
  43273. '�' => 'Ŏ',
  43274. 'ő' => '�',
  43275. 'Å“' => 'Å’',
  43276. 'Å•' => 'Å”',
  43277. 'Å—' => 'Å–',
  43278. 'ř' => 'Ř',
  43279. 'Å›' => 'Åš',
  43280. '�' => 'Ŝ',
  43281. 'ÅŸ' => 'Åž',
  43282. 'Å¡' => 'Å ',
  43283. 'Å£' => 'Å¢',
  43284. 'ť' => 'Ť',
  43285. 'ŧ' => 'Ŧ',
  43286. 'ũ' => 'Ũ',
  43287. 'ū' => 'Ū',
  43288. 'ŭ' => 'Ŭ',
  43289. 'ů' => 'Ů',
  43290. 'ű' => 'Ű',
  43291. 'ų' => 'Ų',
  43292. 'ŵ' => 'Ŵ',
  43293. 'ŷ' => 'Ŷ',
  43294. 'ź' => 'Ź',
  43295. 'ż' => 'Ż',
  43296. 'ž' => 'Ž',
  43297. 'Å¿' => 'S',
  43298. 'ƀ' => 'Ƀ',
  43299. 'ƃ' => 'Ƃ',
  43300. 'Æ…' => 'Æ„',
  43301. 'ƈ' => 'Ƈ',
  43302. 'ƌ' => 'Ƌ',
  43303. 'Æ’' => 'Æ‘',
  43304. 'ƕ' => 'Ƕ',
  43305. 'ƙ' => 'Ƙ',
  43306. 'ƚ' => 'Ƚ',
  43307. 'Æž' => 'È ',
  43308. 'Æ¡' => 'Æ ',
  43309. 'Æ£' => 'Æ¢',
  43310. 'ƥ' => 'Ƥ',
  43311. 'ƨ' => 'Ƨ',
  43312. 'ƭ' => 'Ƭ',
  43313. 'ư' => 'Ư',
  43314. 'ƴ' => 'Ƴ',
  43315. 'ƶ' => 'Ƶ',
  43316. 'ƹ' => 'Ƹ',
  43317. 'ƽ' => 'Ƽ',
  43318. 'Æ¿' => 'Ç·',
  43319. 'Ç…' => 'Ç„',
  43320. 'dž' => 'DŽ',
  43321. 'Lj' => 'LJ',
  43322. 'lj' => 'LJ',
  43323. 'Ç‹' => 'ÇŠ',
  43324. 'nj' => 'NJ',
  43325. 'ǎ' => '�',
  43326. '�' => '�',
  43327. 'Ç’' => 'Ç‘',
  43328. 'Ç”' => 'Ç“',
  43329. 'Ç–' => 'Ç•',
  43330. 'ǘ' => 'Ǘ',
  43331. 'Çš' => 'Ç™',
  43332. 'ǜ' => 'Ǜ',
  43333. '�' => 'Ǝ',
  43334. 'ÇŸ' => 'Çž',
  43335. 'Ç¡' => 'Ç ',
  43336. 'Ç£' => 'Ç¢',
  43337. 'ǥ' => 'Ǥ',
  43338. 'ǧ' => 'Ǧ',
  43339. 'ǩ' => 'Ǩ',
  43340. 'ǫ' => 'Ǫ',
  43341. 'ǭ' => 'Ǭ',
  43342. 'ǯ' => 'Ǯ',
  43343. 'Dz' => 'DZ',
  43344. 'dz' => 'DZ',
  43345. 'ǵ' => 'Ǵ',
  43346. 'ǹ' => 'Ǹ',
  43347. 'ǻ' => 'Ǻ',
  43348. 'ǽ' => 'Ǽ',
  43349. 'ǿ' => 'Ǿ',
  43350. '�' => 'Ȁ',
  43351. 'ȃ' => 'Ȃ',
  43352. 'È…' => 'È„',
  43353. 'ȇ' => 'Ȇ',
  43354. 'ȉ' => 'Ȉ',
  43355. 'È‹' => 'ÈŠ',
  43356. '�' => 'Ȍ',
  43357. '�' => 'Ȏ',
  43358. 'ȑ' => '�',
  43359. 'È“' => 'È’',
  43360. 'È•' => 'È”',
  43361. 'È—' => 'È–',
  43362. 'ș' => 'Ș',
  43363. 'È›' => 'Èš',
  43364. '�' => 'Ȝ',
  43365. 'ÈŸ' => 'Èž',
  43366. 'È£' => 'È¢',
  43367. 'ȥ' => 'Ȥ',
  43368. 'ȧ' => 'Ȧ',
  43369. 'ȩ' => 'Ȩ',
  43370. 'ȫ' => 'Ȫ',
  43371. 'ȭ' => 'Ȭ',
  43372. 'ȯ' => 'Ȯ',
  43373. 'ȱ' => 'Ȱ',
  43374. 'ȳ' => 'Ȳ',
  43375. 'ȼ' => 'Ȼ',
  43376. 'È¿' => 'â±¾',
  43377. 'ɀ' => 'Ɀ',
  43378. 'ɂ' => '�',
  43379. 'ɇ' => 'Ɇ',
  43380. 'ɉ' => 'Ɉ',
  43381. 'É‹' => 'ÉŠ',
  43382. '�' => 'Ɍ',
  43383. '�' => 'Ɏ',
  43384. '�' => 'Ɐ',
  43385. 'É‘' => 'â±­',
  43386. 'É’' => 'â±°',
  43387. 'ɓ' => '�',
  43388. 'ɔ' => 'Ɔ',
  43389. 'ɖ' => 'Ɖ',
  43390. 'É—' => 'ÆŠ',
  43391. 'ə' => '�',
  43392. 'ɛ' => '�',
  43393. 'ɜ' => 'Ɜ',
  43394. 'É ' => 'Æ“',
  43395. 'ɡ' => 'Ɡ',
  43396. 'É£' => 'Æ”',
  43397. 'ɥ' => '�',
  43398. 'ɦ' => 'Ɦ',
  43399. 'ɨ' => 'Ɨ',
  43400. 'É©' => 'Æ–',
  43401. 'É«' => 'â±¢',
  43402. 'ɬ' => 'Ɬ',
  43403. 'ɯ' => 'Ɯ',
  43404. 'ɱ' => 'Ɱ',
  43405. 'ɲ' => '�',
  43406. 'ɵ' => 'Ɵ',
  43407. 'ɽ' => 'Ɽ',
  43408. 'ʀ' => 'Ʀ',
  43409. 'ʃ' => 'Ʃ',
  43410. 'ʇ' => 'Ʇ',
  43411. 'ʈ' => 'Ʈ',
  43412. 'ʉ' => 'Ʉ',
  43413. 'ʊ' => 'Ʊ',
  43414. 'ʋ' => 'Ʋ',
  43415. 'ʌ' => 'Ʌ',
  43416. 'Ê’' => 'Æ·',
  43417. 'Êž' => 'êž°',
  43418. 'ͅ' => 'Ι',
  43419. 'ͱ' => 'Ͱ',
  43420. 'ͳ' => 'Ͳ',
  43421. 'ͷ' => 'Ͷ',
  43422. 'ͻ' => 'Ͻ',
  43423. 'ͼ' => 'Ͼ',
  43424. 'ͽ' => 'Ͽ',
  43425. 'ά' => 'Ά',
  43426. 'έ' => 'Έ',
  43427. 'ή' => 'Ή',
  43428. 'ί' => 'Ί',
  43429. 'α' => 'Α',
  43430. 'β' => 'Β',
  43431. 'γ' => 'Γ',
  43432. 'δ' => 'Δ',
  43433. 'ε' => 'Ε',
  43434. 'ζ' => 'Ζ',
  43435. 'η' => 'Η',
  43436. 'θ' => 'Θ',
  43437. 'ι' => 'Ι',
  43438. 'κ' => 'Κ',
  43439. 'λ' => 'Λ',
  43440. 'μ' => 'Μ',
  43441. 'ν' => '�',
  43442. 'ξ' => 'Ξ',
  43443. 'ο' => 'Ο',
  43444. 'π' => 'Π',
  43445. '�' => 'Ρ',
  43446. 'ς' => 'Σ',
  43447. 'σ' => 'Σ',
  43448. 'τ' => 'Τ',
  43449. 'Ï…' => 'Î¥',
  43450. 'φ' => 'Φ',
  43451. 'χ' => 'Χ',
  43452. 'ψ' => 'Ψ',
  43453. 'ω' => 'Ω',
  43454. 'ϊ' => 'Ϊ',
  43455. 'ϋ' => 'Ϋ',
  43456. 'ό' => 'Ό',
  43457. '�' => 'Ύ',
  43458. 'ώ' => '�',
  43459. '�' => 'Β',
  43460. 'ϑ' => 'Θ',
  43461. 'ϕ' => 'Φ',
  43462. 'ϖ' => 'Π',
  43463. 'ϗ' => '�',
  43464. 'ϙ' => 'Ϙ',
  43465. 'Ï›' => 'Ïš',
  43466. '�' => 'Ϝ',
  43467. 'ÏŸ' => 'Ïž',
  43468. 'Ï¡' => 'Ï ',
  43469. 'Ï£' => 'Ï¢',
  43470. 'ϥ' => 'Ϥ',
  43471. 'ϧ' => 'Ϧ',
  43472. 'ϩ' => 'Ϩ',
  43473. 'ϫ' => 'Ϫ',
  43474. 'ϭ' => 'Ϭ',
  43475. 'ϯ' => 'Ϯ',
  43476. 'ϰ' => 'Κ',
  43477. 'ϱ' => 'Ρ',
  43478. 'ϲ' => 'Ϲ',
  43479. 'ϳ' => 'Ϳ',
  43480. 'ϵ' => 'Ε',
  43481. 'ϸ' => 'Ϸ',
  43482. 'ϻ' => 'Ϻ',
  43483. 'а' => '�',
  43484. 'б' => 'Б',
  43485. 'в' => 'В',
  43486. 'г' => 'Г',
  43487. 'д' => 'Д',
  43488. 'е' => 'Е',
  43489. 'ж' => 'Ж',
  43490. 'з' => 'З',
  43491. 'и' => 'И',
  43492. 'й' => 'Й',
  43493. 'к' => 'К',
  43494. 'л' => 'Л',
  43495. 'м' => 'М',
  43496. 'н' => '�',
  43497. 'о' => 'О',
  43498. 'п' => 'П',
  43499. 'р' => 'Р',
  43500. '�' => 'С',
  43501. 'т' => 'Т',
  43502. 'у' => 'У',
  43503. 'ф' => 'Ф',
  43504. 'Ñ…' => 'Ð¥',
  43505. 'ц' => 'Ц',
  43506. 'ч' => 'Ч',
  43507. 'ш' => 'Ш',
  43508. 'щ' => 'Щ',
  43509. 'ъ' => 'Ъ',
  43510. 'ы' => 'Ы',
  43511. 'ь' => 'Ь',
  43512. '�' => 'Э',
  43513. 'ю' => 'Ю',
  43514. '�' => 'Я',
  43515. '�' => 'Ѐ',
  43516. 'ё' => '�',
  43517. 'ђ' => 'Ђ',
  43518. 'ѓ' => 'Ѓ',
  43519. 'є' => 'Є',
  43520. 'Ñ•' => 'Ð…',
  43521. 'і' => 'І',
  43522. 'ї' => 'Ї',
  43523. 'ј' => 'Ј',
  43524. 'љ' => 'Љ',
  43525. 'њ' => 'Њ',
  43526. 'ћ' => 'Ћ',
  43527. 'ќ' => 'Ќ',
  43528. '�' => '�',
  43529. 'Ñž' => 'ÐŽ',
  43530. 'џ' => '�',
  43531. 'Ñ¡' => 'Ñ ',
  43532. 'Ñ£' => 'Ñ¢',
  43533. 'ѥ' => 'Ѥ',
  43534. 'ѧ' => 'Ѧ',
  43535. 'ѩ' => 'Ѩ',
  43536. 'ѫ' => 'Ѫ',
  43537. 'ѭ' => 'Ѭ',
  43538. 'ѯ' => 'Ѯ',
  43539. 'ѱ' => 'Ѱ',
  43540. 'ѳ' => 'Ѳ',
  43541. 'ѵ' => 'Ѵ',
  43542. 'ѷ' => 'Ѷ',
  43543. 'ѹ' => 'Ѹ',
  43544. 'ѻ' => 'Ѻ',
  43545. 'ѽ' => 'Ѽ',
  43546. 'ѿ' => 'Ѿ',
  43547. 'Ò�' => 'Ò€',
  43548. 'Ò‹' => 'ÒŠ',
  43549. '�' => 'Ҍ',
  43550. 'Ò�' => 'ÒŽ',
  43551. 'Ò‘' => 'Ò�',
  43552. 'Ò“' => 'Ò’',
  43553. 'Ò•' => 'Ò”',
  43554. 'Ò—' => 'Ò–',
  43555. 'Ò™' => 'Ò˜',
  43556. 'Ò›' => 'Òš',
  43557. '�' => 'Ҝ',
  43558. 'ÒŸ' => 'Òž',
  43559. 'Ò¡' => 'Ò ',
  43560. 'Ò£' => 'Ò¢',
  43561. 'Ò¥' => 'Ò¤',
  43562. 'Ò§' => 'Ò¦',
  43563. 'Ò©' => 'Ò¨',
  43564. 'Ò«' => 'Òª',
  43565. 'Ò­' => 'Ò¬',
  43566. 'Ò¯' => 'Ò®',
  43567. 'Ò±' => 'Ò°',
  43568. 'Ò³' => 'Ò²',
  43569. 'Òµ' => 'Ò´',
  43570. 'Ò·' => 'Ò¶',
  43571. 'Ò¹' => 'Ò¸',
  43572. 'Ò»' => 'Òº',
  43573. 'Ò½' => 'Ò¼',
  43574. 'Ò¿' => 'Ò¾',
  43575. 'Ó‚' => 'Ó�',
  43576. 'Ó„' => 'Óƒ',
  43577. 'Ó†' => 'Ó…',
  43578. 'Óˆ' => 'Ó‡',
  43579. 'ÓŠ' => 'Ó‰',
  43580. 'ӌ' => 'Ӌ',
  43581. 'ÓŽ' => 'Ó�',
  43582. 'Ó�' => 'Ó€',
  43583. 'Ó‘' => 'Ó�',
  43584. 'Ó“' => 'Ó’',
  43585. 'Ó•' => 'Ó”',
  43586. 'Ó—' => 'Ó–',
  43587. 'Ó™' => 'Ó˜',
  43588. 'Ó›' => 'Óš',
  43589. '�' => 'Ӝ',
  43590. 'ÓŸ' => 'Óž',
  43591. 'Ó¡' => 'Ó ',
  43592. 'Ó£' => 'Ó¢',
  43593. 'Ó¥' => 'Ó¤',
  43594. 'Ó§' => 'Ó¦',
  43595. 'Ó©' => 'Ó¨',
  43596. 'Ó«' => 'Óª',
  43597. 'Ó­' => 'Ó¬',
  43598. 'Ó¯' => 'Ó®',
  43599. 'Ó±' => 'Ó°',
  43600. 'Ó³' => 'Ó²',
  43601. 'Óµ' => 'Ó´',
  43602. 'Ó·' => 'Ó¶',
  43603. 'Ó¹' => 'Ó¸',
  43604. 'Ó»' => 'Óº',
  43605. 'Ó½' => 'Ó¼',
  43606. 'Ó¿' => 'Ó¾',
  43607. 'Ô�' => 'Ô€',
  43608. 'Ôƒ' => 'Ô‚',
  43609. 'Ô…' => 'Ô„',
  43610. 'Ô‡' => 'Ô†',
  43611. 'Ô‰' => 'Ôˆ',
  43612. 'Ô‹' => 'ÔŠ',
  43613. '�' => 'Ԍ',
  43614. 'Ô�' => 'ÔŽ',
  43615. 'Ô‘' => 'Ô�',
  43616. 'Ô“' => 'Ô’',
  43617. 'Ô•' => 'Ô”',
  43618. 'Ô—' => 'Ô–',
  43619. 'Ô™' => 'Ô˜',
  43620. 'Ô›' => 'Ôš',
  43621. '�' => 'Ԝ',
  43622. 'ÔŸ' => 'Ôž',
  43623. 'Ô¡' => 'Ô ',
  43624. 'Ô£' => 'Ô¢',
  43625. 'Ô¥' => 'Ô¤',
  43626. 'Ô§' => 'Ô¦',
  43627. 'Ô©' => 'Ô¨',
  43628. 'Ô«' => 'Ôª',
  43629. 'Ô­' => 'Ô¬',
  43630. 'Ô¯' => 'Ô®',
  43631. 'Õ¡' => 'Ô±',
  43632. 'Õ¢' => 'Ô²',
  43633. 'Õ£' => 'Ô³',
  43634. 'Õ¤' => 'Ô´',
  43635. 'Õ¥' => 'Ôµ',
  43636. 'Õ¦' => 'Ô¶',
  43637. 'Õ§' => 'Ô·',
  43638. 'Õ¨' => 'Ô¸',
  43639. 'Õ©' => 'Ô¹',
  43640. 'Õª' => 'Ôº',
  43641. 'Õ«' => 'Ô»',
  43642. 'Õ¬' => 'Ô¼',
  43643. 'Õ­' => 'Ô½',
  43644. 'Õ®' => 'Ô¾',
  43645. 'Õ¯' => 'Ô¿',
  43646. 'Õ°' => 'Õ€',
  43647. 'Õ±' => 'Õ�',
  43648. 'Õ²' => 'Õ‚',
  43649. 'Õ³' => 'Õƒ',
  43650. 'Õ´' => 'Õ„',
  43651. 'Õµ' => 'Õ…',
  43652. 'Õ¶' => 'Õ†',
  43653. 'Õ·' => 'Õ‡',
  43654. 'Õ¸' => 'Õˆ',
  43655. 'Õ¹' => 'Õ‰',
  43656. 'Õº' => 'ÕŠ',
  43657. 'Õ»' => 'Õ‹',
  43658. 'ռ' => 'Ռ',
  43659. 'Õ½' => 'Õ�',
  43660. 'Õ¾' => 'ÕŽ',
  43661. 'Õ¿' => 'Õ�',
  43662. 'Ö€' => 'Õ�',
  43663. 'Ö�' => 'Õ‘',
  43664. 'Ö‚' => 'Õ’',
  43665. 'Öƒ' => 'Õ“',
  43666. 'Ö„' => 'Õ”',
  43667. 'Ö…' => 'Õ•',
  43668. 'Ö†' => 'Õ–',
  43669. 'ᵹ' => '�',
  43670. 'áµ½' => 'â±£',
  43671. '�' => 'Ḁ',
  43672. 'ḃ' => 'Ḃ',
  43673. 'ḅ' => 'Ḅ',
  43674. 'ḇ' => 'Ḇ',
  43675. 'ḉ' => 'Ḉ',
  43676. 'ḋ' => 'Ḋ',
  43677. '�' => 'Ḍ',
  43678. '�' => 'Ḏ',
  43679. 'ḑ' => '�',
  43680. 'ḓ' => 'Ḓ',
  43681. 'ḕ' => 'Ḕ',
  43682. 'ḗ' => 'Ḗ',
  43683. 'ḙ' => 'Ḙ',
  43684. 'ḛ' => 'Ḛ',
  43685. '�' => 'Ḝ',
  43686. 'ḟ' => 'Ḟ',
  43687. 'ḡ' => 'Ḡ',
  43688. 'ḣ' => 'Ḣ',
  43689. 'ḥ' => 'Ḥ',
  43690. 'ḧ' => 'Ḧ',
  43691. 'ḩ' => 'Ḩ',
  43692. 'ḫ' => 'Ḫ',
  43693. 'ḭ' => 'Ḭ',
  43694. 'ḯ' => 'Ḯ',
  43695. 'ḱ' => 'Ḱ',
  43696. 'ḳ' => 'Ḳ',
  43697. 'ḵ' => 'Ḵ',
  43698. 'ḷ' => 'Ḷ',
  43699. 'ḹ' => 'Ḹ',
  43700. 'ḻ' => 'Ḻ',
  43701. 'ḽ' => 'Ḽ',
  43702. 'ḿ' => 'Ḿ',
  43703. '�' => 'Ṁ',
  43704. 'ṃ' => 'Ṃ',
  43705. 'ṅ' => 'Ṅ',
  43706. 'ṇ' => 'Ṇ',
  43707. 'ṉ' => 'Ṉ',
  43708. 'ṋ' => 'Ṋ',
  43709. '�' => 'Ṍ',
  43710. '�' => 'Ṏ',
  43711. 'ṑ' => '�',
  43712. 'ṓ' => 'Ṓ',
  43713. 'ṕ' => 'Ṕ',
  43714. 'á¹—' => 'á¹–',
  43715. 'ṙ' => 'Ṙ',
  43716. 'ṛ' => 'Ṛ',
  43717. '�' => 'Ṝ',
  43718. 'ṟ' => 'Ṟ',
  43719. 'ṡ' => 'Ṡ',
  43720. 'á¹£' => 'á¹¢',
  43721. 'ṥ' => 'Ṥ',
  43722. 'ṧ' => 'Ṧ',
  43723. 'ṩ' => 'Ṩ',
  43724. 'ṫ' => 'Ṫ',
  43725. 'ṭ' => 'Ṭ',
  43726. 'ṯ' => 'Ṯ',
  43727. 'á¹±' => 'á¹°',
  43728. 'á¹³' => 'á¹²',
  43729. 'á¹µ' => 'á¹´',
  43730. 'ṷ' => 'Ṷ',
  43731. 'ṹ' => 'Ṹ',
  43732. 'ṻ' => 'Ṻ',
  43733. 'á¹½' => 'á¹¼',
  43734. 'ṿ' => 'Ṿ',
  43735. '�' => 'Ẁ',
  43736. 'ẃ' => 'Ẃ',
  43737. 'ẅ' => 'Ẅ',
  43738. 'ẇ' => 'Ẇ',
  43739. 'ẉ' => 'Ẉ',
  43740. 'ẋ' => 'Ẋ',
  43741. '�' => 'Ẍ',
  43742. '�' => 'Ẏ',
  43743. 'ẑ' => '�',
  43744. 'ẓ' => 'Ẓ',
  43745. 'ẕ' => 'Ẕ',
  43746. 'ẛ' => 'Ṡ',
  43747. 'ạ' => 'Ạ',
  43748. 'ả' => 'Ả',
  43749. 'ấ' => 'Ấ',
  43750. 'ầ' => 'Ầ',
  43751. 'ẩ' => 'Ẩ',
  43752. 'ẫ' => 'Ẫ',
  43753. 'ậ' => 'Ậ',
  43754. 'ắ' => 'Ắ',
  43755. 'ằ' => 'Ằ',
  43756. 'ẳ' => 'Ẳ',
  43757. 'ẵ' => 'Ẵ',
  43758. 'ặ' => 'Ặ',
  43759. 'ẹ' => 'Ẹ',
  43760. 'ẻ' => 'Ẻ',
  43761. 'ẽ' => 'Ẽ',
  43762. 'ế' => 'Ế',
  43763. '�' => 'Ề',
  43764. 'ể' => 'Ể',
  43765. 'ễ' => 'Ễ',
  43766. 'ệ' => 'Ệ',
  43767. 'ỉ' => 'Ỉ',
  43768. 'ị' => 'Ị',
  43769. '�' => 'Ọ',
  43770. '�' => 'Ỏ',
  43771. 'ố' => '�',
  43772. 'ồ' => 'Ồ',
  43773. 'ổ' => 'Ổ',
  43774. 'á»—' => 'á»–',
  43775. 'ộ' => 'Ộ',
  43776. 'ớ' => 'Ớ',
  43777. '�' => 'Ờ',
  43778. 'ở' => 'Ở',
  43779. 'ỡ' => 'Ỡ',
  43780. 'ợ' => 'Ợ',
  43781. 'ụ' => 'Ụ',
  43782. 'ủ' => 'Ủ',
  43783. 'ứ' => 'Ứ',
  43784. 'ừ' => 'Ừ',
  43785. 'ử' => 'Ử',
  43786. 'ữ' => 'Ữ',
  43787. 'á»±' => 'á»°',
  43788. 'ỳ' => 'Ỳ',
  43789. 'ỵ' => 'Ỵ',
  43790. 'ỷ' => 'Ỷ',
  43791. 'ỹ' => 'Ỹ',
  43792. 'ỻ' => 'Ỻ',
  43793. 'ỽ' => 'Ỽ',
  43794. 'ỿ' => 'Ỿ',
  43795. 'ἀ' => 'Ἀ',
  43796. '�' => 'Ἁ',
  43797. 'ἂ' => 'Ἂ',
  43798. 'ἃ' => 'Ἃ',
  43799. 'ἄ' => 'Ἄ',
  43800. 'ἅ' => '�',
  43801. 'ἆ' => 'Ἆ',
  43802. 'ἇ' => '�',
  43803. '�' => 'Ἐ',
  43804. 'ἑ' => 'Ἑ',
  43805. 'ἒ' => 'Ἒ',
  43806. 'ἓ' => 'Ἓ',
  43807. 'ἔ' => 'Ἔ',
  43808. 'ἕ' => '�',
  43809. 'ἠ' => 'Ἠ',
  43810. 'ἡ' => 'Ἡ',
  43811. 'ἢ' => 'Ἢ',
  43812. 'ἣ' => 'Ἣ',
  43813. 'ἤ' => 'Ἤ',
  43814. 'á¼¥' => 'á¼­',
  43815. 'ἦ' => 'Ἦ',
  43816. 'ἧ' => 'Ἧ',
  43817. 'ἰ' => 'Ἰ',
  43818. 'á¼±' => 'á¼¹',
  43819. 'ἲ' => 'Ἲ',
  43820. 'á¼³' => 'á¼»',
  43821. 'á¼´' => 'á¼¼',
  43822. 'á¼µ' => 'á¼½',
  43823. 'ἶ' => 'Ἶ',
  43824. 'ἷ' => 'Ἷ',
  43825. 'ὀ' => 'Ὀ',
  43826. '�' => 'Ὁ',
  43827. 'ὂ' => 'Ὂ',
  43828. 'ὃ' => 'Ὃ',
  43829. 'ὄ' => 'Ὄ',
  43830. 'ὅ' => '�',
  43831. 'ὑ' => 'Ὑ',
  43832. 'ὓ' => 'Ὓ',
  43833. 'ὕ' => '�',
  43834. 'ὗ' => 'Ὗ',
  43835. 'ὠ' => 'Ὠ',
  43836. 'ὡ' => 'Ὡ',
  43837. 'ὢ' => 'Ὢ',
  43838. 'ὣ' => 'Ὣ',
  43839. 'ὤ' => 'Ὤ',
  43840. 'á½¥' => 'á½­',
  43841. 'ὦ' => 'Ὦ',
  43842. 'ὧ' => 'Ὧ',
  43843. 'ὰ' => 'Ὰ',
  43844. 'á½±' => 'á¾»',
  43845. 'ὲ' => 'Ὲ',
  43846. 'έ' => 'Έ',
  43847. 'á½´' => 'á¿Š',
  43848. 'á½µ' => 'á¿‹',
  43849. 'ὶ' => 'Ὶ',
  43850. 'á½·' => 'á¿›',
  43851. 'ὸ' => 'Ὸ',
  43852. 'ό' => 'Ό',
  43853. 'ὺ' => 'Ὺ',
  43854. 'á½»' => 'á¿«',
  43855. 'ὼ' => 'Ὼ',
  43856. 'á½½' => 'á¿»',
  43857. 'ᾀ' => 'ᾈ',
  43858. '�' => 'ᾉ',
  43859. 'ᾂ' => 'ᾊ',
  43860. 'ᾃ' => 'ᾋ',
  43861. 'ᾄ' => 'ᾌ',
  43862. 'ᾅ' => '�',
  43863. 'ᾆ' => 'ᾎ',
  43864. 'ᾇ' => '�',
  43865. '�' => 'ᾘ',
  43866. 'ᾑ' => 'ᾙ',
  43867. 'ᾒ' => 'ᾚ',
  43868. 'ᾓ' => 'ᾛ',
  43869. 'ᾔ' => 'ᾜ',
  43870. 'ᾕ' => '�',
  43871. 'ᾖ' => 'ᾞ',
  43872. 'ᾗ' => 'ᾟ',
  43873. 'ᾠ' => 'ᾨ',
  43874. 'ᾡ' => 'ᾩ',
  43875. 'ᾢ' => 'ᾪ',
  43876. 'ᾣ' => 'ᾫ',
  43877. 'ᾤ' => 'ᾬ',
  43878. 'á¾¥' => 'á¾­',
  43879. 'ᾦ' => 'ᾮ',
  43880. 'ᾧ' => 'ᾯ',
  43881. 'ᾰ' => 'Ᾰ',
  43882. 'á¾±' => 'á¾¹',
  43883. 'á¾³' => 'á¾¼',
  43884. 'ι' => 'Ι',
  43885. 'ῃ' => 'ῌ',
  43886. '�' => 'Ῐ',
  43887. 'á¿‘' => 'á¿™',
  43888. 'ῠ' => 'Ῠ',
  43889. 'á¿¡' => 'á¿©',
  43890. 'ῥ' => 'Ῥ',
  43891. 'ῳ' => 'ῼ',
  43892. 'ⅎ' => 'Ⅎ',
  43893. 'â…°' => 'â… ',
  43894. 'â…±' => 'â…¡',
  43895. 'â…²' => 'â…¢',
  43896. 'â…³' => 'â…£',
  43897. 'â…´' => 'â…¤',
  43898. 'â…µ' => 'â…¥',
  43899. 'â…¶' => 'â…¦',
  43900. 'â…·' => 'â…§',
  43901. 'â…¸' => 'â…¨',
  43902. 'â…¹' => 'â…©',
  43903. 'â…º' => 'â…ª',
  43904. 'â…»' => 'â…«',
  43905. 'â…¼' => 'â…¬',
  43906. 'â…½' => 'â…­',
  43907. 'â…¾' => 'â…®',
  43908. 'â…¿' => 'â…¯',
  43909. 'ↄ' => 'Ↄ',
  43910. '�' => 'Ⓐ',
  43911. 'â“‘' => 'â’·',
  43912. 'â“’' => 'â’¸',
  43913. 'â““' => 'â’¹',
  43914. 'â“”' => 'â’º',
  43915. 'â“•' => 'â’»',
  43916. 'â“–' => 'â’¼',
  43917. 'â“—' => 'â’½',
  43918. 'ⓘ' => 'Ⓘ',
  43919. 'â“™' => 'â’¿',
  43920. 'â“š' => 'â“€',
  43921. 'ⓛ' => '�',
  43922. 'ⓜ' => 'Ⓜ',
  43923. '�' => 'Ⓝ',
  43924. 'â“ž' => 'â“„',
  43925. 'â“Ÿ' => 'â“…',
  43926. 'ⓠ' => 'Ⓠ',
  43927. 'ⓡ' => 'Ⓡ',
  43928. 'ⓢ' => 'Ⓢ',
  43929. 'ⓣ' => 'Ⓣ',
  43930. 'ⓤ' => 'Ⓤ',
  43931. 'â“¥' => 'â“‹',
  43932. 'ⓦ' => 'Ⓦ',
  43933. 'ⓧ' => '�',
  43934. 'ⓨ' => 'Ⓨ',
  43935. 'ⓩ' => '�',
  43936. 'â°°' => 'â°€',
  43937. 'â°±' => 'â°�',
  43938. 'â°²' => 'â°‚',
  43939. 'â°³' => 'â°ƒ',
  43940. 'â°´' => 'â°„',
  43941. 'â°µ' => 'â°…',
  43942. 'â°¶' => 'â°†',
  43943. 'â°·' => 'â°‡',
  43944. 'â°¸' => 'â°ˆ',
  43945. 'â°¹' => 'â°‰',
  43946. 'â°º' => 'â°Š',
  43947. 'â°»' => 'â°‹',
  43948. 'ⰼ' => 'Ⰼ',
  43949. 'â°½' => 'â°�',
  43950. 'â°¾' => 'â°Ž',
  43951. 'â°¿' => 'â°�',
  43952. 'â±€' => 'â°�',
  43953. '�' => 'Ⱁ',
  43954. 'ⱂ' => 'Ⱂ',
  43955. 'ⱃ' => 'Ⱃ',
  43956. 'ⱄ' => 'Ⱄ',
  43957. 'â±…' => 'â°•',
  43958. 'ⱆ' => 'Ⱆ',
  43959. 'ⱇ' => 'Ⱇ',
  43960. 'ⱈ' => 'Ⱈ',
  43961. 'ⱉ' => 'Ⱉ',
  43962. 'ⱊ' => 'Ⱊ',
  43963. 'ⱋ' => 'Ⱋ',
  43964. 'ⱌ' => 'Ⱌ',
  43965. '�' => '�',
  43966. 'ⱎ' => 'Ⱎ',
  43967. '�' => 'Ⱏ',
  43968. '�' => 'Ⱐ',
  43969. 'ⱑ' => 'Ⱑ',
  43970. 'â±’' => 'â°¢',
  43971. 'ⱓ' => 'Ⱓ',
  43972. 'â±”' => 'â°¤',
  43973. 'ⱕ' => 'Ⱕ',
  43974. 'â±–' => 'â°¦',
  43975. 'â±—' => 'â°§',
  43976. 'ⱘ' => 'Ⱘ',
  43977. 'â±™' => 'â°©',
  43978. 'ⱚ' => 'Ⱚ',
  43979. 'â±›' => 'â°«',
  43980. 'ⱜ' => 'Ⱜ',
  43981. '�' => 'Ⱝ',
  43982. 'ⱞ' => 'Ⱞ',
  43983. 'ⱡ' => 'Ⱡ',
  43984. 'ⱥ' => 'Ⱥ',
  43985. 'ⱦ' => 'Ⱦ',
  43986. 'ⱨ' => 'Ⱨ',
  43987. 'ⱪ' => 'Ⱪ',
  43988. 'ⱬ' => 'Ⱬ',
  43989. 'â±³' => 'â±²',
  43990. 'ⱶ' => 'Ⱶ',
  43991. '�' => 'Ⲁ',
  43992. 'ⲃ' => 'Ⲃ',
  43993. 'ⲅ' => 'Ⲅ',
  43994. 'ⲇ' => 'Ⲇ',
  43995. 'ⲉ' => 'Ⲉ',
  43996. 'ⲋ' => 'Ⲋ',
  43997. '�' => 'Ⲍ',
  43998. '�' => 'Ⲏ',
  43999. 'ⲑ' => '�',
  44000. 'ⲓ' => 'Ⲓ',
  44001. 'ⲕ' => 'Ⲕ',
  44002. 'â²—' => 'â²–',
  44003. 'ⲙ' => 'Ⲙ',
  44004. 'ⲛ' => 'Ⲛ',
  44005. '�' => 'Ⲝ',
  44006. 'ⲟ' => 'Ⲟ',
  44007. 'ⲡ' => 'Ⲡ',
  44008. 'â²£' => 'â²¢',
  44009. 'ⲥ' => 'Ⲥ',
  44010. 'ⲧ' => 'Ⲧ',
  44011. 'ⲩ' => 'Ⲩ',
  44012. 'ⲫ' => 'Ⲫ',
  44013. 'ⲭ' => 'Ⲭ',
  44014. 'ⲯ' => 'Ⲯ',
  44015. 'â²±' => 'â²°',
  44016. 'â²³' => 'â²²',
  44017. 'â²µ' => 'â²´',
  44018. 'ⲷ' => 'Ⲷ',
  44019. 'ⲹ' => 'Ⲹ',
  44020. 'ⲻ' => 'Ⲻ',
  44021. 'â²½' => 'â²¼',
  44022. 'ⲿ' => 'Ⲿ',
  44023. '�' => 'Ⳁ',
  44024. 'ⳃ' => 'Ⳃ',
  44025. 'ⳅ' => 'Ⳅ',
  44026. 'ⳇ' => 'Ⳇ',
  44027. 'ⳉ' => 'Ⳉ',
  44028. 'ⳋ' => 'Ⳋ',
  44029. '�' => 'Ⳍ',
  44030. '�' => 'Ⳏ',
  44031. 'ⳑ' => '�',
  44032. 'ⳓ' => 'Ⳓ',
  44033. 'ⳕ' => 'Ⳕ',
  44034. 'â³—' => 'â³–',
  44035. 'ⳙ' => 'Ⳙ',
  44036. 'ⳛ' => 'Ⳛ',
  44037. '�' => 'Ⳝ',
  44038. 'ⳟ' => 'Ⳟ',
  44039. 'ⳡ' => 'Ⳡ',
  44040. 'â³£' => 'â³¢',
  44041. 'ⳬ' => 'Ⳬ',
  44042. 'â³®' => 'â³­',
  44043. 'â³³' => 'â³²',
  44044. 'â´€' => 'á‚ ',
  44045. 'â´�' => 'á‚¡',
  44046. 'â´‚' => 'á‚¢',
  44047. 'â´ƒ' => 'á‚£',
  44048. 'ⴄ' => 'Ⴄ',
  44049. 'â´…' => 'á‚¥',
  44050. 'ⴆ' => 'Ⴆ',
  44051. 'ⴇ' => 'Ⴇ',
  44052. 'ⴈ' => 'Ⴈ',
  44053. 'â´‰' => 'á‚©',
  44054. 'ⴊ' => 'Ⴊ',
  44055. 'â´‹' => 'á‚«',
  44056. 'ⴌ' => 'Ⴌ',
  44057. 'â´�' => 'á‚­',
  44058. 'â´Ž' => 'á‚®',
  44059. '�' => 'Ⴏ',
  44060. 'â´�' => 'á‚°',
  44061. 'ⴑ' => 'Ⴑ',
  44062. 'ⴒ' => 'Ⴒ',
  44063. 'ⴓ' => 'Ⴓ',
  44064. 'â´”' => 'á‚´',
  44065. 'ⴕ' => 'Ⴕ',
  44066. 'ⴖ' => 'Ⴖ',
  44067. 'â´—' => 'á‚·',
  44068. 'ⴘ' => 'Ⴘ',
  44069. 'ⴙ' => 'Ⴙ',
  44070. 'ⴚ' => 'Ⴚ',
  44071. 'â´›' => 'á‚»',
  44072. 'ⴜ' => 'Ⴜ',
  44073. '�' => 'Ⴝ',
  44074. 'ⴞ' => 'Ⴞ',
  44075. 'â´Ÿ' => 'á‚¿',
  44076. 'ⴠ' => 'Ⴠ',
  44077. 'ⴡ' => '�',
  44078. 'ⴢ' => 'Ⴢ',
  44079. 'ⴣ' => 'Ⴣ',
  44080. 'ⴤ' => 'Ⴤ',
  44081. 'ⴥ' => 'Ⴥ',
  44082. 'ⴧ' => 'Ⴧ',
  44083. 'ⴭ' => '�',
  44084. '�' => 'Ꙁ',
  44085. 'ꙃ' => 'Ꙃ',
  44086. 'ꙅ' => 'Ꙅ',
  44087. 'ꙇ' => 'Ꙇ',
  44088. 'ꙉ' => 'Ꙉ',
  44089. 'ꙋ' => 'Ꙋ',
  44090. '�' => 'Ꙍ',
  44091. '�' => 'Ꙏ',
  44092. 'ꙑ' => '�',
  44093. 'ꙓ' => 'Ꙓ',
  44094. 'ꙕ' => 'Ꙕ',
  44095. 'ê™—' => 'ê™–',
  44096. 'ꙙ' => 'Ꙙ',
  44097. 'ꙛ' => 'Ꙛ',
  44098. '�' => 'Ꙝ',
  44099. 'ꙟ' => 'Ꙟ',
  44100. 'ꙡ' => 'Ꙡ',
  44101. 'ꙣ' => 'Ꙣ',
  44102. 'ꙥ' => 'Ꙥ',
  44103. 'ꙧ' => 'Ꙧ',
  44104. 'ꙩ' => 'Ꙩ',
  44105. 'ꙫ' => 'Ꙫ',
  44106. 'ꙭ' => 'Ꙭ',
  44107. '�' => 'Ꚁ',
  44108. 'ꚃ' => 'Ꚃ',
  44109. 'êš…' => 'êš„',
  44110. 'ꚇ' => 'Ꚇ',
  44111. 'ꚉ' => 'Ꚉ',
  44112. 'ꚋ' => 'Ꚋ',
  44113. '�' => 'Ꚍ',
  44114. '�' => 'Ꚏ',
  44115. 'ꚑ' => '�',
  44116. 'êš“' => 'êš’',
  44117. 'êš•' => 'êš”',
  44118. 'êš—' => 'êš–',
  44119. 'ꚙ' => 'Ꚙ',
  44120. 'êš›' => 'êšš',
  44121. 'ꜣ' => 'Ꜣ',
  44122. 'ꜥ' => 'Ꜥ',
  44123. 'ꜧ' => 'Ꜧ',
  44124. 'ꜩ' => 'Ꜩ',
  44125. 'ꜫ' => 'Ꜫ',
  44126. 'ꜭ' => 'Ꜭ',
  44127. 'ꜯ' => 'Ꜯ',
  44128. 'ꜳ' => 'Ꜳ',
  44129. 'ꜵ' => 'Ꜵ',
  44130. 'ꜷ' => 'Ꜷ',
  44131. 'ꜹ' => 'Ꜹ',
  44132. 'ꜻ' => 'Ꜻ',
  44133. 'ꜽ' => 'Ꜽ',
  44134. 'ꜿ' => 'Ꜿ',
  44135. '�' => '�',
  44136. '�' => '�',
  44137. '�' => '�',
  44138. '�' => '�',
  44139. '�' => '�',
  44140. '�' => '�',
  44141. '�' => '�',
  44142. '�' => '�',
  44143. '�' => '�',
  44144. '�' => '�',
  44145. '�' => '�',
  44146. '�' => '�',
  44147. '�' => '�',
  44148. '�' => '�',
  44149. '�' => '�',
  44150. '�' => '�',
  44151. '�' => '�',
  44152. '�' => '�',
  44153. '�' => '�',
  44154. '�' => '�',
  44155. '�' => '�',
  44156. '�' => '�',
  44157. '�' => '�',
  44158. '�' => '�',
  44159. '�' => '�',
  44160. '�' => '�',
  44161. '�' => '�',
  44162. '�' => 'Ꞁ',
  44163. 'ꞃ' => 'Ꞃ',
  44164. 'êž…' => 'êž„',
  44165. 'ꞇ' => 'Ꞇ',
  44166. 'ꞌ' => 'Ꞌ',
  44167. 'ꞑ' => '�',
  44168. 'êž“' => 'êž’',
  44169. 'êž—' => 'êž–',
  44170. 'ꞙ' => 'Ꞙ',
  44171. 'êž›' => 'êžš',
  44172. '�' => 'Ꞝ',
  44173. 'ꞟ' => 'Ꞟ',
  44174. 'êž¡' => 'êž ',
  44175. 'ꞣ' => 'Ꞣ',
  44176. 'ꞥ' => 'Ꞥ',
  44177. 'ꞧ' => 'Ꞧ',
  44178. 'ꞩ' => 'Ꞩ',
  44179. '�' => 'A',
  44180. 'b' => 'B',
  44181. 'c' => 'C',
  44182. 'd' => 'D',
  44183. 'ï½…' => 'ï¼¥',
  44184. 'f' => 'F',
  44185. 'g' => 'G',
  44186. 'h' => 'H',
  44187. 'i' => 'I',
  44188. 'j' => 'J',
  44189. 'k' => 'K',
  44190. 'l' => 'L',
  44191. '�' => 'M',
  44192. 'n' => 'N',
  44193. '�' => 'O',
  44194. '�' => 'P',
  44195. 'q' => 'Q',
  44196. 'ï½’' => 'ï¼²',
  44197. 's' => 'S',
  44198. 'ï½”' => 'ï¼´',
  44199. 'u' => 'U',
  44200. 'v' => 'V',
  44201. 'ï½—' => 'ï¼·',
  44202. 'x' => 'X',
  44203. 'ï½™' => 'ï¼¹',
  44204. 'z' => 'Z',
  44205. '�' => '�',
  44206. '�' => '�',
  44207. '�' => '�',
  44208. '�' => '�',
  44209. '�' => '�',
  44210. '�' => '�',
  44211. '�' => '�',
  44212. '�' => '�',
  44213. '�' => '�',
  44214. '�' => '�',
  44215. '�' => '�',
  44216. '�' => '�',
  44217. '�' => '�',
  44218. '�' => '�',
  44219. '�' => '�',
  44220. '�' => '�',
  44221. '�' => '�',
  44222. '�' => '�',
  44223. '�' => '�',
  44224. '�' => '�',
  44225. '�' => '�',
  44226. '�' => '�',
  44227. '�' => '�',
  44228. '�' => '�',
  44229. '�' => '�',
  44230. '�' => '�',
  44231. '�' => '�',
  44232. '�' => '�',
  44233. '�' => '�',
  44234. '�' => '�',
  44235. '�' => '�',
  44236. '�' => '�',
  44237. '�' => '�',
  44238. '�' => '�',
  44239. '�' => '�',
  44240. '�' => '�',
  44241. '�' => '�',
  44242. '�' => '�',
  44243. '�' => '�',
  44244. '�' => '�',
  44245. 'ð‘£€' => 'ð‘¢ ',
  44246. '�' => '𑢡',
  44247. '𑣂' => '𑢢',
  44248. '𑣃' => '𑢣',
  44249. '𑣄' => '𑢤',
  44250. 'ð‘£…' => 'ð‘¢¥',
  44251. '𑣆' => '𑢦',
  44252. '𑣇' => '𑢧',
  44253. '𑣈' => '𑢨',
  44254. '𑣉' => '𑢩',
  44255. '𑣊' => '𑢪',
  44256. '𑣋' => '𑢫',
  44257. '𑣌' => '𑢬',
  44258. '�' => '𑢭',
  44259. '𑣎' => '𑢮',
  44260. '�' => '𑢯',
  44261. '�' => '𑢰',
  44262. '𑣑' => '𑢱',
  44263. 'ð‘£’' => 'ð‘¢²',
  44264. '𑣓' => '𑢳',
  44265. 'ð‘£”' => 'ð‘¢´',
  44266. '𑣕' => '𑢵',
  44267. '𑣖' => '𑢶',
  44268. 'ð‘£—' => 'ð‘¢·',
  44269. '𑣘' => '𑢸',
  44270. 'ð‘£™' => 'ð‘¢¹',
  44271. '𑣚' => '𑢺',
  44272. 'ð‘£›' => 'ð‘¢»',
  44273. '𑣜' => '𑢼',
  44274. '�' => '𑢽',
  44275. '𑣞' => '𑢾',
  44276. '𑣟' => '𑢿',
  44277. );
  44278. $result =& $data;
  44279. unset($data);
  44280. return $result;
  44281. <?php
  44282. use Symfony\Polyfill\Mbstring as p;
  44283. if (!function_exists('mb_strlen')) {
  44284. define('MB_CASE_UPPER', 0);
  44285. define('MB_CASE_LOWER', 1);
  44286. define('MB_CASE_TITLE', 2);
  44287. function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); }
  44288. function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); }
  44289. function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); }
  44290. function mb_decode_numericentity($s, $convmap, $enc = null) { return p\Mbstring::mb_decode_numericentity($s, $convmap, $enc); }
  44291. function mb_encode_numericentity($s, $convmap, $enc = null, $is_hex = false) { return p\Mbstring::mb_encode_numericentity($s, $convmap, $enc, $is_hex); }
  44292. function mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); }
  44293. function mb_internal_encoding($enc = null) { return p\Mbstring::mb_internal_encoding($enc); }
  44294. function mb_language($lang = null) { return p\Mbstring::mb_language($lang); }
  44295. function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
  44296. function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); }
  44297. function mb_check_encoding($var = null, $encoding = null) { return p\Mbstring::mb_check_encoding($var, $encoding); }
  44298. function mb_detect_encoding($str, $encodingList = null, $strict = false) { return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); }
  44299. function mb_detect_order($encodingList = null) { return p\Mbstring::mb_detect_order($encodingList); }
  44300. function mb_parse_str($s, &$result = array()) { parse_str($s, $result); }
  44301. function mb_strlen($s, $enc = null) { return p\Mbstring::mb_strlen($s, $enc); }
  44302. function mb_strpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); }
  44303. function mb_strtolower($s, $enc = null) { return p\Mbstring::mb_strtolower($s, $enc); }
  44304. function mb_strtoupper($s, $enc = null) { return p\Mbstring::mb_strtoupper($s, $enc); }
  44305. function mb_substitute_character($char = null) { return p\Mbstring::mb_substitute_character($char); }
  44306. function mb_substr($s, $start, $length = 2147483647, $enc = null) { return p\Mbstring::mb_substr($s, $start, $length, $enc); }
  44307. function mb_stripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); }
  44308. function mb_stristr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_stristr($s, $needle, $part, $enc); }
  44309. function mb_strrchr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); }
  44310. function mb_strrichr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); }
  44311. function mb_strripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); }
  44312. function mb_strrpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); }
  44313. function mb_strstr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strstr($s, $needle, $part, $enc); }
  44314. function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); }
  44315. function mb_http_output($enc = null) { return p\Mbstring::mb_http_output($enc); }
  44316. function mb_strwidth($s, $enc = null) { return p\Mbstring::mb_strwidth($s, $enc); }
  44317. function mb_substr_count($haystack, $needle, $enc = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $enc); }
  44318. function mb_output_handler($contents, $status) { return p\Mbstring::mb_output_handler($contents, $status); }
  44319. function mb_http_input($type = '') { return p\Mbstring::mb_http_input($type); }
  44320. function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) { return p\Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $a, $b, $c, $d, $e, $f); }
  44321. }
  44322. if (!function_exists('mb_chr')) {
  44323. function mb_ord($s, $enc = null) { return p\Mbstring::mb_ord($s, $enc); }
  44324. function mb_chr($code, $enc = null) { return p\Mbstring::mb_chr($code, $enc); }
  44325. function mb_scrub($s, $enc = null) { $enc = null === $enc ? mb_internal_encoding() : $enc; return mb_convert_encoding($s, $enc, $enc); }
  44326. }
  44327. <?php
  44328. namespace Symfony\Component\Process\Exception;
  44329. interface ExceptionInterface
  44330. {
  44331. }
  44332. <?php
  44333. namespace Symfony\Component\Process\Exception;
  44334. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  44335. {
  44336. }
  44337. <?php
  44338. namespace Symfony\Component\Process\Exception;
  44339. class LogicException extends \LogicException implements ExceptionInterface
  44340. {
  44341. }
  44342. <?php
  44343. namespace Symfony\Component\Process\Exception;
  44344. use Symfony\Component\Process\Process;
  44345. class ProcessFailedException extends RuntimeException
  44346. {
  44347. private $process;
  44348. public function __construct(Process $process)
  44349. {
  44350. if ($process->isSuccessful()) {
  44351. throw new InvalidArgumentException('Expected a failed process, but the given process was successful.');
  44352. }
  44353. $error = sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s",
  44354. $process->getCommandLine(),
  44355. $process->getExitCode(),
  44356. $process->getExitCodeText(),
  44357. $process->getWorkingDirectory()
  44358. );
  44359. if (!$process->isOutputDisabled()) {
  44360. $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s",
  44361. $process->getOutput(),
  44362. $process->getErrorOutput()
  44363. );
  44364. }
  44365. parent::__construct($error);
  44366. $this->process = $process;
  44367. }
  44368. public function getProcess()
  44369. {
  44370. return $this->process;
  44371. }
  44372. }
  44373. <?php
  44374. namespace Symfony\Component\Process\Exception;
  44375. use Symfony\Component\Process\Process;
  44376. class ProcessTimedOutException extends RuntimeException
  44377. {
  44378. const TYPE_GENERAL = 1;
  44379. const TYPE_IDLE = 2;
  44380. private $process;
  44381. private $timeoutType;
  44382. public function __construct(Process $process, $timeoutType)
  44383. {
  44384. $this->process = $process;
  44385. $this->timeoutType = $timeoutType;
  44386. parent::__construct(sprintf(
  44387. 'The process "%s" exceeded the timeout of %s seconds.',
  44388. $process->getCommandLine(),
  44389. $this->getExceededTimeout()
  44390. ));
  44391. }
  44392. public function getProcess()
  44393. {
  44394. return $this->process;
  44395. }
  44396. public function isGeneralTimeout()
  44397. {
  44398. return self::TYPE_GENERAL === $this->timeoutType;
  44399. }
  44400. public function isIdleTimeout()
  44401. {
  44402. return self::TYPE_IDLE === $this->timeoutType;
  44403. }
  44404. public function getExceededTimeout()
  44405. {
  44406. switch ($this->timeoutType) {
  44407. case self::TYPE_GENERAL:
  44408. return $this->process->getTimeout();
  44409. case self::TYPE_IDLE:
  44410. return $this->process->getIdleTimeout();
  44411. default:
  44412. throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType));
  44413. }
  44414. }
  44415. }
  44416. <?php
  44417. namespace Symfony\Component\Process\Exception;
  44418. class RuntimeException extends \RuntimeException implements ExceptionInterface
  44419. {
  44420. }
  44421. <?php
  44422. namespace Symfony\Component\Process;
  44423. class ExecutableFinder
  44424. {
  44425. private $suffixes = array('.exe', '.bat', '.cmd', '.com');
  44426. public function setSuffixes(array $suffixes)
  44427. {
  44428. $this->suffixes = $suffixes;
  44429. }
  44430. public function addSuffix($suffix)
  44431. {
  44432. $this->suffixes[] = $suffix;
  44433. }
  44434. public function find($name, $default = null, array $extraDirs = array())
  44435. {
  44436. if (ini_get('open_basedir')) {
  44437. $searchPath = explode(PATH_SEPARATOR, ini_get('open_basedir'));
  44438. $dirs = array();
  44439. foreach ($searchPath as $path) {
  44440. if (@is_dir($path)) {
  44441. $dirs[] = $path;
  44442. } else {
  44443. if (basename($path) == $name && @is_executable($path)) {
  44444. return $path;
  44445. }
  44446. }
  44447. }
  44448. } else {
  44449. $dirs = array_merge(
  44450. explode(PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
  44451. $extraDirs
  44452. );
  44453. }
  44454. $suffixes = array('');
  44455. if ('\\' === DIRECTORY_SEPARATOR) {
  44456. $pathExt = getenv('PATHEXT');
  44457. $suffixes = array_merge($suffixes, $pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes);
  44458. }
  44459. foreach ($suffixes as $suffix) {
  44460. foreach ($dirs as $dir) {
  44461. if (@is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === DIRECTORY_SEPARATOR || is_executable($file))) {
  44462. return $file;
  44463. }
  44464. }
  44465. }
  44466. return $default;
  44467. }
  44468. }
  44469. Copyright (c) 2004-2018 Fabien Potencier
  44470. Permission is hereby granted, free of charge, to any person obtaining a copy
  44471. of this software and associated documentation files (the "Software"), to deal
  44472. in the Software without restriction, including without limitation the rights
  44473. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  44474. copies of the Software, and to permit persons to whom the Software is furnished
  44475. to do so, subject to the following conditions:
  44476. The above copyright notice and this permission notice shall be included in all
  44477. copies or substantial portions of the Software.
  44478. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  44479. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  44480. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  44481. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  44482. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  44483. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  44484. THE SOFTWARE.
  44485. <?php
  44486. namespace Symfony\Component\Process;
  44487. class PhpExecutableFinder
  44488. {
  44489. private $executableFinder;
  44490. public function __construct()
  44491. {
  44492. $this->executableFinder = new ExecutableFinder();
  44493. }
  44494. public function find($includeArgs = true)
  44495. {
  44496. $args = $this->findArguments();
  44497. $args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
  44498. if (defined('HHVM_VERSION')) {
  44499. return (getenv('PHP_BINARY') ?: PHP_BINARY).$args;
  44500. }
  44501. if (defined('PHP_BINARY') && PHP_BINARY && \in_array(PHP_SAPI, array('cli', 'cli-server', 'phpdbg'), true)) {
  44502. return PHP_BINARY.$args;
  44503. }
  44504. if ($php = getenv('PHP_PATH')) {
  44505. if (!is_executable($php)) {
  44506. return false;
  44507. }
  44508. return $php;
  44509. }
  44510. if ($php = getenv('PHP_PEAR_PHP_BIN')) {
  44511. if (is_executable($php)) {
  44512. return $php;
  44513. }
  44514. }
  44515. if (is_executable($php = PHP_BINDIR.('\\' === DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) {
  44516. return $php;
  44517. }
  44518. $dirs = array(PHP_BINDIR);
  44519. if ('\\' === DIRECTORY_SEPARATOR) {
  44520. $dirs[] = 'C:\xampp\php\\';
  44521. }
  44522. return $this->executableFinder->find('php', false, $dirs);
  44523. }
  44524. public function findArguments()
  44525. {
  44526. $arguments = array();
  44527. if (defined('HHVM_VERSION')) {
  44528. $arguments[] = '--php';
  44529. } elseif ('phpdbg' === PHP_SAPI) {
  44530. $arguments[] = '-qrr';
  44531. }
  44532. return $arguments;
  44533. }
  44534. }
  44535. <?php
  44536. namespace Symfony\Component\Process;
  44537. use Symfony\Component\Process\Exception\RuntimeException;
  44538. class PhpProcess extends Process
  44539. {
  44540. public function __construct($script, $cwd = null, array $env = null, $timeout = 60, array $options = array())
  44541. {
  44542. $executableFinder = new PhpExecutableFinder();
  44543. if (false === $php = $executableFinder->find()) {
  44544. $php = null;
  44545. }
  44546. if ('phpdbg' === PHP_SAPI) {
  44547. $file = tempnam(sys_get_temp_dir(), 'dbg');
  44548. file_put_contents($file, $script);
  44549. register_shutdown_function('unlink', $file);
  44550. $php .= ' '.ProcessUtils::escapeArgument($file);
  44551. $script = null;
  44552. }
  44553. if ('\\' !== DIRECTORY_SEPARATOR && null !== $php) {
  44554. $php = 'exec '.$php;
  44555. }
  44556. parent::__construct($php, $cwd, $env, $script, $timeout, $options);
  44557. }
  44558. public function setPhpBinary($php)
  44559. {
  44560. $this->setCommandLine($php);
  44561. }
  44562. public function start($callback = null)
  44563. {
  44564. if (null === $this->getCommandLine()) {
  44565. throw new RuntimeException('Unable to find the PHP executable.');
  44566. }
  44567. parent::start($callback);
  44568. }
  44569. }
  44570. <?php
  44571. namespace Symfony\Component\Process\Pipes;
  44572. abstract class AbstractPipes implements PipesInterface
  44573. {
  44574. public $pipes = array();
  44575. private $inputBuffer = '';
  44576. private $input;
  44577. private $blocked = true;
  44578. public function __construct($input)
  44579. {
  44580. if (is_resource($input)) {
  44581. $this->input = $input;
  44582. } elseif (is_string($input)) {
  44583. $this->inputBuffer = $input;
  44584. } else {
  44585. $this->inputBuffer = (string) $input;
  44586. }
  44587. }
  44588. public function close()
  44589. {
  44590. foreach ($this->pipes as $pipe) {
  44591. fclose($pipe);
  44592. }
  44593. $this->pipes = array();
  44594. }
  44595. protected function hasSystemCallBeenInterrupted()
  44596. {
  44597. $lastError = error_get_last();
  44598. return isset($lastError['message']) && false !== stripos($lastError['message'], 'interrupted system call');
  44599. }
  44600. protected function unblock()
  44601. {
  44602. if (!$this->blocked) {
  44603. return;
  44604. }
  44605. foreach ($this->pipes as $pipe) {
  44606. stream_set_blocking($pipe, 0);
  44607. }
  44608. if (null !== $this->input) {
  44609. stream_set_blocking($this->input, 0);
  44610. }
  44611. $this->blocked = false;
  44612. }
  44613. protected function write()
  44614. {
  44615. if (!isset($this->pipes[0])) {
  44616. return;
  44617. }
  44618. $input = $this->input;
  44619. $r = $e = array();
  44620. $w = array($this->pipes[0]);
  44621. if (false === @stream_select($r, $w, $e, 0, 0)) {
  44622. return;
  44623. }
  44624. foreach ($w as $stdin) {
  44625. if (isset($this->inputBuffer[0])) {
  44626. $written = fwrite($stdin, $this->inputBuffer);
  44627. $this->inputBuffer = substr($this->inputBuffer, $written);
  44628. if (isset($this->inputBuffer[0])) {
  44629. return array($this->pipes[0]);
  44630. }
  44631. }
  44632. if ($input) {
  44633. for (;;) {
  44634. $data = fread($input, self::CHUNK_SIZE);
  44635. if (!isset($data[0])) {
  44636. break;
  44637. }
  44638. $written = fwrite($stdin, $data);
  44639. $data = substr($data, $written);
  44640. if (isset($data[0])) {
  44641. $this->inputBuffer = $data;
  44642. return array($this->pipes[0]);
  44643. }
  44644. }
  44645. if (feof($input)) {
  44646. $this->input = null;
  44647. }
  44648. }
  44649. }
  44650. if (null === $this->input && !isset($this->inputBuffer[0])) {
  44651. fclose($this->pipes[0]);
  44652. unset($this->pipes[0]);
  44653. } elseif (!$w) {
  44654. return array($this->pipes[0]);
  44655. }
  44656. }
  44657. }
  44658. <?php
  44659. namespace Symfony\Component\Process\Pipes;
  44660. interface PipesInterface
  44661. {
  44662. const CHUNK_SIZE = 16384;
  44663. public function getDescriptors();
  44664. public function getFiles();
  44665. public function readAndWrite($blocking, $close = false);
  44666. public function areOpen();
  44667. public function close();
  44668. }
  44669. <?php
  44670. namespace Symfony\Component\Process\Pipes;
  44671. use Symfony\Component\Process\Process;
  44672. class UnixPipes extends AbstractPipes
  44673. {
  44674. private $ttyMode;
  44675. private $ptyMode;
  44676. private $disableOutput;
  44677. public function __construct($ttyMode, $ptyMode, $input, $disableOutput)
  44678. {
  44679. $this->ttyMode = (bool) $ttyMode;
  44680. $this->ptyMode = (bool) $ptyMode;
  44681. $this->disableOutput = (bool) $disableOutput;
  44682. parent::__construct($input);
  44683. }
  44684. public function __destruct()
  44685. {
  44686. $this->close();
  44687. }
  44688. public function getDescriptors()
  44689. {
  44690. if ($this->disableOutput) {
  44691. $nullstream = fopen('/dev/null', 'c');
  44692. return array(
  44693. array('pipe', 'r'),
  44694. $nullstream,
  44695. $nullstream,
  44696. );
  44697. }
  44698. if ($this->ttyMode) {
  44699. return array(
  44700. array('file', '/dev/tty', 'r'),
  44701. array('file', '/dev/tty', 'w'),
  44702. array('file', '/dev/tty', 'w'),
  44703. );
  44704. }
  44705. if ($this->ptyMode && Process::isPtySupported()) {
  44706. return array(
  44707. array('pty'),
  44708. array('pty'),
  44709. array('pty'),
  44710. );
  44711. }
  44712. return array(
  44713. array('pipe', 'r'),
  44714. array('pipe', 'w'),
  44715. array('pipe', 'w'),
  44716. );
  44717. }
  44718. public function getFiles()
  44719. {
  44720. return array();
  44721. }
  44722. public function readAndWrite($blocking, $close = false)
  44723. {
  44724. $this->unblock();
  44725. $w = $this->write();
  44726. $read = $e = array();
  44727. $r = $this->pipes;
  44728. unset($r[0]);
  44729. if (($r || $w) && false === @stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
  44730. if (!$this->hasSystemCallBeenInterrupted()) {
  44731. $this->pipes = array();
  44732. }
  44733. return $read;
  44734. }
  44735. foreach ($r as $pipe) {
  44736. $read[$type = array_search($pipe, $this->pipes, true)] = '';
  44737. do {
  44738. $data = fread($pipe, self::CHUNK_SIZE);
  44739. $read[$type] .= $data;
  44740. } while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));
  44741. if (!isset($read[$type][0])) {
  44742. unset($read[$type]);
  44743. }
  44744. if ($close && feof($pipe)) {
  44745. fclose($pipe);
  44746. unset($this->pipes[$type]);
  44747. }
  44748. }
  44749. return $read;
  44750. }
  44751. public function areOpen()
  44752. {
  44753. return (bool) $this->pipes;
  44754. }
  44755. public static function create(Process $process, $input)
  44756. {
  44757. return new static($process->isTty(), $process->isPty(), $input, $process->isOutputDisabled());
  44758. }
  44759. }
  44760. <?php
  44761. namespace Symfony\Component\Process\Pipes;
  44762. use Symfony\Component\Process\Process;
  44763. use Symfony\Component\Process\Exception\RuntimeException;
  44764. class WindowsPipes extends AbstractPipes
  44765. {
  44766. private $files = array();
  44767. private $fileHandles = array();
  44768. private $readBytes = array(
  44769. Process::STDOUT => 0,
  44770. Process::STDERR => 0,
  44771. );
  44772. private $disableOutput;
  44773. public function __construct($disableOutput, $input)
  44774. {
  44775. $this->disableOutput = (bool) $disableOutput;
  44776. if (!$this->disableOutput) {
  44777. $pipes = array(
  44778. Process::STDOUT => Process::OUT,
  44779. Process::STDERR => Process::ERR,
  44780. );
  44781. $tmpCheck = false;
  44782. $tmpDir = sys_get_temp_dir();
  44783. $lastError = 'unknown reason';
  44784. set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
  44785. for ($i = 0;; ++$i) {
  44786. foreach ($pipes as $pipe => $name) {
  44787. $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
  44788. if (file_exists($file) && !unlink($file)) {
  44789. continue 2;
  44790. }
  44791. $h = fopen($file, 'xb');
  44792. if (!$h) {
  44793. $error = $lastError;
  44794. if ($tmpCheck || $tmpCheck = unlink(tempnam(false, 'sf_check_'))) {
  44795. continue;
  44796. }
  44797. restore_error_handler();
  44798. throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $error));
  44799. }
  44800. if (!$h || !$this->fileHandles[$pipe] = fopen($file, 'rb')) {
  44801. continue 2;
  44802. }
  44803. if (isset($this->files[$pipe])) {
  44804. unlink($this->files[$pipe]);
  44805. }
  44806. $this->files[$pipe] = $file;
  44807. }
  44808. break;
  44809. }
  44810. restore_error_handler();
  44811. }
  44812. parent::__construct($input);
  44813. }
  44814. public function __destruct()
  44815. {
  44816. $this->close();
  44817. $this->removeFiles();
  44818. }
  44819. public function getDescriptors()
  44820. {
  44821. if ($this->disableOutput) {
  44822. $nullstream = fopen('NUL', 'c');
  44823. return array(
  44824. array('pipe', 'r'),
  44825. $nullstream,
  44826. $nullstream,
  44827. );
  44828. }
  44829. return array(
  44830. array('pipe', 'r'),
  44831. array('file', 'NUL', 'w'),
  44832. array('file', 'NUL', 'w'),
  44833. );
  44834. }
  44835. public function getFiles()
  44836. {
  44837. return $this->files;
  44838. }
  44839. public function readAndWrite($blocking, $close = false)
  44840. {
  44841. $this->unblock();
  44842. $w = $this->write();
  44843. $read = $r = $e = array();
  44844. if ($blocking) {
  44845. if ($w) {
  44846. @stream_select($r, $w, $e, 0, Process::TIMEOUT_PRECISION * 1E6);
  44847. } elseif ($this->fileHandles) {
  44848. usleep(Process::TIMEOUT_PRECISION * 1E6);
  44849. }
  44850. }
  44851. foreach ($this->fileHandles as $type => $fileHandle) {
  44852. $data = stream_get_contents($fileHandle, -1, $this->readBytes[$type]);
  44853. if (isset($data[0])) {
  44854. $this->readBytes[$type] += strlen($data);
  44855. $read[$type] = $data;
  44856. }
  44857. if ($close) {
  44858. fclose($fileHandle);
  44859. unset($this->fileHandles[$type]);
  44860. }
  44861. }
  44862. return $read;
  44863. }
  44864. public function areOpen()
  44865. {
  44866. return $this->pipes && $this->fileHandles;
  44867. }
  44868. public function close()
  44869. {
  44870. parent::close();
  44871. foreach ($this->fileHandles as $handle) {
  44872. fclose($handle);
  44873. }
  44874. $this->fileHandles = array();
  44875. }
  44876. public static function create(Process $process, $input)
  44877. {
  44878. return new static($process->isOutputDisabled(), $input);
  44879. }
  44880. private function removeFiles()
  44881. {
  44882. foreach ($this->files as $filename) {
  44883. if (file_exists($filename)) {
  44884. @unlink($filename);
  44885. }
  44886. }
  44887. $this->files = array();
  44888. }
  44889. }
  44890. <?php
  44891. namespace Symfony\Component\Process;
  44892. use Symfony\Component\Process\Exception\InvalidArgumentException;
  44893. use Symfony\Component\Process\Exception\LogicException;
  44894. use Symfony\Component\Process\Exception\ProcessFailedException;
  44895. use Symfony\Component\Process\Exception\ProcessTimedOutException;
  44896. use Symfony\Component\Process\Exception\RuntimeException;
  44897. use Symfony\Component\Process\Pipes\PipesInterface;
  44898. use Symfony\Component\Process\Pipes\UnixPipes;
  44899. use Symfony\Component\Process\Pipes\WindowsPipes;
  44900. class Process
  44901. {
  44902. const ERR = 'err';
  44903. const OUT = 'out';
  44904. const STATUS_READY = 'ready';
  44905. const STATUS_STARTED = 'started';
  44906. const STATUS_TERMINATED = 'terminated';
  44907. const STDIN = 0;
  44908. const STDOUT = 1;
  44909. const STDERR = 2;
  44910. const TIMEOUT_PRECISION = 0.2;
  44911. private $callback;
  44912. private $commandline;
  44913. private $cwd;
  44914. private $env;
  44915. private $input;
  44916. private $starttime;
  44917. private $lastOutputTime;
  44918. private $timeout;
  44919. private $idleTimeout;
  44920. private $options;
  44921. private $exitcode;
  44922. private $fallbackStatus = array();
  44923. private $processInformation;
  44924. private $outputDisabled = false;
  44925. private $stdout;
  44926. private $stderr;
  44927. private $enhanceWindowsCompatibility = true;
  44928. private $enhanceSigchildCompatibility;
  44929. private $process;
  44930. private $status = self::STATUS_READY;
  44931. private $incrementalOutputOffset = 0;
  44932. private $incrementalErrorOutputOffset = 0;
  44933. private $tty;
  44934. private $pty;
  44935. private $useFileHandles = false;
  44936. private $processPipes;
  44937. private $latestSignal;
  44938. private static $sigchild;
  44939. public static $exitCodes = array(
  44940. 0 => 'OK',
  44941. 1 => 'General error',
  44942. 2 => 'Misuse of shell builtins',
  44943. 126 => 'Invoked command cannot execute',
  44944. 127 => 'Command not found',
  44945. 128 => 'Invalid exit argument',
  44946. 129 => 'Hangup',
  44947. 130 => 'Interrupt',
  44948. 131 => 'Quit and dump core',
  44949. 132 => 'Illegal instruction',
  44950. 133 => 'Trace/breakpoint trap',
  44951. 134 => 'Process aborted',
  44952. 135 => 'Bus error: "access to undefined portion of memory object"',
  44953. 136 => 'Floating point exception: "erroneous arithmetic operation"',
  44954. 137 => 'Kill (terminate immediately)',
  44955. 138 => 'User-defined 1',
  44956. 139 => 'Segmentation violation',
  44957. 140 => 'User-defined 2',
  44958. 141 => 'Write to pipe with no one reading',
  44959. 142 => 'Signal raised by alarm',
  44960. 143 => 'Termination (request to terminate)',
  44961. 145 => 'Child process terminated, stopped (or continued*)',
  44962. 146 => 'Continue if stopped',
  44963. 147 => 'Stop executing temporarily',
  44964. 148 => 'Terminal stop signal',
  44965. 149 => 'Background process attempting to read from tty ("in")',
  44966. 150 => 'Background process attempting to write to tty ("out")',
  44967. 151 => 'Urgent data available on socket',
  44968. 152 => 'CPU time limit exceeded',
  44969. 153 => 'File size limit exceeded',
  44970. 154 => 'Signal raised by timer counting virtual time: "virtual timer expired"',
  44971. 155 => 'Profiling timer expired',
  44972. 157 => 'Pollable event',
  44973. 159 => 'Bad syscall',
  44974. );
  44975. public function __construct($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = array())
  44976. {
  44977. if (!function_exists('proc_open')) {
  44978. throw new RuntimeException('The Process class relies on proc_open, which is not available on your PHP installation.');
  44979. }
  44980. $this->commandline = $commandline;
  44981. $this->cwd = $cwd;
  44982. if (null === $this->cwd && (defined('ZEND_THREAD_SAFE') || '\\' === DIRECTORY_SEPARATOR)) {
  44983. $this->cwd = getcwd();
  44984. }
  44985. if (null !== $env) {
  44986. $this->setEnv($env);
  44987. }
  44988. $this->setInput($input);
  44989. $this->setTimeout($timeout);
  44990. $this->useFileHandles = '\\' === DIRECTORY_SEPARATOR;
  44991. $this->pty = false;
  44992. $this->enhanceSigchildCompatibility = '\\' !== DIRECTORY_SEPARATOR && $this->isSigchildEnabled();
  44993. $this->options = array_replace(array('suppress_errors' => true, 'binary_pipes' => true), $options);
  44994. }
  44995. public function __destruct()
  44996. {
  44997. $this->stop(0);
  44998. }
  44999. public function __clone()
  45000. {
  45001. $this->resetProcessData();
  45002. }
  45003. public function run($callback = null)
  45004. {
  45005. $this->start($callback);
  45006. return $this->wait();
  45007. }
  45008. public function mustRun($callback = null)
  45009. {
  45010. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  45011. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  45012. }
  45013. if (0 !== $this->run($callback)) {
  45014. throw new ProcessFailedException($this);
  45015. }
  45016. return $this;
  45017. }
  45018. public function start($callback = null)
  45019. {
  45020. if ($this->isRunning()) {
  45021. throw new RuntimeException('Process is already running');
  45022. }
  45023. if ($this->outputDisabled && null !== $callback) {
  45024. throw new LogicException('Output has been disabled, enable it to allow the use of a callback.');
  45025. }
  45026. $this->resetProcessData();
  45027. $this->starttime = $this->lastOutputTime = microtime(true);
  45028. $this->callback = $this->buildCallback($callback);
  45029. $descriptors = $this->getDescriptors();
  45030. $commandline = $this->commandline;
  45031. if ('\\' === DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) {
  45032. $commandline = 'cmd /V:ON /E:ON /D /C "('.$commandline.')';
  45033. foreach ($this->processPipes->getFiles() as $offset => $filename) {
  45034. $commandline .= ' '.$offset.'>'.ProcessUtils::escapeArgument($filename);
  45035. }
  45036. $commandline .= '"';
  45037. if (!isset($this->options['bypass_shell'])) {
  45038. $this->options['bypass_shell'] = true;
  45039. }
  45040. } elseif (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  45041. $descriptors[3] = array('pipe', 'w');
  45042. $commandline = '{ ('.$this->commandline.') <&3 3<&- 3>/dev/null & } 3<&0;';
  45043. $commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code';
  45044. $ptsWorkaround = fopen(__FILE__, 'r');
  45045. }
  45046. $this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $this->env, $this->options);
  45047. if (!is_resource($this->process)) {
  45048. throw new RuntimeException('Unable to launch a new process.');
  45049. }
  45050. $this->status = self::STATUS_STARTED;
  45051. if (isset($descriptors[3])) {
  45052. $this->fallbackStatus['pid'] = (int) fgets($this->processPipes->pipes[3]);
  45053. }
  45054. if ($this->tty) {
  45055. return;
  45056. }
  45057. $this->updateStatus(false);
  45058. $this->checkTimeout();
  45059. }
  45060. public function restart($callback = null)
  45061. {
  45062. if ($this->isRunning()) {
  45063. throw new RuntimeException('Process is already running');
  45064. }
  45065. $process = clone $this;
  45066. $process->start($callback);
  45067. return $process;
  45068. }
  45069. public function wait($callback = null)
  45070. {
  45071. $this->requireProcessIsStarted(__FUNCTION__);
  45072. $this->updateStatus(false);
  45073. if (null !== $callback) {
  45074. $this->callback = $this->buildCallback($callback);
  45075. }
  45076. do {
  45077. $this->checkTimeout();
  45078. $running = '\\' === DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
  45079. $this->readPipes($running, '\\' !== DIRECTORY_SEPARATOR || !$running);
  45080. } while ($running);
  45081. while ($this->isRunning()) {
  45082. usleep(1000);
  45083. }
  45084. if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
  45085. throw new RuntimeException(sprintf('The process has been signaled with signal "%s".', $this->processInformation['termsig']));
  45086. }
  45087. return $this->exitcode;
  45088. }
  45089. public function getPid()
  45090. {
  45091. return $this->isRunning() ? $this->processInformation['pid'] : null;
  45092. }
  45093. public function signal($signal)
  45094. {
  45095. $this->doSignal($signal, true);
  45096. return $this;
  45097. }
  45098. public function disableOutput()
  45099. {
  45100. if ($this->isRunning()) {
  45101. throw new RuntimeException('Disabling output while the process is running is not possible.');
  45102. }
  45103. if (null !== $this->idleTimeout) {
  45104. throw new LogicException('Output can not be disabled while an idle timeout is set.');
  45105. }
  45106. $this->outputDisabled = true;
  45107. return $this;
  45108. }
  45109. public function enableOutput()
  45110. {
  45111. if ($this->isRunning()) {
  45112. throw new RuntimeException('Enabling output while the process is running is not possible.');
  45113. }
  45114. $this->outputDisabled = false;
  45115. return $this;
  45116. }
  45117. public function isOutputDisabled()
  45118. {
  45119. return $this->outputDisabled;
  45120. }
  45121. public function getOutput()
  45122. {
  45123. $this->readPipesForOutput(__FUNCTION__);
  45124. if (false === $ret = stream_get_contents($this->stdout, -1, 0)) {
  45125. return '';
  45126. }
  45127. return $ret;
  45128. }
  45129. public function getIncrementalOutput()
  45130. {
  45131. $this->readPipesForOutput(__FUNCTION__);
  45132. $latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
  45133. $this->incrementalOutputOffset = ftell($this->stdout);
  45134. if (false === $latest) {
  45135. return '';
  45136. }
  45137. return $latest;
  45138. }
  45139. public function clearOutput()
  45140. {
  45141. ftruncate($this->stdout, 0);
  45142. fseek($this->stdout, 0);
  45143. $this->incrementalOutputOffset = 0;
  45144. return $this;
  45145. }
  45146. public function getErrorOutput()
  45147. {
  45148. $this->readPipesForOutput(__FUNCTION__);
  45149. if (false === $ret = stream_get_contents($this->stderr, -1, 0)) {
  45150. return '';
  45151. }
  45152. return $ret;
  45153. }
  45154. public function getIncrementalErrorOutput()
  45155. {
  45156. $this->readPipesForOutput(__FUNCTION__);
  45157. $latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
  45158. $this->incrementalErrorOutputOffset = ftell($this->stderr);
  45159. if (false === $latest) {
  45160. return '';
  45161. }
  45162. return $latest;
  45163. }
  45164. public function clearErrorOutput()
  45165. {
  45166. ftruncate($this->stderr, 0);
  45167. fseek($this->stderr, 0);
  45168. $this->incrementalErrorOutputOffset = 0;
  45169. return $this;
  45170. }
  45171. public function getExitCode()
  45172. {
  45173. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  45174. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  45175. }
  45176. $this->updateStatus(false);
  45177. return $this->exitcode;
  45178. }
  45179. public function getExitCodeText()
  45180. {
  45181. if (null === $exitcode = $this->getExitCode()) {
  45182. return;
  45183. }
  45184. return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error';
  45185. }
  45186. public function isSuccessful()
  45187. {
  45188. return 0 === $this->getExitCode();
  45189. }
  45190. public function hasBeenSignaled()
  45191. {
  45192. $this->requireProcessIsTerminated(__FUNCTION__);
  45193. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  45194. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  45195. }
  45196. return $this->processInformation['signaled'];
  45197. }
  45198. public function getTermSignal()
  45199. {
  45200. $this->requireProcessIsTerminated(__FUNCTION__);
  45201. if ($this->isSigchildEnabled() && (!$this->enhanceSigchildCompatibility || -1 === $this->processInformation['termsig'])) {
  45202. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  45203. }
  45204. return $this->processInformation['termsig'];
  45205. }
  45206. public function hasBeenStopped()
  45207. {
  45208. $this->requireProcessIsTerminated(__FUNCTION__);
  45209. return $this->processInformation['stopped'];
  45210. }
  45211. public function getStopSignal()
  45212. {
  45213. $this->requireProcessIsTerminated(__FUNCTION__);
  45214. return $this->processInformation['stopsig'];
  45215. }
  45216. public function isRunning()
  45217. {
  45218. if (self::STATUS_STARTED !== $this->status) {
  45219. return false;
  45220. }
  45221. $this->updateStatus(false);
  45222. return $this->processInformation['running'];
  45223. }
  45224. public function isStarted()
  45225. {
  45226. return self::STATUS_READY != $this->status;
  45227. }
  45228. public function isTerminated()
  45229. {
  45230. $this->updateStatus(false);
  45231. return self::STATUS_TERMINATED == $this->status;
  45232. }
  45233. public function getStatus()
  45234. {
  45235. $this->updateStatus(false);
  45236. return $this->status;
  45237. }
  45238. public function stop($timeout = 10, $signal = null)
  45239. {
  45240. $timeoutMicro = microtime(true) + $timeout;
  45241. if ($this->isRunning()) {
  45242. $this->doSignal(15, false);
  45243. do {
  45244. usleep(1000);
  45245. } while ($this->isRunning() && microtime(true) < $timeoutMicro);
  45246. if ($this->isRunning()) {
  45247. $this->doSignal($signal ?: 9, false);
  45248. }
  45249. }
  45250. if ($this->isRunning()) {
  45251. if (isset($this->fallbackStatus['pid'])) {
  45252. unset($this->fallbackStatus['pid']);
  45253. return $this->stop(0, $signal);
  45254. }
  45255. $this->close();
  45256. }
  45257. return $this->exitcode;
  45258. }
  45259. public function addOutput($line)
  45260. {
  45261. $this->lastOutputTime = microtime(true);
  45262. fseek($this->stdout, 0, SEEK_END);
  45263. fwrite($this->stdout, $line);
  45264. fseek($this->stdout, $this->incrementalOutputOffset);
  45265. }
  45266. public function addErrorOutput($line)
  45267. {
  45268. $this->lastOutputTime = microtime(true);
  45269. fseek($this->stderr, 0, SEEK_END);
  45270. fwrite($this->stderr, $line);
  45271. fseek($this->stderr, $this->incrementalErrorOutputOffset);
  45272. }
  45273. public function getCommandLine()
  45274. {
  45275. return $this->commandline;
  45276. }
  45277. public function setCommandLine($commandline)
  45278. {
  45279. $this->commandline = $commandline;
  45280. return $this;
  45281. }
  45282. public function getTimeout()
  45283. {
  45284. return $this->timeout;
  45285. }
  45286. public function getIdleTimeout()
  45287. {
  45288. return $this->idleTimeout;
  45289. }
  45290. public function setTimeout($timeout)
  45291. {
  45292. $this->timeout = $this->validateTimeout($timeout);
  45293. return $this;
  45294. }
  45295. public function setIdleTimeout($timeout)
  45296. {
  45297. if (null !== $timeout && $this->outputDisabled) {
  45298. throw new LogicException('Idle timeout can not be set while the output is disabled.');
  45299. }
  45300. $this->idleTimeout = $this->validateTimeout($timeout);
  45301. return $this;
  45302. }
  45303. public function setTty($tty)
  45304. {
  45305. if ('\\' === DIRECTORY_SEPARATOR && $tty) {
  45306. throw new RuntimeException('TTY mode is not supported on Windows platform.');
  45307. }
  45308. if ($tty) {
  45309. static $isTtySupported;
  45310. if (null === $isTtySupported) {
  45311. $isTtySupported = (bool) @proc_open('echo 1 >/dev/null', array(array('file', '/dev/tty', 'r'), array('file', '/dev/tty', 'w'), array('file', '/dev/tty', 'w')), $pipes);
  45312. }
  45313. if (!$isTtySupported) {
  45314. throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
  45315. }
  45316. }
  45317. $this->tty = (bool) $tty;
  45318. return $this;
  45319. }
  45320. public function isTty()
  45321. {
  45322. return $this->tty;
  45323. }
  45324. public function setPty($bool)
  45325. {
  45326. $this->pty = (bool) $bool;
  45327. return $this;
  45328. }
  45329. public function isPty()
  45330. {
  45331. return $this->pty;
  45332. }
  45333. public function getWorkingDirectory()
  45334. {
  45335. if (null === $this->cwd) {
  45336. return getcwd() ?: null;
  45337. }
  45338. return $this->cwd;
  45339. }
  45340. public function setWorkingDirectory($cwd)
  45341. {
  45342. $this->cwd = $cwd;
  45343. return $this;
  45344. }
  45345. public function getEnv()
  45346. {
  45347. return $this->env;
  45348. }
  45349. public function setEnv(array $env)
  45350. {
  45351. $env = array_filter($env, function ($value) {
  45352. return !is_array($value);
  45353. });
  45354. $this->env = array();
  45355. foreach ($env as $key => $value) {
  45356. $this->env[$key] = (string) $value;
  45357. }
  45358. return $this;
  45359. }
  45360. public function getStdin()
  45361. {
  45362. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0. Use the getInput() method instead.', E_USER_DEPRECATED);
  45363. return $this->getInput();
  45364. }
  45365. public function getInput()
  45366. {
  45367. return $this->input;
  45368. }
  45369. public function setStdin($stdin)
  45370. {
  45371. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0. Use the setInput() method instead.', E_USER_DEPRECATED);
  45372. return $this->setInput($stdin);
  45373. }
  45374. public function setInput($input)
  45375. {
  45376. if ($this->isRunning()) {
  45377. throw new LogicException('Input can not be set while the process is running.');
  45378. }
  45379. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  45380. return $this;
  45381. }
  45382. public function getOptions()
  45383. {
  45384. return $this->options;
  45385. }
  45386. public function setOptions(array $options)
  45387. {
  45388. $this->options = $options;
  45389. return $this;
  45390. }
  45391. public function getEnhanceWindowsCompatibility()
  45392. {
  45393. return $this->enhanceWindowsCompatibility;
  45394. }
  45395. public function setEnhanceWindowsCompatibility($enhance)
  45396. {
  45397. $this->enhanceWindowsCompatibility = (bool) $enhance;
  45398. return $this;
  45399. }
  45400. public function getEnhanceSigchildCompatibility()
  45401. {
  45402. return $this->enhanceSigchildCompatibility;
  45403. }
  45404. public function setEnhanceSigchildCompatibility($enhance)
  45405. {
  45406. $this->enhanceSigchildCompatibility = (bool) $enhance;
  45407. return $this;
  45408. }
  45409. public function checkTimeout()
  45410. {
  45411. if (self::STATUS_STARTED !== $this->status) {
  45412. return;
  45413. }
  45414. if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
  45415. $this->stop(0);
  45416. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
  45417. }
  45418. if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
  45419. $this->stop(0);
  45420. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_IDLE);
  45421. }
  45422. }
  45423. public static function isPtySupported()
  45424. {
  45425. static $result;
  45426. if (null !== $result) {
  45427. return $result;
  45428. }
  45429. if ('\\' === DIRECTORY_SEPARATOR) {
  45430. return $result = false;
  45431. }
  45432. return $result = (bool) @proc_open('echo 1 >/dev/null', array(array('pty'), array('pty'), array('pty')), $pipes);
  45433. }
  45434. private function getDescriptors()
  45435. {
  45436. if ('\\' === DIRECTORY_SEPARATOR) {
  45437. $this->processPipes = WindowsPipes::create($this, $this->input);
  45438. } else {
  45439. $this->processPipes = UnixPipes::create($this, $this->input);
  45440. }
  45441. return $this->processPipes->getDescriptors();
  45442. }
  45443. protected function buildCallback($callback)
  45444. {
  45445. $that = $this;
  45446. $out = self::OUT;
  45447. $callback = function ($type, $data) use ($that, $callback, $out) {
  45448. if ($out == $type) {
  45449. $that->addOutput($data);
  45450. } else {
  45451. $that->addErrorOutput($data);
  45452. }
  45453. if (null !== $callback) {
  45454. call_user_func($callback, $type, $data);
  45455. }
  45456. };
  45457. return $callback;
  45458. }
  45459. protected function updateStatus($blocking)
  45460. {
  45461. if (self::STATUS_STARTED !== $this->status) {
  45462. return;
  45463. }
  45464. $this->processInformation = proc_get_status($this->process);
  45465. $running = $this->processInformation['running'];
  45466. $this->readPipes($running && $blocking, '\\' !== DIRECTORY_SEPARATOR || !$running);
  45467. if ($this->fallbackStatus && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  45468. $this->processInformation = $this->fallbackStatus + $this->processInformation;
  45469. }
  45470. if (!$running) {
  45471. $this->close();
  45472. }
  45473. }
  45474. protected function isSigchildEnabled()
  45475. {
  45476. if (null !== self::$sigchild) {
  45477. return self::$sigchild;
  45478. }
  45479. if (!function_exists('phpinfo') || defined('HHVM_VERSION')) {
  45480. return self::$sigchild = false;
  45481. }
  45482. ob_start();
  45483. phpinfo(INFO_GENERAL);
  45484. return self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild');
  45485. }
  45486. private function readPipesForOutput($caller)
  45487. {
  45488. if ($this->outputDisabled) {
  45489. throw new LogicException('Output has been disabled.');
  45490. }
  45491. $this->requireProcessIsStarted($caller);
  45492. $this->updateStatus(false);
  45493. }
  45494. private function validateTimeout($timeout)
  45495. {
  45496. $timeout = (float) $timeout;
  45497. if (0.0 === $timeout) {
  45498. $timeout = null;
  45499. } elseif ($timeout < 0) {
  45500. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  45501. }
  45502. return $timeout;
  45503. }
  45504. private function readPipes($blocking, $close)
  45505. {
  45506. $result = $this->processPipes->readAndWrite($blocking, $close);
  45507. $callback = $this->callback;
  45508. foreach ($result as $type => $data) {
  45509. if (3 !== $type) {
  45510. $callback(self::STDOUT === $type ? self::OUT : self::ERR, $data);
  45511. } elseif (!isset($this->fallbackStatus['signaled'])) {
  45512. $this->fallbackStatus['exitcode'] = (int) $data;
  45513. }
  45514. }
  45515. }
  45516. private function close()
  45517. {
  45518. $this->processPipes->close();
  45519. if (is_resource($this->process)) {
  45520. proc_close($this->process);
  45521. }
  45522. $this->exitcode = $this->processInformation['exitcode'];
  45523. $this->status = self::STATUS_TERMINATED;
  45524. if (-1 === $this->exitcode) {
  45525. if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) {
  45526. $this->exitcode = 128 + $this->processInformation['termsig'];
  45527. } elseif ($this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  45528. $this->processInformation['signaled'] = true;
  45529. $this->processInformation['termsig'] = -1;
  45530. }
  45531. }
  45532. $this->callback = null;
  45533. return $this->exitcode;
  45534. }
  45535. private function resetProcessData()
  45536. {
  45537. $this->starttime = null;
  45538. $this->callback = null;
  45539. $this->exitcode = null;
  45540. $this->fallbackStatus = array();
  45541. $this->processInformation = null;
  45542. $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'wb+');
  45543. $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'wb+');
  45544. $this->process = null;
  45545. $this->latestSignal = null;
  45546. $this->status = self::STATUS_READY;
  45547. $this->incrementalOutputOffset = 0;
  45548. $this->incrementalErrorOutputOffset = 0;
  45549. }
  45550. private function doSignal($signal, $throwException)
  45551. {
  45552. if (null === $pid = $this->getPid()) {
  45553. if ($throwException) {
  45554. throw new LogicException('Can not send signal on a non running process.');
  45555. }
  45556. return false;
  45557. }
  45558. if ('\\' === DIRECTORY_SEPARATOR) {
  45559. exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
  45560. if ($exitCode && $this->isRunning()) {
  45561. if ($throwException) {
  45562. throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
  45563. }
  45564. return false;
  45565. }
  45566. } else {
  45567. if (!$this->enhanceSigchildCompatibility || !$this->isSigchildEnabled()) {
  45568. $ok = @proc_terminate($this->process, $signal);
  45569. } elseif (function_exists('posix_kill')) {
  45570. $ok = @posix_kill($pid, $signal);
  45571. } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), array(2 => array('pipe', 'w')), $pipes)) {
  45572. $ok = false === fgets($pipes[2]);
  45573. }
  45574. if (!$ok) {
  45575. if ($throwException) {
  45576. throw new RuntimeException(sprintf('Error while sending signal `%s`.', $signal));
  45577. }
  45578. return false;
  45579. }
  45580. }
  45581. $this->latestSignal = (int) $signal;
  45582. $this->fallbackStatus['signaled'] = true;
  45583. $this->fallbackStatus['exitcode'] = -1;
  45584. $this->fallbackStatus['termsig'] = $this->latestSignal;
  45585. return true;
  45586. }
  45587. private function requireProcessIsStarted($functionName)
  45588. {
  45589. if (!$this->isStarted()) {
  45590. throw new LogicException(sprintf('Process must be started before calling %s.', $functionName));
  45591. }
  45592. }
  45593. private function requireProcessIsTerminated($functionName)
  45594. {
  45595. if (!$this->isTerminated()) {
  45596. throw new LogicException(sprintf('Process must be terminated before calling %s.', $functionName));
  45597. }
  45598. }
  45599. }
  45600. <?php
  45601. namespace Symfony\Component\Process;
  45602. use Symfony\Component\Process\Exception\InvalidArgumentException;
  45603. use Symfony\Component\Process\Exception\LogicException;
  45604. class ProcessBuilder
  45605. {
  45606. private $arguments;
  45607. private $cwd;
  45608. private $env = array();
  45609. private $input;
  45610. private $timeout = 60;
  45611. private $options = array();
  45612. private $inheritEnv = true;
  45613. private $prefix = array();
  45614. private $outputDisabled = false;
  45615. public function __construct(array $arguments = array())
  45616. {
  45617. $this->arguments = $arguments;
  45618. }
  45619. public static function create(array $arguments = array())
  45620. {
  45621. return new static($arguments);
  45622. }
  45623. public function add($argument)
  45624. {
  45625. $this->arguments[] = $argument;
  45626. return $this;
  45627. }
  45628. public function setPrefix($prefix)
  45629. {
  45630. $this->prefix = is_array($prefix) ? $prefix : array($prefix);
  45631. return $this;
  45632. }
  45633. public function setArguments(array $arguments)
  45634. {
  45635. $this->arguments = $arguments;
  45636. return $this;
  45637. }
  45638. public function setWorkingDirectory($cwd)
  45639. {
  45640. $this->cwd = $cwd;
  45641. return $this;
  45642. }
  45643. public function inheritEnvironmentVariables($inheritEnv = true)
  45644. {
  45645. $this->inheritEnv = $inheritEnv;
  45646. return $this;
  45647. }
  45648. public function setEnv($name, $value)
  45649. {
  45650. $this->env[$name] = $value;
  45651. return $this;
  45652. }
  45653. public function addEnvironmentVariables(array $variables)
  45654. {
  45655. $this->env = array_replace($this->env, $variables);
  45656. return $this;
  45657. }
  45658. public function setInput($input)
  45659. {
  45660. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  45661. return $this;
  45662. }
  45663. public function setTimeout($timeout)
  45664. {
  45665. if (null === $timeout) {
  45666. $this->timeout = null;
  45667. return $this;
  45668. }
  45669. $timeout = (float) $timeout;
  45670. if ($timeout < 0) {
  45671. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  45672. }
  45673. $this->timeout = $timeout;
  45674. return $this;
  45675. }
  45676. public function setOption($name, $value)
  45677. {
  45678. $this->options[$name] = $value;
  45679. return $this;
  45680. }
  45681. public function disableOutput()
  45682. {
  45683. $this->outputDisabled = true;
  45684. return $this;
  45685. }
  45686. public function enableOutput()
  45687. {
  45688. $this->outputDisabled = false;
  45689. return $this;
  45690. }
  45691. public function getProcess()
  45692. {
  45693. if (0 === count($this->prefix) && 0 === count($this->arguments)) {
  45694. throw new LogicException('You must add() command arguments before calling getProcess().');
  45695. }
  45696. $options = $this->options;
  45697. $arguments = array_merge($this->prefix, $this->arguments);
  45698. $script = implode(' ', array_map(array(__NAMESPACE__.'\\ProcessUtils', 'escapeArgument'), $arguments));
  45699. if ($this->inheritEnv) {
  45700. $env = array_replace($_ENV, $_SERVER, $this->env);
  45701. } else {
  45702. $env = $this->env;
  45703. }
  45704. $process = new Process($script, $this->cwd, $env, $this->input, $this->timeout, $options);
  45705. if ($this->outputDisabled) {
  45706. $process->disableOutput();
  45707. }
  45708. return $process;
  45709. }
  45710. }
  45711. <?php
  45712. namespace Symfony\Component\Process;
  45713. use Symfony\Component\Process\Exception\InvalidArgumentException;
  45714. class ProcessUtils
  45715. {
  45716. private function __construct()
  45717. {
  45718. }
  45719. public static function escapeArgument($argument)
  45720. {
  45721. if ('\\' === DIRECTORY_SEPARATOR) {
  45722. if ('' === $argument) {
  45723. return escapeshellarg($argument);
  45724. }
  45725. $escapedArgument = '';
  45726. $quote = false;
  45727. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  45728. if ('"' === $part) {
  45729. $escapedArgument .= '\\"';
  45730. } elseif (self::isSurroundedBy($part, '%')) {
  45731. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  45732. } else {
  45733. if ('\\' === substr($part, -1)) {
  45734. $part .= '\\';
  45735. }
  45736. $quote = true;
  45737. $escapedArgument .= $part;
  45738. }
  45739. }
  45740. if ($quote) {
  45741. $escapedArgument = '"'.$escapedArgument.'"';
  45742. }
  45743. return $escapedArgument;
  45744. }
  45745. return "'".str_replace("'", "'\\''", $argument)."'";
  45746. }
  45747. public static function validateInput($caller, $input)
  45748. {
  45749. if (null !== $input) {
  45750. if (is_resource($input)) {
  45751. return $input;
  45752. }
  45753. if (is_string($input)) {
  45754. return $input;
  45755. }
  45756. if (is_scalar($input)) {
  45757. return (string) $input;
  45758. }
  45759. if (is_object($input) && method_exists($input, '__toString')) {
  45760. @trigger_error('Passing an object as an input is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  45761. return (string) $input;
  45762. }
  45763. throw new InvalidArgumentException(sprintf('%s only accepts strings or stream resources.', $caller));
  45764. }
  45765. return $input;
  45766. }
  45767. private static function isSurroundedBy($arg, $char)
  45768. {
  45769. return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
  45770. }
  45771. }
  45772. Copyright (c) 2011 Jordi Boggiano
  45773. Permission is hereby granted, free of charge, to any person obtaining a copy
  45774. of this software and associated documentation files (the "Software"), to deal
  45775. in the Software without restriction, including without limitation the rights
  45776. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  45777. copies of the Software, and to permit persons to whom the Software is furnished
  45778. to do so, subject to the following conditions:
  45779. The above copyright notice and this permission notice shall be included in all
  45780. copies or substantial portions of the Software.
  45781. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  45782. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  45783. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  45784. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  45785. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  45786. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  45787. THE SOFTWARE.
  45788. <?php
  45789. namespace Seld\JsonLint;
  45790. class DuplicateKeyException extends ParsingException
  45791. {
  45792. public function __construct($message, $key, array $details = array())
  45793. {
  45794. $details['key'] = $key;
  45795. parent::__construct($message, $details);
  45796. }
  45797. public function getKey()
  45798. {
  45799. return $this->details['key'];
  45800. }
  45801. }
  45802. <?php
  45803. namespace Seld\JsonLint;
  45804. use stdClass;
  45805. class JsonParser
  45806. {
  45807. const DETECT_KEY_CONFLICTS = 1;
  45808. const ALLOW_DUPLICATE_KEYS = 2;
  45809. const PARSE_TO_ASSOC = 4;
  45810. private $lexer;
  45811. private $flags;
  45812. private $stack;
  45813. private $vstack;
  45814. private $lstack;
  45815. private $symbols = array(
  45816. 'error' => 2,
  45817. 'JSONString' => 3,
  45818. 'STRING' => 4,
  45819. 'JSONNumber' => 5,
  45820. 'NUMBER' => 6,
  45821. 'JSONNullLiteral' => 7,
  45822. 'NULL' => 8,
  45823. 'JSONBooleanLiteral' => 9,
  45824. 'TRUE' => 10,
  45825. 'FALSE' => 11,
  45826. 'JSONText' => 12,
  45827. 'JSONValue' => 13,
  45828. 'EOF' => 14,
  45829. 'JSONObject' => 15,
  45830. 'JSONArray' => 16,
  45831. '{' => 17,
  45832. '}' => 18,
  45833. 'JSONMemberList' => 19,
  45834. 'JSONMember' => 20,
  45835. ':' => 21,
  45836. ',' => 22,
  45837. '[' => 23,
  45838. ']' => 24,
  45839. 'JSONElementList' => 25,
  45840. '$accept' => 0,
  45841. '$end' => 1,
  45842. );
  45843. private $terminals_ = array(
  45844. 2 => "error",
  45845. 4 => "STRING",
  45846. 6 => "NUMBER",
  45847. 8 => "NULL",
  45848. 10 => "TRUE",
  45849. 11 => "FALSE",
  45850. 14 => "EOF",
  45851. 17 => "{",
  45852. 18 => "}",
  45853. 21 => ":",
  45854. 22 => ",",
  45855. 23 => "[",
  45856. 24 => "]",
  45857. );
  45858. private $productions_ = array(
  45859. 0,
  45860. array(3, 1),
  45861. array(5, 1),
  45862. array(7, 1),
  45863. array(9, 1),
  45864. array(9, 1),
  45865. array(12, 2),
  45866. array(13, 1),
  45867. array(13, 1),
  45868. array(13, 1),
  45869. array(13, 1),
  45870. array(13, 1),
  45871. array(13, 1),
  45872. array(15, 2),
  45873. array(15, 3),
  45874. array(20, 3),
  45875. array(19, 1),
  45876. array(19, 3),
  45877. array(16, 2),
  45878. array(16, 3),
  45879. array(25, 1),
  45880. array(25, 3)
  45881. );
  45882. private $table = array(array(3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 12 => 1, 13 => 2, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 1 => array(3)), array( 14 => array(1,16)), array( 14 => array(2,7), 18 => array(2,7), 22 => array(2,7), 24 => array(2,7)), array( 14 => array(2,8), 18 => array(2,8), 22 => array(2,8), 24 => array(2,8)), array( 14 => array(2,9), 18 => array(2,9), 22 => array(2,9), 24 => array(2,9)), array( 14 => array(2,10), 18 => array(2,10), 22 => array(2,10), 24 => array(2,10)), array( 14 => array(2,11), 18 => array(2,11), 22 => array(2,11), 24 => array(2,11)), array( 14 => array(2,12), 18 => array(2,12), 22 => array(2,12), 24 => array(2,12)), array( 14 => array(2,3), 18 => array(2,3), 22 => array(2,3), 24 => array(2,3)), array( 14 => array(2,4), 18 => array(2,4), 22 => array(2,4), 24 => array(2,4)), array( 14 => array(2,5), 18 => array(2,5), 22 => array(2,5), 24 => array(2,5)), array( 14 => array(2,1), 18 => array(2,1), 21 => array(2,1), 22 => array(2,1), 24 => array(2,1)), array( 14 => array(2,2), 18 => array(2,2), 22 => array(2,2), 24 => array(2,2)), array( 3 => 20, 4 => array(1,12), 18 => array(1,17), 19 => 18, 20 => 19 ), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 23, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15), 24 => array(1,21), 25 => 22 ), array( 1 => array(2,6)), array( 14 => array(2,13), 18 => array(2,13), 22 => array(2,13), 24 => array(2,13)), array( 18 => array(1,24), 22 => array(1,25)), array( 18 => array(2,16), 22 => array(2,16)), array( 21 => array(1,26)), array( 14 => array(2,18), 18 => array(2,18), 22 => array(2,18), 24 => array(2,18)), array( 22 => array(1,28), 24 => array(1,27)), array( 22 => array(2,20), 24 => array(2,20)), array( 14 => array(2,14), 18 => array(2,14), 22 => array(2,14), 24 => array(2,14)), array( 3 => 20, 4 => array(1,12), 20 => 29 ), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 30, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 14 => array(2,19), 18 => array(2,19), 22 => array(2,19), 24 => array(2,19)), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 31, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 18 => array(2,17), 22 => array(2,17)), array( 18 => array(2,15), 22 => array(2,15)), array( 22 => array(2,21), 24 => array(2,21)),
  45883. );
  45884. private $defaultActions = array(
  45885. 16 => array(2, 6)
  45886. );
  45887. public function lint($input, $flags = 0)
  45888. {
  45889. try {
  45890. $this->parse($input, $flags);
  45891. } catch (ParsingException $e) {
  45892. return $e;
  45893. }
  45894. }
  45895. public function parse($input, $flags = 0)
  45896. {
  45897. $this->failOnBOM($input);
  45898. $this->flags = $flags;
  45899. $this->stack = array(0);
  45900. $this->vstack = array(null);
  45901. $this->lstack = array();
  45902. $yytext = '';
  45903. $yylineno = 0;
  45904. $yyleng = 0;
  45905. $recovering = 0;
  45906. $TERROR = 2;
  45907. $EOF = 1;
  45908. $this->lexer = new Lexer();
  45909. $this->lexer->setInput($input);
  45910. $yyloc = $this->lexer->yylloc;
  45911. $this->lstack[] = $yyloc;
  45912. $symbol = null;
  45913. $preErrorSymbol = null;
  45914. $state = null;
  45915. $action = null;
  45916. $a = null;
  45917. $r = null;
  45918. $yyval = new stdClass;
  45919. $p = null;
  45920. $len = null;
  45921. $newState = null;
  45922. $expected = null;
  45923. $errStr = null;
  45924. while (true) {
  45925. $state = $this->stack[count($this->stack)-1];
  45926. if (isset($this->defaultActions[$state])) {
  45927. $action = $this->defaultActions[$state];
  45928. } else {
  45929. if ($symbol == null) {
  45930. $symbol = $this->lex();
  45931. }
  45932. $action = isset($this->table[$state][$symbol]) ? $this->table[$state][$symbol] : false;
  45933. }
  45934. if (!$action || !$action[0]) {
  45935. if (!$recovering) {
  45936. $expected = array();
  45937. foreach ($this->table[$state] as $p => $ignore) {
  45938. if (isset($this->terminals_[$p]) && $p > 2) {
  45939. $expected[] = "'" . $this->terminals_[$p] . "'";
  45940. }
  45941. }
  45942. $message = null;
  45943. if (in_array("'STRING'", $expected) && in_array(substr($this->lexer->match, 0, 1), array('"', "'"))) {
  45944. $message = "Invalid string";
  45945. if ("'" === substr($this->lexer->match, 0, 1)) {
  45946. $message .= ", it appears you used single quotes instead of double quotes";
  45947. } elseif (preg_match('{".+?(\\\\[^"bfnrt/\\\\u])}', $this->lexer->getUpcomingInput(), $match)) {
  45948. $message .= ", it appears you have an unescaped backslash at: ".$match[1];
  45949. } elseif (preg_match('{"(?:[^"]+|\\\\")*$}m', $this->lexer->getUpcomingInput())) {
  45950. $message .= ", it appears you forgot to terminate a string, or attempted to write a multiline string which is invalid";
  45951. }
  45952. }
  45953. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  45954. $errStr .= $this->lexer->showPosition() . "\n";
  45955. if ($message) {
  45956. $errStr .= $message;
  45957. } else {
  45958. $errStr .= (count($expected) > 1) ? "Expected one of: " : "Expected: ";
  45959. $errStr .= implode(', ', $expected);
  45960. }
  45961. if (',' === substr(trim($this->lexer->getPastInput()), -1)) {
  45962. $errStr .= " - It appears you have an extra trailing comma";
  45963. }
  45964. $this->parseError($errStr, array(
  45965. 'text' => $this->lexer->match,
  45966. 'token' => !empty($this->terminals_[$symbol]) ? $this->terminals_[$symbol] : $symbol,
  45967. 'line' => $this->lexer->yylineno,
  45968. 'loc' => $yyloc,
  45969. 'expected' => $expected,
  45970. ));
  45971. }
  45972. if ($recovering == 3) {
  45973. if ($symbol == $EOF) {
  45974. throw new ParsingException($errStr ?: 'Parsing halted.');
  45975. }
  45976. $yyleng = $this->lexer->yyleng;
  45977. $yytext = $this->lexer->yytext;
  45978. $yylineno = $this->lexer->yylineno;
  45979. $yyloc = $this->lexer->yylloc;
  45980. $symbol = $this->lex();
  45981. }
  45982. while (true) {
  45983. if (array_key_exists($TERROR, $this->table[$state])) {
  45984. break;
  45985. }
  45986. if ($state == 0) {
  45987. throw new ParsingException($errStr ?: 'Parsing halted.');
  45988. }
  45989. $this->popStack(1);
  45990. $state = $this->stack[count($this->stack)-1];
  45991. }
  45992. $preErrorSymbol = $symbol;
  45993. $symbol = $TERROR;
  45994. $state = $this->stack[count($this->stack)-1];
  45995. $action = isset($this->table[$state][$TERROR]) ? $this->table[$state][$TERROR] : false;
  45996. $recovering = 3;
  45997. }
  45998. if (is_array($action[0]) && count($action) > 1) {
  45999. throw new ParsingException('Parse Error: multiple actions possible at state: ' . $state . ', token: ' . $symbol);
  46000. }
  46001. switch ($action[0]) {
  46002. case 1:
  46003. $this->stack[] = $symbol;
  46004. $this->vstack[] = $this->lexer->yytext;
  46005. $this->lstack[] = $this->lexer->yylloc;
  46006. $this->stack[] = $action[1];
  46007. $symbol = null;
  46008. if (!$preErrorSymbol) {
  46009. $yyleng = $this->lexer->yyleng;
  46010. $yytext = $this->lexer->yytext;
  46011. $yylineno = $this->lexer->yylineno;
  46012. $yyloc = $this->lexer->yylloc;
  46013. if ($recovering > 0) {
  46014. $recovering--;
  46015. }
  46016. } else {
  46017. $symbol = $preErrorSymbol;
  46018. $preErrorSymbol = null;
  46019. }
  46020. break;
  46021. case 2:
  46022. $len = $this->productions_[$action[1]][1];
  46023. $yyval->token = $this->vstack[count($this->vstack) - $len];
  46024. $yyval->store = array(
  46025. 'first_line' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_line'],
  46026. 'last_line' => $this->lstack[count($this->lstack) - 1]['last_line'],
  46027. 'first_column' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_column'],
  46028. 'last_column' => $this->lstack[count($this->lstack) - 1]['last_column'],
  46029. );
  46030. $r = $this->performAction($yyval, $yytext, $yyleng, $yylineno, $action[1], $this->vstack, $this->lstack);
  46031. if (!$r instanceof Undefined) {
  46032. return $r;
  46033. }
  46034. if ($len) {
  46035. $this->popStack($len);
  46036. }
  46037. $this->stack[] = $this->productions_[$action[1]][0];
  46038. $this->vstack[] = $yyval->token;
  46039. $this->lstack[] = $yyval->store;
  46040. $newState = $this->table[$this->stack[count($this->stack)-2]][$this->stack[count($this->stack)-1]];
  46041. $this->stack[] = $newState;
  46042. break;
  46043. case 3:
  46044. return true;
  46045. }
  46046. }
  46047. return true;
  46048. }
  46049. protected function parseError($str, $hash)
  46050. {
  46051. throw new ParsingException($str, $hash);
  46052. }
  46053. private function performAction(stdClass $yyval, $yytext, $yyleng, $yylineno, $yystate, &$tokens)
  46054. {
  46055. $len = count($tokens) - 1;
  46056. switch ($yystate) {
  46057. case 1:
  46058. $yytext = preg_replace_callback('{(?:\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4})}', array($this, 'stringInterpolation'), $yytext);
  46059. $yyval->token = $yytext;
  46060. break;
  46061. case 2:
  46062. if (strpos($yytext, 'e') !== false || strpos($yytext, 'E') !== false) {
  46063. $yyval->token = floatval($yytext);
  46064. } else {
  46065. $yyval->token = strpos($yytext, '.') === false ? intval($yytext) : floatval($yytext);
  46066. }
  46067. break;
  46068. case 3:
  46069. $yyval->token = null;
  46070. break;
  46071. case 4:
  46072. $yyval->token = true;
  46073. break;
  46074. case 5:
  46075. $yyval->token = false;
  46076. break;
  46077. case 6:
  46078. return $yyval->token = $tokens[$len-1];
  46079. case 13:
  46080. if ($this->flags & self::PARSE_TO_ASSOC) {
  46081. $yyval->token = array();
  46082. } else {
  46083. $yyval->token = new stdClass;
  46084. }
  46085. break;
  46086. case 14:
  46087. $yyval->token = $tokens[$len-1];
  46088. break;
  46089. case 15:
  46090. $yyval->token = array($tokens[$len-2], $tokens[$len]);
  46091. break;
  46092. case 16:
  46093. if (PHP_VERSION_ID < 70100) {
  46094. $property = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  46095. } else {
  46096. $property = $tokens[$len][0];
  46097. }
  46098. if ($this->flags & self::PARSE_TO_ASSOC) {
  46099. $yyval->token = array();
  46100. $yyval->token[$property] = $tokens[$len][1];
  46101. } else {
  46102. $yyval->token = new stdClass;
  46103. $yyval->token->$property = $tokens[$len][1];
  46104. }
  46105. break;
  46106. case 17:
  46107. if ($this->flags & self::PARSE_TO_ASSOC) {
  46108. $yyval->token =& $tokens[$len-2];
  46109. $key = $tokens[$len][0];
  46110. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2][$key])) {
  46111. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  46112. $errStr .= $this->lexer->showPosition() . "\n";
  46113. $errStr .= "Duplicate key: ".$tokens[$len][0];
  46114. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  46115. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2][$key])) {
  46116. $duplicateCount = 1;
  46117. do {
  46118. $duplicateKey = $key . '.' . $duplicateCount++;
  46119. } while (isset($tokens[$len-2][$duplicateKey]));
  46120. $key = $duplicateKey;
  46121. }
  46122. $tokens[$len-2][$key] = $tokens[$len][1];
  46123. } else {
  46124. $yyval->token = $tokens[$len-2];
  46125. if (PHP_VERSION_ID < 70100) {
  46126. $key = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  46127. } else {
  46128. $key = $tokens[$len][0];
  46129. }
  46130. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2]->{$key})) {
  46131. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  46132. $errStr .= $this->lexer->showPosition() . "\n";
  46133. $errStr .= "Duplicate key: ".$tokens[$len][0];
  46134. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  46135. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2]->{$key})) {
  46136. $duplicateCount = 1;
  46137. do {
  46138. $duplicateKey = $key . '.' . $duplicateCount++;
  46139. } while (isset($tokens[$len-2]->$duplicateKey));
  46140. $key = $duplicateKey;
  46141. }
  46142. $tokens[$len-2]->$key = $tokens[$len][1];
  46143. }
  46144. break;
  46145. case 18:
  46146. $yyval->token = array();
  46147. break;
  46148. case 19:
  46149. $yyval->token = $tokens[$len-1];
  46150. break;
  46151. case 20:
  46152. $yyval->token = array($tokens[$len]);
  46153. break;
  46154. case 21:
  46155. $tokens[$len-2][] = $tokens[$len];
  46156. $yyval->token = $tokens[$len-2];
  46157. break;
  46158. }
  46159. return new Undefined();
  46160. }
  46161. private function stringInterpolation($match)
  46162. {
  46163. switch ($match[0]) {
  46164. case '\\\\':
  46165. return '\\';
  46166. case '\"':
  46167. return '"';
  46168. case '\b':
  46169. return chr(8);
  46170. case '\f':
  46171. return chr(12);
  46172. case '\n':
  46173. return "\n";
  46174. case '\r':
  46175. return "\r";
  46176. case '\t':
  46177. return "\t";
  46178. case '\/':
  46179. return "/";
  46180. default:
  46181. return html_entity_decode('&#x'.ltrim(substr($match[0], 2), '0').';', 0, 'UTF-8');
  46182. }
  46183. }
  46184. private function popStack($n)
  46185. {
  46186. $this->stack = array_slice($this->stack, 0, - (2 * $n));
  46187. $this->vstack = array_slice($this->vstack, 0, - $n);
  46188. $this->lstack = array_slice($this->lstack, 0, - $n);
  46189. }
  46190. private function lex()
  46191. {
  46192. $token = $this->lexer->lex() ?: 1;
  46193. if (!is_numeric($token)) {
  46194. $token = isset($this->symbols[$token]) ? $this->symbols[$token] : $token;
  46195. }
  46196. return $token;
  46197. }
  46198. private function failOnBOM($input)
  46199. {
  46200. $bom = "\xEF\xBB\xBF";
  46201. if (substr($input, 0, 3) === $bom) {
  46202. $this->parseError("BOM detected, make sure your input does not include a Unicode Byte-Order-Mark", array());
  46203. }
  46204. }
  46205. }
  46206. <?php
  46207. namespace Seld\JsonLint;
  46208. class Lexer
  46209. {
  46210. private $EOF = 1;
  46211. private $rules = array(
  46212. 0 => '/^\s+/',
  46213. 1 => '/^-?([0-9]|[1-9][0-9]+)(\.[0-9]+)?([eE][+-]?[0-9]+)?\b/',
  46214. 2 => '{^"(?>\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4}|[^\0-\x1f\\\\"]++)*+"}',
  46215. 3 => '/^\{/',
  46216. 4 => '/^\}/',
  46217. 5 => '/^\[/',
  46218. 6 => '/^\]/',
  46219. 7 => '/^,/',
  46220. 8 => '/^:/',
  46221. 9 => '/^true\b/',
  46222. 10 => '/^false\b/',
  46223. 11 => '/^null\b/',
  46224. 12 => '/^$/',
  46225. 13 => '/^./',
  46226. );
  46227. private $conditions = array(
  46228. "INITIAL" => array(
  46229. "rules" => array(0,1,2,3,4,5,6,7,8,9,10,11,12,13),
  46230. "inclusive" => true,
  46231. ),
  46232. );
  46233. private $conditionStack;
  46234. private $input;
  46235. private $more;
  46236. private $done;
  46237. private $matched;
  46238. public $match;
  46239. public $yylineno;
  46240. public $yyleng;
  46241. public $yytext;
  46242. public $yylloc;
  46243. public function lex()
  46244. {
  46245. $r = $this->next();
  46246. if (!$r instanceof Undefined) {
  46247. return $r;
  46248. }
  46249. return $this->lex();
  46250. }
  46251. public function setInput($input)
  46252. {
  46253. $this->input = $input;
  46254. $this->more = false;
  46255. $this->done = false;
  46256. $this->yylineno = $this->yyleng = 0;
  46257. $this->yytext = $this->matched = $this->match = '';
  46258. $this->conditionStack = array('INITIAL');
  46259. $this->yylloc = array('first_line' => 1, 'first_column' => 0, 'last_line' => 1, 'last_column' => 0);
  46260. return $this;
  46261. }
  46262. public function showPosition()
  46263. {
  46264. $pre = str_replace("\n", '', $this->getPastInput());
  46265. $c = str_repeat('-', max(0, strlen($pre) - 1));
  46266. return $pre . str_replace("\n", '', $this->getUpcomingInput()) . "\n" . $c . "^";
  46267. }
  46268. public function getPastInput()
  46269. {
  46270. $past = substr($this->matched, 0, strlen($this->matched) - strlen($this->match));
  46271. return (strlen($past) > 20 ? '...' : '') . substr($past, -20);
  46272. }
  46273. public function getUpcomingInput()
  46274. {
  46275. $next = $this->match;
  46276. if (strlen($next) < 20) {
  46277. $next .= substr($this->input, 0, 20 - strlen($next));
  46278. }
  46279. return substr($next, 0, 20) . (strlen($next) > 20 ? '...' : '');
  46280. }
  46281. protected function parseError($str, $hash)
  46282. {
  46283. throw new \Exception($str);
  46284. }
  46285. private function next()
  46286. {
  46287. if ($this->done) {
  46288. return $this->EOF;
  46289. }
  46290. if ($this->input === '') {
  46291. $this->done = true;
  46292. }
  46293. $token = null;
  46294. $match = null;
  46295. $col = null;
  46296. $lines = null;
  46297. if (!$this->more) {
  46298. $this->yytext = '';
  46299. $this->match = '';
  46300. }
  46301. $rules = $this->getCurrentRules();
  46302. $rulesLen = count($rules);
  46303. for ($i=0; $i < $rulesLen; $i++) {
  46304. if (preg_match($this->rules[$rules[$i]], $this->input, $match)) {
  46305. preg_match_all('/\n.*/', $match[0], $lines);
  46306. $lines = $lines[0];
  46307. if ($lines) {
  46308. $this->yylineno += count($lines);
  46309. }
  46310. $this->yylloc = array(
  46311. 'first_line' => $this->yylloc['last_line'],
  46312. 'last_line' => $this->yylineno+1,
  46313. 'first_column' => $this->yylloc['last_column'],
  46314. 'last_column' => $lines ? strlen($lines[count($lines) - 1]) - 1 : $this->yylloc['last_column'] + strlen($match[0]),
  46315. );
  46316. $this->yytext .= $match[0];
  46317. $this->match .= $match[0];
  46318. $this->yyleng = strlen($this->yytext);
  46319. $this->more = false;
  46320. $this->input = substr($this->input, strlen($match[0]));
  46321. $this->matched .= $match[0];
  46322. $token = $this->performAction($rules[$i], $this->conditionStack[count($this->conditionStack)-1]);
  46323. if ($token) {
  46324. return $token;
  46325. }
  46326. return new Undefined();
  46327. }
  46328. }
  46329. if ($this->input === "") {
  46330. return $this->EOF;
  46331. }
  46332. $this->parseError(
  46333. 'Lexical error on line ' . ($this->yylineno+1) . ". Unrecognized text.\n" . $this->showPosition(),
  46334. array(
  46335. 'text' => "",
  46336. 'token' => null,
  46337. 'line' => $this->yylineno,
  46338. )
  46339. );
  46340. }
  46341. private function getCurrentRules()
  46342. {
  46343. return $this->conditions[$this->conditionStack[count($this->conditionStack)-1]]['rules'];
  46344. }
  46345. private function performAction($avoiding_name_collisions, $YY_START)
  46346. {
  46347. switch ($avoiding_name_collisions) {
  46348. case 0:
  46349. break;
  46350. case 1:
  46351. return 6;
  46352. break;
  46353. case 2:
  46354. $this->yytext = substr($this->yytext, 1, $this->yyleng-2);
  46355. return 4;
  46356. case 3:
  46357. return 17;
  46358. case 4:
  46359. return 18;
  46360. case 5:
  46361. return 23;
  46362. case 6:
  46363. return 24;
  46364. case 7:
  46365. return 22;
  46366. case 8:
  46367. return 21;
  46368. case 9:
  46369. return 10;
  46370. case 10:
  46371. return 11;
  46372. case 11:
  46373. return 8;
  46374. case 12:
  46375. return 14;
  46376. case 13:
  46377. return 'INVALID';
  46378. }
  46379. }
  46380. }
  46381. <?php
  46382. namespace Seld\JsonLint;
  46383. class ParsingException extends \Exception
  46384. {
  46385. protected $details;
  46386. public function __construct($message, $details = array())
  46387. {
  46388. $this->details = $details;
  46389. parent::__construct($message);
  46390. }
  46391. public function getDetails()
  46392. {
  46393. return $this->details;
  46394. }
  46395. }
  46396. <?php
  46397. namespace Seld\JsonLint;
  46398. class Undefined
  46399. {
  46400. }
  46401. Copyright (c) 2015 Jordi Boggiano
  46402. Permission is hereby granted, free of charge, to any person obtaining a copy
  46403. of this software and associated documentation files (the "Software"), to deal
  46404. in the Software without restriction, including without limitation the rights
  46405. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  46406. copies of the Software, and to permit persons to whom the Software is furnished
  46407. to do so, subject to the following conditions:
  46408. The above copyright notice and this permission notice shall be included in all
  46409. copies or substantial portions of the Software.
  46410. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  46411. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  46412. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  46413. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  46414. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  46415. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  46416. THE SOFTWARE.
  46417. <?php
  46418. require __DIR__.'/../vendor/autoload.php';
  46419. echo 'Say hello (visible): ';
  46420. $answer = Seld\CliPrompt\CliPrompt::prompt();
  46421. echo 'You answered: '.$answer . PHP_EOL;
  46422. echo 'Say hello (hidden): ';
  46423. $answer = Seld\CliPrompt\CliPrompt::hiddenPrompt();
  46424. echo 'You answered: '.$answer . PHP_EOL;
  46425. <?php
  46426. namespace Seld\CliPrompt;
  46427. class CliPrompt
  46428. {
  46429. public static function prompt()
  46430. {
  46431. $stdin = fopen('php://stdin', 'r');
  46432. $answer = self::trimAnswer(fgets($stdin, 4096));
  46433. fclose($stdin);
  46434. return $answer;
  46435. }
  46436. public static function hiddenPrompt($allowFallback = false)
  46437. {
  46438. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  46439. $exe = __DIR__.'\\..\\res\\hiddeninput.exe';
  46440. if ('phar:' === substr(__FILE__, 0, 5)) {
  46441. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  46442. $source = fopen($exe, 'r');
  46443. $target = fopen($tmpExe, 'w+');
  46444. stream_copy_to_stream($source, $target);
  46445. fclose($source);
  46446. fclose($target);
  46447. unset($source, $target);
  46448. $exe = $tmpExe;
  46449. }
  46450. $output = shell_exec($exe);
  46451. if (isset($tmpExe)) {
  46452. unlink($tmpExe);
  46453. }
  46454. if ($output !== null) {
  46455. echo PHP_EOL;
  46456. return self::trimAnswer($output);
  46457. }
  46458. }
  46459. if (file_exists('/usr/bin/env')) {
  46460. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  46461. foreach (array('bash', 'zsh', 'ksh', 'csh', 'sh') as $sh) {
  46462. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  46463. $shell = $sh;
  46464. break;
  46465. }
  46466. }
  46467. if (isset($shell)) {
  46468. $readCmd = ($shell === 'csh') ? 'set mypassword = $<' : 'read -r mypassword';
  46469. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  46470. $output = shell_exec($command);
  46471. if ($output !== null) {
  46472. echo PHP_EOL;
  46473. return self::trimAnswer($output);
  46474. }
  46475. }
  46476. }
  46477. if (!$allowFallback) {
  46478. throw new \RuntimeException('Could not prompt for input in a secure fashion, aborting');
  46479. }
  46480. return self::prompt();
  46481. }
  46482. private static function trimAnswer($str)
  46483. {
  46484. return preg_replace('{\r?\n$}D', '', $str);
  46485. }
  46486. }
  46487. MIT License
  46488. Copyright (c) 2016
  46489. Permission is hereby granted, free of charge, to any person obtaining a copy
  46490. of this software and associated documentation files (the "Software"), to deal
  46491. in the Software without restriction, including without limitation the rights
  46492. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  46493. copies of the Software, and to permit persons to whom the Software is
  46494. furnished to do so, subject to the following conditions:
  46495. The above copyright notice and this permission notice shall be included in all
  46496. copies or substantial portions of the Software.
  46497. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  46498. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  46499. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  46500. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  46501. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  46502. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  46503. SOFTWARE.
  46504. <?php
  46505. require __DIR__ . '/../vendor/autoload.php';
  46506. $data = json_decode(file_get_contents('data.json'));
  46507. $validator = new JsonSchema\Validator();
  46508. $validator->check($data, (object) array('$ref' => 'file://' . realpath('schema.json')));
  46509. if ($validator->isValid()) {
  46510. echo "The supplied JSON validates against the schema.\n";
  46511. } else {
  46512. echo "JSON does not validate. Violations:\n";
  46513. foreach ($validator->getErrors() as $error) {
  46514. echo sprintf("[%s] %s\n", $error['property'], $error['message']);
  46515. }
  46516. }
  46517. <?php
  46518. namespace JsonSchema\Constraints;
  46519. use JsonSchema\Entity\JsonPointer;
  46520. use JsonSchema\Exception\InvalidArgumentException;
  46521. use JsonSchema\Exception\ValidationException;
  46522. use JsonSchema\Validator;
  46523. class BaseConstraint
  46524. {
  46525. protected $errors = array();
  46526. protected $errorMask = Validator::ERROR_NONE;
  46527. protected $factory;
  46528. public function __construct(Factory $factory = null)
  46529. {
  46530. $this->factory = $factory ?: new Factory();
  46531. }
  46532. public function addError(JsonPointer $path = null, $message, $constraint = '', array $more = null)
  46533. {
  46534. $error = array(
  46535. 'property' => $this->convertJsonPointerIntoPropertyPath($path ?: new JsonPointer('')),
  46536. 'pointer' => ltrim(strval($path ?: new JsonPointer('')), '#'),
  46537. 'message' => $message,
  46538. 'constraint' => $constraint,
  46539. 'context' => $this->factory->getErrorContext(),
  46540. );
  46541. if ($this->factory->getConfig(Constraint::CHECK_MODE_EXCEPTIONS)) {
  46542. throw new ValidationException(sprintf('Error validating %s: %s', $error['pointer'], $error['message']));
  46543. }
  46544. if (is_array($more) && count($more) > 0) {
  46545. $error += $more;
  46546. }
  46547. $this->errors[] = $error;
  46548. $this->errorMask |= $error['context'];
  46549. }
  46550. public function addErrors(array $errors)
  46551. {
  46552. if ($errors) {
  46553. $this->errors = array_merge($this->errors, $errors);
  46554. $errorMask = &$this->errorMask;
  46555. array_walk($errors, function ($error) use (&$errorMask) {
  46556. if (isset($error['context'])) {
  46557. $errorMask |= $error['context'];
  46558. }
  46559. });
  46560. }
  46561. }
  46562. public function getErrors($errorContext = Validator::ERROR_ALL)
  46563. {
  46564. if ($errorContext === Validator::ERROR_ALL) {
  46565. return $this->errors;
  46566. }
  46567. return array_filter($this->errors, function ($error) use ($errorContext) {
  46568. if ($errorContext & $error['context']) {
  46569. return true;
  46570. }
  46571. });
  46572. }
  46573. public function numErrors($errorContext = Validator::ERROR_ALL)
  46574. {
  46575. if ($errorContext === Validator::ERROR_ALL) {
  46576. return count($this->errors);
  46577. }
  46578. return count($this->getErrors($errorContext));
  46579. }
  46580. public function isValid()
  46581. {
  46582. return !$this->getErrors();
  46583. }
  46584. public function reset()
  46585. {
  46586. $this->errors = array();
  46587. $this->errorMask = Validator::ERROR_NONE;
  46588. }
  46589. public function getErrorMask()
  46590. {
  46591. return $this->errorMask;
  46592. }
  46593. public static function arrayToObjectRecursive($array)
  46594. {
  46595. $json = json_encode($array);
  46596. if (json_last_error() !== \JSON_ERROR_NONE) {
  46597. $message = 'Unable to encode schema array as JSON';
  46598. if (function_exists('json_last_error_msg')) {
  46599. $message .= ': ' . json_last_error_msg();
  46600. }
  46601. throw new InvalidArgumentException($message);
  46602. }
  46603. return (object) json_decode($json);
  46604. }
  46605. }
  46606. <?php
  46607. namespace JsonSchema\Constraints;
  46608. use JsonSchema\Entity\JsonPointer;
  46609. class CollectionConstraint extends Constraint
  46610. {
  46611. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null)
  46612. {
  46613. if (isset($schema->minItems) && count($value) < $schema->minItems) {
  46614. $this->addError($path, 'There must be a minimum of ' . $schema->minItems . ' items in the array', 'minItems', array('minItems' => $schema->minItems));
  46615. }
  46616. if (isset($schema->maxItems) && count($value) > $schema->maxItems) {
  46617. $this->addError($path, 'There must be a maximum of ' . $schema->maxItems . ' items in the array', 'maxItems', array('maxItems' => $schema->maxItems));
  46618. }
  46619. if (isset($schema->uniqueItems) && $schema->uniqueItems) {
  46620. $unique = $value;
  46621. if (is_array($value) && count($value)) {
  46622. $unique = array_map(function ($e) {
  46623. return var_export($e, true);
  46624. }, $value);
  46625. }
  46626. if (count(array_unique($unique)) != count($value)) {
  46627. $this->addError($path, 'There are no duplicates allowed in the array', 'uniqueItems');
  46628. }
  46629. }
  46630. if (isset($schema->items)) {
  46631. $this->validateItems($value, $schema, $path, $i);
  46632. }
  46633. }
  46634. protected function validateItems(&$value, $schema = null, JsonPointer $path = null, $i = null)
  46635. {
  46636. if (is_object($schema->items)) {
  46637. if (isset($schema->items->type)
  46638. && (
  46639. $schema->items->type == 'string'
  46640. || $schema->items->type == 'number'
  46641. || $schema->items->type == 'integer'
  46642. )
  46643. && !isset($schema->additionalItems)
  46644. ) {
  46645. $type = $schema->items->type;
  46646. $typeValidator = $this->factory->createInstanceFor('type');
  46647. $validator = $this->factory->createInstanceFor($type === 'integer' ? 'number' : $type);
  46648. foreach ($value as $k => &$v) {
  46649. $k_path = $this->incrementPath($path, $k);
  46650. $typeValidator->check($v, $schema->items, $k_path, $i);
  46651. $validator->check($v, $schema->items, $k_path, $i);
  46652. }
  46653. unset($v);
  46654. $this->addErrors($typeValidator->getErrors());
  46655. $this->addErrors($validator->getErrors());
  46656. } else {
  46657. foreach ($value as $k => &$v) {
  46658. $initErrors = $this->getErrors();
  46659. $this->checkUndefined($v, $schema->items, $path, $k);
  46660. if (count($initErrors) < count($this->getErrors()) && (isset($schema->additionalItems) && $schema->additionalItems !== false)) {
  46661. $secondErrors = $this->getErrors();
  46662. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  46663. }
  46664. if (isset($secondErrors) && count($secondErrors) < count($this->getErrors())) {
  46665. $this->errors = $secondErrors;
  46666. } elseif (isset($secondErrors) && count($secondErrors) === count($this->getErrors())) {
  46667. $this->errors = $initErrors;
  46668. }
  46669. }
  46670. unset($v);
  46671. }
  46672. } else {
  46673. foreach ($value as $k => &$v) {
  46674. if (array_key_exists($k, $schema->items)) {
  46675. $this->checkUndefined($v, $schema->items[$k], $path, $k);
  46676. } else {
  46677. if (property_exists($schema, 'additionalItems')) {
  46678. if ($schema->additionalItems !== false) {
  46679. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  46680. } else {
  46681. $this->addError(
  46682. $path, 'The item ' . $i . '[' . $k . '] is not defined and the definition does not allow additional items', 'additionalItems', array('additionalItems' => $schema->additionalItems));
  46683. }
  46684. } else {
  46685. $this->checkUndefined($v, new \stdClass(), $path, $k);
  46686. }
  46687. }
  46688. }
  46689. unset($v);
  46690. if (count($value) > 0) {
  46691. for ($k = count($value); $k < count($schema->items); $k++) {
  46692. $undefinedInstance = $this->factory->createInstanceFor('undefined');
  46693. $this->checkUndefined($undefinedInstance, $schema->items[$k], $path, $k);
  46694. }
  46695. }
  46696. }
  46697. }
  46698. }
  46699. <?php
  46700. namespace JsonSchema\Constraints;
  46701. use JsonSchema\Entity\JsonPointer;
  46702. abstract class Constraint extends BaseConstraint implements ConstraintInterface
  46703. {
  46704. protected $inlineSchemaProperty = '$schema';
  46705. const CHECK_MODE_NONE = 0x00000000;
  46706. const CHECK_MODE_NORMAL = 0x00000001;
  46707. const CHECK_MODE_TYPE_CAST = 0x00000002;
  46708. const CHECK_MODE_COERCE_TYPES = 0x00000004;
  46709. const CHECK_MODE_APPLY_DEFAULTS = 0x00000008;
  46710. const CHECK_MODE_EXCEPTIONS = 0x00000010;
  46711. const CHECK_MODE_DISABLE_FORMAT = 0x00000020;
  46712. const CHECK_MODE_ONLY_REQUIRED_DEFAULTS = 0x00000080;
  46713. const CHECK_MODE_VALIDATE_SCHEMA = 0x00000100;
  46714. protected function incrementPath(JsonPointer $path = null, $i)
  46715. {
  46716. $path = $path ?: new JsonPointer('');
  46717. $path = $path->withPropertyPaths(
  46718. array_merge(
  46719. $path->getPropertyPaths(),
  46720. array_filter(array($i), 'strlen')
  46721. )
  46722. );
  46723. return $path;
  46724. }
  46725. protected function checkArray(&$value, $schema = null, JsonPointer $path = null, $i = null)
  46726. {
  46727. $validator = $this->factory->createInstanceFor('collection');
  46728. $validator->check($value, $schema, $path, $i);
  46729. $this->addErrors($validator->getErrors());
  46730. }
  46731. protected function checkObject(&$value, $schema = null, JsonPointer $path = null, $properties = null,
  46732. $additionalProperties = null, $patternProperties = null, $appliedDefaults = array())
  46733. {
  46734. $validator = $this->factory->createInstanceFor('object');
  46735. $validator->check($value, $schema, $path, $properties, $additionalProperties, $patternProperties, $appliedDefaults);
  46736. $this->addErrors($validator->getErrors());
  46737. }
  46738. protected function checkType(&$value, $schema = null, JsonPointer $path = null, $i = null)
  46739. {
  46740. $validator = $this->factory->createInstanceFor('type');
  46741. $validator->check($value, $schema, $path, $i);
  46742. $this->addErrors($validator->getErrors());
  46743. }
  46744. protected function checkUndefined(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  46745. {
  46746. $validator = $this->factory->createInstanceFor('undefined');
  46747. $validator->check($value, $this->factory->getSchemaStorage()->resolveRefSchema($schema), $path, $i, $fromDefault);
  46748. $this->addErrors($validator->getErrors());
  46749. }
  46750. protected function checkString($value, $schema = null, JsonPointer $path = null, $i = null)
  46751. {
  46752. $validator = $this->factory->createInstanceFor('string');
  46753. $validator->check($value, $schema, $path, $i);
  46754. $this->addErrors($validator->getErrors());
  46755. }
  46756. protected function checkNumber($value, $schema = null, JsonPointer $path = null, $i = null)
  46757. {
  46758. $validator = $this->factory->createInstanceFor('number');
  46759. $validator->check($value, $schema, $path, $i);
  46760. $this->addErrors($validator->getErrors());
  46761. }
  46762. protected function checkEnum($value, $schema = null, JsonPointer $path = null, $i = null)
  46763. {
  46764. $validator = $this->factory->createInstanceFor('enum');
  46765. $validator->check($value, $schema, $path, $i);
  46766. $this->addErrors($validator->getErrors());
  46767. }
  46768. protected function checkFormat($value, $schema = null, JsonPointer $path = null, $i = null)
  46769. {
  46770. $validator = $this->factory->createInstanceFor('format');
  46771. $validator->check($value, $schema, $path, $i);
  46772. $this->addErrors($validator->getErrors());
  46773. }
  46774. protected function getTypeCheck()
  46775. {
  46776. return $this->factory->getTypeCheck();
  46777. }
  46778. protected function convertJsonPointerIntoPropertyPath(JsonPointer $pointer)
  46779. {
  46780. $result = array_map(
  46781. function ($path) {
  46782. return sprintf(is_numeric($path) ? '[%d]' : '.%s', $path);
  46783. },
  46784. $pointer->getPropertyPaths()
  46785. );
  46786. return trim(implode('', $result), '.');
  46787. }
  46788. }
  46789. <?php
  46790. namespace JsonSchema\Constraints;
  46791. use JsonSchema\Entity\JsonPointer;
  46792. interface ConstraintInterface
  46793. {
  46794. public function getErrors();
  46795. public function addErrors(array $errors);
  46796. public function addError(JsonPointer $path = null, $message, $constraint='', array $more = null);
  46797. public function isValid();
  46798. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null);
  46799. }
  46800. <?php
  46801. namespace JsonSchema\Constraints;
  46802. use JsonSchema\Entity\JsonPointer;
  46803. class EnumConstraint extends Constraint
  46804. {
  46805. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  46806. {
  46807. if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) {
  46808. return;
  46809. }
  46810. $type = gettype($element);
  46811. foreach ($schema->enum as $enum) {
  46812. $enumType = gettype($enum);
  46813. if ($this->factory->getConfig(self::CHECK_MODE_TYPE_CAST) && $type == 'array' && $enumType == 'object') {
  46814. if ((object) $element == $enum) {
  46815. return;
  46816. }
  46817. }
  46818. if ($type === gettype($enum)) {
  46819. if ($type == 'object') {
  46820. if ($element == $enum) {
  46821. return;
  46822. }
  46823. } elseif ($element === $enum) {
  46824. return;
  46825. }
  46826. }
  46827. }
  46828. $this->addError($path, 'Does not have a value in the enumeration ' . json_encode($schema->enum), 'enum', array('enum' => $schema->enum));
  46829. }
  46830. }
  46831. <?php
  46832. namespace JsonSchema\Constraints;
  46833. use JsonSchema\Exception\InvalidArgumentException;
  46834. use JsonSchema\SchemaStorage;
  46835. use JsonSchema\SchemaStorageInterface;
  46836. use JsonSchema\Uri\UriRetriever;
  46837. use JsonSchema\UriRetrieverInterface;
  46838. use JsonSchema\Validator;
  46839. class Factory
  46840. {
  46841. protected $schemaStorage;
  46842. protected $uriRetriever;
  46843. private $checkMode = Constraint::CHECK_MODE_NORMAL;
  46844. private $typeCheck = array();
  46845. protected $errorContext = Validator::ERROR_DOCUMENT_VALIDATION;
  46846. protected $constraintMap = array(
  46847. 'array' => 'JsonSchema\Constraints\CollectionConstraint',
  46848. 'collection' => 'JsonSchema\Constraints\CollectionConstraint',
  46849. 'object' => 'JsonSchema\Constraints\ObjectConstraint',
  46850. 'type' => 'JsonSchema\Constraints\TypeConstraint',
  46851. 'undefined' => 'JsonSchema\Constraints\UndefinedConstraint',
  46852. 'string' => 'JsonSchema\Constraints\StringConstraint',
  46853. 'number' => 'JsonSchema\Constraints\NumberConstraint',
  46854. 'enum' => 'JsonSchema\Constraints\EnumConstraint',
  46855. 'format' => 'JsonSchema\Constraints\FormatConstraint',
  46856. 'schema' => 'JsonSchema\Constraints\SchemaConstraint',
  46857. 'validator' => 'JsonSchema\Validator'
  46858. );
  46859. private $instanceCache = array();
  46860. public function __construct(
  46861. SchemaStorageInterface $schemaStorage = null,
  46862. UriRetrieverInterface $uriRetriever = null,
  46863. $checkMode = Constraint::CHECK_MODE_NORMAL
  46864. ) {
  46865. $this->setConfig($checkMode);
  46866. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  46867. $this->schemaStorage = $schemaStorage ?: new SchemaStorage($this->uriRetriever);
  46868. }
  46869. public function setConfig($checkMode = Constraint::CHECK_MODE_NORMAL)
  46870. {
  46871. $this->checkMode = $checkMode;
  46872. }
  46873. public function addConfig($options)
  46874. {
  46875. $this->checkMode |= $options;
  46876. }
  46877. public function removeConfig($options)
  46878. {
  46879. $this->checkMode &= ~$options;
  46880. }
  46881. public function getConfig($options = null)
  46882. {
  46883. if ($options === null) {
  46884. return $this->checkMode;
  46885. }
  46886. return $this->checkMode & $options;
  46887. }
  46888. public function getUriRetriever()
  46889. {
  46890. return $this->uriRetriever;
  46891. }
  46892. public function getSchemaStorage()
  46893. {
  46894. return $this->schemaStorage;
  46895. }
  46896. public function getTypeCheck()
  46897. {
  46898. if (!isset($this->typeCheck[$this->checkMode])) {
  46899. $this->typeCheck[$this->checkMode] = ($this->checkMode & Constraint::CHECK_MODE_TYPE_CAST)
  46900. ? new TypeCheck\LooseTypeCheck()
  46901. : new TypeCheck\StrictTypeCheck();
  46902. }
  46903. return $this->typeCheck[$this->checkMode];
  46904. }
  46905. public function setConstraintClass($name, $class)
  46906. {
  46907. if (!class_exists($class)) {
  46908. throw new InvalidArgumentException('Unknown constraint ' . $name);
  46909. }
  46910. if (!in_array('JsonSchema\Constraints\ConstraintInterface', class_implements($class))) {
  46911. throw new InvalidArgumentException('Invalid class ' . $name);
  46912. }
  46913. $this->constraintMap[$name] = $class;
  46914. return $this;
  46915. }
  46916. public function createInstanceFor($constraintName)
  46917. {
  46918. if (!isset($this->constraintMap[$constraintName])) {
  46919. throw new InvalidArgumentException('Unknown constraint ' . $constraintName);
  46920. }
  46921. if (!isset($this->instanceCache[$constraintName])) {
  46922. $this->instanceCache[$constraintName] = new $this->constraintMap[$constraintName]($this);
  46923. }
  46924. return clone $this->instanceCache[$constraintName];
  46925. }
  46926. public function getErrorContext()
  46927. {
  46928. return $this->errorContext;
  46929. }
  46930. public function setErrorContext($errorContext)
  46931. {
  46932. $this->errorContext = $errorContext;
  46933. }
  46934. }
  46935. <?php
  46936. namespace JsonSchema\Constraints;
  46937. use JsonSchema\Entity\JsonPointer;
  46938. use JsonSchema\Rfc3339;
  46939. class FormatConstraint extends Constraint
  46940. {
  46941. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  46942. {
  46943. if (!isset($schema->format) || $this->factory->getConfig(self::CHECK_MODE_DISABLE_FORMAT)) {
  46944. return;
  46945. }
  46946. switch ($schema->format) {
  46947. case 'date':
  46948. if (!$date = $this->validateDateTime($element, 'Y-m-d')) {
  46949. $this->addError($path, sprintf('Invalid date %s, expected format YYYY-MM-DD', json_encode($element)), 'format', array('format' => $schema->format));
  46950. }
  46951. break;
  46952. case 'time':
  46953. if (!$this->validateDateTime($element, 'H:i:s')) {
  46954. $this->addError($path, sprintf('Invalid time %s, expected format hh:mm:ss', json_encode($element)), 'format', array('format' => $schema->format));
  46955. }
  46956. break;
  46957. case 'date-time':
  46958. if (null === Rfc3339::createFromString($element)) {
  46959. $this->addError($path, sprintf('Invalid date-time %s, expected format YYYY-MM-DDThh:mm:ssZ or YYYY-MM-DDThh:mm:ss+hh:mm', json_encode($element)), 'format', array('format' => $schema->format));
  46960. }
  46961. break;
  46962. case 'utc-millisec':
  46963. if (!$this->validateDateTime($element, 'U')) {
  46964. $this->addError($path, sprintf('Invalid time %s, expected integer of milliseconds since Epoch', json_encode($element)), 'format', array('format' => $schema->format));
  46965. }
  46966. break;
  46967. case 'regex':
  46968. if (!$this->validateRegex($element)) {
  46969. $this->addError($path, 'Invalid regex format ' . $element, 'format', array('format' => $schema->format));
  46970. }
  46971. break;
  46972. case 'color':
  46973. if (!$this->validateColor($element)) {
  46974. $this->addError($path, 'Invalid color', 'format', array('format' => $schema->format));
  46975. }
  46976. break;
  46977. case 'style':
  46978. if (!$this->validateStyle($element)) {
  46979. $this->addError($path, 'Invalid style', 'format', array('format' => $schema->format));
  46980. }
  46981. break;
  46982. case 'phone':
  46983. if (!$this->validatePhone($element)) {
  46984. $this->addError($path, 'Invalid phone number', 'format', array('format' => $schema->format));
  46985. }
  46986. break;
  46987. case 'uri':
  46988. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  46989. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  46990. }
  46991. break;
  46992. case 'uriref':
  46993. case 'uri-reference':
  46994. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  46995. if (substr($element, 0, 2) === '//') {
  46996. $validURL = filter_var('scheme:' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  46997. } elseif (substr($element, 0, 1) === '/') {
  46998. $validURL = filter_var('scheme://host' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  46999. } elseif (strlen($element)) {
  47000. $pathParts = explode('/', $element, 2);
  47001. if (strpos($pathParts[0], ':') !== false) {
  47002. $validURL = null;
  47003. } else {
  47004. $validURL = filter_var('scheme://host/' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  47005. }
  47006. } else {
  47007. $validURL = null;
  47008. }
  47009. if ($validURL === null) {
  47010. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  47011. }
  47012. }
  47013. break;
  47014. case 'email':
  47015. $filterFlags = FILTER_NULL_ON_FAILURE;
  47016. if (defined('FILTER_FLAG_EMAIL_UNICODE')) {
  47017. $filterFlags |= constant('FILTER_FLAG_EMAIL_UNICODE');
  47018. }
  47019. if (null === filter_var($element, FILTER_VALIDATE_EMAIL, $filterFlags)) {
  47020. $this->addError($path, 'Invalid email', 'format', array('format' => $schema->format));
  47021. }
  47022. break;
  47023. case 'ip-address':
  47024. case 'ipv4':
  47025. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV4)) {
  47026. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  47027. }
  47028. break;
  47029. case 'ipv6':
  47030. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV6)) {
  47031. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  47032. }
  47033. break;
  47034. case 'host-name':
  47035. case 'hostname':
  47036. if (!$this->validateHostname($element)) {
  47037. $this->addError($path, 'Invalid hostname', 'format', array('format' => $schema->format));
  47038. }
  47039. break;
  47040. default:
  47041. break;
  47042. }
  47043. }
  47044. protected function validateDateTime($datetime, $format)
  47045. {
  47046. $dt = \DateTime::createFromFormat($format, $datetime);
  47047. if (!$dt) {
  47048. return false;
  47049. }
  47050. if ($datetime === $dt->format($format)) {
  47051. return true;
  47052. }
  47053. if ((strpos('u', $format) !== -1) && (preg_match('/\.\d+Z$/', $datetime))) {
  47054. return true;
  47055. }
  47056. return false;
  47057. }
  47058. protected function validateRegex($regex)
  47059. {
  47060. return false !== @preg_match('/' . $regex . '/u', '');
  47061. }
  47062. protected function validateColor($color)
  47063. {
  47064. if (in_array(strtolower($color), array('aqua', 'black', 'blue', 'fuchsia',
  47065. 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange', 'purple',
  47066. 'red', 'silver', 'teal', 'white', 'yellow'))) {
  47067. return true;
  47068. }
  47069. return preg_match('/^#([a-f0-9]{3}|[a-f0-9]{6})$/i', $color);
  47070. }
  47071. protected function validateStyle($style)
  47072. {
  47073. $properties = explode(';', rtrim($style, ';'));
  47074. $invalidEntries = preg_grep('/^\s*[-a-z]+\s*:\s*.+$/i', $properties, PREG_GREP_INVERT);
  47075. return empty($invalidEntries);
  47076. }
  47077. protected function validatePhone($phone)
  47078. {
  47079. return preg_match('/^\+?(\(\d{3}\)|\d{3}) \d{3} \d{4}$/', $phone);
  47080. }
  47081. protected function validateHostname($host)
  47082. {
  47083. $hostnameRegex = '/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/i';
  47084. return preg_match($hostnameRegex, $host);
  47085. }
  47086. }
  47087. <?php
  47088. namespace JsonSchema\Constraints;
  47089. use JsonSchema\Entity\JsonPointer;
  47090. class NumberConstraint extends Constraint
  47091. {
  47092. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  47093. {
  47094. if (isset($schema->exclusiveMinimum)) {
  47095. if (isset($schema->minimum)) {
  47096. if ($schema->exclusiveMinimum && $element <= $schema->minimum) {
  47097. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'exclusiveMinimum', array('minimum' => $schema->minimum));
  47098. } elseif ($element < $schema->minimum) {
  47099. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  47100. }
  47101. } else {
  47102. $this->addError($path, 'Use of exclusiveMinimum requires presence of minimum', 'missingMinimum');
  47103. }
  47104. } elseif (isset($schema->minimum) && $element < $schema->minimum) {
  47105. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  47106. }
  47107. if (isset($schema->exclusiveMaximum)) {
  47108. if (isset($schema->maximum)) {
  47109. if ($schema->exclusiveMaximum && $element >= $schema->maximum) {
  47110. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'exclusiveMaximum', array('maximum' => $schema->maximum));
  47111. } elseif ($element > $schema->maximum) {
  47112. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  47113. }
  47114. } else {
  47115. $this->addError($path, 'Use of exclusiveMaximum requires presence of maximum', 'missingMaximum');
  47116. }
  47117. } elseif (isset($schema->maximum) && $element > $schema->maximum) {
  47118. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  47119. }
  47120. if (isset($schema->divisibleBy) && $this->fmod($element, $schema->divisibleBy) != 0) {
  47121. $this->addError($path, 'Is not divisible by ' . $schema->divisibleBy, 'divisibleBy', array('divisibleBy' => $schema->divisibleBy));
  47122. }
  47123. if (isset($schema->multipleOf) && $this->fmod($element, $schema->multipleOf) != 0) {
  47124. $this->addError($path, 'Must be a multiple of ' . $schema->multipleOf, 'multipleOf', array('multipleOf' => $schema->multipleOf));
  47125. }
  47126. $this->checkFormat($element, $schema, $path, $i);
  47127. }
  47128. private function fmod($number1, $number2)
  47129. {
  47130. $number1 = abs($number1);
  47131. $modulus = fmod($number1, $number2);
  47132. $precision = abs(0.0000000001);
  47133. $diff = (float) ($modulus - $number2);
  47134. if (-$precision < $diff && $diff < $precision) {
  47135. return 0.0;
  47136. }
  47137. $decimals1 = mb_strpos($number1, '.') ? mb_strlen($number1) - mb_strpos($number1, '.') - 1 : 0;
  47138. $decimals2 = mb_strpos($number2, '.') ? mb_strlen($number2) - mb_strpos($number2, '.') - 1 : 0;
  47139. return (float) round($modulus, max($decimals1, $decimals2));
  47140. }
  47141. }
  47142. <?php
  47143. namespace JsonSchema\Constraints;
  47144. use JsonSchema\Entity\JsonPointer;
  47145. class ObjectConstraint extends Constraint
  47146. {
  47147. protected $appliedDefaults = array();
  47148. public function check(&$element, $schema = null, JsonPointer $path = null, $properties = null,
  47149. $additionalProp = null, $patternProperties = null, $appliedDefaults = array())
  47150. {
  47151. if ($element instanceof UndefinedConstraint) {
  47152. return;
  47153. }
  47154. $this->appliedDefaults = $appliedDefaults;
  47155. $matches = array();
  47156. if ($patternProperties) {
  47157. $matches = $this->validatePatternProperties($element, $path, $patternProperties);
  47158. }
  47159. if ($properties) {
  47160. $this->validateProperties($element, $properties, $path);
  47161. }
  47162. $this->validateElement($element, $matches, $schema, $path, $properties, $additionalProp);
  47163. }
  47164. public function validatePatternProperties($element, JsonPointer $path = null, $patternProperties)
  47165. {
  47166. $try = array('/', '#', '+', '~', '%');
  47167. $matches = array();
  47168. foreach ($patternProperties as $pregex => $schema) {
  47169. $delimiter = '/';
  47170. foreach ($try as $delimiter) {
  47171. if (strpos($pregex, $delimiter) === false) {
  47172. break;
  47173. }
  47174. }
  47175. if (@preg_match($delimiter . $pregex . $delimiter . 'u', '') === false) {
  47176. $this->addError($path, 'The pattern "' . $pregex . '" is invalid', 'pregex', array('pregex' => $pregex));
  47177. continue;
  47178. }
  47179. foreach ($element as $i => $value) {
  47180. if (preg_match($delimiter . $pregex . $delimiter . 'u', $i)) {
  47181. $matches[] = $i;
  47182. $this->checkUndefined($value, $schema ?: new \stdClass(), $path, $i, in_array($i, $this->appliedDefaults));
  47183. }
  47184. }
  47185. }
  47186. return $matches;
  47187. }
  47188. public function validateElement($element, $matches, $schema = null, JsonPointer $path = null,
  47189. $properties = null, $additionalProp = null)
  47190. {
  47191. $this->validateMinMaxConstraint($element, $schema, $path);
  47192. foreach ($element as $i => $value) {
  47193. $definition = $this->getProperty($properties, $i);
  47194. if (!in_array($i, $matches) && $additionalProp === false && $this->inlineSchemaProperty !== $i && !$definition) {
  47195. $this->addError($path, 'The property ' . $i . ' is not defined and the definition does not allow additional properties', 'additionalProp');
  47196. }
  47197. if (!in_array($i, $matches) && $additionalProp && !$definition) {
  47198. if ($additionalProp === true) {
  47199. $this->checkUndefined($value, null, $path, $i, in_array($i, $this->appliedDefaults));
  47200. } else {
  47201. $this->checkUndefined($value, $additionalProp, $path, $i, in_array($i, $this->appliedDefaults));
  47202. }
  47203. }
  47204. $require = $this->getProperty($definition, 'requires');
  47205. if ($require && !$this->getProperty($element, $require)) {
  47206. $this->addError($path, 'The presence of the property ' . $i . ' requires that ' . $require . ' also be present', 'requires');
  47207. }
  47208. $property = $this->getProperty($element, $i, $this->factory->createInstanceFor('undefined'));
  47209. if (is_object($property)) {
  47210. $this->validateMinMaxConstraint(!($property instanceof UndefinedConstraint) ? $property : $element, $definition, $path);
  47211. }
  47212. }
  47213. }
  47214. public function validateProperties(&$element, $properties = null, JsonPointer $path = null)
  47215. {
  47216. $undefinedConstraint = $this->factory->createInstanceFor('undefined');
  47217. foreach ($properties as $i => $value) {
  47218. $property = &$this->getProperty($element, $i, $undefinedConstraint);
  47219. $definition = $this->getProperty($properties, $i);
  47220. if (is_object($definition)) {
  47221. $this->checkUndefined($property, $definition, $path, $i, in_array($i, $this->appliedDefaults));
  47222. }
  47223. }
  47224. }
  47225. protected function &getProperty(&$element, $property, $fallback = null)
  47226. {
  47227. if (is_array($element) && (isset($element[$property]) || array_key_exists($property, $element)) ) {
  47228. return $element[$property];
  47229. } elseif (is_object($element) && property_exists($element, $property)) {
  47230. return $element->$property;
  47231. }
  47232. return $fallback;
  47233. }
  47234. protected function validateMinMaxConstraint($element, $objectDefinition, JsonPointer $path = null)
  47235. {
  47236. if (isset($objectDefinition->minProperties) && !is_object($objectDefinition->minProperties)) {
  47237. if ($this->getTypeCheck()->propertyCount($element) < $objectDefinition->minProperties) {
  47238. $this->addError($path, 'Must contain a minimum of ' . $objectDefinition->minProperties . ' properties', 'minProperties', array('minProperties' => $objectDefinition->minProperties));
  47239. }
  47240. }
  47241. if (isset($objectDefinition->maxProperties) && !is_object($objectDefinition->maxProperties)) {
  47242. if ($this->getTypeCheck()->propertyCount($element) > $objectDefinition->maxProperties) {
  47243. $this->addError($path, 'Must contain no more than ' . $objectDefinition->maxProperties . ' properties', 'maxProperties', array('maxProperties' => $objectDefinition->maxProperties));
  47244. }
  47245. }
  47246. }
  47247. }
  47248. <?php
  47249. namespace JsonSchema\Constraints;
  47250. use JsonSchema\Entity\JsonPointer;
  47251. use JsonSchema\Exception\InvalidArgumentException;
  47252. use JsonSchema\Exception\InvalidSchemaException;
  47253. use JsonSchema\Exception\RuntimeException;
  47254. use JsonSchema\Validator;
  47255. class SchemaConstraint extends Constraint
  47256. {
  47257. const DEFAULT_SCHEMA_SPEC = 'http://json-schema.org/draft-04/schema#';
  47258. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  47259. {
  47260. if ($schema !== null) {
  47261. $validationSchema = $schema;
  47262. } elseif ($this->getTypeCheck()->propertyExists($element, $this->inlineSchemaProperty)) {
  47263. $validationSchema = $this->getTypeCheck()->propertyGet($element, $this->inlineSchemaProperty);
  47264. } else {
  47265. throw new InvalidArgumentException('no schema found to verify against');
  47266. }
  47267. if (is_array($validationSchema)) {
  47268. $validationSchema = BaseConstraint::arrayToObjectRecursive($validationSchema);
  47269. }
  47270. if ($this->factory->getConfig(self::CHECK_MODE_VALIDATE_SCHEMA)) {
  47271. if (!$this->getTypeCheck()->isObject($validationSchema)) {
  47272. throw new RuntimeException('Cannot validate the schema of a non-object');
  47273. }
  47274. if ($this->getTypeCheck()->propertyExists($validationSchema, '$schema')) {
  47275. $schemaSpec = $this->getTypeCheck()->propertyGet($validationSchema, '$schema');
  47276. } else {
  47277. $schemaSpec = self::DEFAULT_SCHEMA_SPEC;
  47278. }
  47279. $schemaStorage = $this->factory->getSchemaStorage();
  47280. if (!$this->getTypeCheck()->isObject($schemaSpec)) {
  47281. $schemaSpec = $schemaStorage->getSchema($schemaSpec);
  47282. }
  47283. $initialErrorCount = $this->numErrors();
  47284. $initialConfig = $this->factory->getConfig();
  47285. $initialContext = $this->factory->getErrorContext();
  47286. $this->factory->removeConfig(self::CHECK_MODE_VALIDATE_SCHEMA | self::CHECK_MODE_APPLY_DEFAULTS);
  47287. $this->factory->addConfig(self::CHECK_MODE_TYPE_CAST);
  47288. $this->factory->setErrorContext(Validator::ERROR_SCHEMA_VALIDATION);
  47289. try {
  47290. $this->check($validationSchema, $schemaSpec);
  47291. } catch (\Exception $e) {
  47292. if ($this->factory->getConfig(self::CHECK_MODE_EXCEPTIONS)) {
  47293. throw new InvalidSchemaException('Schema did not pass validation', 0, $e);
  47294. }
  47295. }
  47296. if ($this->numErrors() > $initialErrorCount) {
  47297. $this->addError($path, 'Schema is not valid', 'schema');
  47298. }
  47299. $this->factory->setConfig($initialConfig);
  47300. $this->factory->setErrorContext($initialContext);
  47301. }
  47302. $this->checkUndefined($element, $validationSchema, $path, $i);
  47303. }
  47304. }
  47305. <?php
  47306. namespace JsonSchema\Constraints;
  47307. use JsonSchema\Entity\JsonPointer;
  47308. class StringConstraint extends Constraint
  47309. {
  47310. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  47311. {
  47312. if (isset($schema->maxLength) && $this->strlen($element) > $schema->maxLength) {
  47313. $this->addError($path, 'Must be at most ' . $schema->maxLength . ' characters long', 'maxLength', array(
  47314. 'maxLength' => $schema->maxLength,
  47315. ));
  47316. }
  47317. if (isset($schema->minLength) && $this->strlen($element) < $schema->minLength) {
  47318. $this->addError($path, 'Must be at least ' . $schema->minLength . ' characters long', 'minLength', array(
  47319. 'minLength' => $schema->minLength,
  47320. ));
  47321. }
  47322. if (isset($schema->pattern) && !preg_match('#' . str_replace('#', '\\#', $schema->pattern) . '#u', $element)) {
  47323. $this->addError($path, 'Does not match the regex pattern ' . $schema->pattern, 'pattern', array(
  47324. 'pattern' => $schema->pattern,
  47325. ));
  47326. }
  47327. $this->checkFormat($element, $schema, $path, $i);
  47328. }
  47329. private function strlen($string)
  47330. {
  47331. if (extension_loaded('mbstring')) {
  47332. return mb_strlen($string, mb_detect_encoding($string));
  47333. }
  47334. return strlen($string);
  47335. }
  47336. }
  47337. <?php
  47338. namespace JsonSchema\Constraints\TypeCheck;
  47339. class LooseTypeCheck implements TypeCheckInterface
  47340. {
  47341. public static function isObject($value)
  47342. {
  47343. return
  47344. is_object($value) ||
  47345. (is_array($value) && (count($value) == 0 || self::isAssociativeArray($value)));
  47346. }
  47347. public static function isArray($value)
  47348. {
  47349. return
  47350. is_array($value) &&
  47351. (count($value) == 0 || !self::isAssociativeArray($value));
  47352. }
  47353. public static function propertyGet($value, $property)
  47354. {
  47355. if (is_object($value)) {
  47356. return $value->{$property};
  47357. }
  47358. return $value[$property];
  47359. }
  47360. public static function propertySet(&$value, $property, $data)
  47361. {
  47362. if (is_object($value)) {
  47363. $value->{$property} = $data;
  47364. } else {
  47365. $value[$property] = $data;
  47366. }
  47367. }
  47368. public static function propertyExists($value, $property)
  47369. {
  47370. if (is_object($value)) {
  47371. return property_exists($value, $property);
  47372. }
  47373. return array_key_exists($property, $value);
  47374. }
  47375. public static function propertyCount($value)
  47376. {
  47377. if (is_object($value)) {
  47378. return count(get_object_vars($value));
  47379. }
  47380. return count($value);
  47381. }
  47382. private static function isAssociativeArray($arr)
  47383. {
  47384. return array_keys($arr) !== range(0, count($arr) - 1);
  47385. }
  47386. }
  47387. <?php
  47388. namespace JsonSchema\Constraints\TypeCheck;
  47389. class StrictTypeCheck implements TypeCheckInterface
  47390. {
  47391. public static function isObject($value)
  47392. {
  47393. return is_object($value);
  47394. }
  47395. public static function isArray($value)
  47396. {
  47397. return is_array($value);
  47398. }
  47399. public static function propertyGet($value, $property)
  47400. {
  47401. return $value->{$property};
  47402. }
  47403. public static function propertySet(&$value, $property, $data)
  47404. {
  47405. $value->{$property} = $data;
  47406. }
  47407. public static function propertyExists($value, $property)
  47408. {
  47409. return property_exists($value, $property);
  47410. }
  47411. public static function propertyCount($value)
  47412. {
  47413. return count(get_object_vars($value));
  47414. }
  47415. }
  47416. <?php
  47417. namespace JsonSchema\Constraints\TypeCheck;
  47418. interface TypeCheckInterface
  47419. {
  47420. public static function isObject($value);
  47421. public static function isArray($value);
  47422. public static function propertyGet($value, $property);
  47423. public static function propertySet(&$value, $property, $data);
  47424. public static function propertyExists($value, $property);
  47425. public static function propertyCount($value);
  47426. }
  47427. <?php
  47428. namespace JsonSchema\Constraints;
  47429. use JsonSchema\Entity\JsonPointer;
  47430. use JsonSchema\Exception\InvalidArgumentException;
  47431. use UnexpectedValueException as StandardUnexpectedValueException;
  47432. class TypeConstraint extends Constraint
  47433. {
  47434. public static $wording = array(
  47435. 'integer' => 'an integer',
  47436. 'number' => 'a number',
  47437. 'boolean' => 'a boolean',
  47438. 'object' => 'an object',
  47439. 'array' => 'an array',
  47440. 'string' => 'a string',
  47441. 'null' => 'a null',
  47442. 'any' => null,
  47443. 0 => null,
  47444. );
  47445. public function check(&$value = null, $schema = null, JsonPointer $path = null, $i = null)
  47446. {
  47447. $type = isset($schema->type) ? $schema->type : null;
  47448. $isValid = false;
  47449. $wording = array();
  47450. if (is_array($type)) {
  47451. $this->validateTypesArray($value, $type, $wording, $isValid, $path);
  47452. } elseif (is_object($type)) {
  47453. $this->checkUndefined($value, $type, $path);
  47454. return;
  47455. } else {
  47456. $isValid = $this->validateType($value, $type);
  47457. }
  47458. if ($isValid === false) {
  47459. if (!is_array($type)) {
  47460. $this->validateTypeNameWording($type);
  47461. $wording[] = self::$wording[$type];
  47462. }
  47463. $this->addError($path, ucwords(gettype($value)) . ' value found, but ' .
  47464. $this->implodeWith($wording, ', ', 'or') . ' is required', 'type');
  47465. }
  47466. }
  47467. protected function validateTypesArray(&$value, array $type, &$validTypesWording, &$isValid, $path)
  47468. {
  47469. foreach ($type as $tp) {
  47470. if (is_object($tp)) {
  47471. if (!$isValid) {
  47472. $validator = $this->factory->createInstanceFor('type');
  47473. $subSchema = new \stdClass();
  47474. $subSchema->type = $tp;
  47475. $validator->check($value, $subSchema, $path, null);
  47476. $error = $validator->getErrors();
  47477. $isValid = !(bool) $error;
  47478. $validTypesWording[] = self::$wording['object'];
  47479. }
  47480. } else {
  47481. $this->validateTypeNameWording($tp);
  47482. $validTypesWording[] = self::$wording[$tp];
  47483. if (!$isValid) {
  47484. $isValid = $this->validateType($value, $tp);
  47485. }
  47486. }
  47487. }
  47488. }
  47489. protected function implodeWith(array $elements, $delimiter = ', ', $listEnd = false)
  47490. {
  47491. if ($listEnd === false || !isset($elements[1])) {
  47492. return implode($delimiter, $elements);
  47493. }
  47494. $lastElement = array_slice($elements, -1);
  47495. $firsElements = join($delimiter, array_slice($elements, 0, -1));
  47496. $implodedElements = array_merge(array($firsElements), $lastElement);
  47497. return join(" $listEnd ", $implodedElements);
  47498. }
  47499. protected function validateTypeNameWording($type)
  47500. {
  47501. if (!isset(self::$wording[$type])) {
  47502. throw new StandardUnexpectedValueException(
  47503. sprintf(
  47504. 'No wording for %s available, expected wordings are: [%s]',
  47505. var_export($type, true),
  47506. implode(', ', array_filter(self::$wording)))
  47507. );
  47508. }
  47509. }
  47510. protected function validateType(&$value, $type)
  47511. {
  47512. if (!$type) {
  47513. return true;
  47514. }
  47515. if ('any' === $type) {
  47516. return true;
  47517. }
  47518. if ('object' === $type) {
  47519. return $this->getTypeCheck()->isObject($value);
  47520. }
  47521. if ('array' === $type) {
  47522. return $this->getTypeCheck()->isArray($value);
  47523. }
  47524. $coerce = $this->factory->getConfig(Constraint::CHECK_MODE_COERCE_TYPES);
  47525. if ('integer' === $type) {
  47526. if ($coerce) {
  47527. $value = $this->toInteger($value);
  47528. }
  47529. return is_int($value);
  47530. }
  47531. if ('number' === $type) {
  47532. if ($coerce) {
  47533. $value = $this->toNumber($value);
  47534. }
  47535. return is_numeric($value) && !is_string($value);
  47536. }
  47537. if ('boolean' === $type) {
  47538. if ($coerce) {
  47539. $value = $this->toBoolean($value);
  47540. }
  47541. return is_bool($value);
  47542. }
  47543. if ('string' === $type) {
  47544. return is_string($value);
  47545. }
  47546. if ('email' === $type) {
  47547. return is_string($value);
  47548. }
  47549. if ('null' === $type) {
  47550. return is_null($value);
  47551. }
  47552. throw new InvalidArgumentException((is_object($value) ? 'object' : $value) . ' is an invalid type for ' . $type);
  47553. }
  47554. protected function toBoolean($value)
  47555. {
  47556. if ($value === 'true') {
  47557. return true;
  47558. }
  47559. if ($value === 'false') {
  47560. return false;
  47561. }
  47562. return $value;
  47563. }
  47564. protected function toNumber($value)
  47565. {
  47566. if (is_numeric($value)) {
  47567. return $value + 0;
  47568. }
  47569. return $value;
  47570. }
  47571. protected function toInteger($value)
  47572. {
  47573. if (is_numeric($value) && (int) $value == $value) {
  47574. return (int) $value;
  47575. }
  47576. return $value;
  47577. }
  47578. }
  47579. <?php
  47580. namespace JsonSchema\Constraints;
  47581. use JsonSchema\Constraints\TypeCheck\LooseTypeCheck;
  47582. use JsonSchema\Entity\JsonPointer;
  47583. use JsonSchema\Exception\ValidationException;
  47584. use JsonSchema\Uri\UriResolver;
  47585. class UndefinedConstraint extends Constraint
  47586. {
  47587. protected $appliedDefaults = array();
  47588. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  47589. {
  47590. if (is_null($schema) || !is_object($schema)) {
  47591. return;
  47592. }
  47593. $path = $this->incrementPath($path ?: new JsonPointer(''), $i);
  47594. if ($fromDefault) {
  47595. $path->setFromDefault();
  47596. }
  47597. $this->validateCommonProperties($value, $schema, $path, $i);
  47598. $this->validateOfProperties($value, $schema, $path, '');
  47599. $this->validateTypes($value, $schema, $path, $i);
  47600. }
  47601. public function validateTypes(&$value, $schema = null, JsonPointer $path, $i = null)
  47602. {
  47603. if ($this->getTypeCheck()->isArray($value)) {
  47604. $this->checkArray($value, $schema, $path, $i);
  47605. }
  47606. if (LooseTypeCheck::isObject($value)) {
  47607. $this->checkObject(
  47608. $value,
  47609. $schema,
  47610. $path,
  47611. isset($schema->properties) ? $schema->properties : null,
  47612. isset($schema->additionalProperties) ? $schema->additionalProperties : null,
  47613. isset($schema->patternProperties) ? $schema->patternProperties : null,
  47614. $this->appliedDefaults
  47615. );
  47616. }
  47617. if (is_string($value)) {
  47618. $this->checkString($value, $schema, $path, $i);
  47619. }
  47620. if (is_numeric($value)) {
  47621. $this->checkNumber($value, $schema, $path, $i);
  47622. }
  47623. if (isset($schema->enum)) {
  47624. $this->checkEnum($value, $schema, $path, $i);
  47625. }
  47626. }
  47627. protected function validateCommonProperties(&$value, $schema = null, JsonPointer $path, $i = '')
  47628. {
  47629. if (isset($schema->extends)) {
  47630. if (is_string($schema->extends)) {
  47631. $schema->extends = $this->validateUri($schema, $schema->extends);
  47632. }
  47633. if (is_array($schema->extends)) {
  47634. foreach ($schema->extends as $extends) {
  47635. $this->checkUndefined($value, $extends, $path, $i);
  47636. }
  47637. } else {
  47638. $this->checkUndefined($value, $schema->extends, $path, $i);
  47639. }
  47640. }
  47641. if (!$path->fromDefault()) {
  47642. $this->applyDefaultValues($value, $schema, $path);
  47643. }
  47644. if ($this->getTypeCheck()->isObject($value)) {
  47645. if (!($value instanceof self) && isset($schema->required) && is_array($schema->required)) {
  47646. foreach ($schema->required as $required) {
  47647. if (!$this->getTypeCheck()->propertyExists($value, $required)) {
  47648. $this->addError(
  47649. $this->incrementPath($path ?: new JsonPointer(''), $required),
  47650. 'The property ' . $required . ' is required',
  47651. 'required'
  47652. );
  47653. }
  47654. }
  47655. } elseif (isset($schema->required) && !is_array($schema->required)) {
  47656. if ($schema->required && $value instanceof self) {
  47657. $propertyPaths = $path->getPropertyPaths();
  47658. $propertyName = end($propertyPaths);
  47659. $this->addError(
  47660. $path,
  47661. 'The property ' . $propertyName . ' is required',
  47662. 'required'
  47663. );
  47664. }
  47665. }
  47666. }
  47667. if (!($value instanceof self)) {
  47668. $this->checkType($value, $schema, $path, $i);
  47669. }
  47670. if (isset($schema->disallow)) {
  47671. $initErrors = $this->getErrors();
  47672. $typeSchema = new \stdClass();
  47673. $typeSchema->type = $schema->disallow;
  47674. $this->checkType($value, $typeSchema, $path);
  47675. if (count($this->getErrors()) == count($initErrors)) {
  47676. $this->addError($path, 'Disallowed value was matched', 'disallow');
  47677. } else {
  47678. $this->errors = $initErrors;
  47679. }
  47680. }
  47681. if (isset($schema->not)) {
  47682. $initErrors = $this->getErrors();
  47683. $this->checkUndefined($value, $schema->not, $path, $i);
  47684. if (count($this->getErrors()) == count($initErrors)) {
  47685. $this->addError($path, 'Matched a schema which it should not', 'not');
  47686. } else {
  47687. $this->errors = $initErrors;
  47688. }
  47689. }
  47690. if (isset($schema->dependencies) && $this->getTypeCheck()->isObject($value)) {
  47691. $this->validateDependencies($value, $schema->dependencies, $path);
  47692. }
  47693. }
  47694. private function shouldApplyDefaultValue($requiredOnly, $schema, $name = null, $parentSchema = null)
  47695. {
  47696. if (!$requiredOnly) {
  47697. return true;
  47698. }
  47699. if (
  47700. $name !== null
  47701. && isset($parentSchema->required)
  47702. && is_array($parentSchema->required)
  47703. && in_array($name, $parentSchema->required)
  47704. ) {
  47705. return true;
  47706. }
  47707. if (isset($schema->required) && !is_array($schema->required) && $schema->required) {
  47708. return true;
  47709. }
  47710. return false;
  47711. }
  47712. protected function applyDefaultValues(&$value, $schema, $path)
  47713. {
  47714. if (!$this->factory->getConfig(self::CHECK_MODE_APPLY_DEFAULTS)) {
  47715. return;
  47716. }
  47717. $requiredOnly = $this->factory->getConfig(self::CHECK_MODE_ONLY_REQUIRED_DEFAULTS);
  47718. if (isset($schema->properties) && LooseTypeCheck::isObject($value)) {
  47719. foreach ($schema->properties as $currentProperty => $propertyDefinition) {
  47720. $propertyDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($propertyDefinition);
  47721. if (
  47722. !LooseTypeCheck::propertyExists($value, $currentProperty)
  47723. && property_exists($propertyDefinition, 'default')
  47724. && $this->shouldApplyDefaultValue($requiredOnly, $propertyDefinition, $currentProperty, $schema)
  47725. ) {
  47726. if (is_object($propertyDefinition->default)) {
  47727. LooseTypeCheck::propertySet($value, $currentProperty, clone $propertyDefinition->default);
  47728. } else {
  47729. LooseTypeCheck::propertySet($value, $currentProperty, $propertyDefinition->default);
  47730. }
  47731. $this->appliedDefaults[] = $currentProperty;
  47732. }
  47733. }
  47734. } elseif (isset($schema->items) && LooseTypeCheck::isArray($value)) {
  47735. $items = array();
  47736. if (LooseTypeCheck::isArray($schema->items)) {
  47737. $items = $schema->items;
  47738. } elseif (isset($schema->minItems) && count($value) < $schema->minItems) {
  47739. $items = array_fill(count($value), $schema->minItems - count($value), $schema->items);
  47740. }
  47741. foreach ($items as $currentItem => $itemDefinition) {
  47742. $itemDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($itemDefinition);
  47743. if (
  47744. !array_key_exists($currentItem, $value)
  47745. && property_exists($itemDefinition, 'default')
  47746. && $this->shouldApplyDefaultValue($requiredOnly, $itemDefinition)) {
  47747. if (is_object($itemDefinition->default)) {
  47748. $value[$currentItem] = clone $itemDefinition->default;
  47749. } else {
  47750. $value[$currentItem] = $itemDefinition->default;
  47751. }
  47752. }
  47753. $path->setFromDefault();
  47754. }
  47755. } elseif (
  47756. $value instanceof self
  47757. && property_exists($schema, 'default')
  47758. && $this->shouldApplyDefaultValue($requiredOnly, $schema)) {
  47759. $value = is_object($schema->default) ? clone $schema->default : $schema->default;
  47760. $path->setFromDefault();
  47761. }
  47762. }
  47763. protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i = '')
  47764. {
  47765. if ($value instanceof self) {
  47766. return;
  47767. }
  47768. if (isset($schema->allOf)) {
  47769. $isValid = true;
  47770. foreach ($schema->allOf as $allOf) {
  47771. $initErrors = $this->getErrors();
  47772. $this->checkUndefined($value, $allOf, $path, $i);
  47773. $isValid = $isValid && (count($this->getErrors()) == count($initErrors));
  47774. }
  47775. if (!$isValid) {
  47776. $this->addError($path, 'Failed to match all schemas', 'allOf');
  47777. }
  47778. }
  47779. if (isset($schema->anyOf)) {
  47780. $isValid = false;
  47781. $startErrors = $this->getErrors();
  47782. $caughtException = null;
  47783. foreach ($schema->anyOf as $anyOf) {
  47784. $initErrors = $this->getErrors();
  47785. try {
  47786. $this->checkUndefined($value, $anyOf, $path, $i);
  47787. if ($isValid = (count($this->getErrors()) == count($initErrors))) {
  47788. break;
  47789. }
  47790. } catch (ValidationException $e) {
  47791. $isValid = false;
  47792. }
  47793. }
  47794. if (!$isValid) {
  47795. $this->addError($path, 'Failed to match at least one schema', 'anyOf');
  47796. } else {
  47797. $this->errors = $startErrors;
  47798. }
  47799. }
  47800. if (isset($schema->oneOf)) {
  47801. $allErrors = array();
  47802. $matchedSchemas = 0;
  47803. $startErrors = $this->getErrors();
  47804. foreach ($schema->oneOf as $oneOf) {
  47805. try {
  47806. $this->errors = array();
  47807. $this->checkUndefined($value, $oneOf, $path, $i);
  47808. if (count($this->getErrors()) == 0) {
  47809. $matchedSchemas++;
  47810. }
  47811. $allErrors = array_merge($allErrors, array_values($this->getErrors()));
  47812. } catch (ValidationException $e) {
  47813. }
  47814. }
  47815. if ($matchedSchemas !== 1) {
  47816. $this->addErrors(array_merge($allErrors, $startErrors));
  47817. $this->addError($path, 'Failed to match exactly one schema', 'oneOf');
  47818. } else {
  47819. $this->errors = $startErrors;
  47820. }
  47821. }
  47822. }
  47823. protected function validateDependencies($value, $dependencies, JsonPointer $path, $i = '')
  47824. {
  47825. foreach ($dependencies as $key => $dependency) {
  47826. if ($this->getTypeCheck()->propertyExists($value, $key)) {
  47827. if (is_string($dependency)) {
  47828. if (!$this->getTypeCheck()->propertyExists($value, $dependency)) {
  47829. $this->addError($path, "$key depends on $dependency and $dependency is missing", 'dependencies');
  47830. }
  47831. } elseif (is_array($dependency)) {
  47832. foreach ($dependency as $d) {
  47833. if (!$this->getTypeCheck()->propertyExists($value, $d)) {
  47834. $this->addError($path, "$key depends on $d and $d is missing", 'dependencies');
  47835. }
  47836. }
  47837. } elseif (is_object($dependency)) {
  47838. $this->checkUndefined($value, $dependency, $path, $i);
  47839. }
  47840. }
  47841. }
  47842. }
  47843. protected function validateUri($schema, $schemaUri = null)
  47844. {
  47845. $resolver = new UriResolver();
  47846. $retriever = $this->factory->getUriRetriever();
  47847. $jsonSchema = null;
  47848. if ($resolver->isValid($schemaUri)) {
  47849. $schemaId = property_exists($schema, 'id') ? $schema->id : null;
  47850. $jsonSchema = $retriever->retrieve($schemaId, $schemaUri);
  47851. }
  47852. return $jsonSchema;
  47853. }
  47854. }
  47855. <?php
  47856. namespace JsonSchema\Entity;
  47857. use JsonSchema\Exception\InvalidArgumentException;
  47858. class JsonPointer
  47859. {
  47860. private $filename;
  47861. private $propertyPaths = array();
  47862. private $fromDefault = false;
  47863. public function __construct($value)
  47864. {
  47865. if (!is_string($value)) {
  47866. throw new InvalidArgumentException('Ref value must be a string');
  47867. }
  47868. $splitRef = explode('#', $value, 2);
  47869. $this->filename = $splitRef[0];
  47870. if (array_key_exists(1, $splitRef)) {
  47871. $this->propertyPaths = $this->decodePropertyPaths($splitRef[1]);
  47872. }
  47873. }
  47874. private function decodePropertyPaths($propertyPathString)
  47875. {
  47876. $paths = array();
  47877. foreach (explode('/', trim($propertyPathString, '/')) as $path) {
  47878. $path = $this->decodePath($path);
  47879. if (is_string($path) && '' !== $path) {
  47880. $paths[] = $path;
  47881. }
  47882. }
  47883. return $paths;
  47884. }
  47885. private function encodePropertyPaths()
  47886. {
  47887. return array_map(
  47888. array($this, 'encodePath'),
  47889. $this->getPropertyPaths()
  47890. );
  47891. }
  47892. private function decodePath($path)
  47893. {
  47894. return strtr($path, array('~1' => '/', '~0' => '~', '%25' => '%'));
  47895. }
  47896. private function encodePath($path)
  47897. {
  47898. return strtr($path, array('/' => '~1', '~' => '~0', '%' => '%25'));
  47899. }
  47900. public function getFilename()
  47901. {
  47902. return $this->filename;
  47903. }
  47904. public function getPropertyPaths()
  47905. {
  47906. return $this->propertyPaths;
  47907. }
  47908. public function withPropertyPaths(array $propertyPaths)
  47909. {
  47910. $new = clone $this;
  47911. $new->propertyPaths = $propertyPaths;
  47912. return $new;
  47913. }
  47914. public function getPropertyPathAsString()
  47915. {
  47916. return rtrim('#/' . implode('/', $this->encodePropertyPaths()), '/');
  47917. }
  47918. public function __toString()
  47919. {
  47920. return $this->getFilename() . $this->getPropertyPathAsString();
  47921. }
  47922. public function setFromDefault()
  47923. {
  47924. $this->fromDefault = true;
  47925. }
  47926. public function fromDefault()
  47927. {
  47928. return $this->fromDefault;
  47929. }
  47930. }
  47931. <?php
  47932. namespace JsonSchema\Exception;
  47933. interface ExceptionInterface
  47934. {
  47935. }
  47936. <?php
  47937. namespace JsonSchema\Exception;
  47938. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  47939. {
  47940. }
  47941. <?php
  47942. namespace JsonSchema\Exception;
  47943. class InvalidConfigException extends RuntimeException
  47944. {
  47945. }
  47946. <?php
  47947. namespace JsonSchema\Exception;
  47948. class InvalidSchemaException extends RuntimeException
  47949. {
  47950. }
  47951. <?php
  47952. namespace JsonSchema\Exception;
  47953. class InvalidSchemaMediaTypeException extends RuntimeException
  47954. {
  47955. }
  47956. <?php
  47957. namespace JsonSchema\Exception;
  47958. class InvalidSourceUriException extends InvalidArgumentException
  47959. {
  47960. }
  47961. <?php
  47962. namespace JsonSchema\Exception;
  47963. class JsonDecodingException extends RuntimeException
  47964. {
  47965. public function __construct($code = JSON_ERROR_NONE, \Exception $previous = null)
  47966. {
  47967. switch ($code) {
  47968. case JSON_ERROR_DEPTH:
  47969. $message = 'The maximum stack depth has been exceeded';
  47970. break;
  47971. case JSON_ERROR_STATE_MISMATCH:
  47972. $message = 'Invalid or malformed JSON';
  47973. break;
  47974. case JSON_ERROR_CTRL_CHAR:
  47975. $message = 'Control character error, possibly incorrectly encoded';
  47976. break;
  47977. case JSON_ERROR_UTF8:
  47978. $message = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  47979. break;
  47980. case JSON_ERROR_SYNTAX:
  47981. $message = 'JSON syntax is malformed';
  47982. break;
  47983. default:
  47984. $message = 'Syntax error';
  47985. }
  47986. parent::__construct($message, $code, $previous);
  47987. }
  47988. }
  47989. <?php
  47990. namespace JsonSchema\Exception;
  47991. class ResourceNotFoundException extends RuntimeException
  47992. {
  47993. }
  47994. <?php
  47995. namespace JsonSchema\Exception;
  47996. class RuntimeException extends \RuntimeException implements ExceptionInterface
  47997. {
  47998. }
  47999. <?php
  48000. namespace JsonSchema\Exception;
  48001. class UnresolvableJsonPointerException extends InvalidArgumentException
  48002. {
  48003. }
  48004. <?php
  48005. namespace JsonSchema\Exception;
  48006. class UriResolverException extends RuntimeException
  48007. {
  48008. }
  48009. <?php
  48010. namespace JsonSchema\Exception;
  48011. class ValidationException extends RuntimeException
  48012. {
  48013. }
  48014. <?php
  48015. namespace JsonSchema\Iterator;
  48016. class ObjectIterator implements \Iterator, \Countable
  48017. {
  48018. private $object;
  48019. private $position = 0;
  48020. private $data = array();
  48021. private $initialized = false;
  48022. public function __construct($object)
  48023. {
  48024. $this->object = $object;
  48025. }
  48026. public function current()
  48027. {
  48028. $this->initialize();
  48029. return $this->data[$this->position];
  48030. }
  48031. public function next()
  48032. {
  48033. $this->initialize();
  48034. $this->position++;
  48035. }
  48036. public function key()
  48037. {
  48038. $this->initialize();
  48039. return $this->position;
  48040. }
  48041. public function valid()
  48042. {
  48043. $this->initialize();
  48044. return isset($this->data[$this->position]);
  48045. }
  48046. public function rewind()
  48047. {
  48048. $this->initialize();
  48049. $this->position = 0;
  48050. }
  48051. public function count()
  48052. {
  48053. $this->initialize();
  48054. return count($this->data);
  48055. }
  48056. private function initialize()
  48057. {
  48058. if (!$this->initialized) {
  48059. $this->data = $this->buildDataFromObject($this->object);
  48060. $this->initialized = true;
  48061. }
  48062. }
  48063. private function buildDataFromObject($object)
  48064. {
  48065. $result = array();
  48066. $stack = new \SplStack();
  48067. $stack->push($object);
  48068. while (!$stack->isEmpty()) {
  48069. $current = $stack->pop();
  48070. if (is_object($current)) {
  48071. array_push($result, $current);
  48072. }
  48073. foreach ($this->getDataFromItem($current) as $propertyName => $propertyValue) {
  48074. if (is_object($propertyValue) || is_array($propertyValue)) {
  48075. $stack->push($propertyValue);
  48076. }
  48077. }
  48078. }
  48079. return $result;
  48080. }
  48081. private function getDataFromItem($item)
  48082. {
  48083. if (!is_object($item) && !is_array($item)) {
  48084. return array();
  48085. }
  48086. return is_object($item) ? get_object_vars($item) : $item;
  48087. }
  48088. }
  48089. <?php
  48090. namespace JsonSchema;
  48091. class Rfc3339
  48092. {
  48093. const REGEX = '/^(\d{4}-\d{2}-\d{2}[T ]{1}\d{2}:\d{2}:\d{2})(\.\d+)?(Z|([+-]\d{2}):?(\d{2}))$/';
  48094. public static function createFromString($string)
  48095. {
  48096. if (!preg_match(self::REGEX, strtoupper($string), $matches)) {
  48097. return null;
  48098. }
  48099. $dateAndTime = $matches[1];
  48100. $microseconds = $matches[2] ?: '.000000';
  48101. $timeZone = 'Z' !== $matches[3] ? $matches[4] . ':' . $matches[5] : '+00:00';
  48102. $dateFormat = strpos($dateAndTime, 'T') === false ? 'Y-m-d H:i:s.uP' : 'Y-m-d\TH:i:s.uP';
  48103. $dateTime = \DateTime::createFromFormat($dateFormat, $dateAndTime . $microseconds . $timeZone, new \DateTimeZone('UTC'));
  48104. return $dateTime ?: null;
  48105. }
  48106. }
  48107. <?php
  48108. namespace JsonSchema;
  48109. use JsonSchema\Constraints\BaseConstraint;
  48110. use JsonSchema\Entity\JsonPointer;
  48111. use JsonSchema\Exception\UnresolvableJsonPointerException;
  48112. use JsonSchema\Uri\UriResolver;
  48113. use JsonSchema\Uri\UriRetriever;
  48114. class SchemaStorage implements SchemaStorageInterface
  48115. {
  48116. const INTERNAL_PROVIDED_SCHEMA_URI = 'internal://provided-schema/';
  48117. protected $uriRetriever;
  48118. protected $uriResolver;
  48119. protected $schemas = array();
  48120. public function __construct(
  48121. UriRetrieverInterface $uriRetriever = null,
  48122. UriResolverInterface $uriResolver = null
  48123. ) {
  48124. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  48125. $this->uriResolver = $uriResolver ?: new UriResolver();
  48126. }
  48127. public function getUriRetriever()
  48128. {
  48129. return $this->uriRetriever;
  48130. }
  48131. public function getUriResolver()
  48132. {
  48133. return $this->uriResolver;
  48134. }
  48135. public function addSchema($id, $schema = null)
  48136. {
  48137. if (is_null($schema) && $id !== self::INTERNAL_PROVIDED_SCHEMA_URI) {
  48138. $schema = $this->uriRetriever->retrieve($id);
  48139. }
  48140. if (is_array($schema)) {
  48141. $schema = BaseConstraint::arrayToObjectRecursive($schema);
  48142. }
  48143. if (is_object($schema) && property_exists($schema, 'id')) {
  48144. if ($schema->id == 'http://json-schema.org/draft-04/schema#') {
  48145. $schema->properties->id->format = 'uri-reference';
  48146. } elseif ($schema->id == 'http://json-schema.org/draft-03/schema#') {
  48147. $schema->properties->id->format = 'uri-reference';
  48148. $schema->properties->{'$ref'}->format = 'uri-reference';
  48149. }
  48150. }
  48151. $this->expandRefs($schema, $id);
  48152. $this->schemas[$id] = $schema;
  48153. }
  48154. private function expandRefs(&$schema, $base = null)
  48155. {
  48156. if (!is_object($schema)) {
  48157. if (is_array($schema)) {
  48158. foreach ($schema as &$member) {
  48159. $this->expandRefs($member, $base);
  48160. }
  48161. }
  48162. return;
  48163. }
  48164. if (property_exists($schema, 'id') && is_string($schema->id) && $base != $schema->id) {
  48165. $base = $this->uriResolver->resolve($schema->id, $base);
  48166. }
  48167. if (property_exists($schema, '$ref') && is_string($schema->{'$ref'})) {
  48168. $refPointer = new JsonPointer($this->uriResolver->resolve($schema->{'$ref'}, $base));
  48169. $schema->{'$ref'} = (string) $refPointer;
  48170. }
  48171. foreach ($schema as &$member) {
  48172. $this->expandRefs($member, $base);
  48173. }
  48174. }
  48175. public function getSchema($id)
  48176. {
  48177. if (!array_key_exists($id, $this->schemas)) {
  48178. $this->addSchema($id);
  48179. }
  48180. return $this->schemas[$id];
  48181. }
  48182. public function resolveRef($ref)
  48183. {
  48184. $jsonPointer = new JsonPointer($ref);
  48185. $fileName = $jsonPointer->getFilename();
  48186. if (!strlen($fileName)) {
  48187. throw new UnresolvableJsonPointerException(sprintf(
  48188. "Could not resolve fragment '%s': no file is defined",
  48189. $jsonPointer->getPropertyPathAsString()
  48190. ));
  48191. }
  48192. $refSchema = $this->getSchema($fileName);
  48193. foreach ($jsonPointer->getPropertyPaths() as $path) {
  48194. if (is_object($refSchema) && property_exists($refSchema, $path)) {
  48195. $refSchema = $this->resolveRefSchema($refSchema->{$path});
  48196. } elseif (is_array($refSchema) && array_key_exists($path, $refSchema)) {
  48197. $refSchema = $this->resolveRefSchema($refSchema[$path]);
  48198. } else {
  48199. throw new UnresolvableJsonPointerException(sprintf(
  48200. 'File: %s is found, but could not resolve fragment: %s',
  48201. $jsonPointer->getFilename(),
  48202. $jsonPointer->getPropertyPathAsString()
  48203. ));
  48204. }
  48205. }
  48206. return $refSchema;
  48207. }
  48208. public function resolveRefSchema($refSchema)
  48209. {
  48210. if (is_object($refSchema) && property_exists($refSchema, '$ref') && is_string($refSchema->{'$ref'})) {
  48211. $newSchema = $this->resolveRef($refSchema->{'$ref'});
  48212. $refSchema = (object) (get_object_vars($refSchema) + get_object_vars($newSchema));
  48213. unset($refSchema->{'$ref'});
  48214. }
  48215. return $refSchema;
  48216. }
  48217. }
  48218. <?php
  48219. namespace JsonSchema;
  48220. interface SchemaStorageInterface
  48221. {
  48222. public function addSchema($id, $schema = null);
  48223. public function getSchema($id);
  48224. public function resolveRef($ref);
  48225. public function resolveRefSchema($refSchema);
  48226. }
  48227. <?php
  48228. namespace JsonSchema\Uri\Retrievers;
  48229. abstract class AbstractRetriever implements UriRetrieverInterface
  48230. {
  48231. protected $contentType;
  48232. public function getContentType()
  48233. {
  48234. return $this->contentType;
  48235. }
  48236. }
  48237. <?php
  48238. namespace JsonSchema\Uri\Retrievers;
  48239. use JsonSchema\Exception\RuntimeException;
  48240. use JsonSchema\Validator;
  48241. class Curl extends AbstractRetriever
  48242. {
  48243. protected $messageBody;
  48244. public function __construct()
  48245. {
  48246. if (!function_exists('curl_init')) {
  48247. throw new RuntimeException('cURL not installed');
  48248. }
  48249. }
  48250. public function retrieve($uri)
  48251. {
  48252. $ch = curl_init();
  48253. curl_setopt($ch, CURLOPT_URL, $uri);
  48254. curl_setopt($ch, CURLOPT_HEADER, true);
  48255. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  48256. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: ' . Validator::SCHEMA_MEDIA_TYPE));
  48257. $response = curl_exec($ch);
  48258. if (false === $response) {
  48259. throw new \JsonSchema\Exception\ResourceNotFoundException('JSON schema not found');
  48260. }
  48261. $this->fetchMessageBody($response);
  48262. $this->fetchContentType($response);
  48263. curl_close($ch);
  48264. return $this->messageBody;
  48265. }
  48266. private function fetchMessageBody($response)
  48267. {
  48268. preg_match("/(?:\r\n){2}(.*)$/ms", $response, $match);
  48269. $this->messageBody = $match[1];
  48270. }
  48271. protected function fetchContentType($response)
  48272. {
  48273. if (0 < preg_match("/Content-Type:(\V*)/ims", $response, $match)) {
  48274. $this->contentType = trim($match[1]);
  48275. return true;
  48276. }
  48277. return false;
  48278. }
  48279. }
  48280. <?php
  48281. namespace JsonSchema\Uri\Retrievers;
  48282. use JsonSchema\Exception\ResourceNotFoundException;
  48283. class FileGetContents extends AbstractRetriever
  48284. {
  48285. protected $messageBody;
  48286. public function retrieve($uri)
  48287. {
  48288. $errorMessage = null;
  48289. set_error_handler(function ($errno, $errstr) use (&$errorMessage) {
  48290. $errorMessage = $errstr;
  48291. });
  48292. $response = file_get_contents($uri);
  48293. restore_error_handler();
  48294. if ($errorMessage) {
  48295. throw new ResourceNotFoundException($errorMessage);
  48296. }
  48297. if (false === $response) {
  48298. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  48299. }
  48300. if ($response == ''
  48301. && substr($uri, 0, 7) == 'file://' && substr($uri, -1) == '/'
  48302. ) {
  48303. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  48304. }
  48305. $this->messageBody = $response;
  48306. if (!empty($http_response_header)) {
  48307. $this->fetchContentType($http_response_header);
  48308. } else {
  48309. $this->contentType = null;
  48310. }
  48311. return $this->messageBody;
  48312. }
  48313. private function fetchContentType(array $headers)
  48314. {
  48315. foreach ($headers as $header) {
  48316. if ($this->contentType = self::getContentTypeMatchInHeader($header)) {
  48317. return true;
  48318. }
  48319. }
  48320. return false;
  48321. }
  48322. protected static function getContentTypeMatchInHeader($header)
  48323. {
  48324. if (0 < preg_match("/Content-Type:(\V*)/ims", $header, $match)) {
  48325. return trim($match[1]);
  48326. }
  48327. return null;
  48328. }
  48329. }
  48330. <?php
  48331. namespace JsonSchema\Uri\Retrievers;
  48332. use JsonSchema\Validator;
  48333. class PredefinedArray extends AbstractRetriever
  48334. {
  48335. private $schemas;
  48336. public function __construct(array $schemas, $contentType = Validator::SCHEMA_MEDIA_TYPE)
  48337. {
  48338. $this->schemas = $schemas;
  48339. $this->contentType = $contentType;
  48340. }
  48341. public function retrieve($uri)
  48342. {
  48343. if (!array_key_exists($uri, $this->schemas)) {
  48344. throw new \JsonSchema\Exception\ResourceNotFoundException(sprintf(
  48345. 'The JSON schema "%s" was not found.',
  48346. $uri
  48347. ));
  48348. }
  48349. return $this->schemas[$uri];
  48350. }
  48351. }
  48352. <?php
  48353. namespace JsonSchema\Uri\Retrievers;
  48354. interface UriRetrieverInterface
  48355. {
  48356. public function retrieve($uri);
  48357. public function getContentType();
  48358. }
  48359. <?php
  48360. namespace JsonSchema\Uri;
  48361. use JsonSchema\Exception\UriResolverException;
  48362. use JsonSchema\UriResolverInterface;
  48363. class UriResolver implements UriResolverInterface
  48364. {
  48365. public function parse($uri)
  48366. {
  48367. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  48368. $components = array();
  48369. if (5 < count($match)) {
  48370. $components = array(
  48371. 'scheme' => $match[2],
  48372. 'authority' => $match[4],
  48373. 'path' => $match[5]
  48374. );
  48375. }
  48376. if (7 < count($match)) {
  48377. $components['query'] = $match[7];
  48378. }
  48379. if (9 < count($match)) {
  48380. $components['fragment'] = $match[9];
  48381. }
  48382. return $components;
  48383. }
  48384. public function generate(array $components)
  48385. {
  48386. $uri = $components['scheme'] . '://'
  48387. . $components['authority']
  48388. . $components['path'];
  48389. if (array_key_exists('query', $components) && strlen($components['query'])) {
  48390. $uri .= '?' . $components['query'];
  48391. }
  48392. if (array_key_exists('fragment', $components)) {
  48393. $uri .= '#' . $components['fragment'];
  48394. }
  48395. return $uri;
  48396. }
  48397. public function resolve($uri, $baseUri = null)
  48398. {
  48399. if (
  48400. !is_null($baseUri) &&
  48401. !filter_var($baseUri, \FILTER_VALIDATE_URL) &&
  48402. !preg_match('|^[^/]+://|u', $baseUri)
  48403. ) {
  48404. if (is_file($baseUri)) {
  48405. $baseUri = 'file://' . realpath($baseUri);
  48406. } elseif (is_dir($baseUri)) {
  48407. $baseUri = 'file://' . realpath($baseUri) . '/';
  48408. } else {
  48409. $baseUri = 'file://' . getcwd() . '/' . $baseUri;
  48410. }
  48411. }
  48412. if ($uri == '') {
  48413. return $baseUri;
  48414. }
  48415. $components = $this->parse($uri);
  48416. $path = $components['path'];
  48417. if (!empty($components['scheme'])) {
  48418. return $uri;
  48419. }
  48420. $baseComponents = $this->parse($baseUri);
  48421. $basePath = $baseComponents['path'];
  48422. $baseComponents['path'] = self::combineRelativePathWithBasePath($path, $basePath);
  48423. if (isset($components['fragment'])) {
  48424. $baseComponents['fragment'] = $components['fragment'];
  48425. }
  48426. return $this->generate($baseComponents);
  48427. }
  48428. public static function combineRelativePathWithBasePath($relativePath, $basePath)
  48429. {
  48430. $relativePath = self::normalizePath($relativePath);
  48431. if ($relativePath == '') {
  48432. return $basePath;
  48433. }
  48434. if ($relativePath[0] == '/') {
  48435. return $relativePath;
  48436. }
  48437. $basePathSegments = explode('/', $basePath);
  48438. preg_match('|^/?(\.\./(?:\./)*)*|', $relativePath, $match);
  48439. $numLevelUp = strlen($match[0]) /3 + 1;
  48440. if ($numLevelUp >= count($basePathSegments)) {
  48441. throw new UriResolverException(sprintf("Unable to resolve URI '%s' from base '%s'", $relativePath, $basePath));
  48442. }
  48443. $basePathSegments = array_slice($basePathSegments, 0, -$numLevelUp);
  48444. $path = preg_replace('|^/?(\.\./(\./)*)*|', '', $relativePath);
  48445. return implode('/', $basePathSegments) . '/' . $path;
  48446. }
  48447. private static function normalizePath($path)
  48448. {
  48449. $path = preg_replace('|((?<!\.)\./)*|', '', $path);
  48450. $path = preg_replace('|//|', '/', $path);
  48451. return $path;
  48452. }
  48453. public function isValid($uri)
  48454. {
  48455. $components = $this->parse($uri);
  48456. return !empty($components);
  48457. }
  48458. }
  48459. <?php
  48460. namespace JsonSchema\Uri;
  48461. use JsonSchema\Exception\InvalidSchemaMediaTypeException;
  48462. use JsonSchema\Exception\JsonDecodingException;
  48463. use JsonSchema\Exception\ResourceNotFoundException;
  48464. use JsonSchema\Uri\Retrievers\FileGetContents;
  48465. use JsonSchema\Uri\Retrievers\UriRetrieverInterface;
  48466. use JsonSchema\UriRetrieverInterface as BaseUriRetrieverInterface;
  48467. use JsonSchema\Validator;
  48468. class UriRetriever implements BaseUriRetrieverInterface
  48469. {
  48470. protected $translationMap = array(
  48471. '|^https?://json-schema.org/draft-(0[34])/schema#?|' => 'package://dist/schema/json-schema-draft-$1.json'
  48472. );
  48473. protected $uriRetriever = null;
  48474. private $schemaCache = array();
  48475. public function confirmMediaType($uriRetriever, $uri)
  48476. {
  48477. $contentType = $uriRetriever->getContentType();
  48478. if (is_null($contentType)) {
  48479. return;
  48480. }
  48481. if (in_array($contentType, array(Validator::SCHEMA_MEDIA_TYPE, 'application/json'))) {
  48482. return;
  48483. }
  48484. if (substr($uri, 0, 23) == 'http://json-schema.org/') {
  48485. return true;
  48486. }
  48487. throw new InvalidSchemaMediaTypeException(sprintf('Media type %s expected', Validator::SCHEMA_MEDIA_TYPE));
  48488. }
  48489. public function getUriRetriever()
  48490. {
  48491. if (is_null($this->uriRetriever)) {
  48492. $this->setUriRetriever(new FileGetContents());
  48493. }
  48494. return $this->uriRetriever;
  48495. }
  48496. public function resolvePointer($jsonSchema, $uri)
  48497. {
  48498. $resolver = new UriResolver();
  48499. $parsed = $resolver->parse($uri);
  48500. if (empty($parsed['fragment'])) {
  48501. return $jsonSchema;
  48502. }
  48503. $path = explode('/', $parsed['fragment']);
  48504. while ($path) {
  48505. $pathElement = array_shift($path);
  48506. if (!empty($pathElement)) {
  48507. $pathElement = str_replace('~1', '/', $pathElement);
  48508. $pathElement = str_replace('~0', '~', $pathElement);
  48509. if (!empty($jsonSchema->$pathElement)) {
  48510. $jsonSchema = $jsonSchema->$pathElement;
  48511. } else {
  48512. throw new ResourceNotFoundException(
  48513. 'Fragment "' . $parsed['fragment'] . '" not found'
  48514. . ' in ' . $uri
  48515. );
  48516. }
  48517. if (!is_object($jsonSchema)) {
  48518. throw new ResourceNotFoundException(
  48519. 'Fragment part "' . $pathElement . '" is no object '
  48520. . ' in ' . $uri
  48521. );
  48522. }
  48523. }
  48524. }
  48525. return $jsonSchema;
  48526. }
  48527. public function retrieve($uri, $baseUri = null, $translate = true)
  48528. {
  48529. $resolver = new UriResolver();
  48530. $resolvedUri = $fetchUri = $resolver->resolve($uri, $baseUri);
  48531. $arParts = $resolver->parse($resolvedUri);
  48532. if (isset($arParts['fragment'])) {
  48533. unset($arParts['fragment']);
  48534. $fetchUri = $resolver->generate($arParts);
  48535. }
  48536. if ($translate) {
  48537. $fetchUri = $this->translate($fetchUri);
  48538. }
  48539. $jsonSchema = $this->loadSchema($fetchUri);
  48540. $jsonSchema = $this->resolvePointer($jsonSchema, $resolvedUri);
  48541. if ($jsonSchema instanceof \stdClass) {
  48542. $jsonSchema->id = $resolvedUri;
  48543. }
  48544. return $jsonSchema;
  48545. }
  48546. protected function loadSchema($fetchUri)
  48547. {
  48548. if (isset($this->schemaCache[$fetchUri])) {
  48549. return $this->schemaCache[$fetchUri];
  48550. }
  48551. $uriRetriever = $this->getUriRetriever();
  48552. $contents = $this->uriRetriever->retrieve($fetchUri);
  48553. $this->confirmMediaType($uriRetriever, $fetchUri);
  48554. $jsonSchema = json_decode($contents);
  48555. if (JSON_ERROR_NONE < $error = json_last_error()) {
  48556. throw new JsonDecodingException($error);
  48557. }
  48558. $this->schemaCache[$fetchUri] = $jsonSchema;
  48559. return $jsonSchema;
  48560. }
  48561. public function setUriRetriever(UriRetrieverInterface $uriRetriever)
  48562. {
  48563. $this->uriRetriever = $uriRetriever;
  48564. return $this;
  48565. }
  48566. public function parse($uri)
  48567. {
  48568. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  48569. $components = array();
  48570. if (5 < count($match)) {
  48571. $components = array(
  48572. 'scheme' => $match[2],
  48573. 'authority' => $match[4],
  48574. 'path' => $match[5]
  48575. );
  48576. }
  48577. if (7 < count($match)) {
  48578. $components['query'] = $match[7];
  48579. }
  48580. if (9 < count($match)) {
  48581. $components['fragment'] = $match[9];
  48582. }
  48583. return $components;
  48584. }
  48585. public function generate(array $components)
  48586. {
  48587. $uri = $components['scheme'] . '://'
  48588. . $components['authority']
  48589. . $components['path'];
  48590. if (array_key_exists('query', $components)) {
  48591. $uri .= $components['query'];
  48592. }
  48593. if (array_key_exists('fragment', $components)) {
  48594. $uri .= $components['fragment'];
  48595. }
  48596. return $uri;
  48597. }
  48598. public function resolve($uri, $baseUri = null)
  48599. {
  48600. $components = $this->parse($uri);
  48601. $path = $components['path'];
  48602. if ((array_key_exists('scheme', $components)) && ('http' === $components['scheme'])) {
  48603. return $uri;
  48604. }
  48605. $baseComponents = $this->parse($baseUri);
  48606. $basePath = $baseComponents['path'];
  48607. $baseComponents['path'] = UriResolver::combineRelativePathWithBasePath($path, $basePath);
  48608. return $this->generate($baseComponents);
  48609. }
  48610. public function isValid($uri)
  48611. {
  48612. $components = $this->parse($uri);
  48613. return !empty($components);
  48614. }
  48615. public function setTranslation($from, $to)
  48616. {
  48617. $this->translationMap[$from] = $to;
  48618. }
  48619. public function translate($uri)
  48620. {
  48621. foreach ($this->translationMap as $from => $to) {
  48622. $uri = preg_replace($from, $to, $uri);
  48623. }
  48624. $uri = preg_replace('|^package://|', sprintf('file://%s/', realpath(__DIR__ . '/../../..')), $uri);
  48625. return $uri;
  48626. }
  48627. }
  48628. <?php
  48629. namespace JsonSchema;
  48630. interface UriResolverInterface
  48631. {
  48632. public function resolve($uri, $baseUri = null);
  48633. }
  48634. <?php
  48635. namespace JsonSchema;
  48636. interface UriRetrieverInterface
  48637. {
  48638. public function retrieve($uri, $baseUri = null);
  48639. }
  48640. <?php
  48641. namespace JsonSchema;
  48642. use JsonSchema\Constraints\BaseConstraint;
  48643. use JsonSchema\Constraints\Constraint;
  48644. class Validator extends BaseConstraint
  48645. {
  48646. const SCHEMA_MEDIA_TYPE = 'application/schema+json';
  48647. const ERROR_NONE = 0x00000000;
  48648. const ERROR_ALL = 0xFFFFFFFF;
  48649. const ERROR_DOCUMENT_VALIDATION = 0x00000001;
  48650. const ERROR_SCHEMA_VALIDATION = 0x00000002;
  48651. public function validate(&$value, $schema = null, $checkMode = null)
  48652. {
  48653. if (is_array($schema)) {
  48654. $schema = self::arrayToObjectRecursive($schema);
  48655. }
  48656. $initialCheckMode = $this->factory->getConfig();
  48657. if ($checkMode !== null) {
  48658. $this->factory->setConfig($checkMode);
  48659. }
  48660. if (is_object($schema) && property_exists($schema, 'id')) {
  48661. $schemaURI = $schema->id;
  48662. } else {
  48663. $schemaURI = SchemaStorage::INTERNAL_PROVIDED_SCHEMA_URI;
  48664. }
  48665. $this->factory->getSchemaStorage()->addSchema($schemaURI, $schema);
  48666. $validator = $this->factory->createInstanceFor('schema');
  48667. $validator->check(
  48668. $value,
  48669. $this->factory->getSchemaStorage()->getSchema($schemaURI)
  48670. );
  48671. $this->factory->setConfig($initialCheckMode);
  48672. $this->addErrors(array_unique($validator->getErrors(), SORT_REGULAR));
  48673. return $validator->getErrorMask();
  48674. }
  48675. public function check($value, $schema)
  48676. {
  48677. return $this->validate($value, $schema);
  48678. }
  48679. public function coerce(&$value, $schema)
  48680. {
  48681. return $this->validate($value, $schema, Constraint::CHECK_MODE_COERCE_TYPES);
  48682. }
  48683. }
  48684. Copyright (C) 2015 Composer
  48685. Permission is hereby granted, free of charge, to any person obtaining a copy of
  48686. this software and associated documentation files (the "Software"), to deal in
  48687. the Software without restriction, including without limitation the rights to
  48688. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  48689. of the Software, and to permit persons to whom the Software is furnished to do
  48690. so, subject to the following conditions:
  48691. The above copyright notice and this permission notice shall be included in all
  48692. copies or substantial portions of the Software.
  48693. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  48694. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  48695. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  48696. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  48697. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  48698. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  48699. SOFTWARE.
  48700. <?php
  48701. namespace Composer\Spdx;
  48702. class SpdxLicenses
  48703. {
  48704. const LICENSES_FILE = 'spdx-licenses.json';
  48705. const EXCEPTIONS_FILE = 'spdx-exceptions.json';
  48706. private $licenses;
  48707. private $licensesExpression;
  48708. private $exceptions;
  48709. private $exceptionsExpression;
  48710. public function __construct()
  48711. {
  48712. $this->loadLicenses();
  48713. $this->loadExceptions();
  48714. }
  48715. public function getLicenseByIdentifier($identifier)
  48716. {
  48717. $key = strtolower($identifier);
  48718. if (!isset($this->licenses[$key])) {
  48719. return;
  48720. }
  48721. list($identifier, $name, $isOsiApproved, $isDeprecatedLicenseId) = $this->licenses[$key];
  48722. return array(
  48723. $name,
  48724. $isOsiApproved,
  48725. 'https://spdx.org/licenses/' . $identifier . '.html#licenseText',
  48726. $isDeprecatedLicenseId,
  48727. );
  48728. }
  48729. public function getLicenses()
  48730. {
  48731. return $this->licenses;
  48732. }
  48733. public function getExceptionByIdentifier($identifier)
  48734. {
  48735. $key = strtolower($identifier);
  48736. if (!isset($this->exceptions[$key])) {
  48737. return;
  48738. }
  48739. list($identifier, $name) = $this->exceptions[$key];
  48740. return array(
  48741. $name,
  48742. 'https://spdx.org/licenses/' . $identifier . '.html#licenseExceptionText',
  48743. );
  48744. }
  48745. public function getIdentifierByName($name)
  48746. {
  48747. foreach ($this->licenses as $licenseData) {
  48748. if ($licenseData[1] === $name) {
  48749. return $licenseData[0];
  48750. }
  48751. }
  48752. foreach ($this->exceptions as $licenseData) {
  48753. if ($licenseData[1] === $name) {
  48754. return $licenseData[0];
  48755. }
  48756. }
  48757. }
  48758. public function isOsiApprovedByIdentifier($identifier)
  48759. {
  48760. return $this->licenses[strtolower($identifier)][2];
  48761. }
  48762. public function isDeprecatedByIdentifier($identifier)
  48763. {
  48764. return $this->licenses[strtolower($identifier)][3];
  48765. }
  48766. public function validate($license)
  48767. {
  48768. if (is_array($license)) {
  48769. $count = count($license);
  48770. if ($count !== count(array_filter($license, 'is_string'))) {
  48771. throw new \InvalidArgumentException('Array of strings expected.');
  48772. }
  48773. $license = $count > 1 ? '(' . implode(' OR ', $license) . ')' : (string) reset($license);
  48774. }
  48775. if (!is_string($license)) {
  48776. throw new \InvalidArgumentException(sprintf(
  48777. 'Array or String expected, %s given.',
  48778. gettype($license)
  48779. ));
  48780. }
  48781. return $this->isValidLicenseString($license);
  48782. }
  48783. public static function getResourcesDir()
  48784. {
  48785. return dirname(__DIR__) . '/res';
  48786. }
  48787. private function loadLicenses()
  48788. {
  48789. if (null !== $this->licenses) {
  48790. return;
  48791. }
  48792. $json = file_get_contents(self::getResourcesDir() . '/' . self::LICENSES_FILE);
  48793. $this->licenses = array();
  48794. foreach (json_decode($json, true) as $identifier => $license) {
  48795. $this->licenses[strtolower($identifier)] = array($identifier, $license[0], $license[1], $license[2]);
  48796. }
  48797. }
  48798. private function loadExceptions()
  48799. {
  48800. if (null !== $this->exceptions) {
  48801. return;
  48802. }
  48803. $json = file_get_contents(self::getResourcesDir() . '/' . self::EXCEPTIONS_FILE);
  48804. $this->exceptions = array();
  48805. foreach (json_decode($json, true) as $identifier => $exception) {
  48806. $this->exceptions[strtolower($identifier)] = array($identifier, $exception[0]);
  48807. }
  48808. }
  48809. private function getLicensesExpression()
  48810. {
  48811. if (null === $this->licensesExpression) {
  48812. $licenses = array_map('preg_quote', array_keys($this->licenses));
  48813. rsort($licenses);
  48814. $licenses = implode('|', $licenses);
  48815. $this->licensesExpression = $licenses;
  48816. }
  48817. return $this->licensesExpression;
  48818. }
  48819. private function getExceptionsExpression()
  48820. {
  48821. if (null === $this->exceptionsExpression) {
  48822. $exceptions = array_map('preg_quote', array_keys($this->exceptions));
  48823. rsort($exceptions);
  48824. $exceptions = implode('|', $exceptions);
  48825. $this->exceptionsExpression = $exceptions;
  48826. }
  48827. return $this->exceptionsExpression;
  48828. }
  48829. private function isValidLicenseString($license)
  48830. {
  48831. if (isset($this->licenses[strtolower($license)])) {
  48832. return true;
  48833. }
  48834. $licenses = $this->getLicensesExpression();
  48835. $exceptions = $this->getExceptionsExpression();
  48836. $regex = <<<REGEX
  48837. {
  48838. (?(DEFINE)
  48839. # idstring: 1*( ALPHA / DIGIT / - / . )
  48840. (?<idstring>[\pL\pN.-]{1,})
  48841. # license-id: taken from list
  48842. (?<licenseid>${licenses})
  48843. # license-exception-id: taken from list
  48844. (?<licenseexceptionid>${exceptions})
  48845. # license-ref: [DocumentRef-1*(idstring):]LicenseRef-1*(idstring)
  48846. (?<licenseref>(?:DocumentRef-(?&idstring):)?LicenseRef-(?&idstring))
  48847. # simple-expresssion: license-id / license-id+ / license-ref
  48848. (?<simple_expression>(?&licenseid)\+? | (?&licenseid) | (?&licenseref))
  48849. # compound-expression: 1*(
  48850. # simple-expression /
  48851. # simple-expression WITH license-exception-id /
  48852. # compound-expression AND compound-expression /
  48853. # compound-expression OR compound-expression
  48854. # ) / ( compound-expression ) )
  48855. (?<compound_head>
  48856. (?&simple_expression) ( \s+ WITH \s+ (?&licenseexceptionid))?
  48857. | \( \s* (?&compound_expression) \s* \)
  48858. )
  48859. (?<compound_expression>
  48860. (?&compound_head) (?: \s+ (?:AND|OR) \s+ (?&compound_expression))?
  48861. )
  48862. # license-expression: 1*1(simple-expression / compound-expression)
  48863. (?<license_expression>(?&compound_expression) | (?&simple_expression))
  48864. ) # end of define
  48865. ^(NONE | NOASSERTION | (?&license_expression))$
  48866. }xi
  48867. REGEX;
  48868. $match = preg_match($regex, $license);
  48869. if (0 === $match) {
  48870. return false;
  48871. }
  48872. if (false === $match) {
  48873. throw new \RuntimeException('Regex failed to compile/run.');
  48874. }
  48875. return true;
  48876. }
  48877. }
  48878. Copyright (C) 2015 Composer
  48879. Permission is hereby granted, free of charge, to any person obtaining a copy of
  48880. this software and associated documentation files (the "Software"), to deal in
  48881. the Software without restriction, including without limitation the rights to
  48882. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  48883. of the Software, and to permit persons to whom the Software is furnished to do
  48884. so, subject to the following conditions:
  48885. The above copyright notice and this permission notice shall be included in all
  48886. copies or substantial portions of the Software.
  48887. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  48888. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  48889. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  48890. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  48891. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  48892. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  48893. SOFTWARE.
  48894. <?php
  48895. namespace Composer\Semver;
  48896. use Composer\Semver\Constraint\Constraint;
  48897. class Comparator
  48898. {
  48899. public static function greaterThan($version1, $version2)
  48900. {
  48901. return self::compare($version1, '>', $version2);
  48902. }
  48903. public static function greaterThanOrEqualTo($version1, $version2)
  48904. {
  48905. return self::compare($version1, '>=', $version2);
  48906. }
  48907. public static function lessThan($version1, $version2)
  48908. {
  48909. return self::compare($version1, '<', $version2);
  48910. }
  48911. public static function lessThanOrEqualTo($version1, $version2)
  48912. {
  48913. return self::compare($version1, '<=', $version2);
  48914. }
  48915. public static function equalTo($version1, $version2)
  48916. {
  48917. return self::compare($version1, '==', $version2);
  48918. }
  48919. public static function notEqualTo($version1, $version2)
  48920. {
  48921. return self::compare($version1, '!=', $version2);
  48922. }
  48923. public static function compare($version1, $operator, $version2)
  48924. {
  48925. $constraint = new Constraint($operator, $version2);
  48926. return $constraint->matches(new Constraint('==', $version1));
  48927. }
  48928. }
  48929. <?php
  48930. namespace Composer\Semver\Constraint;
  48931. trigger_error('The ' . __CLASS__ . ' abstract class is deprecated, there is no replacement for it, it will be removed in the next major version.', E_USER_DEPRECATED);
  48932. abstract class AbstractConstraint implements ConstraintInterface
  48933. {
  48934. protected $prettyString;
  48935. public function matches(ConstraintInterface $provider)
  48936. {
  48937. if ($provider instanceof $this) {
  48938. return $this->matchSpecific($provider);
  48939. }
  48940. return $provider->matches($this);
  48941. }
  48942. public function setPrettyString($prettyString)
  48943. {
  48944. $this->prettyString = $prettyString;
  48945. }
  48946. public function getPrettyString()
  48947. {
  48948. if ($this->prettyString) {
  48949. return $this->prettyString;
  48950. }
  48951. return $this->__toString();
  48952. }
  48953. }
  48954. <?php
  48955. namespace Composer\Semver\Constraint;
  48956. class Constraint implements ConstraintInterface
  48957. {
  48958. const OP_EQ = 0;
  48959. const OP_LT = 1;
  48960. const OP_LE = 2;
  48961. const OP_GT = 3;
  48962. const OP_GE = 4;
  48963. const OP_NE = 5;
  48964. private static $transOpStr = array(
  48965. '=' => self::OP_EQ,
  48966. '==' => self::OP_EQ,
  48967. '<' => self::OP_LT,
  48968. '<=' => self::OP_LE,
  48969. '>' => self::OP_GT,
  48970. '>=' => self::OP_GE,
  48971. '<>' => self::OP_NE,
  48972. '!=' => self::OP_NE,
  48973. );
  48974. private static $transOpInt = array(
  48975. self::OP_EQ => '==',
  48976. self::OP_LT => '<',
  48977. self::OP_LE => '<=',
  48978. self::OP_GT => '>',
  48979. self::OP_GE => '>=',
  48980. self::OP_NE => '!=',
  48981. );
  48982. protected $operator;
  48983. protected $version;
  48984. protected $prettyString;
  48985. public function matches(ConstraintInterface $provider)
  48986. {
  48987. if ($provider instanceof $this) {
  48988. return $this->matchSpecific($provider);
  48989. }
  48990. return $provider->matches($this);
  48991. }
  48992. public function setPrettyString($prettyString)
  48993. {
  48994. $this->prettyString = $prettyString;
  48995. }
  48996. public function getPrettyString()
  48997. {
  48998. if ($this->prettyString) {
  48999. return $this->prettyString;
  49000. }
  49001. return $this->__toString();
  49002. }
  49003. public static function getSupportedOperators()
  49004. {
  49005. return array_keys(self::$transOpStr);
  49006. }
  49007. public function __construct($operator, $version)
  49008. {
  49009. if (!isset(self::$transOpStr[$operator])) {
  49010. throw new \InvalidArgumentException(sprintf(
  49011. 'Invalid operator "%s" given, expected one of: %s',
  49012. $operator,
  49013. implode(', ', self::getSupportedOperators())
  49014. ));
  49015. }
  49016. $this->operator = self::$transOpStr[$operator];
  49017. $this->version = $version;
  49018. }
  49019. public function versionCompare($a, $b, $operator, $compareBranches = false)
  49020. {
  49021. if (!isset(self::$transOpStr[$operator])) {
  49022. throw new \InvalidArgumentException(sprintf(
  49023. 'Invalid operator "%s" given, expected one of: %s',
  49024. $operator,
  49025. implode(', ', self::getSupportedOperators())
  49026. ));
  49027. }
  49028. $aIsBranch = 'dev-' === substr($a, 0, 4);
  49029. $bIsBranch = 'dev-' === substr($b, 0, 4);
  49030. if ($aIsBranch && $bIsBranch) {
  49031. return $operator === '==' && $a === $b;
  49032. }
  49033. if (!$compareBranches && ($aIsBranch || $bIsBranch)) {
  49034. return false;
  49035. }
  49036. return version_compare($a, $b, $operator);
  49037. }
  49038. public function matchSpecific(Constraint $provider, $compareBranches = false)
  49039. {
  49040. $noEqualOp = str_replace('=', '', self::$transOpInt[$this->operator]);
  49041. $providerNoEqualOp = str_replace('=', '', self::$transOpInt[$provider->operator]);
  49042. $isEqualOp = self::OP_EQ === $this->operator;
  49043. $isNonEqualOp = self::OP_NE === $this->operator;
  49044. $isProviderEqualOp = self::OP_EQ === $provider->operator;
  49045. $isProviderNonEqualOp = self::OP_NE === $provider->operator;
  49046. if ($isNonEqualOp || $isProviderNonEqualOp) {
  49047. return !$isEqualOp && !$isProviderEqualOp
  49048. || $this->versionCompare($provider->version, $this->version, '!=', $compareBranches);
  49049. }
  49050. if ($this->operator !== self::OP_EQ && $noEqualOp === $providerNoEqualOp) {
  49051. return true;
  49052. }
  49053. if ($this->versionCompare($provider->version, $this->version, self::$transOpInt[$this->operator], $compareBranches)) {
  49054. if ($provider->version === $this->version
  49055. && self::$transOpInt[$provider->operator] === $providerNoEqualOp
  49056. && self::$transOpInt[$this->operator] !== $noEqualOp) {
  49057. return false;
  49058. }
  49059. return true;
  49060. }
  49061. return false;
  49062. }
  49063. public function __toString()
  49064. {
  49065. return self::$transOpInt[$this->operator] . ' ' . $this->version;
  49066. }
  49067. }
  49068. <?php
  49069. namespace Composer\Semver\Constraint;
  49070. interface ConstraintInterface
  49071. {
  49072. public function matches(ConstraintInterface $provider);
  49073. public function getPrettyString();
  49074. public function __toString();
  49075. }
  49076. <?php
  49077. namespace Composer\Semver\Constraint;
  49078. class EmptyConstraint implements ConstraintInterface
  49079. {
  49080. protected $prettyString;
  49081. public function matches(ConstraintInterface $provider)
  49082. {
  49083. return true;
  49084. }
  49085. public function setPrettyString($prettyString)
  49086. {
  49087. $this->prettyString = $prettyString;
  49088. }
  49089. public function getPrettyString()
  49090. {
  49091. if ($this->prettyString) {
  49092. return $this->prettyString;
  49093. }
  49094. return $this->__toString();
  49095. }
  49096. public function __toString()
  49097. {
  49098. return '[]';
  49099. }
  49100. }
  49101. <?php
  49102. namespace Composer\Semver\Constraint;
  49103. class MultiConstraint implements ConstraintInterface
  49104. {
  49105. protected $constraints;
  49106. protected $prettyString;
  49107. protected $conjunctive;
  49108. public function __construct(array $constraints, $conjunctive = true)
  49109. {
  49110. $this->constraints = $constraints;
  49111. $this->conjunctive = $conjunctive;
  49112. }
  49113. public function getConstraints()
  49114. {
  49115. return $this->constraints;
  49116. }
  49117. public function isConjunctive()
  49118. {
  49119. return $this->conjunctive;
  49120. }
  49121. public function isDisjunctive()
  49122. {
  49123. return !$this->conjunctive;
  49124. }
  49125. public function matches(ConstraintInterface $provider)
  49126. {
  49127. if (false === $this->conjunctive) {
  49128. foreach ($this->constraints as $constraint) {
  49129. if ($constraint->matches($provider)) {
  49130. return true;
  49131. }
  49132. }
  49133. return false;
  49134. }
  49135. foreach ($this->constraints as $constraint) {
  49136. if (!$constraint->matches($provider)) {
  49137. return false;
  49138. }
  49139. }
  49140. return true;
  49141. }
  49142. public function setPrettyString($prettyString)
  49143. {
  49144. $this->prettyString = $prettyString;
  49145. }
  49146. public function getPrettyString()
  49147. {
  49148. if ($this->prettyString) {
  49149. return $this->prettyString;
  49150. }
  49151. return $this->__toString();
  49152. }
  49153. public function __toString()
  49154. {
  49155. $constraints = array();
  49156. foreach ($this->constraints as $constraint) {
  49157. $constraints[] = (string) $constraint;
  49158. }
  49159. return '[' . implode($this->conjunctive ? ' ' : ' || ', $constraints) . ']';
  49160. }
  49161. }
  49162. <?php
  49163. namespace Composer\Semver;
  49164. use Composer\Semver\Constraint\Constraint;
  49165. class Semver
  49166. {
  49167. const SORT_ASC = 1;
  49168. const SORT_DESC = -1;
  49169. private static $versionParser;
  49170. public static function satisfies($version, $constraints)
  49171. {
  49172. if (null === self::$versionParser) {
  49173. self::$versionParser = new VersionParser();
  49174. }
  49175. $versionParser = self::$versionParser;
  49176. $provider = new Constraint('==', $versionParser->normalize($version));
  49177. $constraints = $versionParser->parseConstraints($constraints);
  49178. return $constraints->matches($provider);
  49179. }
  49180. public static function satisfiedBy(array $versions, $constraints)
  49181. {
  49182. $versions = array_filter($versions, function ($version) use ($constraints) {
  49183. return Semver::satisfies($version, $constraints);
  49184. });
  49185. return array_values($versions);
  49186. }
  49187. public static function sort(array $versions)
  49188. {
  49189. return self::usort($versions, self::SORT_ASC);
  49190. }
  49191. public static function rsort(array $versions)
  49192. {
  49193. return self::usort($versions, self::SORT_DESC);
  49194. }
  49195. private static function usort(array $versions, $direction)
  49196. {
  49197. if (null === self::$versionParser) {
  49198. self::$versionParser = new VersionParser();
  49199. }
  49200. $versionParser = self::$versionParser;
  49201. $normalized = array();
  49202. foreach ($versions as $key => $version) {
  49203. $normalized[] = array($versionParser->normalize($version), $key);
  49204. }
  49205. usort($normalized, function (array $left, array $right) use ($direction) {
  49206. if ($left[0] === $right[0]) {
  49207. return 0;
  49208. }
  49209. if (Comparator::lessThan($left[0], $right[0])) {
  49210. return -$direction;
  49211. }
  49212. return $direction;
  49213. });
  49214. $sorted = array();
  49215. foreach ($normalized as $item) {
  49216. $sorted[] = $versions[$item[1]];
  49217. }
  49218. return $sorted;
  49219. }
  49220. }
  49221. <?php
  49222. namespace Composer\Semver;
  49223. use Composer\Semver\Constraint\ConstraintInterface;
  49224. use Composer\Semver\Constraint\EmptyConstraint;
  49225. use Composer\Semver\Constraint\MultiConstraint;
  49226. use Composer\Semver\Constraint\Constraint;
  49227. class VersionParser
  49228. {
  49229. private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)((?:[.-]?\d+)*+)?)?([.-]?dev)?';
  49230. private static $stabilities = array('stable', 'RC', 'beta', 'alpha', 'dev');
  49231. public static function parseStability($version)
  49232. {
  49233. $version = preg_replace('{#.+$}i', '', $version);
  49234. if ('dev-' === substr($version, 0, 4) || '-dev' === substr($version, -4)) {
  49235. return 'dev';
  49236. }
  49237. preg_match('{' . self::$modifierRegex . '(?:\+.*)?$}i', strtolower($version), $match);
  49238. if (!empty($match[3])) {
  49239. return 'dev';
  49240. }
  49241. if (!empty($match[1])) {
  49242. if ('beta' === $match[1] || 'b' === $match[1]) {
  49243. return 'beta';
  49244. }
  49245. if ('alpha' === $match[1] || 'a' === $match[1]) {
  49246. return 'alpha';
  49247. }
  49248. if ('rc' === $match[1]) {
  49249. return 'RC';
  49250. }
  49251. }
  49252. return 'stable';
  49253. }
  49254. public static function normalizeStability($stability)
  49255. {
  49256. $stability = strtolower($stability);
  49257. return $stability === 'rc' ? 'RC' : $stability;
  49258. }
  49259. public function normalize($version, $fullVersion = null)
  49260. {
  49261. $version = trim($version);
  49262. if (null === $fullVersion) {
  49263. $fullVersion = $version;
  49264. }
  49265. if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $version, $match)) {
  49266. $version = $match[1];
  49267. }
  49268. if (preg_match('{^(?:dev-)?(?:master|trunk|default)$}i', $version)) {
  49269. return '9999999-dev';
  49270. }
  49271. if ('dev-' === strtolower(substr($version, 0, 4))) {
  49272. return 'dev-' . substr($version, 4);
  49273. }
  49274. if (preg_match('{^([^,\s+]++)\+[^\s]++$}', $version, $match)) {
  49275. $version = $match[1];
  49276. }
  49277. if (preg_match('{^v?(\d{1,5})(\.\d++)?(\.\d++)?(\.\d++)?' . self::$modifierRegex . '$}i', $version, $matches)) {
  49278. $version = $matches[1]
  49279. . (!empty($matches[2]) ? $matches[2] : '.0')
  49280. . (!empty($matches[3]) ? $matches[3] : '.0')
  49281. . (!empty($matches[4]) ? $matches[4] : '.0');
  49282. $index = 5;
  49283. } elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3})?)' . self::$modifierRegex . '$}i', $version, $matches)) {
  49284. $version = preg_replace('{\D}', '.', $matches[1]);
  49285. $index = 2;
  49286. }
  49287. if (isset($index)) {
  49288. if (!empty($matches[$index])) {
  49289. if ('stable' === $matches[$index]) {
  49290. return $version;
  49291. }
  49292. $version .= '-' . $this->expandStability($matches[$index]) . (!empty($matches[$index + 1]) ? ltrim($matches[$index + 1], '.-') : '');
  49293. }
  49294. if (!empty($matches[$index + 2])) {
  49295. $version .= '-dev';
  49296. }
  49297. return $version;
  49298. }
  49299. if (preg_match('{(.*?)[.-]?dev$}i', $version, $match)) {
  49300. try {
  49301. return $this->normalizeBranch($match[1]);
  49302. } catch (\Exception $e) {
  49303. }
  49304. }
  49305. $extraMessage = '';
  49306. if (preg_match('{ +as +' . preg_quote($version) . '$}', $fullVersion)) {
  49307. $extraMessage = ' in "' . $fullVersion . '", the alias must be an exact version';
  49308. } elseif (preg_match('{^' . preg_quote($version) . ' +as +}', $fullVersion)) {
  49309. $extraMessage = ' in "' . $fullVersion . '", the alias source must be an exact version, if it is a branch name you should prefix it with dev-';
  49310. }
  49311. throw new \UnexpectedValueException('Invalid version string "' . $version . '"' . $extraMessage);
  49312. }
  49313. public function parseNumericAliasPrefix($branch)
  49314. {
  49315. if (preg_match('{^(?P<version>(\d++\\.)*\d++)(?:\.x)?-dev$}i', $branch, $matches)) {
  49316. return $matches['version'] . '.';
  49317. }
  49318. return false;
  49319. }
  49320. public function normalizeBranch($name)
  49321. {
  49322. $name = trim($name);
  49323. if (in_array($name, array('master', 'trunk', 'default'))) {
  49324. return $this->normalize($name);
  49325. }
  49326. if (preg_match('{^v?(\d++)(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?$}i', $name, $matches)) {
  49327. $version = '';
  49328. for ($i = 1; $i < 5; ++$i) {
  49329. $version .= isset($matches[$i]) ? str_replace(array('*', 'X'), 'x', $matches[$i]) : '.x';
  49330. }
  49331. return str_replace('x', '9999999', $version) . '-dev';
  49332. }
  49333. return 'dev-' . $name;
  49334. }
  49335. public function parseConstraints($constraints)
  49336. {
  49337. $prettyConstraint = $constraints;
  49338. if (preg_match('{^([^,\s]*?)@(' . implode('|', self::$stabilities) . ')$}i', $constraints, $match)) {
  49339. $constraints = empty($match[1]) ? '*' : $match[1];
  49340. }
  49341. if (preg_match('{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#.+$}i', $constraints, $match)) {
  49342. $constraints = $match[1];
  49343. }
  49344. $orConstraints = preg_split('{\s*\|\|?\s*}', trim($constraints));
  49345. $orGroups = array();
  49346. foreach ($orConstraints as $constraints) {
  49347. $andConstraints = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $constraints);
  49348. if (count($andConstraints) > 1) {
  49349. $constraintObjects = array();
  49350. foreach ($andConstraints as $constraint) {
  49351. foreach ($this->parseConstraint($constraint) as $parsedConstraint) {
  49352. $constraintObjects[] = $parsedConstraint;
  49353. }
  49354. }
  49355. } else {
  49356. $constraintObjects = $this->parseConstraint($andConstraints[0]);
  49357. }
  49358. if (1 === count($constraintObjects)) {
  49359. $constraint = $constraintObjects[0];
  49360. } else {
  49361. $constraint = new MultiConstraint($constraintObjects);
  49362. }
  49363. $orGroups[] = $constraint;
  49364. }
  49365. if (1 === count($orGroups)) {
  49366. $constraint = $orGroups[0];
  49367. } elseif (2 === count($orGroups)
  49368. && $orGroups[0] instanceof MultiConstraint
  49369. && $orGroups[1] instanceof MultiConstraint
  49370. && 2 === count($orGroups[0]->getConstraints())
  49371. && 2 === count($orGroups[1]->getConstraints())
  49372. && ($a = (string) $orGroups[0])
  49373. && substr($a, 0, 3) === '[>=' && (false !== ($posA = strpos($a, '<', 4)))
  49374. && ($b = (string) $orGroups[1])
  49375. && substr($b, 0, 3) === '[>=' && (false !== ($posB = strpos($b, '<', 4)))
  49376. && substr($a, $posA + 2, -1) === substr($b, 4, $posB - 5)
  49377. ) {
  49378. $constraint = new MultiConstraint(array(
  49379. new Constraint('>=', substr($a, 4, $posA - 5)),
  49380. new Constraint('<', substr($b, $posB + 2, -1)),
  49381. ));
  49382. } else {
  49383. $constraint = new MultiConstraint($orGroups, false);
  49384. }
  49385. $constraint->setPrettyString($prettyConstraint);
  49386. return $constraint;
  49387. }
  49388. private function parseConstraint($constraint)
  49389. {
  49390. if (preg_match('{^([^,\s]+?)@(' . implode('|', self::$stabilities) . ')$}i', $constraint, $match)) {
  49391. $constraint = $match[1];
  49392. if ($match[2] !== 'stable') {
  49393. $stabilityModifier = $match[2];
  49394. }
  49395. }
  49396. if (preg_match('{^v?[xX*](\.[xX*])*$}i', $constraint)) {
  49397. return array(new EmptyConstraint());
  49398. }
  49399. $versionRegex = 'v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.(\d++))?' . self::$modifierRegex . '(?:\+[^\s]+)?';
  49400. if (preg_match('{^~>?' . $versionRegex . '$}i', $constraint, $matches)) {
  49401. if (substr($constraint, 0, 2) === '~>') {
  49402. throw new \UnexpectedValueException(
  49403. 'Could not parse version constraint ' . $constraint . ': ' .
  49404. 'Invalid operator "~>", you probably meant to use the "~" operator'
  49405. );
  49406. }
  49407. if (isset($matches[4]) && '' !== $matches[4]) {
  49408. $position = 4;
  49409. } elseif (isset($matches[3]) && '' !== $matches[3]) {
  49410. $position = 3;
  49411. } elseif (isset($matches[2]) && '' !== $matches[2]) {
  49412. $position = 2;
  49413. } else {
  49414. $position = 1;
  49415. }
  49416. $stabilitySuffix = '';
  49417. if (!empty($matches[5])) {
  49418. $stabilitySuffix .= '-' . $this->expandStability($matches[5]) . (!empty($matches[6]) ? $matches[6] : '');
  49419. }
  49420. if (!empty($matches[7])) {
  49421. $stabilitySuffix .= '-dev';
  49422. }
  49423. if (!$stabilitySuffix) {
  49424. $stabilitySuffix = '-dev';
  49425. }
  49426. $lowVersion = $this->manipulateVersionString($matches, $position, 0) . $stabilitySuffix;
  49427. $lowerBound = new Constraint('>=', $lowVersion);
  49428. $highPosition = max(1, $position - 1);
  49429. $highVersion = $this->manipulateVersionString($matches, $highPosition, 1) . '-dev';
  49430. $upperBound = new Constraint('<', $highVersion);
  49431. return array(
  49432. $lowerBound,
  49433. $upperBound,
  49434. );
  49435. }
  49436. if (preg_match('{^\^' . $versionRegex . '($)}i', $constraint, $matches)) {
  49437. if ('0' !== $matches[1] || '' === $matches[2]) {
  49438. $position = 1;
  49439. } elseif ('0' !== $matches[2] || '' === $matches[3]) {
  49440. $position = 2;
  49441. } else {
  49442. $position = 3;
  49443. }
  49444. $stabilitySuffix = '';
  49445. if (empty($matches[5]) && empty($matches[7])) {
  49446. $stabilitySuffix .= '-dev';
  49447. }
  49448. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  49449. $lowerBound = new Constraint('>=', $lowVersion);
  49450. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  49451. $upperBound = new Constraint('<', $highVersion);
  49452. return array(
  49453. $lowerBound,
  49454. $upperBound,
  49455. );
  49456. }
  49457. if (preg_match('{^v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.[xX*])++$}', $constraint, $matches)) {
  49458. if (isset($matches[3]) && '' !== $matches[3]) {
  49459. $position = 3;
  49460. } elseif (isset($matches[2]) && '' !== $matches[2]) {
  49461. $position = 2;
  49462. } else {
  49463. $position = 1;
  49464. }
  49465. $lowVersion = $this->manipulateVersionString($matches, $position) . '-dev';
  49466. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  49467. if ($lowVersion === '0.0.0.0-dev') {
  49468. return array(new Constraint('<', $highVersion));
  49469. }
  49470. return array(
  49471. new Constraint('>=', $lowVersion),
  49472. new Constraint('<', $highVersion),
  49473. );
  49474. }
  49475. if (preg_match('{^(?P<from>' . $versionRegex . ') +- +(?P<to>' . $versionRegex . ')($)}i', $constraint, $matches)) {
  49476. $lowStabilitySuffix = '';
  49477. if (empty($matches[6]) && empty($matches[8])) {
  49478. $lowStabilitySuffix = '-dev';
  49479. }
  49480. $lowVersion = $this->normalize($matches['from']);
  49481. $lowerBound = new Constraint('>=', $lowVersion . $lowStabilitySuffix);
  49482. $empty = function ($x) {
  49483. return ($x === 0 || $x === '0') ? false : empty($x);
  49484. };
  49485. if ((!$empty($matches[11]) && !$empty($matches[12])) || !empty($matches[14]) || !empty($matches[16])) {
  49486. $highVersion = $this->normalize($matches['to']);
  49487. $upperBound = new Constraint('<=', $highVersion);
  49488. } else {
  49489. $highMatch = array('', $matches[10], $matches[11], $matches[12], $matches[13]);
  49490. $highVersion = $this->manipulateVersionString($highMatch, $empty($matches[11]) ? 1 : 2, 1) . '-dev';
  49491. $upperBound = new Constraint('<', $highVersion);
  49492. }
  49493. return array(
  49494. $lowerBound,
  49495. $upperBound,
  49496. );
  49497. }
  49498. if (preg_match('{^(<>|!=|>=?|<=?|==?)?\s*(.*)}', $constraint, $matches)) {
  49499. try {
  49500. $version = $this->normalize($matches[2]);
  49501. if (!empty($stabilityModifier) && $this->parseStability($version) === 'stable') {
  49502. $version .= '-' . $stabilityModifier;
  49503. } elseif ('<' === $matches[1] || '>=' === $matches[1]) {
  49504. if (!preg_match('/-' . self::$modifierRegex . '$/', strtolower($matches[2]))) {
  49505. if (substr($matches[2], 0, 4) !== 'dev-') {
  49506. $version .= '-dev';
  49507. }
  49508. }
  49509. }
  49510. return array(new Constraint($matches[1] ?: '=', $version));
  49511. } catch (\Exception $e) {
  49512. }
  49513. }
  49514. $message = 'Could not parse version constraint ' . $constraint;
  49515. if (isset($e)) {
  49516. $message .= ': ' . $e->getMessage();
  49517. }
  49518. throw new \UnexpectedValueException($message);
  49519. }
  49520. private function manipulateVersionString($matches, $position, $increment = 0, $pad = '0')
  49521. {
  49522. for ($i = 4; $i > 0; --$i) {
  49523. if ($i > $position) {
  49524. $matches[$i] = $pad;
  49525. } elseif ($i === $position && $increment) {
  49526. $matches[$i] += $increment;
  49527. if ($matches[$i] < 0) {
  49528. $matches[$i] = $pad;
  49529. --$position;
  49530. if ($i === 1) {
  49531. return;
  49532. }
  49533. }
  49534. }
  49535. }
  49536. return $matches[1] . '.' . $matches[2] . '.' . $matches[3] . '.' . $matches[4];
  49537. }
  49538. private function expandStability($stability)
  49539. {
  49540. $stability = strtolower($stability);
  49541. switch ($stability) {
  49542. case 'a':
  49543. return 'alpha';
  49544. case 'b':
  49545. return 'beta';
  49546. case 'p':
  49547. case 'pl':
  49548. return 'patch';
  49549. case 'rc':
  49550. return 'RC';
  49551. default:
  49552. return $stability;
  49553. }
  49554. }
  49555. }
  49556. Copyright (C) 2016 Composer
  49557. Permission is hereby granted, free of charge, to any person obtaining a copy of
  49558. this software and associated documentation files (the "Software"), to deal in
  49559. the Software without restriction, including without limitation the rights to
  49560. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  49561. of the Software, and to permit persons to whom the Software is furnished to do
  49562. so, subject to the following conditions:
  49563. The above copyright notice and this permission notice shall be included in all
  49564. copies or substantial portions of the Software.
  49565. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  49566. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  49567. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  49568. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  49569. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  49570. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  49571. SOFTWARE.
  49572. <?php
  49573. namespace Composer\CaBundle;
  49574. use Psr\Log\LoggerInterface;
  49575. use Symfony\Component\Process\PhpProcess;
  49576. class CaBundle
  49577. {
  49578. private static $caPath;
  49579. private static $caFileValidity = array();
  49580. private static $useOpensslParse;
  49581. public static function getSystemCaRootBundlePath(LoggerInterface $logger = null)
  49582. {
  49583. if (self::$caPath !== null) {
  49584. return self::$caPath;
  49585. }
  49586. $envCertFile = getenv('SSL_CERT_FILE');
  49587. if ($envCertFile && is_readable($envCertFile) && static::validateCaFile($envCertFile, $logger)) {
  49588. return self::$caPath = $envCertFile;
  49589. }
  49590. $envCertDir = getenv('SSL_CERT_DIR');
  49591. if ($envCertDir && is_dir($envCertDir) && is_readable($envCertDir)) {
  49592. return self::$caPath = $envCertDir;
  49593. }
  49594. $configured = ini_get('openssl.cafile');
  49595. if ($configured && strlen($configured) > 0 && is_readable($configured) && static::validateCaFile($configured, $logger)) {
  49596. return self::$caPath = $configured;
  49597. }
  49598. $configured = ini_get('openssl.capath');
  49599. if ($configured && is_dir($configured) && is_readable($configured)) {
  49600. return self::$caPath = $configured;
  49601. }
  49602. $caBundlePaths = array(
  49603. '/etc/pki/tls/certs/ca-bundle.crt',
  49604. '/etc/ssl/certs/ca-certificates.crt',
  49605. '/etc/ssl/ca-bundle.pem',
  49606. '/usr/local/share/certs/ca-root-nss.crt',
  49607. '/usr/ssl/certs/ca-bundle.crt',
  49608. '/opt/local/share/curl/curl-ca-bundle.crt',
  49609. '/usr/local/share/curl/curl-ca-bundle.crt',
  49610. '/usr/share/ssl/certs/ca-bundle.crt',
  49611. '/etc/ssl/cert.pem',
  49612. '/usr/local/etc/ssl/cert.pem',
  49613. '/usr/local/etc/openssl/cert.pem',
  49614. );
  49615. foreach ($caBundlePaths as $caBundle) {
  49616. if (@is_readable($caBundle) && static::validateCaFile($caBundle, $logger)) {
  49617. return self::$caPath = $caBundle;
  49618. }
  49619. }
  49620. foreach ($caBundlePaths as $caBundle) {
  49621. $caBundle = dirname($caBundle);
  49622. if (@is_dir($caBundle) && glob($caBundle.'/*')) {
  49623. return self::$caPath = $caBundle;
  49624. }
  49625. }
  49626. return self::$caPath = static::getBundledCaBundlePath();
  49627. }
  49628. public static function getBundledCaBundlePath()
  49629. {
  49630. $caBundleFile = __DIR__.'/../res/cacert.pem';
  49631. if (0 === strpos($caBundleFile, 'phar://')) {
  49632. file_put_contents(
  49633. $tempCaBundleFile = tempnam(sys_get_temp_dir(), 'openssl-ca-bundle-'),
  49634. file_get_contents($caBundleFile)
  49635. );
  49636. register_shutdown_function(function() use ($tempCaBundleFile) {
  49637. @unlink($tempCaBundleFile);
  49638. });
  49639. $caBundleFile = $tempCaBundleFile;
  49640. }
  49641. return $caBundleFile;
  49642. }
  49643. public static function validateCaFile($filename, LoggerInterface $logger = null)
  49644. {
  49645. static $warned = false;
  49646. if (isset(self::$caFileValidity[$filename])) {
  49647. return self::$caFileValidity[$filename];
  49648. }
  49649. $contents = file_get_contents($filename);
  49650. if (!static::isOpensslParseSafe()) {
  49651. if (!$warned && $logger) {
  49652. $logger->warning(sprintf(
  49653. 'Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.',
  49654. PHP_VERSION
  49655. ));
  49656. $warned = true;
  49657. }
  49658. $isValid = !empty($contents);
  49659. } else {
  49660. $isValid = (bool) openssl_x509_parse($contents);
  49661. }
  49662. if ($logger) {
  49663. $logger->debug('Checked CA file '.realpath($filename).': '.($isValid ? 'valid' : 'invalid'));
  49664. }
  49665. return self::$caFileValidity[$filename] = $isValid;
  49666. }
  49667. public static function isOpensslParseSafe()
  49668. {
  49669. if (null !== self::$useOpensslParse) {
  49670. return self::$useOpensslParse;
  49671. }
  49672. if (PHP_VERSION_ID >= 50600) {
  49673. return self::$useOpensslParse = true;
  49674. }
  49675. if (
  49676. (PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50328)
  49677. || (PHP_VERSION_ID < 50500 && PHP_VERSION_ID >= 50423)
  49678. || (PHP_VERSION_ID < 50600 && PHP_VERSION_ID >= 50507)
  49679. ) {
  49680. return self::$useOpensslParse = true;
  49681. }
  49682. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  49683. return self::$useOpensslParse = false;
  49684. }
  49685. $compareDistroVersionPrefix = function ($prefix, $fixedVersion) {
  49686. $regex = '{^'.preg_quote($prefix).'([0-9]+)$}';
  49687. if (preg_match($regex, PHP_VERSION, $m)) {
  49688. return ((int) $m[1]) >= $fixedVersion;
  49689. }
  49690. return false;
  49691. };
  49692. if (
  49693. $compareDistroVersionPrefix('5.3.3-7+squeeze', 18)
  49694. || $compareDistroVersionPrefix('5.4.4-14+deb7u', 7)
  49695. || $compareDistroVersionPrefix('5.3.10-1ubuntu3.', 9)
  49696. ) {
  49697. return self::$useOpensslParse = true;
  49698. }
  49699. if (!class_exists('Symfony\Component\Process\PhpProcess')) {
  49700. return self::$useOpensslParse = false;
  49701. }
  49702. $cert = 'LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVwRENDQTR5Z0F3SUJBZ0lKQUp6dThyNnU2ZUJjTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUhETVFzd0NRWUQKVlFRR0V3SkVSVEVjTUJvR0ExVUVDQXdUVG05eVpISm9aV2x1TFZkbGMzUm1ZV3hsYmpFUU1BNEdBMVVFQnd3SApTOE9Ed3Jac2JqRVVNQklHQTFVRUNnd0xVMlZyZEdsdmJrVnBibk14SHpBZEJnTlZCQXNNRmsxaGJHbGphVzkxCmN5QkRaWEowSUZObFkzUnBiMjR4SVRBZkJnTlZCQU1NR0cxaGJHbGphVzkxY3k1elpXdDBhVzl1WldsdWN5NWsKWlRFcU1DZ0dDU3FHU0liM0RRRUpBUlliYzNSbFptRnVMbVZ6YzJWeVFITmxhM1JwYjI1bGFXNXpMbVJsTUhVWQpaREU1TnpBd01UQXhNREF3TURBd1dnQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBCkFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUEKQUFBQUFBQVhEVEUwTVRFeU9ERXhNemt6TlZvd2djTXhDekFKQmdOVkJBWVRBa1JGTVJ3d0dnWURWUVFJREJOTwpiM0prY21obGFXNHRWMlZ6ZEdaaGJHVnVNUkF3RGdZRFZRUUhEQWRMdzRQQ3RteHVNUlF3RWdZRFZRUUtEQXRUClpXdDBhVzl1UldsdWN6RWZNQjBHQTFVRUN3d1dUV0ZzYVdOcGIzVnpJRU5sY25RZ1UyVmpkR2x2YmpFaE1COEcKQTFVRUF3d1liV0ZzYVdOcGIzVnpMbk5sYTNScGIyNWxhVzV6TG1SbE1Tb3dLQVlKS29aSWh2Y05BUWtCRmh0egpkR1ZtWVc0dVpYTnpaWEpBYzJWcmRHbHZibVZwYm5NdVpHVXdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCCkR3QXdnZ0VLQW9JQkFRRERBZjNobDdKWTBYY0ZuaXlFSnBTU0RxbjBPcUJyNlFQNjV1c0pQUnQvOFBhRG9xQnUKd0VZVC9OYSs2ZnNnUGpDMHVLOURaZ1dnMnRIV1dvYW5TYmxBTW96NVBINlorUzRTSFJaN2UyZERJalBqZGhqaAowbUxnMlVNTzV5cDBWNzk3R2dzOWxOdDZKUmZIODFNTjJvYlhXczROdHp0TE11RDZlZ3FwcjhkRGJyMzRhT3M4CnBrZHVpNVVhd1Raa3N5NXBMUEhxNWNNaEZHbTA2djY1Q0xvMFYyUGQ5K0tBb2tQclBjTjVLTEtlYno3bUxwazYKU01lRVhPS1A0aWRFcXh5UTdPN2ZCdUhNZWRzUWh1K3ByWTNzaTNCVXlLZlF0UDVDWm5YMmJwMHdLSHhYMTJEWAoxbmZGSXQ5RGJHdkhUY3lPdU4rblpMUEJtM3ZXeG50eUlJdlZBZ01CQUFHalFqQkFNQWtHQTFVZEV3UUNNQUF3CkVRWUpZSVpJQVliNFFnRUJCQVFEQWdlQU1Bc0dBMVVkRHdRRUF3SUZvREFUQmdOVkhTVUVEREFLQmdnckJnRUYKQlFjREFqQU5CZ2txaGtpRzl3MEJBUVVGQUFPQ0FRRUFHMGZaWVlDVGJkajFYWWMrMVNub2FQUit2SThDOENhRAo4KzBVWWhkbnlVNGdnYTBCQWNEclk5ZTk0ZUVBdTZacXljRjZGakxxWFhkQWJvcHBXb2NyNlQ2R0QxeDMzQ2tsClZBcnpHL0t4UW9oR0QySmVxa2hJTWxEb214SE83a2EzOStPYThpMnZXTFZ5alU4QVp2V01BcnVIYTRFRU55RzcKbFcyQWFnYUZLRkNyOVRuWFRmcmR4R1ZFYnY3S1ZRNmJkaGc1cDVTanBXSDErTXEwM3VSM1pYUEJZZHlWODMxOQpvMGxWajFLRkkyRENML2xpV2lzSlJvb2YrMWNSMzVDdGQwd1lCY3BCNlRac2xNY09QbDc2ZHdLd0pnZUpvMlFnClpzZm1jMnZDMS9xT2xOdU5xLzBUenprVkd2OEVUVDNDZ2FVK1VYZTRYT1Z2a2NjZWJKbjJkZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K';
  49703. $script = <<<'EOT'
  49704. error_reporting(-1);
  49705. $info = openssl_x509_parse(base64_decode('%s'));
  49706. var_dump(PHP_VERSION, $info['issuer']['emailAddress'], $info['validFrom_time_t']);
  49707. EOT;
  49708. $script = '<'."?php\n".sprintf($script, $cert);
  49709. try {
  49710. $process = new PhpProcess($script);
  49711. $process->mustRun();
  49712. } catch (\Exception $e) {
  49713. return self::$useOpensslParse = false;
  49714. }
  49715. $output = preg_split('{\r?\n}', trim($process->getOutput()));
  49716. $errorOutput = trim($process->getErrorOutput());
  49717. if (
  49718. count($output) === 3
  49719. && $output[0] === sprintf('string(%d) "%s"', strlen(PHP_VERSION), PHP_VERSION)
  49720. && $output[1] === 'string(27) "stefan.esser@sektioneins.de"'
  49721. && $output[2] === 'int(-1)'
  49722. && preg_match('{openssl_x509_parse\(\): illegal (?:ASN1 data type for|length in) timestamp in - on line \d+}', $errorOutput)
  49723. ) {
  49724. return self::$useOpensslParse = true;
  49725. }
  49726. return self::$useOpensslParse = false;
  49727. }
  49728. public static function reset()
  49729. {
  49730. self::$caFileValidity = array();
  49731. self::$caPath = null;
  49732. self::$useOpensslParse = null;
  49733. }
  49734. }
  49735. Copyright (c) 2012 PHP Framework Interoperability Group
  49736. Permission is hereby granted, free of charge, to any person obtaining a copy
  49737. of this software and associated documentation files (the "Software"), to deal
  49738. in the Software without restriction, including without limitation the rights
  49739. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  49740. copies of the Software, and to permit persons to whom the Software is
  49741. furnished to do so, subject to the following conditions:
  49742. The above copyright notice and this permission notice shall be included in
  49743. all copies or substantial portions of the Software.
  49744. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  49745. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  49746. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  49747. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  49748. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  49749. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  49750. THE SOFTWARE.
  49751. <?php
  49752. namespace Psr\Log;
  49753. abstract class AbstractLogger implements LoggerInterface
  49754. {
  49755. public function emergency($message, array $context = array())
  49756. {
  49757. $this->log(LogLevel::EMERGENCY, $message, $context);
  49758. }
  49759. public function alert($message, array $context = array())
  49760. {
  49761. $this->log(LogLevel::ALERT, $message, $context);
  49762. }
  49763. public function critical($message, array $context = array())
  49764. {
  49765. $this->log(LogLevel::CRITICAL, $message, $context);
  49766. }
  49767. public function error($message, array $context = array())
  49768. {
  49769. $this->log(LogLevel::ERROR, $message, $context);
  49770. }
  49771. public function warning($message, array $context = array())
  49772. {
  49773. $this->log(LogLevel::WARNING, $message, $context);
  49774. }
  49775. public function notice($message, array $context = array())
  49776. {
  49777. $this->log(LogLevel::NOTICE, $message, $context);
  49778. }
  49779. public function info($message, array $context = array())
  49780. {
  49781. $this->log(LogLevel::INFO, $message, $context);
  49782. }
  49783. public function debug($message, array $context = array())
  49784. {
  49785. $this->log(LogLevel::DEBUG, $message, $context);
  49786. }
  49787. }
  49788. <?php
  49789. namespace Psr\Log;
  49790. class InvalidArgumentException extends \InvalidArgumentException
  49791. {
  49792. }
  49793. <?php
  49794. namespace Psr\Log;
  49795. class LogLevel
  49796. {
  49797. const EMERGENCY = 'emergency';
  49798. const ALERT = 'alert';
  49799. const CRITICAL = 'critical';
  49800. const ERROR = 'error';
  49801. const WARNING = 'warning';
  49802. const NOTICE = 'notice';
  49803. const INFO = 'info';
  49804. const DEBUG = 'debug';
  49805. }
  49806. <?php
  49807. namespace Psr\Log;
  49808. interface LoggerAwareInterface
  49809. {
  49810. public function setLogger(LoggerInterface $logger);
  49811. }
  49812. <?php
  49813. namespace Psr\Log;
  49814. trait LoggerAwareTrait
  49815. {
  49816. protected $logger;
  49817. public function setLogger(LoggerInterface $logger)
  49818. {
  49819. $this->logger = $logger;
  49820. }
  49821. }
  49822. <?php
  49823. namespace Psr\Log;
  49824. interface LoggerInterface
  49825. {
  49826. public function emergency($message, array $context = array());
  49827. public function alert($message, array $context = array());
  49828. public function critical($message, array $context = array());
  49829. public function error($message, array $context = array());
  49830. public function warning($message, array $context = array());
  49831. public function notice($message, array $context = array());
  49832. public function info($message, array $context = array());
  49833. public function debug($message, array $context = array());
  49834. public function log($level, $message, array $context = array());
  49835. }
  49836. <?php
  49837. namespace Psr\Log;
  49838. trait LoggerTrait
  49839. {
  49840. public function emergency($message, array $context = array())
  49841. {
  49842. $this->log(LogLevel::EMERGENCY, $message, $context);
  49843. }
  49844. public function alert($message, array $context = array())
  49845. {
  49846. $this->log(LogLevel::ALERT, $message, $context);
  49847. }
  49848. public function critical($message, array $context = array())
  49849. {
  49850. $this->log(LogLevel::CRITICAL, $message, $context);
  49851. }
  49852. public function error($message, array $context = array())
  49853. {
  49854. $this->log(LogLevel::ERROR, $message, $context);
  49855. }
  49856. public function warning($message, array $context = array())
  49857. {
  49858. $this->log(LogLevel::WARNING, $message, $context);
  49859. }
  49860. public function notice($message, array $context = array())
  49861. {
  49862. $this->log(LogLevel::NOTICE, $message, $context);
  49863. }
  49864. public function info($message, array $context = array())
  49865. {
  49866. $this->log(LogLevel::INFO, $message, $context);
  49867. }
  49868. public function debug($message, array $context = array())
  49869. {
  49870. $this->log(LogLevel::DEBUG, $message, $context);
  49871. }
  49872. abstract public function log($level, $message, array $context = array());
  49873. }
  49874. <?php
  49875. namespace Psr\Log;
  49876. class NullLogger extends AbstractLogger
  49877. {
  49878. public function log($level, $message, array $context = array())
  49879. {
  49880. }
  49881. }
  49882. <?php
  49883. namespace Psr\Log\Test;
  49884. use Psr\Log\LoggerInterface;
  49885. use Psr\Log\LogLevel;
  49886. abstract class LoggerInterfaceTest extends \PHPUnit_Framework_TestCase
  49887. {
  49888. abstract public function getLogger();
  49889. abstract public function getLogs();
  49890. public function testImplements()
  49891. {
  49892. $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger());
  49893. }
  49894. public function testLogsAtAllLevels($level, $message)
  49895. {
  49896. $logger = $this->getLogger();
  49897. $logger->{$level}($message, array('user' => 'Bob'));
  49898. $logger->log($level, $message, array('user' => 'Bob'));
  49899. $expected = array(
  49900. $level.' message of level '.$level.' with context: Bob',
  49901. $level.' message of level '.$level.' with context: Bob',
  49902. );
  49903. $this->assertEquals($expected, $this->getLogs());
  49904. }
  49905. public function provideLevelsAndMessages()
  49906. {
  49907. return array(
  49908. LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'),
  49909. LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'),
  49910. LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'),
  49911. LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'),
  49912. LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'),
  49913. LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'),
  49914. LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'),
  49915. LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'),
  49916. );
  49917. }
  49918. public function testThrowsOnInvalidLevel()
  49919. {
  49920. $logger = $this->getLogger();
  49921. $logger->log('invalid level', 'Foo');
  49922. }
  49923. public function testContextReplacement()
  49924. {
  49925. $logger = $this->getLogger();
  49926. $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
  49927. $expected = array('info {Message {nothing} Bob Bar a}');
  49928. $this->assertEquals($expected, $this->getLogs());
  49929. }
  49930. public function testObjectCastToString()
  49931. {
  49932. if (method_exists($this, 'createPartialMock')) {
  49933. $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString'));
  49934. } else {
  49935. $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
  49936. }
  49937. $dummy->expects($this->once())
  49938. ->method('__toString')
  49939. ->will($this->returnValue('DUMMY'));
  49940. $this->getLogger()->warning($dummy);
  49941. $expected = array('warning DUMMY');
  49942. $this->assertEquals($expected, $this->getLogs());
  49943. }
  49944. public function testContextCanContainAnything()
  49945. {
  49946. $context = array(
  49947. 'bool' => true,
  49948. 'null' => null,
  49949. 'string' => 'Foo',
  49950. 'int' => 0,
  49951. 'float' => 0.5,
  49952. 'nested' => array('with object' => new DummyTest),
  49953. 'object' => new \DateTime,
  49954. 'resource' => fopen('php://memory', 'r'),
  49955. );
  49956. $this->getLogger()->warning('Crazy context data', $context);
  49957. $expected = array('warning Crazy context data');
  49958. $this->assertEquals($expected, $this->getLogs());
  49959. }
  49960. public function testContextExceptionKeyCanBeExceptionOrOtherValues()
  49961. {
  49962. $logger = $this->getLogger();
  49963. $logger->warning('Random message', array('exception' => 'oops'));
  49964. $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
  49965. $expected = array(
  49966. 'warning Random message',
  49967. 'critical Uncaught Exception!'
  49968. );
  49969. $this->assertEquals($expected, $this->getLogs());
  49970. }
  49971. }
  49972. class DummyTest
  49973. {
  49974. public function __toString()
  49975. {
  49976. }
  49977. }
  49978. <?php
  49979. require_once __DIR__ . '/composer/autoload_real.php';
  49980. return ComposerAutoloaderInitComposerPhar1525427099::getLoader();
  49981. <?php
  49982. $vendorDir = dirname(dirname(__FILE__));
  49983. $baseDir = dirname($vendorDir);
  49984. return array(
  49985. );
  49986. <?php
  49987. $vendorDir = dirname(dirname(__FILE__));
  49988. $baseDir = dirname($vendorDir);
  49989. return array(
  49990. 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
  49991. 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
  49992. 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
  49993. 'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
  49994. 'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'),
  49995. 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
  49996. 'Seld\\PharUtils\\' => array($vendorDir . '/seld/phar-utils/src'),
  49997. 'Seld\\JsonLint\\' => array($vendorDir . '/seld/jsonlint/src/Seld/JsonLint'),
  49998. 'Seld\\CliPrompt\\' => array($vendorDir . '/seld/cli-prompt/src'),
  49999. 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
  50000. 'JsonSchema\\' => array($vendorDir . '/justinrainbow/json-schema/src/JsonSchema'),
  50001. 'Composer\\Spdx\\' => array($vendorDir . '/composer/spdx-licenses/src'),
  50002. 'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
  50003. 'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'),
  50004. 'Composer\\' => array($baseDir . '/src/Composer'),
  50005. );
  50006. <?php
  50007. $vendorDir = dirname(dirname(__FILE__));
  50008. $baseDir = dirname($vendorDir);
  50009. return array(
  50010. );
  50011. <?php
  50012. $vendorDir = dirname(dirname(__FILE__));
  50013. $baseDir = dirname($vendorDir);
  50014. return array(
  50015. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
  50016. );
  50017. <?php
  50018. class ComposerAutoloaderInitComposerPhar1525427099
  50019. {
  50020. private static $loader;
  50021. public static function loadClassLoader($class)
  50022. {
  50023. if ('Composer\Autoload\ClassLoader' === $class) {
  50024. require __DIR__ . '/ClassLoader.php';
  50025. }
  50026. }
  50027. public static function getLoader()
  50028. {
  50029. if (null !== self::$loader) {
  50030. return self::$loader;
  50031. }
  50032. spl_autoload_register(array('ComposerAutoloaderInitComposerPhar1525427099', 'loadClassLoader'), true, true);
  50033. self::$loader = $loader = new \Composer\Autoload\ClassLoader();
  50034. spl_autoload_unregister(array('ComposerAutoloaderInitComposerPhar1525427099', 'loadClassLoader'));
  50035. $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  50036. if ($useStaticLoader) {
  50037. require_once __DIR__ . '/autoload_static.php';
  50038. call_user_func(\Composer\Autoload\ComposerStaticInitComposerPhar1525427099::getInitializer($loader));
  50039. } else {
  50040. $map = require __DIR__ . '/autoload_namespaces.php';
  50041. foreach ($map as $namespace => $path) {
  50042. $loader->set($namespace, $path);
  50043. }
  50044. $map = require __DIR__ . '/autoload_psr4.php';
  50045. foreach ($map as $namespace => $path) {
  50046. $loader->setPsr4($namespace, $path);
  50047. }
  50048. $classMap = require __DIR__ . '/autoload_classmap.php';
  50049. if ($classMap) {
  50050. $loader->addClassMap($classMap);
  50051. }
  50052. }
  50053. $loader->register(true);
  50054. if ($useStaticLoader) {
  50055. $includeFiles = Composer\Autoload\ComposerStaticInitComposerPhar1525427099::$files;
  50056. } else {
  50057. $includeFiles = require __DIR__ . '/autoload_files.php';
  50058. }
  50059. foreach ($includeFiles as $fileIdentifier => $file) {
  50060. composerRequireComposerPhar1525427099($fileIdentifier, $file);
  50061. }
  50062. return $loader;
  50063. }
  50064. }
  50065. function composerRequireComposerPhar1525427099($fileIdentifier, $file)
  50066. {
  50067. if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  50068. require $file;
  50069. $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
  50070. }
  50071. }
  50072. <?php
  50073. namespace Composer\Autoload;
  50074. class ComposerStaticInitComposerPhar1525427099
  50075. {
  50076. public static $files = array (
  50077. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
  50078. );
  50079. public static $prefixLengthsPsr4 = array (
  50080. 'S' =>
  50081. array (
  50082. 'Symfony\\Polyfill\\Mbstring\\' => 26,
  50083. 'Symfony\\Component\\Process\\' => 26,
  50084. 'Symfony\\Component\\Finder\\' => 25,
  50085. 'Symfony\\Component\\Filesystem\\' => 29,
  50086. 'Symfony\\Component\\Debug\\' => 24,
  50087. 'Symfony\\Component\\Console\\' => 26,
  50088. 'Seld\\PharUtils\\' => 15,
  50089. 'Seld\\JsonLint\\' => 14,
  50090. 'Seld\\CliPrompt\\' => 15,
  50091. ),
  50092. 'P' =>
  50093. array (
  50094. 'Psr\\Log\\' => 8,
  50095. ),
  50096. 'J' =>
  50097. array (
  50098. 'JsonSchema\\' => 11,
  50099. ),
  50100. 'C' =>
  50101. array (
  50102. 'Composer\\Spdx\\' => 14,
  50103. 'Composer\\Semver\\' => 16,
  50104. 'Composer\\CaBundle\\' => 18,
  50105. 'Composer\\' => 9,
  50106. ),
  50107. );
  50108. public static $prefixDirsPsr4 = array (
  50109. 'Symfony\\Polyfill\\Mbstring\\' =>
  50110. array (
  50111. 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
  50112. ),
  50113. 'Symfony\\Component\\Process\\' =>
  50114. array (
  50115. 0 => __DIR__ . '/..' . '/symfony/process',
  50116. ),
  50117. 'Symfony\\Component\\Finder\\' =>
  50118. array (
  50119. 0 => __DIR__ . '/..' . '/symfony/finder',
  50120. ),
  50121. 'Symfony\\Component\\Filesystem\\' =>
  50122. array (
  50123. 0 => __DIR__ . '/..' . '/symfony/filesystem',
  50124. ),
  50125. 'Symfony\\Component\\Debug\\' =>
  50126. array (
  50127. 0 => __DIR__ . '/..' . '/symfony/debug',
  50128. ),
  50129. 'Symfony\\Component\\Console\\' =>
  50130. array (
  50131. 0 => __DIR__ . '/..' . '/symfony/console',
  50132. ),
  50133. 'Seld\\PharUtils\\' =>
  50134. array (
  50135. 0 => __DIR__ . '/..' . '/seld/phar-utils/src',
  50136. ),
  50137. 'Seld\\JsonLint\\' =>
  50138. array (
  50139. 0 => __DIR__ . '/..' . '/seld/jsonlint/src/Seld/JsonLint',
  50140. ),
  50141. 'Seld\\CliPrompt\\' =>
  50142. array (
  50143. 0 => __DIR__ . '/..' . '/seld/cli-prompt/src',
  50144. ),
  50145. 'Psr\\Log\\' =>
  50146. array (
  50147. 0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
  50148. ),
  50149. 'JsonSchema\\' =>
  50150. array (
  50151. 0 => __DIR__ . '/..' . '/justinrainbow/json-schema/src/JsonSchema',
  50152. ),
  50153. 'Composer\\Spdx\\' =>
  50154. array (
  50155. 0 => __DIR__ . '/..' . '/composer/spdx-licenses/src',
  50156. ),
  50157. 'Composer\\Semver\\' =>
  50158. array (
  50159. 0 => __DIR__ . '/..' . '/composer/semver/src',
  50160. ),
  50161. 'Composer\\CaBundle\\' =>
  50162. array (
  50163. 0 => __DIR__ . '/..' . '/composer/ca-bundle/src',
  50164. ),
  50165. 'Composer\\' =>
  50166. array (
  50167. 0 => __DIR__ . '/../..' . '/src/Composer',
  50168. ),
  50169. );
  50170. public static function getInitializer(ClassLoader $loader)
  50171. {
  50172. return \Closure::bind(function () use ($loader) {
  50173. $loader->prefixLengthsPsr4 = ComposerStaticInitComposerPhar1525427099::$prefixLengthsPsr4;
  50174. $loader->prefixDirsPsr4 = ComposerStaticInitComposerPhar1525427099::$prefixDirsPsr4;
  50175. }, null, ClassLoader::class);
  50176. }
  50177. }
  50178. <?php
  50179. namespace Composer\Autoload;
  50180. class ClassLoader
  50181. {
  50182. private $prefixLengthsPsr4 = array();
  50183. private $prefixDirsPsr4 = array();
  50184. private $fallbackDirsPsr4 = array();
  50185. private $prefixesPsr0 = array();
  50186. private $fallbackDirsPsr0 = array();
  50187. private $useIncludePath = false;
  50188. private $classMap = array();
  50189. private $classMapAuthoritative = false;
  50190. private $missingClasses = array();
  50191. private $apcuPrefix;
  50192. public function getPrefixes()
  50193. {
  50194. if (!empty($this->prefixesPsr0)) {
  50195. return call_user_func_array('array_merge', $this->prefixesPsr0);
  50196. }
  50197. return array();
  50198. }
  50199. public function getPrefixesPsr4()
  50200. {
  50201. return $this->prefixDirsPsr4;
  50202. }
  50203. public function getFallbackDirs()
  50204. {
  50205. return $this->fallbackDirsPsr0;
  50206. }
  50207. public function getFallbackDirsPsr4()
  50208. {
  50209. return $this->fallbackDirsPsr4;
  50210. }
  50211. public function getClassMap()
  50212. {
  50213. return $this->classMap;
  50214. }
  50215. public function addClassMap(array $classMap)
  50216. {
  50217. if ($this->classMap) {
  50218. $this->classMap = array_merge($this->classMap, $classMap);
  50219. } else {
  50220. $this->classMap = $classMap;
  50221. }
  50222. }
  50223. public function add($prefix, $paths, $prepend = false)
  50224. {
  50225. if (!$prefix) {
  50226. if ($prepend) {
  50227. $this->fallbackDirsPsr0 = array_merge(
  50228. (array) $paths,
  50229. $this->fallbackDirsPsr0
  50230. );
  50231. } else {
  50232. $this->fallbackDirsPsr0 = array_merge(
  50233. $this->fallbackDirsPsr0,
  50234. (array) $paths
  50235. );
  50236. }
  50237. return;
  50238. }
  50239. $first = $prefix[0];
  50240. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  50241. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  50242. return;
  50243. }
  50244. if ($prepend) {
  50245. $this->prefixesPsr0[$first][$prefix] = array_merge(
  50246. (array) $paths,
  50247. $this->prefixesPsr0[$first][$prefix]
  50248. );
  50249. } else {
  50250. $this->prefixesPsr0[$first][$prefix] = array_merge(
  50251. $this->prefixesPsr0[$first][$prefix],
  50252. (array) $paths
  50253. );
  50254. }
  50255. }
  50256. public function addPsr4($prefix, $paths, $prepend = false)
  50257. {
  50258. if (!$prefix) {
  50259. if ($prepend) {
  50260. $this->fallbackDirsPsr4 = array_merge(
  50261. (array) $paths,
  50262. $this->fallbackDirsPsr4
  50263. );
  50264. } else {
  50265. $this->fallbackDirsPsr4 = array_merge(
  50266. $this->fallbackDirsPsr4,
  50267. (array) $paths
  50268. );
  50269. }
  50270. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  50271. $length = strlen($prefix);
  50272. if ('\\' !== $prefix[$length - 1]) {
  50273. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  50274. }
  50275. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  50276. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  50277. } elseif ($prepend) {
  50278. $this->prefixDirsPsr4[$prefix] = array_merge(
  50279. (array) $paths,
  50280. $this->prefixDirsPsr4[$prefix]
  50281. );
  50282. } else {
  50283. $this->prefixDirsPsr4[$prefix] = array_merge(
  50284. $this->prefixDirsPsr4[$prefix],
  50285. (array) $paths
  50286. );
  50287. }
  50288. }
  50289. public function set($prefix, $paths)
  50290. {
  50291. if (!$prefix) {
  50292. $this->fallbackDirsPsr0 = (array) $paths;
  50293. } else {
  50294. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  50295. }
  50296. }
  50297. public function setPsr4($prefix, $paths)
  50298. {
  50299. if (!$prefix) {
  50300. $this->fallbackDirsPsr4 = (array) $paths;
  50301. } else {
  50302. $length = strlen($prefix);
  50303. if ('\\' !== $prefix[$length - 1]) {
  50304. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  50305. }
  50306. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  50307. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  50308. }
  50309. }
  50310. public function setUseIncludePath($useIncludePath)
  50311. {
  50312. $this->useIncludePath = $useIncludePath;
  50313. }
  50314. public function getUseIncludePath()
  50315. {
  50316. return $this->useIncludePath;
  50317. }
  50318. public function setClassMapAuthoritative($classMapAuthoritative)
  50319. {
  50320. $this->classMapAuthoritative = $classMapAuthoritative;
  50321. }
  50322. public function isClassMapAuthoritative()
  50323. {
  50324. return $this->classMapAuthoritative;
  50325. }
  50326. public function setApcuPrefix($apcuPrefix)
  50327. {
  50328. $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
  50329. }
  50330. public function getApcuPrefix()
  50331. {
  50332. return $this->apcuPrefix;
  50333. }
  50334. public function register($prepend = false)
  50335. {
  50336. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  50337. }
  50338. public function unregister()
  50339. {
  50340. spl_autoload_unregister(array($this, 'loadClass'));
  50341. }
  50342. public function loadClass($class)
  50343. {
  50344. if ($file = $this->findFile($class)) {
  50345. includeFile($file);
  50346. return true;
  50347. }
  50348. }
  50349. public function findFile($class)
  50350. {
  50351. if (isset($this->classMap[$class])) {
  50352. return $this->classMap[$class];
  50353. }
  50354. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  50355. return false;
  50356. }
  50357. if (null !== $this->apcuPrefix) {
  50358. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  50359. if ($hit) {
  50360. return $file;
  50361. }
  50362. }
  50363. $file = $this->findFileWithExtension($class, '.php');
  50364. if (false === $file && defined('HHVM_VERSION')) {
  50365. $file = $this->findFileWithExtension($class, '.hh');
  50366. }
  50367. if (null !== $this->apcuPrefix) {
  50368. apcu_add($this->apcuPrefix.$class, $file);
  50369. }
  50370. if (false === $file) {
  50371. $this->missingClasses[$class] = true;
  50372. }
  50373. return $file;
  50374. }
  50375. private function findFileWithExtension($class, $ext)
  50376. {
  50377. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  50378. $first = $class[0];
  50379. if (isset($this->prefixLengthsPsr4[$first])) {
  50380. $subPath = $class;
  50381. while (false !== $lastPos = strrpos($subPath, '\\')) {
  50382. $subPath = substr($subPath, 0, $lastPos);
  50383. $search = $subPath.'\\';
  50384. if (isset($this->prefixDirsPsr4[$search])) {
  50385. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  50386. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  50387. if (file_exists($file = $dir . $pathEnd)) {
  50388. return $file;
  50389. }
  50390. }
  50391. }
  50392. }
  50393. }
  50394. foreach ($this->fallbackDirsPsr4 as $dir) {
  50395. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  50396. return $file;
  50397. }
  50398. }
  50399. if (false !== $pos = strrpos($class, '\\')) {
  50400. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  50401. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  50402. } else {
  50403. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  50404. }
  50405. if (isset($this->prefixesPsr0[$first])) {
  50406. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  50407. if (0 === strpos($class, $prefix)) {
  50408. foreach ($dirs as $dir) {
  50409. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  50410. return $file;
  50411. }
  50412. }
  50413. }
  50414. }
  50415. }
  50416. foreach ($this->fallbackDirsPsr0 as $dir) {
  50417. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  50418. return $file;
  50419. }
  50420. }
  50421. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  50422. return $file;
  50423. }
  50424. return false;
  50425. }
  50426. }
  50427. function includeFile($file)
  50428. {
  50429. include $file;
  50430. }
  50431. ##
  50432. ## Bundle of CA Root Certificates
  50433. ##
  50434. ## Certificate data from Mozilla as of: Wed Mar 7 04:12:06 2018 GMT
  50435. ##
  50436. ## This is a bundle of X.509 certificates of public Certificate Authorities
  50437. ## (CA). These were automatically extracted from Mozilla's root certificates
  50438. ## file (certdata.txt). This file can be found in the mozilla source tree:
  50439. ## https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
  50440. ##
  50441. ## It contains the certificates in PEM format and therefore
  50442. ## can be directly used with curl / libcurl / php_curl, or with
  50443. ## an Apache+mod_ssl webserver for SSL client authentication.
  50444. ## Just configure this file as the SSLCACertificateFile.
  50445. ##
  50446. ## Conversion done with mk-ca-bundle.pl version 1.27.
  50447. ## SHA256: 704f02707ec6b4c4a7597a8c6039b020def11e64f3ef0605a9c3543d48038a57
  50448. ##
  50449. GlobalSign Root CA
  50450. ==================
  50451. -----BEGIN CERTIFICATE-----
  50452. MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx
  50453. GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds
  50454. b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV
  50455. BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD
  50456. VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa
  50457. DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc
  50458. THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb
  50459. Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP
  50460. c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX
  50461. gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
  50462. HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF
  50463. AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj
  50464. Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG
  50465. j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH
  50466. hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC
  50467. X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
  50468. -----END CERTIFICATE-----
  50469. GlobalSign Root CA - R2
  50470. =======================
  50471. -----BEGIN CERTIFICATE-----
  50472. MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4GA1UECxMXR2xv
  50473. YmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  50474. bFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  50475. aWduIFJvb3QgQ0EgLSBSMjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  50476. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6
  50477. ErPLv4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8eoLrvozp
  50478. s6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklqtTleiDTsvHgMCJiEbKjN
  50479. S7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzdC9XZzPnqJworc5HGnRusyMvo4KD0L5CL
  50480. TfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pazq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6C
  50481. ygPCm48CAwEAAaOBnDCBmTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E
  50482. FgQUm+IHV2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nbG9i
  50483. YWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG3lm0mi3f3BmGLjAN
  50484. BgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4GsJ0/WwbgcQ3izDJr86iw8bmEbTUsp
  50485. 9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu
  50486. 01yiPqFbQfXf5WRDLenVOavSot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG7
  50487. 9G+dwfCMNYxdAfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7
  50488. TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==
  50489. -----END CERTIFICATE-----
  50490. Verisign Class 3 Public Primary Certification Authority - G3
  50491. ============================================================
  50492. -----BEGIN CERTIFICATE-----
  50493. MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV
  50494. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  50495. cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  50496. IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh
  50497. dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw
  50498. CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy
  50499. dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv
  50500. cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkg
  50501. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  50502. ggEBAMu6nFL8eB8aHm8bN3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1
  50503. EUGO+i2tKmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGukxUc
  50504. cLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBmCC+Vk7+qRy+oRpfw
  50505. EuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJXwzw3sJ2zq/3avL6QaaiMxTJ5Xpj
  50506. 055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWuimi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA
  50507. ERSWwauSCPc/L8my/uRan2Te2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5f
  50508. j267Cz3qWhMeDGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC
  50509. /Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565pF4ErWjfJXir0
  50510. xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGtTxzhT5yvDwyd93gN2PQ1VoDa
  50511. t20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ==
  50512. -----END CERTIFICATE-----
  50513. Entrust.net Premium 2048 Secure Server CA
  50514. =========================================
  50515. -----BEGIN CERTIFICATE-----
  50516. MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u
  50517. ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp
  50518. bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV
  50519. BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx
  50520. NzUwNTFaFw0yOTA3MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3
  50521. d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl
  50522. MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u
  50523. ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  50524. MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL
  50525. Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr
  50526. hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW
  50527. nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi
  50528. VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo0IwQDAOBgNVHQ8BAf8E
  50529. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJ
  50530. KoZIhvcNAQEFBQADggEBADubj1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPy
  50531. T/4xmf3IDExoU8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf
  50532. zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5bu/8j72gZyxKT
  50533. J1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+bYQLCIt+jerXmCHG8+c8eS9e
  50534. nNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/ErfF6adulZkMV8gzURZVE=
  50535. -----END CERTIFICATE-----
  50536. Baltimore CyberTrust Root
  50537. =========================
  50538. -----BEGIN CERTIFICATE-----
  50539. MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE
  50540. ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li
  50541. ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC
  50542. SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs
  50543. dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME
  50544. uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB
  50545. UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C
  50546. G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9
  50547. XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr
  50548. l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI
  50549. VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB
  50550. BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh
  50551. cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5
  50552. hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa
  50553. Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
  50554. RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
  50555. -----END CERTIFICATE-----
  50556. AddTrust External Root
  50557. ======================
  50558. -----BEGIN CERTIFICATE-----
  50559. MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
  50560. QWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYD
  50561. VQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEw
  50562. NDgzOFowbzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRU
  50563. cnVzdCBFeHRlcm5hbCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0Eg
  50564. Um9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvtH7xsD821
  50565. +iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9uMq/NzgtHj6RQa1wVsfw
  50566. Tz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzXmk6vBbOmcZSccbNQYArHE504B4YCqOmo
  50567. aSYYkKtMsE8jqzpPhNjfzp/haW+710LXa0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy
  50568. 2xSoRcRdKn23tNbE7qzNE0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv7
  50569. 7+ldU9U0WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYDVR0P
  50570. BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0Jvf6xCZU7wO94CTL
  50571. VBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRk
  50572. VHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB
  50573. IFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZl
  50574. j7DYd7usQWxHYINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
  50575. 6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvCNr4TDea9Y355
  50576. e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEXc4g/VhsxOBi0cQ+azcgOno4u
  50577. G+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5amnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
  50578. -----END CERTIFICATE-----
  50579. Entrust Root Certification Authority
  50580. ====================================
  50581. -----BEGIN CERTIFICATE-----
  50582. MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAUBgNV
  50583. BAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMgaW5jb3Jw
  50584. b3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMWKGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsG
  50585. A1UEAxMkRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0
  50586. MloXDTI2MTEyNzIwNTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMu
  50587. MTkwNwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSByZWZlcmVu
  50588. Y2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNVBAMTJEVudHJ1c3QgUm9v
  50589. dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  50590. ALaVtkNC+sZtKm9I35RMOVcF7sN5EUFoNu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYsz
  50591. A9u3g3s+IIRe7bJWKKf44LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOww
  50592. Cj0Yzfv9KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGIrb68
  50593. j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi94DkZfs0Nw4pgHBN
  50594. rziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOBsDCBrTAOBgNVHQ8BAf8EBAMCAQYw
  50595. DwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAigA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1
  50596. MzQyWjAfBgNVHSMEGDAWgBRokORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DH
  50597. hmak8fdLQ/uEvW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
  50598. A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9tO1KzKtvn1ISM
  50599. Y/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6ZuaAGAT/3B+XxFNSRuzFVJ7yVTa
  50600. v52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTS
  50601. W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0
  50602. tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8
  50603. -----END CERTIFICATE-----
  50604. GeoTrust Global CA
  50605. ==================
  50606. -----BEGIN CERTIFICATE-----
  50607. MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVTMRYwFAYDVQQK
  50608. Ew1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9iYWwgQ0EwHhcNMDIwNTIxMDQw
  50609. MDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j
  50610. LjEbMBkGA1UEAxMSR2VvVHJ1c3QgR2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  50611. CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjo
  50612. BbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDviS2Aelet
  50613. 8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU1XupGc1V3sjs0l44U+Vc
  50614. T4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagU
  50615. vTLrGAMoUgRx5aszPeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTAD
  50616. AQH/MB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVk
  50617. DBF9qn1luMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKInZ57Q
  50618. zxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfStQWVYrmm3ok9Nns4
  50619. d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcFPseKUgzbFbS9bZvlxrFUaKnjaZC2
  50620. mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Unhw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6p
  50621. XE0zX5IJL4hmXXeXxx12E6nV5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvm
  50622. Mw==
  50623. -----END CERTIFICATE-----
  50624. GeoTrust Universal CA
  50625. =====================
  50626. -----BEGIN CERTIFICATE-----
  50627. MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  50628. R2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVyc2FsIENBMB4XDTA0MDMwNDA1
  50629. MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IElu
  50630. Yy4xHjAcBgNVBAMTFUdlb1RydXN0IFVuaXZlcnNhbCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIP
  50631. ADCCAgoCggIBAKYVVaCjxuAfjJ0hUNfBvitbtaSeodlyWL0AG0y/YckUHUWCq8YdgNY96xCcOq9t
  50632. JPi8cQGeBvV8Xx7BDlXKg5pZMK4ZyzBIle0iN430SppyZj6tlcDgFgDgEB8rMQ7XlFTTQjOgNB0e
  50633. RXbdT8oYN+yFFXoZCPzVx5zw8qkuEKmS5j1YPakWaDwvdSEYfyh3peFhF7em6fgemdtzbvQKoiFs
  50634. 7tqqhZJmr/Z6a4LauiIINQ/PQvE1+mrufislzDoR5G2vc7J2Ha3QsnhnGqQ5HFELZ1aD/ThdDc7d
  50635. 8Lsrlh/eezJS/R27tQahsiFepdaVaH/wmZ7cRQg+59IJDTWU3YBOU5fXtQlEIGQWFwMCTFMNaN7V
  50636. qnJNk22CDtucvc+081xdVHppCZbW2xHBjXWotM85yM48vCR85mLK4b19p71XZQvk/iXttmkQ3Cga
  50637. Rr0BHdCXteGYO8A3ZNY9lO4L4fUorgtWv3GLIylBjobFS1J72HGrH4oVpjuDWtdYAVHGTEHZf9hB
  50638. Z3KiKN9gg6meyHv8U3NyWfWTehd2Ds735VzZC1U0oqpbtWpU5xPKV+yXbfReBi9Fi1jUIxaS5BZu
  50639. KGNZMN9QAZxjiRqf2xeUgnA3wySemkfWWspOqGmJch+RbNt+nhutxx9z3SxPGWX9f5NAEC7S8O08
  50640. ni4oPmkmM8V7AgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNq7LqqwDLiIJlF0
  50641. XG0D08DYj3rWMB8GA1UdIwQYMBaAFNq7LqqwDLiIJlF0XG0D08DYj3rWMA4GA1UdDwEB/wQEAwIB
  50642. hjANBgkqhkiG9w0BAQUFAAOCAgEAMXjmx7XfuJRAyXHEqDXsRh3ChfMoWIawC/yOsjmPRFWrZIRc
  50643. aanQmjg8+uUfNeVE44B5lGiku8SfPeE0zTBGi1QrlaXv9z+ZhP015s8xxtxqv6fXIwjhmF7DWgh2
  50644. qaavdy+3YL1ERmrvl/9zlcGO6JP7/TG37FcREUWbMPEaiDnBTzynANXH/KttgCJwpQzgXQQpAvvL
  50645. oJHRfNbDflDVnVi+QTjruXU8FdmbyUqDWcDaU/0zuzYYm4UPFd3uLax2k7nZAY1IEKj79TiG8dsK
  50646. xr2EoyNB3tZ3b4XUhRxQ4K5RirqNPnbiucon8l+f725ZDQbYKxek0nxru18UGkiPGkzns0ccjkxF
  50647. KyDuSN/n3QmOGKjaQI2SJhFTYXNd673nxE0pN2HrrDktZy4W1vUAg4WhzH92xH3kt0tm7wNFYGm2
  50648. DFKWkoRepqO1pD4r2czYG0eq8kTaT/kD6PAUyz/zg97QwVTjt+gKN02LIFkDMBmhLMi9ER/frslK
  50649. xfMnZmaGrGiR/9nmUxwPi1xpZQomyB40w11Re9epnAahNt3ViZS82eQtDF4JbAiXfKM9fJP/P6EU
  50650. p8+1Xevb2xzEdt+Iub1FBZUbrvxGakyvSOPOrg/SfuvmbJxPgWp6ZKy7PtXny3YuxadIwVyQD8vI
  50651. P/rmMuGNG2+k5o7Y+SlIis5z/iw=
  50652. -----END CERTIFICATE-----
  50653. GeoTrust Universal CA 2
  50654. =======================
  50655. -----BEGIN CERTIFICATE-----
  50656. MIIFbDCCA1SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  50657. R2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwHhcNMDQwMzA0
  50658. MDUwMDAwWhcNMjkwMzA0MDUwMDAwWjBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3Qg
  50659. SW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwggIiMA0GCSqGSIb3DQEBAQUA
  50660. A4ICDwAwggIKAoICAQCzVFLByT7y2dyxUxpZKeexw0Uo5dfR7cXFS6GqdHtXr0om/Nj1XqduGdt0
  50661. DE81WzILAePb63p3NeqqWuDW6KFXlPCQo3RWlEQwAx5cTiuFJnSCegx2oG9NzkEtoBUGFF+3Qs17
  50662. j1hhNNwqCPkuwwGmIkQcTAeC5lvO0Ep8BNMZcyfwqph/Lq9O64ceJHdqXbboW0W63MOhBW9Wjo8Q
  50663. JqVJwy7XQYci4E+GymC16qFjwAGXEHm9ADwSbSsVsaxLse4YuU6W3Nx2/zu+z18DwPw76L5GG//a
  50664. QMJS9/7jOvdqdzXQ2o3rXhhqMcceujwbKNZrVMaqW9eiLBsZzKIC9ptZvTdrhrVtgrrY6slWvKk2
  50665. WP0+GfPtDCapkzj4T8FdIgbQl+rhrcZV4IErKIM6+vR7IVEAvlI4zs1meaj0gVbi0IMJR1FbUGrP
  50666. 20gaXT73y/Zl92zxlfgCOzJWgjl6W70viRu/obTo/3+NjN8D8WBOWBFM66M/ECuDmgFz2ZRthAAn
  50667. ZqzwcEAJQpKtT5MNYQlRJNiS1QuUYbKHsu3/mjX/hVTK7URDrBs8FmtISgocQIgfksILAAX/8sgC
  50668. SqSqqcyZlpwvWOB94b67B9xfBHJcMTTD7F8t4D1kkCLm0ey4Lt1ZrtmhN79UNdxzMk+MBB4zsslG
  50669. 8dhcyFVQyWi9qLo2CQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR281Xh+qQ2
  50670. +/CfXGJx7Tz0RzgQKzAfBgNVHSMEGDAWgBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAOBgNVHQ8BAf8E
  50671. BAMCAYYwDQYJKoZIhvcNAQEFBQADggIBAGbBxiPz2eAubl/oz66wsCVNK/g7WJtAJDday6sWSf+z
  50672. dXkzoS9tcBc0kf5nfo/sm+VegqlVHy/c1FEHEv6sFj4sNcZj/NwQ6w2jqtB8zNHQL1EuxBRa3ugZ
  50673. 4T7GzKQp5y6EqgYweHZUcyiYWTjgAA1i00J9IZ+uPTqM1fp3DRgrFg5fNuH8KrUwJM/gYwx7WBr+
  50674. mbpCErGR9Hxo4sjoryzqyX6uuyo9DRXcNJW2GHSoag/HtPQTxORb7QrSpJdMKu0vbBKJPfEncKpq
  50675. A1Ihn0CoZ1Dy81of398j9tx4TuaYT1U6U+Pv8vSfx3zYWK8pIpe44L2RLrB27FcRz+8pRPPphXpg
  50676. Y+RdM4kX2TGq2tbzGDVyz4crL2MjhF2EjD9XoIj8mZEoJmmZ1I+XRL6O1UixpCgp8RW04eWe3fiP
  50677. pm8m1wk8OhwRDqZsN/etRIcsKMfYdIKz0G9KV7s1KSegi+ghp4dkNl3M2Basx7InQJJVOCiNUW7d
  50678. FGdTbHFcJoRNdVq2fmBWqU2t+5sel/MN2dKXVHfaPRK34B7vCAas+YWH6aLcr34YEoP9VhdBLtUp
  50679. gn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwXQMAJKOSLakhT2+zNVVXxxvjpoixMptEm
  50680. X36vWkzaH6byHCx+rgIW0lbQL1dTR+iS
  50681. -----END CERTIFICATE-----
  50682. Visa eCommerce Root
  50683. ===================
  50684. -----BEGIN CERTIFICATE-----
  50685. MIIDojCCAoqgAwIBAgIQE4Y1TR0/BvLB+WUF1ZAcYjANBgkqhkiG9w0BAQUFADBrMQswCQYDVQQG
  50686. EwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMmVmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2Ug
  50687. QXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNvbW1lcmNlIFJvb3QwHhcNMDIwNjI2MDIxODM2
  50688. WhcNMjIwNjI0MDAxNjEyWjBrMQswCQYDVQQGEwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMm
  50689. VmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNv
  50690. bW1lcmNlIFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvV95WHm6h2mCxlCfL
  50691. F9sHP4CFT8icttD0b0/Pmdjh28JIXDqsOTPHH2qLJj0rNfVIsZHBAk4ElpF7sDPwsRROEW+1QK8b
  50692. RaVK7362rPKgH1g/EkZgPI2h4H3PVz4zHvtH8aoVlwdVZqW1LS7YgFmypw23RuwhY/81q6UCzyr0
  50693. TP579ZRdhE2o8mCP2w4lPJ9zcc+U30rq299yOIzzlr3xF7zSujtFWsan9sYXiwGd/BmoKoMWuDpI
  50694. /k4+oKsGGelT84ATB+0tvz8KPFUgOSwsAGl0lUq8ILKpeeUYiZGo3BxN77t+Nwtd/jmliFKMAGzs
  50695. GHxBvfaLdXe6YJ2E5/4tAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEG
  50696. MB0GA1UdDgQWBBQVOIMPPyw/cDMezUb+B4wg4NfDtzANBgkqhkiG9w0BAQUFAAOCAQEAX/FBfXxc
  50697. CLkr4NWSR/pnXKUTwwMhmytMiUbPWU3J/qVAtmPN3XEolWcRzCSs00Rsca4BIGsDoo8Ytyk6feUW
  50698. YFN4PMCvFYP3j1IzJL1kk5fui/fbGKhtcbP3LBfQdCVp9/5rPJS+TUtBjE7ic9DjkCJzQ83z7+pz
  50699. zkWKsKZJ/0x9nXGIxHYdkFsd7v3M9+79YKWxehZx0RbQfBI8bGmX265fOZpwLwU8GUYEmSA20GBu
  50700. YQa7FkKMcPcw++DbZqMAAb3mLNqRX6BGi01qnD093QVG/na/oAo85ADmJ7f/hC3euiInlhBx6yLt
  50701. 398znM/jra6O1I7mT1GvFpLgXPYHDw==
  50702. -----END CERTIFICATE-----
  50703. Comodo AAA Services root
  50704. ========================
  50705. -----BEGIN CERTIFICATE-----
  50706. MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  50707. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  50708. TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw
  50709. MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl
  50710. c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV
  50711. BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  50712. ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG
  50713. C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs
  50714. i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW
  50715. Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH
  50716. Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK
  50717. Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f
  50718. BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl
  50719. cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz
  50720. LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm
  50721. 7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
  50722. Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z
  50723. 8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C
  50724. 12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
  50725. -----END CERTIFICATE-----
  50726. QuoVadis Root CA
  50727. ================
  50728. -----BEGIN CERTIFICATE-----
  50729. MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJCTTEZMBcGA1UE
  50730. ChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
  50731. eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAz
  50732. MTkxODMzMzNaFw0yMTAzMTcxODMzMzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRp
  50733. cyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQD
  50734. EyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF
  50735. AAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Ypli4kVEAkOPcahdxYTMuk
  50736. J0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2DrOpm2RgbaIr1VxqYuvXtdj182d6UajtL
  50737. F8HVj71lODqV0D1VNk7feVcxKh7YWWVJWCCYfqtffp/p1k3sg3Spx2zY7ilKhSoGFPlU5tPaZQeL
  50738. YzcS19Dsw3sgQUSj7cugF+FxZc4dZjH3dgEZyH0DWLaVSR2mEiboxgx24ONmy+pdpibu5cxfvWen
  50739. AScOospUxbF6lR1xHkopigPcakXBpBlebzbNw6Kwt/5cOOJSvPhEQ+aQuwIDAQABo4ICUjCCAk4w
  50740. PQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwczovL29jc3AucXVvdmFkaXNvZmZzaG9y
  50741. ZS5jb20wDwYDVR0TAQH/BAUwAwEB/zCCARoGA1UdIASCAREwggENMIIBCQYJKwYBBAG+WAABMIH7
  50742. MIHUBggrBgEFBQcCAjCBxxqBxFJlbGlhbmNlIG9uIHRoZSBRdW9WYWRpcyBSb290IENlcnRpZmlj
  50743. YXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJs
  50744. ZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh
  50745. Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYIKwYBBQUHAgEW
  50746. Fmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3TKbkGGew5Oanwl4Rqy+/fMIGu
  50747. BgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rqy+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkw
  50748. FwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0
  50749. aG9yaXR5MS4wLAYDVQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6
  50750. tlCLMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSkfnIYj9lo
  50751. fFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf87C9TqnN7Az10buYWnuul
  50752. LsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1RcHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2x
  50753. gI4JVrmcGmD+XcHXetwReNDWXcG31a0ymQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi
  50754. 5upZIof4l/UO/erMkqQWxFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi
  50755. 5nrQNiOKSnQ2+Q==
  50756. -----END CERTIFICATE-----
  50757. QuoVadis Root CA 2
  50758. ==================
  50759. -----BEGIN CERTIFICATE-----
  50760. MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  50761. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMjAeFw0wNjExMjQx
  50762. ODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  50763. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  50764. DwAwggIKAoICAQCaGMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6
  50765. XJxgFyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55JWpzmM+Yk
  50766. lvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bBrrcCaoF6qUWD4gXmuVbB
  50767. lDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp+ARz8un+XJiM9XOva7R+zdRcAitMOeGy
  50768. lZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt
  50769. 66/3FsvbzSUr5R/7mp/iUcw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1Jdxn
  50770. wQ5hYIizPtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og/zOh
  50771. D7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UHoycR7hYQe7xFSkyy
  50772. BNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuIyV77zGHcizN300QyNQliBJIWENie
  50773. J0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1Ud
  50774. DgQWBBQahGK8SEwzJQTU7tD2A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGU
  50775. a6FJpEcwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT
  50776. ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2fBluornFdLwUv
  50777. Z+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzng/iN/Ae42l9NLmeyhP3ZRPx3
  50778. UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2BlfF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodm
  50779. VjB3pjd4M1IQWK4/YY7yarHvGH5KWWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK
  50780. +JDSV6IZUaUtl0HaB0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrW
  50781. IozchLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPRTUIZ3Ph1
  50782. WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWDmbA4CD/pXvk1B+TJYm5X
  50783. f6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0ZohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II
  50784. 4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8
  50785. VCLAAVBpQ570su9t+Oza8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u
  50786. -----END CERTIFICATE-----
  50787. QuoVadis Root CA 3
  50788. ==================
  50789. -----BEGIN CERTIFICATE-----
  50790. MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  50791. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMzAeFw0wNjExMjQx
  50792. OTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  50793. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  50794. DwAwggIKAoICAQDMV0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNgg
  50795. DhoB4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUrH556VOij
  50796. KTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd8lyyBTNvijbO0BNO/79K
  50797. DDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9CabwvvWhDFlaJKjdhkf2mrk7AyxRllDdLkgbv
  50798. BNDInIjbC3uBr7E9KsRlOni27tyAsdLTmZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwp
  50799. p5ijJUMv7/FfJuGITfhebtfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8
  50800. nT8KKdjcT5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDtWAEX
  50801. MJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZc6tsgLjoC2SToJyM
  50802. Gf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A4iLItLRkT9a6fUg+qGkM17uGcclz
  50803. uD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYDVR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHT
  50804. BgkrBgEEAb5YAAMwgcUwgZMGCCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmlj
  50805. YXRlIGNvbnN0aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0
  50806. aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVudC4wLQYIKwYB
  50807. BQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2NwczALBgNVHQ8EBAMCAQYwHQYD
  50808. VR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4GA1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4
  50809. ywLQoUmkRzBFMQswCQYDVQQGEwJCTTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UE
  50810. AxMSUXVvVmFkaXMgUm9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZV
  50811. qyM07ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSemd1o417+s
  50812. hvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd+LJ2w/w4E6oM3kJpK27z
  50813. POuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2
  50814. Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadNt54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp
  50815. 8kokUvd0/bpO5qgdAm6xDYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBC
  50816. bjPsMZ57k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6szHXu
  50817. g/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0jWy10QJLZYxkNc91p
  50818. vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr
  50819. qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
  50820. -----END CERTIFICATE-----
  50821. Security Communication Root CA
  50822. ==============================
  50823. -----BEGIN CERTIFICATE-----
  50824. MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  50825. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  50826. HhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  50827. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  50828. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw
  50829. 8yl89f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJDKaVv0uM
  50830. DPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9Ms+k2Y7CI9eNqPPYJayX
  50831. 5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/NQV3Is00qVUarH9oe4kA92819uZKAnDfd
  50832. DJZkndwi92SL32HeFZRSFaB9UslLqCHJxrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2
  50833. JChzAgMBAAGjPzA9MB0GA1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYw
  50834. DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vGkl3g
  50835. 0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfrUj94nK9NrvjVT8+a
  50836. mCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5Bw+SUEmK3TGXX8npN6o7WWWXlDLJ
  50837. s58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJUJRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ
  50838. 6rBK+1YWc26sTfcioU+tHXotRSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAi
  50839. FL39vmwLAw==
  50840. -----END CERTIFICATE-----
  50841. Sonera Class 2 Root CA
  50842. ======================
  50843. -----BEGIN CERTIFICATE-----
  50844. MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEPMA0GA1UEChMG
  50845. U29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAxMDQwNjA3Mjk0MFoXDTIxMDQw
  50846. NjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNVBAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJh
  50847. IENsYXNzMiBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3
  50848. /Ei9vX+ALTU74W+oZ6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybT
  50849. dXnt5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s3TmVToMG
  50850. f+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2EjvOr7nQKV0ba5cTppCD8P
  50851. tOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu8nYybieDwnPz3BjotJPqdURrBGAgcVeH
  50852. nfO+oJAjPYok4doh28MCAwEAAaMzMDEwDwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITT
  50853. XjwwCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt
  50854. 0jSv9zilzqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/3DEI
  50855. cbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvDFNr450kkkdAdavph
  50856. Oe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6Tk6ezAyNlNzZRZxe7EJQY670XcSx
  50857. EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH
  50858. llpwrN9M
  50859. -----END CERTIFICATE-----
  50860. XRamp Global CA Root
  50861. ====================
  50862. -----BEGIN CERTIFICATE-----
  50863. MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE
  50864. BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj
  50865. dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
  50866. dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx
  50867. HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg
  50868. U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
  50869. dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu
  50870. IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx
  50871. foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE
  50872. zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs
  50873. AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry
  50874. xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  50875. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap
  50876. oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC
  50877. AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc
  50878. /Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
  50879. qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n
  50880. nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz
  50881. 8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw=
  50882. -----END CERTIFICATE-----
  50883. Go Daddy Class 2 CA
  50884. ===================
  50885. -----BEGIN CERTIFICATE-----
  50886. MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY
  50887. VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp
  50888. ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG
  50889. A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
  50890. RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD
  50891. ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv
  50892. 2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32
  50893. qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j
  50894. YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY
  50895. vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O
  50896. BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o
  50897. atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu
  50898. MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG
  50899. A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim
  50900. PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt
  50901. I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
  50902. HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI
  50903. Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b
  50904. vZ8=
  50905. -----END CERTIFICATE-----
  50906. Starfield Class 2 CA
  50907. ====================
  50908. -----BEGIN CERTIFICATE-----
  50909. MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc
  50910. U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg
  50911. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo
  50912. MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG
  50913. A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG
  50914. SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY
  50915. bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ
  50916. JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm
  50917. epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN
  50918. F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF
  50919. MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f
  50920. hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo
  50921. bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g
  50922. QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs
  50923. afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM
  50924. PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
  50925. xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD
  50926. KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3
  50927. QBFGmh95DmK/D5fs4C8fF5Q=
  50928. -----END CERTIFICATE-----
  50929. Taiwan GRCA
  50930. ===========
  50931. -----BEGIN CERTIFICATE-----
  50932. MIIFcjCCA1qgAwIBAgIQH51ZWtcvwgZEpYAIaeNe9jANBgkqhkiG9w0BAQUFADA/MQswCQYDVQQG
  50933. EwJUVzEwMC4GA1UECgwnR292ZXJubWVudCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4X
  50934. DTAyMTIwNTEzMjMzM1oXDTMyMTIwNTEzMjMzM1owPzELMAkGA1UEBhMCVFcxMDAuBgNVBAoMJ0dv
  50935. dmVybm1lbnQgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQAD
  50936. ggIPADCCAgoCggIBAJoluOzMonWoe/fOW1mKydGGEghU7Jzy50b2iPN86aXfTEc2pBsBHH8eV4qN
  50937. w8XRIePaJD9IK/ufLqGU5ywck9G/GwGHU5nOp/UKIXZ3/6m3xnOUT0b3EEk3+qhZSV1qgQdW8or5
  50938. BtD3cCJNtLdBuTK4sfCxw5w/cP1T3YGq2GN49thTbqGsaoQkclSGxtKyyhwOeYHWtXBiCAEuTk8O
  50939. 1RGvqa/lmr/czIdtJuTJV6L7lvnM4T9TjGxMfptTCAtsF/tnyMKtsc2AtJfcdgEWFelq16TheEfO
  50940. htX7MfP6Mb40qij7cEwdScevLJ1tZqa2jWR+tSBqnTuBto9AAGdLiYa4zGX+FVPpBMHWXx1E1wov
  50941. J5pGfaENda1UhhXcSTvxls4Pm6Dso3pdvtUqdULle96ltqqvKKyskKw4t9VoNSZ63Pc78/1Fm9G7
  50942. Q3hub/FCVGqY8A2tl+lSXunVanLeavcbYBT0peS2cWeqH+riTcFCQP5nRhc4L0c/cZyu5SHKYS1t
  50943. B6iEfC3uUSXxY5Ce/eFXiGvviiNtsea9P63RPZYLhY3Naye7twWb7LuRqQoHEgKXTiCQ8P8NHuJB
  50944. O9NAOueNXdpm5AKwB1KYXA6OM5zCppX7VRluTI6uSw+9wThNXo+EHWbNxWCWtFJaBYmOlXqYwZE8
  50945. lSOyDvR5tMl8wUohAgMBAAGjajBoMB0GA1UdDgQWBBTMzO/MKWCkO7GStjz6MmKPrCUVOzAMBgNV
  50946. HRMEBTADAQH/MDkGBGcqBwAEMTAvMC0CAQAwCQYFKw4DAhoFADAHBgVnKgMAAAQUA5vwIhP/lSg2
  50947. 09yewDL7MTqKUWUwDQYJKoZIhvcNAQEFBQADggIBAECASvomyc5eMN1PhnR2WPWus4MzeKR6dBcZ
  50948. TulStbngCnRiqmjKeKBMmo4sIy7VahIkv9Ro04rQ2JyftB8M3jh+Vzj8jeJPXgyfqzvS/3WXy6Tj
  50949. Zwj/5cAWtUgBfen5Cv8b5Wppv3ghqMKnI6mGq3ZW6A4M9hPdKmaKZEk9GhiHkASfQlK3T8v+R0F2
  50950. Ne//AHY2RTKbxkaFXeIksB7jSJaYV0eUVXoPQbFEJPPB/hprv4j9wabak2BegUqZIJxIZhm1AHlU
  50951. D7gsL0u8qV1bYH+Mh6XgUmMqvtg7hUAV/h62ZT/FS9p+tXo1KaMuephgIqP0fSdOLeq0dDzpD6Qz
  50952. DxARvBMB1uUO07+1EqLhRSPAzAhuYbeJq4PjJB7mXQfnHyA+z2fI56wwbSdLaG5LKlwCCDTb+Hbk
  50953. Z6MmnD+iMsJKxYEYMRBWqoTvLQr/uB930r+lWKBi5NdLkXWNiYCYfm3LU05er/ayl4WXudpVBrkk
  50954. 7tfGOB5jGxI7leFYrPLfhNVfmS8NVVvmONsuP3LpSIXLuykTjx44VbnzssQwmSNOXfJIoRIM3BKQ
  50955. CZBUkQM8R+XVyWXgt0t97EfTsws+rZ7QdAAO671RrcDeLMDDav7v3Aun+kbfYNucpllQdSNpc5Oy
  50956. +fwC00fmcc4QAu4njIT/rEUNE1yDMuAlpYYsfPQS
  50957. -----END CERTIFICATE-----
  50958. DigiCert Assured ID Root CA
  50959. ===========================
  50960. -----BEGIN CERTIFICATE-----
  50961. MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG
  50962. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  50963. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx
  50964. MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  50965. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew
  50966. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO
  50967. 9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy
  50968. UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW
  50969. /lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy
  50970. oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf
  50971. GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRF
  50972. 66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzANBgkq
  50973. hkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2Bc
  50974. EkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38Fn
  50975. SbNd67IJKusm7Xi+fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i
  50976. 8b5QZ7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
  50977. +o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
  50978. -----END CERTIFICATE-----
  50979. DigiCert Global Root CA
  50980. =======================
  50981. -----BEGIN CERTIFICATE-----
  50982. MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQG
  50983. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  50984. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAw
  50985. MDAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  50986. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkq
  50987. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn
  50988. TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5
  50989. BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H
  50990. 4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y
  50991. 7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB
  50992. o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm
  50993. 8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF
  50994. BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr
  50995. EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt
  50996. tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886
  50997. UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
  50998. CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
  50999. -----END CERTIFICATE-----
  51000. DigiCert High Assurance EV Root CA
  51001. ==================================
  51002. -----BEGIN CERTIFICATE-----
  51003. MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG
  51004. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSsw
  51005. KQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAw
  51006. MFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZ
  51007. MBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFu
  51008. Y2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm+9S75S0t
  51009. Mqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTWPNt0OKRKzE0lgvdKpVMS
  51010. OO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEMxChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3
  51011. MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFBIk5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQ
  51012. NAQTXKFx01p8VdteZOE3hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUe
  51013. h10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB
  51014. Af8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY
  51015. JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQ
  51016. V8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFp
  51017. myPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK
  51018. mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
  51019. vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K
  51020. -----END CERTIFICATE-----
  51021. Certplus Class 2 Primary CA
  51022. ===========================
  51023. -----BEGIN CERTIFICATE-----
  51024. MIIDkjCCAnqgAwIBAgIRAIW9S/PY2uNp9pTXX8OlRCMwDQYJKoZIhvcNAQEFBQAwPTELMAkGA1UE
  51025. BhMCRlIxETAPBgNVBAoTCENlcnRwbHVzMRswGQYDVQQDExJDbGFzcyAyIFByaW1hcnkgQ0EwHhcN
  51026. OTkwNzA3MTcwNTAwWhcNMTkwNzA2MjM1OTU5WjA9MQswCQYDVQQGEwJGUjERMA8GA1UEChMIQ2Vy
  51027. dHBsdXMxGzAZBgNVBAMTEkNsYXNzIDIgUHJpbWFyeSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP
  51028. ADCCAQoCggEBANxQltAS+DXSCHh6tlJw/W/uz7kRy1134ezpfgSN1sxvc0NXYKwzCkTsA18cgCSR
  51029. 5aiRVhKC9+Ar9NuuYS6JEI1rbLqzAr3VNsVINyPi8Fo3UjMXEuLRYE2+L0ER4/YXJQyLkcAbmXuZ
  51030. Vg2v7tK8R1fjeUl7NIknJITesezpWE7+Tt9avkGtrAjFGA7v0lPubNCdEgETjdyAYveVqUSISnFO
  51031. YFWe2yMZeVYHDD9jC1yw4r5+FfyUM1hBOHTE4Y+L3yasH7WLO7dDWWuwJKZtkIvEcupdM5i3y95e
  51032. e++U8Rs+yskhwcWYAqqi9lt3m/V+llU0HGdpwPFC40es/CgcZlUCAwEAAaOBjDCBiTAPBgNVHRME
  51033. CDAGAQH/AgEKMAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQU43Mt38sOKAze3bOkynm4jrvoMIkwEQYJ
  51034. YIZIAYb4QgEBBAQDAgEGMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly93d3cuY2VydHBsdXMuY29t
  51035. L0NSTC9jbGFzczIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQCnVM+IRBnL39R/AN9WM2K191EBkOvD
  51036. P9GIROkkXe/nFL0gt5o8AP5tn9uQ3Nf0YtaLcF3n5QRIqWh8yfFC82x/xXp8HVGIutIKPidd3i1R
  51037. TtMTZGnkLuPT55sJmabglZvOGtd/vjzOUrMRFcEPF80Du5wlFbqidon8BvEY0JNLDnyCt6X09l/+
  51038. 7UCmnYR0ObncHoUW2ikbhiMAybuJfm6AiB4vFLQDJKgybwOaRywwvlbGp0ICcBvqQNi6BQNwB6SW
  51039. //1IMwrh3KWBkJtN3X3n57LNXMhqlfil9o3EXXgIvnsG1knPGTZQIy4I5p4FTUcY1Rbpsda2ENW7
  51040. l7+ijrRU
  51041. -----END CERTIFICATE-----
  51042. DST Root CA X3
  51043. ==============
  51044. -----BEGIN CERTIFICATE-----
  51045. MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/MSQwIgYDVQQK
  51046. ExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4X
  51047. DTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVowPzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1
  51048. cmUgVHJ1c3QgQ28uMRcwFQYDVQQDEw5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQAD
  51049. ggEPADCCAQoCggEBAN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmT
  51050. rE4Orz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEqOLl5CjH9
  51051. UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9bxiqKqy69cK3FCxolkHRy
  51052. xXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40d
  51053. utolucbY38EVAjqr2m7xPi71XAicPNaDaeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0T
  51054. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQ
  51055. MA0GCSqGSIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69ikug
  51056. dB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXrAvHRAosZy5Q6XkjE
  51057. GB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZzR8srzJmwN0jP41ZL9c8PDHIyh8bw
  51058. RLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubS
  51059. fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
  51060. -----END CERTIFICATE-----
  51061. SwissSign Gold CA - G2
  51062. ======================
  51063. -----BEGIN CERTIFICATE-----
  51064. MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw
  51065. EwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2lnbiBHb2xkIENBIC0gRzIwHhcN
  51066. MDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBFMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dp
  51067. c3NTaWduIEFHMR8wHQYDVQQDExZTd2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0B
  51068. AQEFAAOCAg8AMIICCgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUq
  51069. t2/876LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+bbqBHH5C
  51070. jCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c6bM8K8vzARO/Ws/BtQpg
  51071. vd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqEemA8atufK+ze3gE/bk3lUIbLtK/tREDF
  51072. ylqM2tIrfKjuvqblCqoOpd8FUrdVxyJdMmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvR
  51073. AiTysybUa9oEVeXBCsdtMDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuend
  51074. jIj3o02yMszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69yFGkO
  51075. peUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPiaG59je883WX0XaxR
  51076. 7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxMgI93e2CaHt+28kgeDrpOVG2Y4OGi
  51077. GqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw
  51078. AwEB/zAdBgNVHQ4EFgQUWyV7lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64
  51079. OfPAeGZe6Drn8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov
  51080. L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe645R88a7A3hfm
  51081. 5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczOUYrHUDFu4Up+GC9pWbY9ZIEr
  51082. 44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOf
  51083. Mke6UiI0HTJ6CVanfCU2qT1L2sCCbwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6m
  51084. Gu6uLftIdxf+u+yvGPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxp
  51085. mo/a77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCChdiDyyJk
  51086. vC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid392qgQmwLOM7XdVAyksLf
  51087. KzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEppLd6leNcG2mqeSz53OiATIgHQv2ieY2Br
  51088. NU0LbbqhPcCT4H8js1WtciVORvnSFu+wZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6Lqj
  51089. viOvrv1vA+ACOzB2+httQc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ
  51090. -----END CERTIFICATE-----
  51091. SwissSign Silver CA - G2
  51092. ========================
  51093. -----BEGIN CERTIFICATE-----
  51094. MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCQ0gxFTAT
  51095. BgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMB4X
  51096. DTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0NlowRzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3
  51097. aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG
  51098. 9w0BAQEFAAOCAg8AMIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644
  51099. N0MvFz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7brYT7QbNHm
  51100. +/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieFnbAVlDLaYQ1HTWBCrpJH
  51101. 6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH6ATK72oxh9TAtvmUcXtnZLi2kUpCe2Uu
  51102. MGoM9ZDulebyzYLs2aFK7PayS+VFheZteJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5h
  51103. qAaEuSh6XzjZG6k4sIN/c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5
  51104. FZGkECwJMoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRHHTBs
  51105. ROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTfjNFusB3hB48IHpmc
  51106. celM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb65i/4z3GcRm25xBWNOHkDRUjvxF3X
  51107. CO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/
  51108. BAUwAwEB/zAdBgNVHQ4EFgQUF6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRB
  51109. tjpbO8tFnb0cwpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0
  51110. cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBAHPGgeAn0i0P
  51111. 4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShpWJHckRE1qTodvBqlYJ7YH39F
  51112. kWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L
  51113. 3XWgwF15kIwb4FDm3jH+mHtwX6WQ2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx
  51114. /uNncqCxv1yL5PqZIseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFa
  51115. DGi8aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2Xem1ZqSqP
  51116. e97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQRdAtq/gsD/KNVV4n+Ssuu
  51117. WxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJ
  51118. DIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ub
  51119. DgEj8Z+7fNzcbBGXJbLytGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u
  51120. -----END CERTIFICATE-----
  51121. GeoTrust Primary Certification Authority
  51122. ========================================
  51123. -----BEGIN CERTIFICATE-----
  51124. MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQG
  51125. EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMoR2VvVHJ1c3QgUHJpbWFyeSBD
  51126. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgx
  51127. CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQ
  51128. cmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  51129. CgKCAQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9AWbK7hWN
  51130. b6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjAZIVcFU2Ix7e64HXprQU9
  51131. nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE07e9GceBrAqg1cmuXm2bgyxx5X9gaBGge
  51132. RwLmnWDiNpcB3841kt++Z8dtd1k7j53WkBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGt
  51133. tm/81w7a4DSwDRp35+MImO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  51134. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJKoZI
  51135. hvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ16CePbJC/kRYkRj5K
  51136. Ts4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl4b7UVXGYNTq+k+qurUKykG/g/CFN
  51137. NWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6KoKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHa
  51138. Floxt/m0cYASSJlyc1pZU8FjUjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG
  51139. 1riR/aYNKxoUAT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk=
  51140. -----END CERTIFICATE-----
  51141. thawte Primary Root CA
  51142. ======================
  51143. -----BEGIN CERTIFICATE-----
  51144. MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCBqTELMAkGA1UE
  51145. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  51146. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  51147. cml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3
  51148. MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwg
  51149. SW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMv
  51150. KGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMT
  51151. FnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCs
  51152. oPD7gFnUnMekz52hWXMJEEUMDSxuaPFsW0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ
  51153. 1CRfBsDMRJSUjQJib+ta3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGc
  51154. q/gcfomk6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6Sk/K
  51155. aAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94JNqR32HuHUETVPm4p
  51156. afs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYD
  51157. VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XPr87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUF
  51158. AAOCAQEAeRHAS7ORtvzw6WfUDW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeE
  51159. uzLlQRHAd9mzYJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX
  51160. xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2/qxAeeWsEG89
  51161. jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/LHbTY5xZ3Y+m4Q6gLkH3LpVH
  51162. z7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7jVaMaA==
  51163. -----END CERTIFICATE-----
  51164. VeriSign Class 3 Public Primary Certification Authority - G5
  51165. ============================================================
  51166. -----BEGIN CERTIFICATE-----
  51167. MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
  51168. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  51169. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  51170. IHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRp
  51171. ZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCB
  51172. yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2ln
  51173. biBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBh
  51174. dXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmlt
  51175. YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
  51176. ggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKz
  51177. j/i5Vbext0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhD
  51178. Y2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/
  51179. Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNHiDxpg8v+R70r
  51180. fk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/
  51181. BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2Uv
  51182. Z2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy
  51183. aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKvMzEzMA0GCSqG
  51184. SIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzEp6B4Eq1iDkVwZMXnl2YtmAl+
  51185. X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKE
  51186. KQsTb47bDN0lAtukixlE0kF6BWlKWE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiC
  51187. Km0oHw0LxOXnGiYZ4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vE
  51188. ZV8NhnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq
  51189. -----END CERTIFICATE-----
  51190. SecureTrust CA
  51191. ==============
  51192. -----BEGIN CERTIFICATE-----
  51193. MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQG
  51194. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xFzAVBgNVBAMTDlNlY3VyZVRy
  51195. dXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIzMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAe
  51196. BgNVBAoTF1NlY3VyZVRydXN0IENvcnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCC
  51197. ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQX
  51198. OZEzZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO0gMdA+9t
  51199. DWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIaowW8xQmxSPmjL8xk037uH
  51200. GFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b
  51201. 01k/unK8RCSc43Oz969XL0Imnal0ugBS8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmH
  51202. ursCAwEAAaOBnTCBmjATBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/
  51203. BAUwAwEB/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCegJYYj
  51204. aHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  51205. KoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt36Z3q059c4EVlew3KW+JwULKUBRSu
  51206. SceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHf
  51207. mbx8IVQr5Fiiu1cprp6poxkmD5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZ
  51208. nMUFdAvnZyPSCPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
  51209. 3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
  51210. -----END CERTIFICATE-----
  51211. Secure Global CA
  51212. ================
  51213. -----BEGIN CERTIFICATE-----
  51214. MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQG
  51215. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBH
  51216. bG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkxMjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEg
  51217. MB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwg
  51218. Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jx
  51219. YDiJiQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa/FHtaMbQ
  51220. bqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJjnIFHovdRIWCQtBJwB1g
  51221. 8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnIHmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYV
  51222. HDGA76oYa8J719rO+TMg1fW9ajMtgQT7sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi
  51223. 0XPnj3pDAgMBAAGjgZ0wgZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  51224. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCswKaAn
  51225. oCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsGAQQBgjcVAQQDAgEA
  51226. MA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0LURYD7xh8yOOvaliTFGCRsoTciE6+
  51227. OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXOH0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cn
  51228. CDpOGR86p1hcF895P4vkp9MmI50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/5
  51229. 3CYNv6ZHdAbYiNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc
  51230. f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW
  51231. -----END CERTIFICATE-----
  51232. COMODO Certification Authority
  51233. ==============================
  51234. -----BEGIN CERTIFICATE-----
  51235. MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UE
  51236. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  51237. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNVBAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1
  51238. dGhvcml0eTAeFw0wNjEyMDEwMDAwMDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEb
  51239. MBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFD
  51240. T01PRE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  51241. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3UcEbVASY06m/weaKXTuH
  51242. +7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI2GqGd0S7WWaXUF601CxwRM/aN5VCaTww
  51243. xHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV
  51244. 4EajcNxo2f8ESIl33rXp+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA
  51245. 1KGzqSX+DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5OnKVI
  51246. rLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAOBgNVHQ8BAf8E
  51247. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9k
  51248. b2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOC
  51249. AQEAPpiem/Yb6dc5t3iuHXIYSdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CP
  51250. OGEIqB6BCsAvIC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/
  51251. RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4zJVSk/BwJVmc
  51252. IGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5ddBA6+C4OmF4O5MBKgxTMVBbkN
  51253. +8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IBZQ==
  51254. -----END CERTIFICATE-----
  51255. Network Solutions Certificate Authority
  51256. =======================================
  51257. -----BEGIN CERTIFICATE-----
  51258. MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBiMQswCQYDVQQG
  51259. EwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydOZXR3b3Jr
  51260. IFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMx
  51261. MjM1OTU5WjBiMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu
  51262. MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
  51263. CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwzc7MEL7xx
  51264. jOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPPOCwGJgl6cvf6UDL4wpPT
  51265. aaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rlmGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXT
  51266. crA/vGp97Eh/jcOrqnErU2lBUzS1sLnFBgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc
  51267. /Qzpf14Dl847ABSHJ3A4qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMB
  51268. AAGjgZcwgZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIBBjAP
  51269. BgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwubmV0c29sc3NsLmNv
  51270. bS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3JpdHkuY3JsMA0GCSqGSIb3DQEBBQUA
  51271. A4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc86fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q
  51272. 4LqILPxFzBiwmZVRDuwduIj/h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/
  51273. GGUsyfJj4akH/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv
  51274. wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHNpGxlaKFJdlxD
  51275. ydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey
  51276. -----END CERTIFICATE-----
  51277. COMODO ECC Certification Authority
  51278. ==================================
  51279. -----BEGIN CERTIFICATE-----
  51280. MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTELMAkGA1UEBhMC
  51281. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  51282. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBB
  51283. dXRob3JpdHkwHhcNMDgwMzA2MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0Ix
  51284. GzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
  51285. Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRo
  51286. b3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSRFtSrYpn1PlILBs5BAH+X
  51287. 4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0JcfRK9ChQtP6IHG4/bC8vCVlbpVsLM5ni
  51288. wz2J+Wos77LTBumjQjBAMB0GA1UdDgQWBBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8E
  51289. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VG
  51290. FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA
  51291. U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
  51292. -----END CERTIFICATE-----
  51293. OISTE WISeKey Global Root GA CA
  51294. ===============================
  51295. -----BEGIN CERTIFICATE-----
  51296. MIID8TCCAtmgAwIBAgIQQT1yx/RrH4FDffHSKFTfmjANBgkqhkiG9w0BAQUFADCBijELMAkGA1UE
  51297. BhMCQ0gxEDAOBgNVBAoTB1dJU2VLZXkxGzAZBgNVBAsTEkNvcHlyaWdodCAoYykgMjAwNTEiMCAG
  51298. A1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBH
  51299. bG9iYWwgUm9vdCBHQSBDQTAeFw0wNTEyMTExNjAzNDRaFw0zNzEyMTExNjA5NTFaMIGKMQswCQYD
  51300. VQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEbMBkGA1UECxMSQ29weXJpZ2h0IChjKSAyMDA1MSIw
  51301. IAYDVQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5
  51302. IEdsb2JhbCBSb290IEdBIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy0+zAJs9
  51303. Nt350UlqaxBJH+zYK7LG+DKBKUOVTJoZIyEVRd7jyBxRVVuuk+g3/ytr6dTqvirdqFEr12bDYVxg
  51304. Asj1znJ7O7jyTmUIms2kahnBAbtzptf2w93NvKSLtZlhuAGio9RN1AU9ka34tAhxZK9w8RxrfvbD
  51305. d50kc3vkDIzh2TbhmYsFmQvtRTEJysIA2/dyoJaqlYfQjse2YXMNdmaM3Bu0Y6Kff5MTMPGhJ9vZ
  51306. /yxViJGg4E8HsChWjBgbl0SOid3gF27nKu+POQoxhILYQBRJLnpB5Kf+42TMwVlxSywhp1t94B3R
  51307. LoGbw9ho972WG6xwsRYUC9tguSYBBQIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw
  51308. AwEB/zAdBgNVHQ4EFgQUswN+rja8sHnR3JQmthG+IbJphpQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  51309. KoZIhvcNAQEFBQADggEBAEuh/wuHbrP5wUOxSPMowB0uyQlB+pQAHKSkq0lPjz0e701vvbyk9vIm
  51310. MMkQyh2I+3QZH4VFvbBsUfk2ftv1TDI6QU9bR8/oCy22xBmddMVHxjtqD6wU2zz0c5ypBd8A3HR4
  51311. +vg1YFkCExh8vPtNsCBtQ7tgMHpnM1zFmdH4LTlSc/uMqpclXHLZCB6rTjzjgTGfA6b7wP4piFXa
  51312. hNVQA7bihKOmNqoROgHhGEvWRGizPflTdISzRpFGlgC3gCy24eMQ4tui5yiPAZZiFj4A4xylNoEY
  51313. okxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ/L7fCg0=
  51314. -----END CERTIFICATE-----
  51315. Certigna
  51316. ========
  51317. -----BEGIN CERTIFICATE-----
  51318. MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNVBAYTAkZSMRIw
  51319. EAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4XDTA3MDYyOTE1MTMwNVoXDTI3
  51320. MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwI
  51321. Q2VydGlnbmEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7q
  51322. XOEm7RFHYeGifBZ4QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyH
  51323. GxnygQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbwzBfsV1/p
  51324. ogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q130yGLMLLGq/jj8UEYkg
  51325. DncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKf
  51326. Irjxwo1p3Po6WAbfAgMBAAGjgbwwgbkwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQ
  51327. tCRZvgHyUtVF9lo53BEwZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJ
  51328. BgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzjAQ/J
  51329. SP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG9w0BAQUFAAOCAQEA
  51330. hQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8hbV6lUmPOEvjvKtpv6zf+EwLHyzs+
  51331. ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFncfca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1klu
  51332. PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY
  51333. 1gkIl2PlwS6wt0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw
  51334. WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg==
  51335. -----END CERTIFICATE-----
  51336. Deutsche Telekom Root CA 2
  51337. ==========================
  51338. -----BEGIN CERTIFICATE-----
  51339. MIIDnzCCAoegAwIBAgIBJjANBgkqhkiG9w0BAQUFADBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMT
  51340. RGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEG
  51341. A1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290IENBIDIwHhcNOTkwNzA5MTIxMTAwWhcNMTkwNzA5
  51342. MjM1OTAwWjBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0G
  51343. A1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBS
  51344. b290IENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrC6M14IspFLEUha88EOQ5
  51345. bzVdSq7d6mGNlUn0b2SjGmBmpKlAIoTZ1KXleJMOaAGtuU1cOs7TuKhCQN/Po7qCWWqSG6wcmtoI
  51346. KyUn+WkjR/Hg6yx6m/UTAtB+NHzCnjwAWav12gz1MjwrrFDa1sPeg5TKqAyZMg4ISFZbavva4VhY
  51347. AUlfckE8FQYBjl2tqriTtM2e66foai1SNNs671x1Udrb8zH57nGYMsRUFUQM+ZtV7a3fGAigo4aK
  51348. Se5TBY8ZTNXeWHmb0mocQqvF1afPaA+W5OFhmHZhyJF81j4A4pFQh+GdCuatl9Idxjp9y7zaAzTV
  51349. jlsB9WoHtxa2bkp/AgMBAAGjQjBAMB0GA1UdDgQWBBQxw3kbuvVT1xfgiXotF2wKsyudMzAPBgNV
  51350. HRMECDAGAQH/AgEFMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAlGRZrTlk5ynr
  51351. E/5aw4sTV8gEJPB0d8Bg42f76Ymmg7+Wgnxu1MM9756AbrsptJh6sTtU6zkXR34ajgv8HzFZMQSy
  51352. zhfzLMdiNlXiItiJVbSYSKpk+tYcNthEeFpaIzpXl/V6ME+un2pMSyuOoAPjPuCp1NJ70rOo4nI8
  51353. rZ7/gFnkm0W09juwzTkZmDLl6iFhkOQxIY40sfcvNUqFENrnijchvllj4PKFiDFT1FQUhXB59C4G
  51354. dyd1Lx+4ivn+xbrYNuSD7Odlt79jWvNGr4GUN9RBjNYj1h7P9WgbRGOiWrqnNVmh5XAFmw4jV5mU
  51355. Cm26OWMohpLzGITY+9HPBVZkVw==
  51356. -----END CERTIFICATE-----
  51357. Cybertrust Global Root
  51358. ======================
  51359. -----BEGIN CERTIFICATE-----
  51360. MIIDoTCCAomgAwIBAgILBAAAAAABD4WqLUgwDQYJKoZIhvcNAQEFBQAwOzEYMBYGA1UEChMPQ3li
  51361. ZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2JhbCBSb290MB4XDTA2MTIxNTA4
  51362. MDAwMFoXDTIxMTIxNTA4MDAwMFowOzEYMBYGA1UEChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQD
  51363. ExZDeWJlcnRydXN0IEdsb2JhbCBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
  51364. +Mi8vRRQZhP/8NN57CPytxrHjoXxEnOmGaoQ25yiZXRadz5RfVb23CO21O1fWLE3TdVJDm71aofW
  51365. 0ozSJ8bi/zafmGWgE07GKmSb1ZASzxQG9Dvj1Ci+6A74q05IlG2OlTEQXO2iLb3VOm2yHLtgwEZL
  51366. AfVJrn5GitB0jaEMAs7u/OePuGtm839EAL9mJRQr3RAwHQeWP032a7iPt3sMpTjr3kfb1V05/Iin
  51367. 89cqdPHoWqI7n1C6poxFNcJQZZXcY4Lv3b93TZxiyWNzFtApD0mpSPCzqrdsxacwOUBdrsTiXSZT
  51368. 8M4cIwhhqJQZugRiQOwfOHB3EgZxpzAYXSUnpQIDAQABo4GlMIGiMA4GA1UdDwEB/wQEAwIBBjAP
  51369. BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBS2CHsNesysIEyGVjJez6tuhS1wVzA/BgNVHR8EODA2
  51370. MDSgMqAwhi5odHRwOi8vd3d3Mi5wdWJsaWMtdHJ1c3QuY29tL2NybC9jdC9jdHJvb3QuY3JsMB8G
  51371. A1UdIwQYMBaAFLYIew16zKwgTIZWMl7Pq26FLXBXMA0GCSqGSIb3DQEBBQUAA4IBAQBW7wojoFRO
  51372. lZfJ+InaRcHUowAl9B8Tq7ejhVhpwjCt2BWKLePJzYFa+HMjWqd8BfP9IjsO0QbE2zZMcwSO5bAi
  51373. 5MXzLqXZI+O4Tkogp24CJJ8iYGd7ix1yCcUxXOl5n4BHPa2hCwcUPUf/A2kaDAtE52Mlp3+yybh2
  51374. hO0j9n0Hq0V+09+zv+mKts2oomcrUtW3ZfA5TGOgkXmTUg9U3YO7n9GPp1Nzw8v/MOx8BLjYRB+T
  51375. X3EJIrduPuocA06dGiBh+4E37F78CkWr1+cXVdCg6mCbpvbjjFspwgZgFJ0tl0ypkxWdYcQBX0jW
  51376. WL1WMRJOEcgh4LMRkWXbtKaIOM5V
  51377. -----END CERTIFICATE-----
  51378. ePKI Root Certification Authority
  51379. =================================
  51380. -----BEGIN CERTIFICATE-----
  51381. MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQG
  51382. EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xKjAoBgNVBAsMIWVQS0kg
  51383. Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMx
  51384. MjdaMF4xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEq
  51385. MCgGA1UECwwhZVBLSSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0B
  51386. AQEFAAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAHSyZbCUNs
  51387. IZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAhijHyl3SJCRImHJ7K2RKi
  51388. lTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3XDZoTM1PRYfl61dd4s5oz9wCGzh1NlDiv
  51389. qOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX
  51390. 12ruOzjjK9SXDrkb5wdJfzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0O
  51391. WQqraffAsgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uUWH1+
  51392. ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLSnT0IFaUQAS2zMnao
  51393. lQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pHdmX2Os+PYhcZewoozRrSgx4hxyy/
  51394. vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJipNiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXi
  51395. Zo1jDiVN1Rmy5nk3pyKdVDECAwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/Qkqi
  51396. MAwGA1UdEwQFMAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH
  51397. ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGBuvl2ICO1J2B0
  51398. 1GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6YlPwZpVnPDimZI+ymBV3QGypzq
  51399. KOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkPJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdV
  51400. xrsStZf0X4OFunHB2WyBEXYKCrC/gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEP
  51401. NXubrjlpC2JgQCA2j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+r
  51402. GNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxE
  51403. xJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS/jQ6fbjpKdx2qcgw+BRx
  51404. gMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2zGp1iro2C6pSe3VkQw63d4k3jMdXH7Ojy
  51405. sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD
  51406. BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw=
  51407. -----END CERTIFICATE-----
  51408. certSIGN ROOT CA
  51409. ================
  51410. -----BEGIN CERTIFICATE-----
  51411. MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYTAlJPMREwDwYD
  51412. VQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTAeFw0wNjA3MDQxNzIwMDRa
  51413. Fw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UE
  51414. CxMQY2VydFNJR04gUk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7I
  51415. JUqOtdu0KBuqV5Do0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHH
  51416. rfAQUySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5dRdY4zTW2
  51417. ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQOA7+j0xbm0bqQfWwCHTD
  51418. 0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwvJoIQ4uNllAoEwF73XVv4EOLQunpL+943
  51419. AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B
  51420. Af8EBAMCAcYwHQYDVR0OBBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IB
  51421. AQA+0hyJLjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecYMnQ8
  51422. SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ44gx+FkagQnIl6Z0
  51423. x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6IJd1hJyMctTEHBDa0GpC9oHRxUIlt
  51424. vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7Nz
  51425. TogVZ96edhBiIL5VaZVDADlN9u6wWk5JRFRYX0KD
  51426. -----END CERTIFICATE-----
  51427. GeoTrust Primary Certification Authority - G3
  51428. =============================================
  51429. -----BEGIN CERTIFICATE-----
  51430. MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UE
  51431. BhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA4IEdlb1RydXN0
  51432. IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFy
  51433. eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIz
  51434. NTk1OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAo
  51435. YykgMjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMT
  51436. LUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZI
  51437. hvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz+uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5j
  51438. K/BGvESyiaHAKAxJcCGVn2TAppMSAmUmhsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdE
  51439. c5IiaacDiGydY8hS2pgn5whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3C
  51440. IShwiP/WJmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exALDmKu
  51441. dlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZChuOl1UcCAwEAAaNC
  51442. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMR5yo6hTgMdHNxr
  51443. 2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IBAQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9
  51444. cr5HqQ6XErhK8WTTOd8lNNTBzU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbE
  51445. Ap7aDHdlDkQNkv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD
  51446. AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUHSJsMC8tJP33s
  51447. t/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2Gspki4cErx5z481+oghLrGREt
  51448. -----END CERTIFICATE-----
  51449. thawte Primary Root CA - G2
  51450. ===========================
  51451. -----BEGIN CERTIFICATE-----
  51452. MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDELMAkGA1UEBhMC
  51453. VVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMpIDIwMDcgdGhhd3RlLCBJbmMu
  51454. IC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3Qg
  51455. Q0EgLSBHMjAeFw0wNzExMDUwMDAwMDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEV
  51456. MBMGA1UEChMMdGhhd3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBG
  51457. b3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAt
  51458. IEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/BebfowJPDQfGAFG6DAJS
  51459. LSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6papu+7qzcMBniKI11KOasf2twu8x+qi5
  51460. 8/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU
  51461. mtgAMADna3+FGO6Lts6KDPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUN
  51462. G4k8VIZ3KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41oxXZ3K
  51463. rr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg==
  51464. -----END CERTIFICATE-----
  51465. thawte Primary Root CA - G3
  51466. ===========================
  51467. -----BEGIN CERTIFICATE-----
  51468. MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCBrjELMAkGA1UE
  51469. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  51470. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  51471. cml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0w
  51472. ODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh
  51473. d3RlLCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMTgwNgYD
  51474. VQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIG
  51475. A1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  51476. MIIBCgKCAQEAsr8nLPvb2FvdeHsbnndmgcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2At
  51477. P0LMqmsywCPLLEHd5N/8YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC
  51478. +BsUa0Lfb1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS99irY
  51479. 7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2SzhkGcuYMXDhpxwTW
  51480. vGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUkOQIDAQABo0IwQDAPBgNVHRMBAf8E
  51481. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJ
  51482. KoZIhvcNAQELBQADggEBABpA2JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweK
  51483. A3rD6z8KLFIWoCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu
  51484. t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7cKUGRIjxpp7sC
  51485. 8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fMm7v/OeZWYdMKp8RcTGB7BXcm
  51486. er/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZuMdRAGmI0Nj81Aa6sY6A=
  51487. -----END CERTIFICATE-----
  51488. GeoTrust Primary Certification Authority - G2
  51489. =============================================
  51490. -----BEGIN CERTIFICATE-----
  51491. MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDELMAkGA1UEBhMC
  51492. VVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA3IEdlb1RydXN0IElu
  51493. Yy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBD
  51494. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1
  51495. OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg
  51496. MjAwNyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMTLUdl
  51497. b1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjB2MBAGByqGSM49AgEG
  51498. BSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcLSo17VDs6bl8VAsBQps8lL33KSLjHUGMc
  51499. KiEIfJo22Av+0SbFWDEwKCXzXV2juLaltJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYD
  51500. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+
  51501. EVXVMAoGCCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGTqQ7m
  51502. ndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBuczrD6ogRLQy7rQkgu2
  51503. npaqBA+K
  51504. -----END CERTIFICATE-----
  51505. VeriSign Universal Root Certification Authority
  51506. ===============================================
  51507. -----BEGIN CERTIFICATE-----
  51508. MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCBvTELMAkGA1UE
  51509. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  51510. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  51511. IHVzZSBvbmx5MTgwNgYDVQQDEy9WZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9u
  51512. IEF1dGhvcml0eTAeFw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJV
  51513. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  51514. cmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  51515. IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmljYXRpb24gQXV0
  51516. aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj
  51517. 1mCOkdeQmIN65lgZOIzF9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGP
  51518. MiJhgsWHH26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+HLL72
  51519. 9fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN/BMReYTtXlT2NJ8I
  51520. AfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPTrJ9VAMf2CGqUuV/c4DPxhGD5WycR
  51521. tPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0G
  51522. CCsGAQUFBwEMBGEwX6FdoFswWTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2O
  51523. a8PPgGrUSBgsexkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud
  51524. DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4sAPmLGd75JR3
  51525. Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+seQxIcaBlVZaDrHC1LGmWazx
  51526. Y8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTx
  51527. P/jgdFcrGJ2BtMQo2pSXpXDrrB2+BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+P
  51528. wGZsY6rp2aQW9IHRlRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4
  51529. mJO37M2CYfE45k+XmCpajQ==
  51530. -----END CERTIFICATE-----
  51531. VeriSign Class 3 Public Primary Certification Authority - G4
  51532. ============================================================
  51533. -----BEGIN CERTIFICATE-----
  51534. MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjELMAkGA1UEBhMC
  51535. VVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3
  51536. b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVz
  51537. ZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmlj
  51538. YXRpb24gQXV0aG9yaXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjEL
  51539. MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBU
  51540. cnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRo
  51541. b3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5
  51542. IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8
  51543. Utpkmw4tXNherJI9/gHmGUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGz
  51544. rl0Bp3vefLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUwAwEB
  51545. /zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEw
  51546. HzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVyaXNpZ24u
  51547. Y29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMWkf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMD
  51548. A2gAMGUCMGYhDBgmYFo4e1ZC4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIx
  51549. AJw9SDkjOVgaFRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA==
  51550. -----END CERTIFICATE-----
  51551. NetLock Arany (Class Gold) Főtanúsítvány
  51552. ========================================
  51553. -----BEGIN CERTIFICATE-----
  51554. MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G
  51555. A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610
  51556. dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBB
  51557. cmFueSAoQ2xhc3MgR29sZCkgRsWRdGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgx
  51558. MjA2MTUwODIxWjCBpzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxO
  51559. ZXRMb2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlmaWNhdGlv
  51560. biBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNzIEdvbGQpIEbFkXRhbsO6
  51561. c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCRec75LbRTDofTjl5Bu
  51562. 0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrTlF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw
  51563. /HpYzY6b7cNGbIRwXdrzAZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAk
  51564. H3B5r9s5VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRGILdw
  51565. fzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2BJtr+UBdADTHLpl1
  51566. neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIB
  51567. BjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2MU9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwW
  51568. qZw8UQCgwBEIBaeZ5m8BiFRhbvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTta
  51569. YtOUZcTh5m2C+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC
  51570. bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2FuLjbvrW5Kfna
  51571. NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu
  51572. dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=
  51573. -----END CERTIFICATE-----
  51574. Staat der Nederlanden Root CA - G2
  51575. ==================================
  51576. -----BEGIN CERTIFICATE-----
  51577. MIIFyjCCA7KgAwIBAgIEAJiWjDANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  51578. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  51579. Um9vdCBDQSAtIEcyMB4XDTA4MDMyNjExMTgxN1oXDTIwMDMyNTExMDMxMFowWjELMAkGA1UEBhMC
  51580. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  51581. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMVZ
  51582. 5291qj5LnLW4rJ4L5PnZyqtdj7U5EILXr1HgO+EASGrP2uEGQxGZqhQlEq0i6ABtQ8SpuOUfiUtn
  51583. vWFI7/3S4GCI5bkYYCjDdyutsDeqN95kWSpGV+RLufg3fNU254DBtvPUZ5uW6M7XxgpT0GtJlvOj
  51584. CwV3SPcl5XCsMBQgJeN/dVrlSPhOewMHBPqCYYdu8DvEpMfQ9XQ+pV0aCPKbJdL2rAQmPlU6Yiil
  51585. e7Iwr/g3wtG61jj99O9JMDeZJiFIhQGp5Rbn3JBV3w/oOM2ZNyFPXfUib2rFEhZgF1XyZWampzCR
  51586. OME4HYYEhLoaJXhena/MUGDWE4dS7WMfbWV9whUYdMrhfmQpjHLYFhN9C0lK8SgbIHRrxT3dsKpI
  51587. CT0ugpTNGmXZK4iambwYfp/ufWZ8Pr2UuIHOzZgweMFvZ9C+X+Bo7d7iscksWXiSqt8rYGPy5V65
  51588. 48r6f1CGPqI0GAwJaCgRHOThuVw+R7oyPxjMW4T182t0xHJ04eOLoEq9jWYv6q012iDTiIJh8BIi
  51589. trzQ1aTsr1SIJSQ8p22xcik/Plemf1WvbibG/ufMQFxRRIEKeN5KzlW/HdXZt1bv8Hb/C3m1r737
  51590. qWmRRpdogBQ2HbN/uymYNqUg+oJgYjOk7Na6B6duxc8UpufWkjTYgfX8HV2qXB72o007uPc5AgMB
  51591. AAGjgZcwgZQwDwYDVR0TAQH/BAUwAwEB/zBSBgNVHSAESzBJMEcGBFUdIAAwPzA9BggrBgEFBQcC
  51592. ARYxaHR0cDovL3d3dy5wa2lvdmVyaGVpZC5ubC9wb2xpY2llcy9yb290LXBvbGljeS1HMjAOBgNV
  51593. HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJFoMocVHYnitfGsNig0jQt8YojrMA0GCSqGSIb3DQEBCwUA
  51594. A4ICAQCoQUpnKpKBglBu4dfYszk78wIVCVBR7y29JHuIhjv5tLySCZa59sCrI2AGeYwRTlHSeYAz
  51595. +51IvuxBQ4EffkdAHOV6CMqqi3WtFMTC6GY8ggen5ieCWxjmD27ZUD6KQhgpxrRW/FYQoAUXvQwj
  51596. f/ST7ZwaUb7dRUG/kSS0H4zpX897IZmflZ85OkYcbPnNe5yQzSipx6lVu6xiNGI1E0sUOlWDuYaN
  51597. kqbG9AclVMwWVxJKgnjIFNkXgiYtXSAfea7+1HAWFpWD2DU5/1JddRwWxRNVz0fMdWVSSt7wsKfk
  51598. CpYL+63C4iWEst3kvX5ZbJvw8NjnyvLplzh+ib7M+zkXYT9y2zqR2GUBGR2tUKRXCnxLvJxxcypF
  51599. URmFzI79R6d0lR2o0a9OF7FpJsKqeFdbxU2n5Z4FF5TKsl+gSRiNNOkmbEgeqmiSBeGCc1qb3Adb
  51600. CG19ndeNIdn8FCCqwkXfP+cAslHkwvgFuXkajDTznlvkN1trSt8sV4pAWja63XVECDdCcAz+3F4h
  51601. oKOKwJCcaNpQ5kUQR3i2TtJlycM33+FCY7BXN0Ute4qcvwXqZVUz9zkQxSgqIXobisQk+T8VyJoV
  51602. IPVVYpbtbZNQvOSqeK3Zywplh6ZmwcSBo3c6WB4L7oOLnR7SUqTMHW+wmG2UMbX4cQrcufx9MmDm
  51603. 66+KAQ==
  51604. -----END CERTIFICATE-----
  51605. Hongkong Post Root CA 1
  51606. =======================
  51607. -----BEGIN CERTIFICATE-----
  51608. MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoT
  51609. DUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMB4XDTAzMDUx
  51610. NTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25n
  51611. IFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEF
  51612. AAOCAQ8AMIIBCgKCAQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1
  51613. ApzQjVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEnPzlTCeqr
  51614. auh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjhZY4bXSNmO7ilMlHIhqqh
  51615. qZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9nnV0ttgCXjqQesBCNnLsak3c78QA3xMY
  51616. V18meMjWCnl3v/evt3a5pQuEF10Q6m/hq5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNV
  51617. HRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7i
  51618. h9legYsCmEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI37pio
  51619. l7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clBoiMBdDhViw+5Lmei
  51620. IAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJsEhTkYY2sEJCehFC78JZvRZ+K88ps
  51621. T/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpOfMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilT
  51622. c4afU9hDDl3WY4JxHYB0yvbiAmvZWg==
  51623. -----END CERTIFICATE-----
  51624. SecureSign RootCA11
  51625. ===================
  51626. -----BEGIN CERTIFICATE-----
  51627. MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi
  51628. SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS
  51629. b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw
  51630. KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1
  51631. cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL
  51632. TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO
  51633. wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq
  51634. g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP
  51635. O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA
  51636. bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX
  51637. t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh
  51638. OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r
  51639. bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ
  51640. Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01
  51641. y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061
  51642. lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I=
  51643. -----END CERTIFICATE-----
  51644. Microsec e-Szigno Root CA 2009
  51645. ==============================
  51646. -----BEGIN CERTIFICATE-----
  51647. MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJIVTER
  51648. MA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jv
  51649. c2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o
  51650. dTAeFw0wOTA2MTYxMTMwMThaFw0yOTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UE
  51651. BwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUt
  51652. U3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTCCASIw
  51653. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvPkd6mJviZpWNwrZuuyjNA
  51654. fW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tccbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG
  51655. 0IMZfcChEhyVbUr02MelTTMuhTlAdX4UfIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKA
  51656. pxn1ntxVUwOXewdI/5n7N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm
  51657. 1HxdrtbCxkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1+rUC
  51658. AwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTLD8bf
  51659. QkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAbBgNVHREE
  51660. FDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqGSIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0o
  51661. lZMEyL/azXm4Q5DwpL7v8u8hmLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfX
  51662. I/OMn74dseGkddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775
  51663. tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c2Pm2G2JwCz02
  51664. yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi
  51665. LXpUq3DDfSJlgnCW
  51666. -----END CERTIFICATE-----
  51667. GlobalSign Root CA - R3
  51668. =======================
  51669. -----BEGIN CERTIFICATE-----
  51670. MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xv
  51671. YmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  51672. bFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  51673. aWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  51674. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWt
  51675. iHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsTgHeMCOFJ
  51676. 0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmmKPZpO/bLyCiR5Z2KYVc3
  51677. rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zdQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjl
  51678. OCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2
  51679. xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  51680. FI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7
  51681. lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8
  51682. EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1E
  51683. bddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18
  51684. YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r
  51685. kpeDMdmztcpHWD9f
  51686. -----END CERTIFICATE-----
  51687. Autoridad de Certificacion Firmaprofesional CIF A62634068
  51688. =========================================================
  51689. -----BEGIN CERTIFICATE-----
  51690. MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UEBhMCRVMxQjBA
  51691. BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2
  51692. MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEyMzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIw
  51693. QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB
  51694. NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD
  51695. Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P
  51696. B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY
  51697. 7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH
  51698. ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI
  51699. plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX
  51700. MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX
  51701. LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK
  51702. bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU
  51703. vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1Ud
  51704. EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNH
  51705. DhpkLzCBpgYDVR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp
  51706. cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBvACAAZABlACAA
  51707. bABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBlAGwAbwBuAGEAIAAwADgAMAAx
  51708. ADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx
  51709. 51tkljYyGOylMnfX40S2wBEqgLk9am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qk
  51710. R71kMrv2JYSiJ0L1ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaP
  51711. T481PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS3a/DTg4f
  51712. Jl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5kSeTy36LssUzAKh3ntLFl
  51713. osS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF3dvd6qJ2gHN99ZwExEWN57kci57q13XR
  51714. crHedUTnQn3iV2t93Jm8PYMo6oCTjcVMZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoR
  51715. saS8I8nkvof/uZS2+F0gStRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTD
  51716. KCOM/iczQ0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQBjLMi
  51717. 6Et8Vcad+qMUu2WFbm5PEn4KPJ2V
  51718. -----END CERTIFICATE-----
  51719. Izenpe.com
  51720. ==========
  51721. -----BEGIN CERTIFICATE-----
  51722. MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQG
  51723. EwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wHhcNMDcxMjEz
  51724. MTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMu
  51725. QS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ
  51726. 03rKDx6sp4boFmVqscIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAK
  51727. ClaOxdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6HLmYRY2xU
  51728. +zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFXuaOKmMPsOzTFlUFpfnXC
  51729. PCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQDyCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxT
  51730. OTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbK
  51731. F7jJeodWLBoBHmy+E60QrLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK
  51732. 0GqfvEyNBjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8Lhij+
  51733. 0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIBQFqNeb+Lz0vPqhbB
  51734. leStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+HMh3/1uaD7euBUbl8agW7EekFwID
  51735. AQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2luZm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+
  51736. SVpFTlBFIFMuQS4gLSBDSUYgQTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBG
  51737. NjIgUzgxQzBBBgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx
  51738. MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  51739. BBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUAA4ICAQB4pgwWSp9MiDrAyw6l
  51740. Fn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWblaQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbga
  51741. kEyrkgPH7UIBzg/YsfqikuFgba56awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8q
  51742. hT/AQKM6WfxZSzwoJNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Cs
  51743. g1lwLDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCTVyvehQP5
  51744. aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGkLhObNA5me0mrZJfQRsN5
  51745. nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJbUjWumDqtujWTI6cfSN01RpiyEGjkpTHC
  51746. ClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZo
  51747. Q0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1Z
  51748. WrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw==
  51749. -----END CERTIFICATE-----
  51750. Chambers of Commerce Root - 2008
  51751. ================================
  51752. -----BEGIN CERTIFICATE-----
  51753. MIIHTzCCBTegAwIBAgIJAKPaQn6ksa7aMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYDVQQGEwJFVTFD
  51754. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  51755. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  51756. QS4xKTAnBgNVBAMTIENoYW1iZXJzIG9mIENvbW1lcmNlIFJvb3QgLSAyMDA4MB4XDTA4MDgwMTEy
  51757. Mjk1MFoXDTM4MDczMTEyMjk1MFowga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNl
  51758. ZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQF
  51759. EwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJl
  51760. cnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
  51761. AQCvAMtwNyuAWko6bHiUfaN/Gh/2NdW928sNRHI+JrKQUrpjOyhYb6WzbZSm891kDFX29ufyIiKA
  51762. XuFixrYp4YFs8r/lfTJqVKAyGVn+H4vXPWCGhSRv4xGzdz4gljUha7MI2XAuZPeEklPWDrCQiorj
  51763. h40G072QDuKZoRuGDtqaCrsLYVAGUvGef3bsyw/QHg3PmTA9HMRFEFis1tPo1+XqxQEHd9ZR5gN/
  51764. ikilTWh1uem8nk4ZcfUyS5xtYBkL+8ydddy/Js2Pk3g5eXNeJQ7KXOt3EgfLZEFHcpOrUMPrCXZk
  51765. NNI5t3YRCQ12RcSprj1qr7V9ZS+UWBDsXHyvfuK2GNnQm05aSd+pZgvMPMZ4fKecHePOjlO+Bd5g
  51766. D2vlGts/4+EhySnB8esHnFIbAURRPHsl18TlUlRdJQfKFiC4reRB7noI/plvg6aRArBsNlVq5331
  51767. lubKgdaX8ZSD6e2wsWsSaR6s+12pxZjptFtYer49okQ6Y1nUCyXeG0+95QGezdIp1Z8XGQpvvwyQ
  51768. 0wlf2eOKNcx5Wk0ZN5K3xMGtr/R5JJqyAQuxr1yW84Ay+1w9mPGgP0revq+ULtlVmhduYJ1jbLhj
  51769. ya6BXBg14JC7vjxPNyK5fuvPnnchpj04gftI2jE9K+OJ9dC1vX7gUMQSibMjmhAxhduub+84Mxh2
  51770. EQIDAQABo4IBbDCCAWgwEgYDVR0TAQH/BAgwBgEB/wIBDDAdBgNVHQ4EFgQU+SSsD7K1+HnA+mCI
  51771. G8TZTQKeFxkwgeMGA1UdIwSB2zCB2IAU+SSsD7K1+HnA+mCIG8TZTQKeFxmhgbSkgbEwga4xCzAJ
  51772. BgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNh
  51773. bWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENh
  51774. bWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDiC
  51775. CQCj2kJ+pLGu2jAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUH
  51776. AgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAJASryI1
  51777. wqM58C7e6bXpeHxIvj99RZJe6dqxGfwWPJ+0W2aeaufDuV2I6A+tzyMP3iU6XsxPpcG1Lawk0lgH
  51778. 3qLPaYRgM+gQDROpI9CF5Y57pp49chNyM/WqfcZjHwj0/gF/JM8rLFQJ3uIrbZLGOU8W6jx+ekbU
  51779. RWpGqOt1glanq6B8aBMz9p0w8G8nOSQjKpD9kCk18pPfNKXG9/jvjA9iSnyu0/VU+I22mlaHFoI6
  51780. M6taIgj3grrqLuBHmrS1RaMFO9ncLkVAO+rcf+g769HsJtg1pDDFOqxXnrN2pSB7+R5KBWIBpih1
  51781. YJeSDW4+TTdDDZIVnBgizVGZoCkaPF+KMjNbMMeJL0eYD6MDxvbxrN8y8NmBGuScvfaAFPDRLLmF
  51782. 9dijscilIeUcE5fuDr3fKanvNFNb0+RqE4QGtjICxFKuItLcsiFCGtpA8CnJ7AoMXOLQusxI0zcK
  51783. zBIKinmwPQN/aUv0NCB9szTqjktk9T79syNnFQ0EuPAtwQlRPLJsFfClI9eDdOTlLsn+mCdCxqvG
  51784. nrDQWzilm1DefhiYtUU79nm06PcaewaD+9CL2rvHvRirCG88gGtAPxkZumWK5r7VXNM21+9AUiRg
  51785. OGcEMeyP84LG3rlV8zsxkVrctQgVrXYlCg17LofiDKYGvCYQbTed7N14jHyAxfDZd0jQ
  51786. -----END CERTIFICATE-----
  51787. Global Chambersign Root - 2008
  51788. ==============================
  51789. -----BEGIN CERTIFICATE-----
  51790. MIIHSTCCBTGgAwIBAgIJAMnN0+nVfSPOMA0GCSqGSIb3DQEBBQUAMIGsMQswCQYDVQQGEwJFVTFD
  51791. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  51792. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  51793. QS4xJzAlBgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwODAeFw0wODA4MDExMjMx
  51794. NDBaFw0zODA3MzExMjMxNDBaMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUg
  51795. Y3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJ
  51796. QTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAlBgNVBAMTHkdsb2JhbCBD
  51797. aGFtYmVyc2lnbiBSb290IC0gMjAwODCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDf
  51798. VtPkOpt2RbQT2//BthmLN0EYlVJH6xedKYiONWwGMi5HYvNJBL99RDaxccy9Wglz1dmFRP+RVyXf
  51799. XjaOcNFccUMd2drvXNL7G706tcuto8xEpw2uIRU/uXpbknXYpBI4iRmKt4DS4jJvVpyR1ogQC7N0
  51800. ZJJ0YPP2zxhPYLIj0Mc7zmFLmY/CDNBAspjcDahOo7kKrmCgrUVSY7pmvWjg+b4aqIG7HkF4ddPB
  51801. /gBVsIdU6CeQNR1MM62X/JcumIS/LMmjv9GYERTtY/jKmIhYF5ntRQOXfjyGHoiMvvKRhI9lNNgA
  51802. TH23MRdaKXoKGCQwoze1eqkBfSbW+Q6OWfH9GzO1KTsXO0G2Id3UwD2ln58fQ1DJu7xsepeY7s2M
  51803. H/ucUa6LcL0nn3HAa6x9kGbo1106DbDVwo3VyJ2dwW3Q0L9R5OP4wzg2rtandeavhENdk5IMagfe
  51804. Ox2YItaswTXbo6Al/3K1dh3ebeksZixShNBFks4c5eUzHdwHU1SjqoI7mjcv3N2gZOnm3b2u/GSF
  51805. HTynyQbehP9r6GsaPMWis0L7iwk+XwhSx2LE1AVxv8Rk5Pihg+g+EpuoHtQ2TS9x9o0o9oOpE9Jh
  51806. wZG7SMA0j0GMS0zbaRL/UJScIINZc+18ofLx/d33SdNDWKBWY8o9PeU1VlnpDsogzCtLkykPAgMB
  51807. AAGjggFqMIIBZjASBgNVHRMBAf8ECDAGAQH/AgEMMB0GA1UdDgQWBBS5CcqcHtvTbDprru1U8VuT
  51808. BjUuXjCB4QYDVR0jBIHZMIHWgBS5CcqcHtvTbDprru1U8VuTBjUuXqGBsqSBrzCBrDELMAkGA1UE
  51809. BhMCRVUxQzBBBgNVBAcTOk1hZHJpZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2FtZXJm
  51810. aXJtYS5jb20vYWRkcmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UEChMSQUMgQ2FtZXJm
  51811. aXJtYSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNpZ24gUm9vdCAtIDIwMDiCCQDJzdPp
  51812. 1X0jzjAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUHAgEWHGh0
  51813. dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAICIf3DekijZBZRG
  51814. /5BXqfEv3xoNa/p8DhxJJHkn2EaqbylZUohwEurdPfWbU1Rv4WCiqAm57OtZfMY18dwY6fFn5a+6
  51815. ReAJ3spED8IXDneRRXozX1+WLGiLwUePmJs9wOzL9dWCkoQ10b42OFZyMVtHLaoXpGNR6woBrX/s
  51816. dZ7LoR/xfxKxueRkf2fWIyr0uDldmOghp+G9PUIadJpwr2hsUF1Jz//7Dl3mLEfXgTpZALVza2Mg
  51817. 9jFFCDkO9HB+QHBaP9BrQql0PSgvAm11cpUJjUhjxsYjV5KTXjXBjfkK9yydYhz2rXzdpjEetrHH
  51818. foUm+qRqtdpjMNHvkzeyZi99Bffnt0uYlDXA2TopwZ2yUDMdSqlapskD7+3056huirRXhOukP9Du
  51819. qqqHW2Pok+JrqNS4cnhrG+055F3Lm6qH1U9OAP7Zap88MQ8oAgF9mOinsKJknnn4SPIVqczmyETr
  51820. P3iZ8ntxPjzxmKfFGBI/5rsoM0LpRQp8bfKGeS/Fghl9CYl8slR2iK7ewfPM4W7bMdaTrpmg7yVq
  51821. c5iJWzouE4gev8CSlDQb4ye3ix5vQv/n6TebUB0tovkC7stYWDpxvGjjqsGvHCgfotwjZT+B6q6Z
  51822. 09gwzxMNTxXJhLynSC34MCN32EZLeW32jO06f2ARePTpm67VVMB0gNELQp/B
  51823. -----END CERTIFICATE-----
  51824. Go Daddy Root Certificate Authority - G2
  51825. ========================================
  51826. -----BEGIN CERTIFICATE-----
  51827. MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  51828. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMu
  51829. MTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5
  51830. MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
  51831. b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8G
  51832. A1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI
  51833. hvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKDE6bFIEMBO4Tx5oVJnyfq
  51834. 9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD
  51835. +qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutd
  51836. fMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMl
  51837. NAJWJwGRtDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNC
  51838. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9
  51839. BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096ac
  51840. vNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r
  51841. 5N9ss4UXnT3ZJE95kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYV
  51842. N8Gb5DKj7Tjo2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
  51843. LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1
  51844. -----END CERTIFICATE-----
  51845. Starfield Root Certificate Authority - G2
  51846. =========================================
  51847. -----BEGIN CERTIFICATE-----
  51848. MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  51849. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  51850. b2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0
  51851. eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAw
  51852. DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQg
  51853. VGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZpY2F0ZSBB
  51854. dXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3twQP89o/8ArFv
  51855. W59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMgnLRJdzIpVv257IzdIvpy3Cdhl+72WoTs
  51856. bhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNk
  51857. N3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7Nf
  51858. ZTD4p7dNdloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbU
  51859. JtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  51860. AQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfol
  51861. TwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx
  51862. 4mcujJUDJi5DnUox9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUw
  51863. F5okxBDgBPfg8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K
  51864. pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZ
  51865. c2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0
  51866. -----END CERTIFICATE-----
  51867. Starfield Services Root Certificate Authority - G2
  51868. ==================================================
  51869. -----BEGIN CERTIFICATE-----
  51870. MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  51871. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  51872. b2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVsZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRl
  51873. IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNV
  51874. BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxT
  51875. dGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2VydmljZXMg
  51876. Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
  51877. AQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20pOsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2
  51878. h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm28xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4Pa
  51879. hHQUw2eeBGg6345AWh1KTs9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLP
  51880. LJGmpufehRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk6mFB
  51881. rMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAwDwYDVR0TAQH/BAUw
  51882. AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+qAdcwKziIorhtSpzyEZGDMA0GCSqG
  51883. SIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMIbw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPP
  51884. E95Dz+I0swSdHynVv/heyNXBve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTy
  51885. xQGjhdByPq1zqwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd
  51886. iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn0q23KXB56jza
  51887. YyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCNsSi6
  51888. -----END CERTIFICATE-----
  51889. AffirmTrust Commercial
  51890. ======================
  51891. -----BEGIN CERTIFICATE-----
  51892. MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCVVMxFDAS
  51893. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMB4XDTEw
  51894. MDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  51895. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEF
  51896. AAOCAQ8AMIIBCgKCAQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6Eqdb
  51897. DuKPHx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yrba0F8PrV
  51898. C8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPALMeIrJmqbTFeurCA+ukV6
  51899. BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1yHp52UKqK39c/s4mT6NmgTWvRLpUHhww
  51900. MmWd5jyTXlBOeuM61G7MGvv50jeuJCqrVwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNV
  51901. HQ4EFgQUnZPGU4teyq8/nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  51902. AQYwDQYJKoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYGXUPG
  51903. hi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNjvbz4YYCanrHOQnDi
  51904. qX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivtZ8SOyUOyXGsViQK8YvxO8rUzqrJv
  51905. 0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9gN53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0kh
  51906. sUlHRUe072o0EclNmsxZt9YCnlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8=
  51907. -----END CERTIFICATE-----
  51908. AffirmTrust Networking
  51909. ======================
  51910. -----BEGIN CERTIFICATE-----
  51911. MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UEBhMCVVMxFDAS
  51912. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMB4XDTEw
  51913. MDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  51914. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEF
  51915. AAOCAQ8AMIIBCgKCAQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SE
  51916. Hi3yYJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbuakCNrmreI
  51917. dIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRLQESxG9fhwoXA3hA/Pe24
  51918. /PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gb
  51919. h+0t+nvujArjqWaJGctB+d1ENmHP4ndGyH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNV
  51920. HQ4EFgQUBx/S55zawm6iQLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  51921. AQYwDQYJKoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfOtDIu
  51922. UFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzuQY0x2+c06lkh1QF6
  51923. 12S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZLgo/bNjR9eUJtGxUAArgFU2HdW23
  51924. WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4uolu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9
  51925. /ZFvgrG+CJPbFEfxojfHRZ48x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s=
  51926. -----END CERTIFICATE-----
  51927. AffirmTrust Premium
  51928. ===================
  51929. -----BEGIN CERTIFICATE-----
  51930. MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UEBhMCVVMxFDAS
  51931. BgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMB4XDTEwMDEy
  51932. OTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRy
  51933. dXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  51934. MIICCgKCAgEAxBLfqV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtn
  51935. BKAQJG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ+jjeRFcV
  51936. 5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrSs8PhaJyJ+HoAVt70VZVs
  51937. +7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmd
  51938. GPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d770O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5R
  51939. p9EixAqnOEhss/n/fauGV+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NI
  51940. S+LI+H+SqHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S5u04
  51941. 6uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4IaC1nEWTJ3s7xgaVY5
  51942. /bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TXOwF0lkLgAOIua+rF7nKsu7/+6qqo
  51943. +Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYEFJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB
  51944. /wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByv
  51945. MiPIs0laUZx2KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg
  51946. Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B8OWycvpEgjNC
  51947. 6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQMKSOyARiqcTtNd56l+0OOF6S
  51948. L5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK
  51949. +4w1IX2COPKpVJEZNZOUbWo6xbLQu4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmV
  51950. BtWVyuEklut89pMFu+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFg
  51951. IxpHYoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8GKa1qF60
  51952. g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaORtGdFNrHF+QFlozEJLUb
  51953. zxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6eKeC2uAloGRwYQw==
  51954. -----END CERTIFICATE-----
  51955. AffirmTrust Premium ECC
  51956. =======================
  51957. -----BEGIN CERTIFICATE-----
  51958. MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMCVVMxFDASBgNV
  51959. BAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQcmVtaXVtIEVDQzAeFw0xMDAx
  51960. MjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJBgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1U
  51961. cnVzdDEgMB4GA1UEAwwXQWZmaXJtVHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQA
  51962. IgNiAAQNMF4bFZ0D0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQ
  51963. N8O9ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0GA1UdDgQW
  51964. BBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAK
  51965. BggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/VsaobgxCd05DhT1wV/GzTjxi+zygk8N53X
  51966. 57hG8f2h4nECMEJZh0PUUd+60wkyWs6Iflc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKM
  51967. eQ==
  51968. -----END CERTIFICATE-----
  51969. Certum Trusted Network CA
  51970. =========================
  51971. -----BEGIN CERTIFICATE-----
  51972. MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK
  51973. ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlv
  51974. biBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIy
  51975. MTIwNzM3WhcNMjkxMjMxMTIwNzM3WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBU
  51976. ZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  51977. MSIwIAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
  51978. AQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rHUV+rpDKmYYe2bg+G0jAC
  51979. l/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LMTXPb865Px1bVWqeWifrzq2jUI4ZZJ88J
  51980. J7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVUBBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4
  51981. fOQtf/WsX+sWn7Et0brMkUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0
  51982. cvW0QM8xAcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNVHRMB
  51983. Af8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNVHQ8BAf8EBAMCAQYw
  51984. DQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15ysHhE49wcrwn9I0j6vSrEuVUEtRCj
  51985. jSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfLI9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1
  51986. mS1FhIrlQgnXdAIv94nYmem8J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5aj
  51987. Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI
  51988. 03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw=
  51989. -----END CERTIFICATE-----
  51990. TWCA Root Certification Authority
  51991. =================================
  51992. -----BEGIN CERTIFICATE-----
  51993. MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ
  51994. VEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNh
  51995. dGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMzWhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQG
  51996. EwJUVzESMBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NB
  51997. IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
  51998. AoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFEAcK0HMMx
  51999. QhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HHK3XLfJ+utdGdIzdjp9xC
  52000. oi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeXRfwZVzsrb+RH9JlF/h3x+JejiB03HFyP
  52001. 4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1r
  52002. y+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIB
  52003. BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG
  52004. 9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lC
  52005. mtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlW
  52006. QtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVY
  52007. T0bf+215WfKEIlKuD8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocny
  52008. Yh0igzyXxfkZYiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==
  52009. -----END CERTIFICATE-----
  52010. Security Communication RootCA2
  52011. ==============================
  52012. -----BEGIN CERTIFICATE-----
  52013. MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
  52014. U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMeU2VjdXJpdHkgQ29tbXVuaWNh
  52015. dGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoXDTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMC
  52016. SlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3Vy
  52017. aXR5IENvbW11bmljYXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  52018. ANAVOVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGrzbl+dp++
  52019. +T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVMVAX3NuRFg3sUZdbcDE3R
  52020. 3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQhNBqyjoGADdH5H5XTz+L62e4iKrFvlNV
  52021. spHEfbmwhRkGeC7bYRr6hfVKkaHnFtWOojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1K
  52022. EOtOghY6rCcMU/Gt1SSwawNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8
  52023. QIH4D5csOPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEB
  52024. CwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpFcoJxDjrSzG+ntKEj
  52025. u/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXcokgfGT+Ok+vx+hfuzU7jBBJV1uXk
  52026. 3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6q
  52027. tnRGEmyR7jTV7JqR50S+kDFy1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29
  52028. mvVXIwAHIRc/SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03
  52029. -----END CERTIFICATE-----
  52030. EC-ACC
  52031. ======
  52032. -----BEGIN CERTIFICATE-----
  52033. MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB8zELMAkGA1UE
  52034. BhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2VydGlmaWNhY2lvIChOSUYgUS0w
  52035. ODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYD
  52036. VQQLEyxWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UE
  52037. CxMsSmVyYXJxdWlhIEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMT
  52038. BkVDLUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQGEwJFUzE7
  52039. MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8gKE5JRiBRLTA4MDExNzYt
  52040. SSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZl
  52041. Z2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQubmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJh
  52042. cnF1aWEgRW50aXRhdHMgZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUND
  52043. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R85iK
  52044. w5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm4CgPukLjbo73FCeT
  52045. ae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaVHMf5NLWUhdWZXqBIoH7nF2W4onW4
  52046. HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNdQlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0a
  52047. E9jD2z3Il3rucO2n5nzbcc8tlGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw
  52048. 0JDnJwIDAQABo4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E
  52049. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4opvpXY0wfwYD
  52050. VR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBodHRwczovL3d3dy5jYXRjZXJ0
  52051. Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5l
  52052. dC92ZXJhcnJlbCAwDQYJKoZIhvcNAQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJ
  52053. lF7W2u++AVtd0x7Y/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNa
  52054. Al6kSBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhyRp/7SNVe
  52055. l+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOSAgu+TGbrIP65y7WZf+a2
  52056. E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xlnJ2lYJU6Un/10asIbvPuW/mIPX64b24D
  52057. 5EI=
  52058. -----END CERTIFICATE-----
  52059. Hellenic Academic and Research Institutions RootCA 2011
  52060. =======================================================
  52061. -----BEGIN CERTIFICATE-----
  52062. MIIEMTCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCR1IxRDBCBgNVBAoT
  52063. O0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9y
  52064. aXR5MUAwPgYDVQQDEzdIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  52065. IFJvb3RDQSAyMDExMB4XDTExMTIwNjEzNDk1MloXDTMxMTIwMTEzNDk1MlowgZUxCzAJBgNVBAYT
  52066. AkdSMUQwQgYDVQQKEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  52067. IENlcnQuIEF1dGhvcml0eTFAMD4GA1UEAxM3SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNo
  52068. IEluc3RpdHV0aW9ucyBSb290Q0EgMjAxMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  52069. AKlTAOMupvaO+mDYLZU++CwqVE7NuYRhlFhPjz2L5EPzdYmNUeTDN9KKiE15HrcS3UN4SoqS5tdI
  52070. 1Q+kOilENbgH9mgdVc04UfCMJDGFr4PJfel3r+0ae50X+bOdOFAPplp5kYCvN66m0zH7tSYJnTxa
  52071. 71HFK9+WXesyHgLacEnsbgzImjeN9/E2YEsmLIKe0HjzDQ9jpFEw4fkrJxIH2Oq9GGKYsFk3fb7u
  52072. 8yBRQlqD75O6aRXxYp2fmTmCobd0LovUxQt7L/DICto9eQqakxylKHJzkUOap9FNhYS5qXSPFEDH
  52073. 3N6sQWRstBmbAmNtJGSPRLIl6s5ddAxjMlyNh+UCAwEAAaOBiTCBhjAPBgNVHRMBAf8EBTADAQH/
  52074. MAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQUppFC/RNhSiOeCKQp5dgTBCPuQSUwRwYDVR0eBEAwPqA8
  52075. MAWCAy5ncjAFggMuZXUwBoIELmVkdTAGggQub3JnMAWBAy5ncjAFgQMuZXUwBoEELmVkdTAGgQQu
  52076. b3JnMA0GCSqGSIb3DQEBBQUAA4IBAQAf73lB4XtuP7KMhjdCSk4cNx6NZrokgclPEg8hwAOXhiVt
  52077. XdMiKahsog2p6z0GW5k6x8zDmjR/qw7IThzh+uTczQ2+vyT+bOdrwg3IBp5OjWEopmr95fZi6hg8
  52078. TqBTnbI6nOulnJEWtk2C4AwFSKls9cz4y51JtPACpf1wA+2KIaWuE4ZJwzNzvoc7dIsXRSZMFpGD
  52079. /md9zU1jZ/rzAxKWeAaNsWftjj++n08C9bMJL/NMh98qy5V8AcysNnq/onN694/BtZqhFLKPM58N
  52080. 7yLcZnuEvUUXBj08yrl3NI/K6s8/MT7jiOOASSXIl7WdmplNsDz4SgCbZN2fOUvRJ9e4
  52081. -----END CERTIFICATE-----
  52082. Actalis Authentication Root CA
  52083. ==============================
  52084. -----BEGIN CERTIFICATE-----
  52085. MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UEBhMCSVQxDjAM
  52086. BgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UE
  52087. AwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDky
  52088. MjExMjIwMlowazELMAkGA1UEBhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlz
  52089. IFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290
  52090. IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNvUTufClrJ
  52091. wkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX4ay8IMKx4INRimlNAJZa
  52092. by/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9KK3giq0itFZljoZUj5NDKd45RnijMCO6
  52093. zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1f
  52094. YVEiVRvjRuPjPdA1YprbrxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2
  52095. oxgkg4YQ51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2Fbe8l
  52096. EfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxeKF+w6D9Fz8+vm2/7
  52097. hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4Fv6MGn8i1zeQf1xcGDXqVdFUNaBr8
  52098. EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbnfpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5
  52099. jF66CyCU3nuDuP/jVo23Eek7jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLY
  52100. iDrIn3hm7YnzezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt
  52101. ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQALe3KHwGCmSUyI
  52102. WOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70jsNjLiNmsGe+b7bAEzlgqqI0
  52103. JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDzWochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKx
  52104. K3JCaKygvU5a2hi/a5iB0P2avl4VSM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+
  52105. Xlff1ANATIGk0k9jpwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC
  52106. 4yyXX04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+OkfcvHlXHo
  52107. 2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7RK4X9p2jIugErsWx0Hbhz
  52108. lefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btUZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXem
  52109. OR/qnuOf0GZvBeyqdn6/axag67XH/JJULysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9
  52110. vwGYT7JZVEc+NHt4bVaTLnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg==
  52111. -----END CERTIFICATE-----
  52112. Trustis FPS Root CA
  52113. ===================
  52114. -----BEGIN CERTIFICATE-----
  52115. MIIDZzCCAk+gAwIBAgIQGx+ttiD5JNM2a/fH8YygWTANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQG
  52116. EwJHQjEYMBYGA1UEChMPVHJ1c3RpcyBMaW1pdGVkMRwwGgYDVQQLExNUcnVzdGlzIEZQUyBSb290
  52117. IENBMB4XDTAzMTIyMzEyMTQwNloXDTI0MDEyMTExMzY1NFowRTELMAkGA1UEBhMCR0IxGDAWBgNV
  52118. BAoTD1RydXN0aXMgTGltaXRlZDEcMBoGA1UECxMTVHJ1c3RpcyBGUFMgUm9vdCBDQTCCASIwDQYJ
  52119. KoZIhvcNAQEBBQADggEPADCCAQoCggEBAMVQe547NdDfxIzNjpvto8A2mfRC6qc+gIMPpqdZh8mQ
  52120. RUN+AOqGeSoDvT03mYlmt+WKVoaTnGhLaASMk5MCPjDSNzoiYYkchU59j9WvezX2fihHiTHcDnlk
  52121. H5nSW7r+f2C/revnPDgpai/lkQtV/+xvWNUtyd5MZnGPDNcE2gfmHhjjvSkCqPoc4Vu5g6hBSLwa
  52122. cY3nYuUtsuvffM/bq1rKMfFMIvMFE/eC+XN5DL7XSxzA0RU8k0Fk0ea+IxciAIleH2ulrG6nS4zt
  52123. o3Lmr2NNL4XSFDWaLk6M6jKYKIahkQlBOrTh4/L68MkKokHdqeMDx4gVOxzUGpTXn2RZEm0CAwEA
  52124. AaNTMFEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBS6+nEleYtXQSUhhgtx67JkDoshZzAd
  52125. BgNVHQ4EFgQUuvpxJXmLV0ElIYYLceuyZA6LIWcwDQYJKoZIhvcNAQEFBQADggEBAH5Y//01GX2c
  52126. GE+esCu8jowU/yyg2kdbw++BLa8F6nRIW/M+TgfHbcWzk88iNVy2P3UnXwmWzaD+vkAMXBJV+JOC
  52127. yinpXj9WV4s4NvdFGkwozZ5BuO1WTISkQMi4sKUraXAEasP41BIy+Q7DsdwyhEQsb8tGD+pmQQ9P
  52128. 8Vilpg0ND2HepZ5dfWWhPBfnqFVO76DH7cZEf1T1o+CP8HxVIo8ptoGj4W1OLBuAZ+ytIJ8MYmHV
  52129. l/9D7S3B2l0pKoU/rGXuhg8FjZBf3+6f9L/uHfuY5H+QK4R4EA5sSVPvFVtlRkpdr7r7OnIdzfYl
  52130. iB6XzCGcKQENZetX2fNXlrtIzYE=
  52131. -----END CERTIFICATE-----
  52132. Buypass Class 2 Root CA
  52133. =======================
  52134. -----BEGIN CERTIFICATE-----
  52135. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  52136. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMiBSb290IENBMB4X
  52137. DTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1owTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  52138. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIw
  52139. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1
  52140. g1Lr6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPVL4O2fuPn
  52141. 9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC911K2GScuVr1QGbNgGE41b
  52142. /+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHxMlAQTn/0hpPshNOOvEu/XAFOBz3cFIqU
  52143. CqTqc/sLUegTBxj6DvEr0VQVfTzh97QZQmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeff
  52144. awrbD02TTqigzXsu8lkBarcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgI
  52145. zRFo1clrUs3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLiFRhn
  52146. Bkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRSP/TizPJhk9H9Z2vX
  52147. Uq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN9SG9dKpN6nIDSdvHXx1iY8f93ZHs
  52148. M+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxPAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  52149. VR0OBBYEFMmAd+BikoL1RpzzuvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  52150. AAOCAgEAU18h9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s
  52151. A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3tOluwlN5E40EI
  52152. osHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo+fsicdl9sz1Gv7SEr5AcD48S
  52153. aq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYd
  52154. DnkM/crqJIByw5c/8nerQyIKx+u2DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWD
  52155. LfJ6v9r9jv6ly0UsH8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0
  52156. oyLQI+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK75t98biGC
  52157. wWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h3PFaTWwyI0PurKju7koS
  52158. CTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPzY11aWOIv4x3kqdbQCtCev9eBCfHJxyYN
  52159. rJgWVqA=
  52160. -----END CERTIFICATE-----
  52161. Buypass Class 3 Root CA
  52162. =======================
  52163. -----BEGIN CERTIFICATE-----
  52164. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  52165. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMyBSb290IENBMB4X
  52166. DTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFowTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  52167. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIw
  52168. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRH
  52169. sJ8YZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3EN3coTRiR
  52170. 5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9tznDDgFHmV0ST9tD+leh
  52171. 7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX0DJq1l1sDPGzbjniazEuOQAnFN44wOwZ
  52172. ZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH
  52173. 2xc519woe2v1n/MuwU8XKhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV
  52174. /afmiSTYzIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvSO1UQ
  52175. RwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D34xFMFbG02SrZvPA
  52176. Xpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgPK9Dx2hzLabjKSWJtyNBjYt1gD1iq
  52177. j6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  52178. VR0OBBYEFEe4zf/lb+74suwvTg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  52179. AAOCAgEAACAjQTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV
  52180. cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXSIGrs/CIBKM+G
  52181. uIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2HJLw5QY33KbmkJs4j1xrG0aG
  52182. Q0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsaO5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8
  52183. ZORK15FTAaggiG6cX0S5y2CBNOxv033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2
  52184. KSb12tjE8nVhz36udmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz
  52185. 6MkEkbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg413OEMXbug
  52186. UZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvDu79leNKGef9JOxqDDPDe
  52187. eOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq4/g7u9xN12TyUb7mqqta6THuBrxzvxNi
  52188. Cp/HuZc=
  52189. -----END CERTIFICATE-----
  52190. T-TeleSec GlobalRoot Class 3
  52191. ============================
  52192. -----BEGIN CERTIFICATE-----
  52193. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  52194. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  52195. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgx
  52196. MDAxMTAyOTU2WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  52197. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  52198. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0GCSqGSIb3
  52199. DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN8ELg63iIVl6bmlQdTQyK
  52200. 9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/RLyTPWGrTs0NvvAgJ1gORH8EGoel15YU
  52201. NpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZF
  52202. iP0Zf3WHHx+xGwpzJFu5ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W
  52203. 0eDrXltMEnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGjQjBA
  52204. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1A/d2O2GCahKqGFPr
  52205. AyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOyWL6ukK2YJ5f+AbGwUgC4TeQbIXQb
  52206. fsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzT
  52207. ucpH9sry9uetuUg/vBa3wW306gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7h
  52208. P0HHRwA11fXT91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml
  52209. e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4pTpPDpFQUWw==
  52210. -----END CERTIFICATE-----
  52211. EE Certification Centre Root CA
  52212. ===============================
  52213. -----BEGIN CERTIFICATE-----
  52214. MIIEAzCCAuugAwIBAgIQVID5oHPtPwBMyonY43HmSjANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG
  52215. EwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czEoMCYGA1UEAwwfRUUgQ2Vy
  52216. dGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYGCSqGSIb3DQEJARYJcGtpQHNrLmVlMCIYDzIw
  52217. MTAxMDMwMTAxMDMwWhgPMjAzMDEyMTcyMzU5NTlaMHUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKDBlB
  52218. UyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMSgwJgYDVQQDDB9FRSBDZXJ0aWZpY2F0aW9uIENlbnRy
  52219. ZSBSb290IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwggEiMA0GCSqGSIb3DQEBAQUAA4IB
  52220. DwAwggEKAoIBAQDIIMDs4MVLqwd4lfNE7vsLDP90jmG7sWLqI9iroWUyeuuOF0+W2Ap7kaJjbMeM
  52221. TC55v6kF/GlclY1i+blw7cNRfdCT5mzrMEvhvH2/UpvObntl8jixwKIy72KyaOBhU8E2lf/slLo2
  52222. rpwcpzIP5Xy0xm90/XsY6KxX7QYgSzIwWFv9zajmofxwvI6Sc9uXp3whrj3B9UiHbCe9nyV0gVWw
  52223. 93X2PaRka9ZP585ArQ/dMtO8ihJTmMmJ+xAdTX7Nfh9WDSFwhfYggx/2uh8Ej+p3iDXE/+pOoYtN
  52224. P2MbRMNE1CV2yreN1x5KZmTNXMWcg+HCCIia7E6j8T4cLNlsHaFLAgMBAAGjgYowgYcwDwYDVR0T
  52225. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBLyWj7qVhy/zQas8fElyalL1BSZ
  52226. MEUGA1UdJQQ+MDwGCCsGAQUFBwMCBggrBgEFBQcDAQYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEF
  52227. BQcDCAYIKwYBBQUHAwkwDQYJKoZIhvcNAQEFBQADggEBAHv25MANqhlHt01Xo/6tu7Fq1Q+e2+Rj
  52228. xY6hUFaTlrg4wCQiZrxTFGGVv9DHKpY5P30osxBAIWrEr7BSdxjhlthWXePdNl4dp1BUoMUq5KqM
  52229. lIpPnTX/dqQGE5Gion0ARD9V04I8GtVbvFZMIi5GQ4okQC3zErg7cBqklrkar4dBGmoYDQZPxz5u
  52230. uSlNDUmJEYcyW+ZLBMjkXOZ0c5RdFpgTlf7727FE5TpwrDdr5rMzcijJs1eg9gIWiAYLtqZLICjU
  52231. 3j2LrTcFU3T+bsy8QxdxXvnFzBqpYe73dgzzcvRyrc9yAjYHR8/vGVCJYMzpJJUPwssd8m92kMfM
  52232. dcGWxZ0=
  52233. -----END CERTIFICATE-----
  52234. D-TRUST Root Class 3 CA 2 2009
  52235. ==============================
  52236. -----BEGIN CERTIFICATE-----
  52237. MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  52238. DAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTAe
  52239. Fw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NThaME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxE
  52240. LVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIw
  52241. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOAD
  52242. ER03UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42tSHKXzlA
  52243. BF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9RySPocq60vFYJfxLLHLGv
  52244. KZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsMlFqVlNpQmvH/pStmMaTJOKDfHR+4CS7z
  52245. p+hnUquVH+BGPtikw8paxTGA6Eian5Rp/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUC
  52246. AwEAAaOCARowggEWMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ
  52247. 4PGEMA4GA1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVjdG9y
  52248. eS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUyMENBJTIwMiUyMDIw
  52249. MDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRlcmV2b2NhdGlvbmxpc3QwQ6BBoD+G
  52250. PWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAw
  52251. OS5jcmwwDQYJKoZIhvcNAQELBQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm
  52252. 2H6NMLVwMeniacfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0
  52253. o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4KzCUqNQT4YJEV
  52254. dT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8PIWmawomDeCTmGCufsYkl4ph
  52255. X5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3YJohw1+qRzT65ysCQblrGXnRl11z+o+I=
  52256. -----END CERTIFICATE-----
  52257. D-TRUST Root Class 3 CA 2 EV 2009
  52258. =================================
  52259. -----BEGIN CERTIFICATE-----
  52260. MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  52261. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  52262. OTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUwNDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  52263. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  52264. OTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfS
  52265. egpnljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM03TP1YtHh
  52266. zRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6ZqQTMFexgaDbtCHu39b+T
  52267. 7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lRp75mpoo6Kr3HGrHhFPC+Oh25z1uxav60
  52268. sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure35
  52269. 11H3a6UCAwEAAaOCASQwggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyv
  52270. cop9NteaHNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFwOi8v
  52271. ZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xhc3MlMjAzJTIwQ0El
  52272. MjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1ERT9jZXJ0aWZpY2F0ZXJldm9jYXRp
  52273. b25saXN0MEagRKBChkBodHRwOi8vd3d3LmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xh
  52274. c3NfM19jYV8yX2V2XzIwMDkuY3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+
  52275. PPoeUSbrh/Yp3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05
  52276. nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNFCSuGdXzfX2lX
  52277. ANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7naxpeG0ILD5EJt/rDiZE4OJudA
  52278. NCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqXKVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVv
  52279. w9y4AyHqnxbxLFS1
  52280. -----END CERTIFICATE-----
  52281. CA Disig Root R2
  52282. ================
  52283. -----BEGIN CERTIFICATE-----
  52284. MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNVBAYTAlNLMRMw
  52285. EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
  52286. ZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQyMDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sx
  52287. EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
  52288. c2lnIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbC
  52289. w3OeNcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNHPWSb6Wia
  52290. xswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3Ix2ymrdMxp7zo5eFm1tL7
  52291. A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbeQTg06ov80egEFGEtQX6sx3dOy1FU+16S
  52292. GBsEWmjGycT6txOgmLcRK7fWV8x8nhfRyyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqV
  52293. g8NTEQxzHQuyRpDRQjrOQG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa
  52294. 5Beny912H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJQfYE
  52295. koopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUDi/ZnWejBBhG93c+A
  52296. Ak9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORsnLMOPReisjQS1n6yqEm70XooQL6i
  52297. Fh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNV
  52298. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5u
  52299. Qu0wDQYJKoZIhvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM
  52300. tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqfGopTpti72TVV
  52301. sRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkblvdhuDvEK7Z4bLQjb/D907Je
  52302. dR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W8
  52303. 1k/BfDxujRNt+3vrMNDcTa/F1balTFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjx
  52304. mHHEt38OFdAlab0inSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01
  52305. utI3gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18DrG5gPcFw0
  52306. sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3OszMOl6W8KjptlwlCFtaOg
  52307. UxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8xL4ysEr3vQCj8KWefshNPZiTEUxnpHikV
  52308. 7+ZtsH8tZ/3zbBt1RqPlShfppNcL
  52309. -----END CERTIFICATE-----
  52310. ACCVRAIZ1
  52311. =========
  52312. -----BEGIN CERTIFICATE-----
  52313. MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UEAwwJQUNDVlJB
  52314. SVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQswCQYDVQQGEwJFUzAeFw0xMTA1
  52315. MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQBgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwH
  52316. UEtJQUNDVjENMAsGA1UECgwEQUNDVjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  52317. DwAwggIKAoICAQCbqau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gM
  52318. jmoYHtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWoG2ioPej0
  52319. RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpAlHPrzg5XPAOBOp0KoVdD
  52320. aaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhrIA8wKFSVf+DuzgpmndFALW4ir50awQUZ
  52321. 0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDG
  52322. WuzndN9wrqODJerWx5eHk6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs7
  52323. 8yM2x/474KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMOm3WR
  52324. 5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpacXpkatcnYGMN285J
  52325. 9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPluUsXQA+xtrn13k/c4LOsOxFwYIRK
  52326. Q26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYIKwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRw
  52327. Oi8vd3d3LmFjY3YuZXMvZmlsZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEu
  52328. Y3J0MB8GCCsGAQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2
  52329. VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeTVfZW6oHlNsyM
  52330. Hj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIGCCsGAQUFBwICMIIBFB6CARAA
  52331. QQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUAcgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBh
  52332. AO0AegAgAGQAZQAgAGwAYQAgAEEAQwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUA
  52333. YwBuAG8AbABvAGcA7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBj
  52334. AHQAcgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAAQwBQAFMA
  52335. IABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUAczAwBggrBgEFBQcCARYk
  52336. aHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2MuaHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0
  52337. dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRtaW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2
  52338. MV9kZXIuY3JsMA4GA1UdDwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZI
  52339. hvcNAQEFBQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdpD70E
  52340. R9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gUJyCpZET/LtZ1qmxN
  52341. YEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+mAM/EKXMRNt6GGT6d7hmKG9Ww7Y49
  52342. nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepDvV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJ
  52343. TS+xJlsndQAJxGJ3KQhfnlmstn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3
  52344. sCPdK6jT2iWH7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h
  52345. I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szAh1xA2syVP1Xg
  52346. Nce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xFd3+YJ5oyXSrjhO7FmGYvliAd
  52347. 3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2HpPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3p
  52348. EfbRD0tVNEYqi4Y7
  52349. -----END CERTIFICATE-----
  52350. TWCA Global Root CA
  52351. ===================
  52352. -----BEGIN CERTIFICATE-----
  52353. MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcxEjAQBgNVBAoT
  52354. CVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMTVFdDQSBHbG9iYWwgUm9vdCBD
  52355. QTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQK
  52356. EwlUQUlXQU4tQ0ExEDAOBgNVBAsTB1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3Qg
  52357. Q0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2C
  52358. nJfF10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz0ALfUPZV
  52359. r2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfChMBwqoJimFb3u/Rk28OKR
  52360. Q4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbHzIh1HrtsBv+baz4X7GGqcXzGHaL3SekV
  52361. tTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1W
  52362. KKD+u4ZqyPpcC1jcxkt2yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99
  52363. sy2sbZCilaLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYPoA/p
  52364. yJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQABDzfuBSO6N+pjWxn
  52365. kjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcEqYSjMq+u7msXi7Kx/mzhkIyIqJdI
  52366. zshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMC
  52367. AQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6g
  52368. cFGn90xHNcgL1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn
  52369. LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WFH6vPNOw/KP4M
  52370. 8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNoRI2T9GRwoD2dKAXDOXC4Ynsg
  52371. /eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlg
  52372. lPx4mI88k1HtQJAH32RjJMtOcQWh15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryP
  52373. A9gK8kxkRr05YuWW6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3m
  52374. i4TWnsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5jwa19hAM8
  52375. EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWzaGHQRiapIVJpLesux+t3
  52376. zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmyKwbQBM0=
  52377. -----END CERTIFICATE-----
  52378. TeliaSonera Root CA v1
  52379. ======================
  52380. -----BEGIN CERTIFICATE-----
  52381. MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAwNzEUMBIGA1UE
  52382. CgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJvb3QgQ0EgdjEwHhcNMDcxMDE4
  52383. MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwW
  52384. VGVsaWFTb25lcmEgUm9vdCBDQSB2MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+
  52385. 6yfwIaPzaSZVfp3FVRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA
  52386. 3GV17CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+XZ75Ljo1k
  52387. B1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+/jXh7VB7qTCNGdMJjmhn
  52388. Xb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxH
  52389. oLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkmdtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3
  52390. F0fUTPHSiXk+TT2YqGHeOh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJ
  52391. oWjiUIMusDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4pgd7
  52392. gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fsslESl1MpWtTwEhDc
  52393. TwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQarMCpgKIv7NHfirZ1fpoeDVNAgMB
  52394. AAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qW
  52395. DNXr+nuqF+gTEjANBgkqhkiG9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNm
  52396. zqjMDfz1mgbldxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx
  52397. 0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1TjTQpgcmLNkQfW
  52398. pb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBedY2gea+zDTYa4EzAvXUYNR0PV
  52399. G6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpc
  52400. c41teyWRyu5FrgZLAMzTsVlQ2jqIOylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOT
  52401. JsjrDNYmiLbAJM+7vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2
  52402. qReWt88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcnHL/EVlP6
  52403. Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVxSK236thZiNSQvxaz2ems
  52404. WWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY=
  52405. -----END CERTIFICATE-----
  52406. E-Tugra Certification Authority
  52407. ===============================
  52408. -----BEGIN CERTIFICATE-----
  52409. MIIGSzCCBDOgAwIBAgIIamg+nFGby1MwDQYJKoZIhvcNAQELBQAwgbIxCzAJBgNVBAYTAlRSMQ8w
  52410. DQYDVQQHDAZBbmthcmExQDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamls
  52411. ZXJpIHZlIEhpem1ldGxlcmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBN
  52412. ZXJrZXppMSgwJgYDVQQDDB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTEzMDMw
  52413. NTEyMDk0OFoXDTIzMDMwMzEyMDk0OFowgbIxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmEx
  52414. QDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamlsZXJpIHZlIEhpem1ldGxl
  52415. cmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBNZXJrZXppMSgwJgYDVQQD
  52416. DB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  52417. MIICCgKCAgEA4vU/kwVRHoViVF56C/UYB4Oufq9899SKa6VjQzm5S/fDxmSJPZQuVIBSOTkHS0vd
  52418. hQd2h8y/L5VMzH2nPbxHD5hw+IyFHnSOkm0bQNGZDbt1bsipa5rAhDGvykPL6ys06I+XawGb1Q5K
  52419. CKpbknSFQ9OArqGIW66z6l7LFpp3RMih9lRozt6Plyu6W0ACDGQXwLWTzeHxE2bODHnv0ZEoq1+g
  52420. ElIwcxmOj+GMB6LDu0rw6h8VqO4lzKRG+Bsi77MOQ7osJLjFLFzUHPhdZL3Dk14opz8n8Y4e0ypQ
  52421. BaNV2cvnOVPAmJ6MVGKLJrD3fY185MaeZkJVgkfnsliNZvcHfC425lAcP9tDJMW/hkd5s3kc91r0
  52422. E+xs+D/iWR+V7kI+ua2oMoVJl0b+SzGPWsutdEcf6ZG33ygEIqDUD13ieU/qbIWGvaimzuT6w+Gz
  52423. rt48Ue7LE3wBf4QOXVGUnhMMti6lTPk5cDZvlsouDERVxcr6XQKj39ZkjFqzAQqptQpHF//vkUAq
  52424. jqFGOjGY5RH8zLtJVor8udBhmm9lbObDyz51Sf6Pp+KJxWfXnUYTTjF2OySznhFlhqt/7x3U+Lzn
  52425. rFpct1pHXFXOVbQicVtbC/DP3KBhZOqp12gKY6fgDT+gr9Oq0n7vUaDmUStVkhUXU8u3Zg5mTPj5
  52426. dUyQ5xJwx0UCAwEAAaNjMGEwHQYDVR0OBBYEFC7j27JJ0JxUeVz6Jyr+zE7S6E5UMA8GA1UdEwEB
  52427. /wQFMAMBAf8wHwYDVR0jBBgwFoAULuPbsknQnFR5XPonKv7MTtLoTlQwDgYDVR0PAQH/BAQDAgEG
  52428. MA0GCSqGSIb3DQEBCwUAA4ICAQAFNzr0TbdF4kV1JI+2d1LoHNgQk2Xz8lkGpD4eKexd0dCrfOAK
  52429. kEh47U6YA5n+KGCRHTAduGN8qOY1tfrTYXbm1gdLymmasoR6d5NFFxWfJNCYExL/u6Au/U5Mh/jO
  52430. XKqYGwXgAEZKgoClM4so3O0409/lPun++1ndYYRP0lSWE2ETPo+Aab6TR7U1Q9Jauz1c77NCR807
  52431. VRMGsAnb/WP2OogKmW9+4c4bU2pEZiNRCHu8W1Ki/QY3OEBhj0qWuJA3+GbHeJAAFS6LrVE1Uweo
  52432. a2iu+U48BybNCAVwzDk/dr2l02cmAYamU9JgO3xDf1WKvJUawSg5TB9D0pH0clmKuVb8P7Sd2nCc
  52433. dlqMQ1DujjByTd//SffGqWfZbawCEeI6FiWnWAjLb1NBnEg4R2gz0dfHj9R0IdTDBZB6/86WiLEV
  52434. KV0jq9BgoRJP3vQXzTLlyb/IQ639Lo7xr+L0mPoSHyDYwKcMhcWQ9DstliaxLL5Mq+ux0orJ23gT
  52435. Dx4JnW2PAJ8C2sH6H3p6CcRK5ogql5+Ji/03X186zjhZhkuvcQu02PJwT58yE+Owp1fl2tpDy4Q0
  52436. 8ijE6m30Ku/Ba3ba+367hTzSU8JNvnHhRdH9I2cNE3X7z2VnIp2usAnRCf8dNL/+I5c30jn6PQ0G
  52437. C7TbO6Orb1wdtn7os4I07QZcJA==
  52438. -----END CERTIFICATE-----
  52439. T-TeleSec GlobalRoot Class 2
  52440. ============================
  52441. -----BEGIN CERTIFICATE-----
  52442. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  52443. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  52444. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgx
  52445. MDAxMTA0MDE0WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  52446. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  52447. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0GCSqGSIb3
  52448. DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUdAqSzm1nzHoqvNK38DcLZ
  52449. SBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiCFoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/F
  52450. vudocP05l03Sx5iRUKrERLMjfTlH6VJi1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx970
  52451. 2cu+fjOlbpSD8DT6IavqjnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGV
  52452. WOHAD3bZwI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGjQjBA
  52453. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/WSA2AHmgoCJrjNXy
  52454. YdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhyNsZt+U2e+iKo4YFWz827n+qrkRk4
  52455. r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPACuvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNf
  52456. vNoBYimipidx5joifsFvHZVwIEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR
  52457. 3p1m0IvVVGb6g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN
  52458. 9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlPBSeOE6Fuwg==
  52459. -----END CERTIFICATE-----
  52460. Atos TrustedRoot 2011
  52461. =====================
  52462. -----BEGIN CERTIFICATE-----
  52463. MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UEAwwVQXRvcyBU
  52464. cnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0xMTA3MDcxNDU4
  52465. MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMMFUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsG
  52466. A1UECgwEQXRvczELMAkGA1UEBhMCREUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCV
  52467. hTuXbyo7LjvPpvMpNb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr
  52468. 54rMVD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+SZFhyBH+
  52469. DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ4J7sVaE3IqKHBAUsR320
  52470. HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0Lcp2AMBYHlT8oDv3FdU9T1nSatCQujgKR
  52471. z3bFmx5VdJx4IbHwLfELn8LVlhgf8FQieowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7R
  52472. l+lwrrw7GWzbITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZ
  52473. bNshMBgGA1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB
  52474. CwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8jvZfza1zv7v1Apt+h
  52475. k6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kPDpFrdRbhIfzYJsdHt6bPWHJxfrrh
  52476. TZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pcmaHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a9
  52477. 61qn8FYiqTxlVMYVqL2Gns2Dlmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G
  52478. 3mB/ufNPRJLvKrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed
  52479. -----END CERTIFICATE-----
  52480. QuoVadis Root CA 1 G3
  52481. =====================
  52482. -----BEGIN CERTIFICATE-----
  52483. MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQELBQAwSDELMAkG
  52484. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  52485. b3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJN
  52486. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEg
  52487. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakE
  52488. PBtVwedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWerNrwU8lm
  52489. PNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF34168Xfuw6cwI2H44g4hWf6
  52490. Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh4Pw5qlPafX7PGglTvF0FBM+hSo+LdoIN
  52491. ofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXpUhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/l
  52492. g6AnhF4EwfWQvTA9xO+oabw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV
  52493. 7qJZjqlc3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/GKubX
  52494. 9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSthfbZxbGL0eUQMk1f
  52495. iyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KOTk0k+17kBL5yG6YnLUlamXrXXAkg
  52496. t3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOtzCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  52497. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZI
  52498. hvcNAQELBQADggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC
  52499. MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2cDMT/uFPpiN3
  52500. GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUNqXsCHKnQO18LwIE6PWThv6ct
  52501. Tr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP
  52502. +V04ikkwj+3x6xn0dxoxGE1nVGwvb2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh
  52503. 3jRJjehZrJ3ydlo28hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fa
  52504. wx/kNSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNjZgKAvQU6
  52505. O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhpq1467HxpvMc7hU6eFbm0
  52506. FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFtnh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOV
  52507. hMJKzRwuJIczYOXD
  52508. -----END CERTIFICATE-----
  52509. QuoVadis Root CA 2 G3
  52510. =====================
  52511. -----BEGIN CERTIFICATE-----
  52512. MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQELBQAwSDELMAkG
  52513. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  52514. b3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJN
  52515. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIg
  52516. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFh
  52517. ZiFfqq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMWn4rjyduY
  52518. NM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ymc5GQYaYDFCDy54ejiK2t
  52519. oIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+O7q414AB+6XrW7PFXmAqMaCvN+ggOp+o
  52520. MiwMzAkd056OXbxMmO7FGmh77FOm6RQ1o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+l
  52521. V0POKa2Mq1W/xPtbAd0jIaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZo
  52522. L1NesNKqIcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz8eQQ
  52523. sSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43ehvNURG3YBZwjgQQvD
  52524. 6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l7ZizlWNof/k19N+IxWA1ksB8aRxh
  52525. lRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALGcC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  52526. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZI
  52527. hvcNAQELBQADggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66
  52528. AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RCroijQ1h5fq7K
  52529. pVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0GaW/ZZGYjeVYg3UQt4XAoeo0L9
  52530. x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4nlv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgz
  52531. dWqTHBLmYF5vHX/JHyPLhGGfHoJE+V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6X
  52532. U/IyAgkwo1jwDQHVcsaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+Nw
  52533. mNtddbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNgKCLjsZWD
  52534. zYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeMHVOyToV7BjjHLPj4sHKN
  52535. JeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4WSr2Rz0ZiC3oheGe7IUIarFsNMkd7Egr
  52536. O3jtZsSOeWmD3n+M
  52537. -----END CERTIFICATE-----
  52538. QuoVadis Root CA 3 G3
  52539. =====================
  52540. -----BEGIN CERTIFICATE-----
  52541. MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQELBQAwSDELMAkG
  52542. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  52543. b3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJN
  52544. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMg
  52545. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286
  52546. IxSR/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNuFoM7pmRL
  52547. Mon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXRU7Ox7sWTaYI+FrUoRqHe
  52548. 6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+cra1AdHkrAj80//ogaX3T7mH1urPnMNA3
  52549. I4ZyYUUpSFlob3emLoG+B01vr87ERRORFHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3U
  52550. VDmrJqMz6nWB2i3ND0/kA9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f7
  52551. 5li59wzweyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634RylsSqi
  52552. Md5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBpVzgeAVuNVejH38DM
  52553. dyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0QA4XN8f+MFrXBsj6IbGB/kE+V9/Yt
  52554. rQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  52555. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZI
  52556. hvcNAQELBQADggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px
  52557. KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnIFUBhynLWcKzS
  52558. t/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5WvvoxXqA/4Ti2Tk08HS6IT7SdEQ
  52559. TXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFgu/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9Du
  52560. DcpmvJRPpq3t/O5jrFc/ZSXPsoaP0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGib
  52561. Ih6BJpsQBJFxwAYf3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmD
  52562. hPbl8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+DhcI00iX
  52563. 0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HNPlopNLk9hM6xZdRZkZFW
  52564. dSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ywaZWWDYWGWVjUTR939+J399roD1B0y2
  52565. PpxxVJkES/1Y+Zj0
  52566. -----END CERTIFICATE-----
  52567. DigiCert Assured ID Root G2
  52568. ===========================
  52569. -----BEGIN CERTIFICATE-----
  52570. MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQG
  52571. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  52572. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgw
  52573. MTE1MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  52574. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIw
  52575. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSAn61UQbVH
  52576. 35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4HteccbiJVMWWXvdMX0h5i89vq
  52577. bFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9HpEgjAALAcKxHad3A2m67OeYfcgnDmCXRw
  52578. VWmvo2ifv922ebPynXApVfSr/5Vh88lAbx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OP
  52579. YLfykqGxvYmJHzDNw6YuYjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+Rn
  52580. lTGNAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTO
  52581. w0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPIQW5pJ6d1Ee88hjZv
  52582. 0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I0jJmwYrA8y8678Dj1JGG0VDjA9tz
  52583. d29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4GnilmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAW
  52584. hsI6yLETcDbYz+70CjTVW0z9B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0M
  52585. jomZmWzwPDCvON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo
  52586. IhNzbM8m9Yop5w==
  52587. -----END CERTIFICATE-----
  52588. DigiCert Assured ID Root G3
  52589. ===========================
  52590. -----BEGIN CERTIFICATE-----
  52591. MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV
  52592. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYD
  52593. VQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  52594. MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  52595. d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQ
  52596. BgcqhkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJfZn4f5dwb
  52597. RXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17QRSAPWXYQ1qAk8C3eNvJs
  52598. KTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgF
  52599. UaFNN6KDec6NHSrkhDAKBggqhkjOPQQDAwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5Fy
  52600. YZ5eEJJZVrmDxxDnOOlYJjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy
  52601. 1vUhZscv6pZjamVFkpUBtA==
  52602. -----END CERTIFICATE-----
  52603. DigiCert Global Root G2
  52604. =======================
  52605. -----BEGIN CERTIFICATE-----
  52606. MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQG
  52607. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  52608. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUx
  52609. MjAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  52610. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkq
  52611. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI2/Ou8jqJ
  52612. kTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx1x7e/dfgy5SDN67sH0NO
  52613. 3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQq2EGnI/yuum06ZIya7XzV+hdG82MHauV
  52614. BJVJ8zUtluNJbd134/tJS7SsVQepj5WztCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyM
  52615. UNGPHgm+F6HmIcr9g+UQvIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQAB
  52616. o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV5uNu
  52617. 5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY1Yl9PMWLSn/pvtsr
  52618. F9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4NeF22d+mQrvHRAiGfzZ0JFrabA0U
  52619. WTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NGFdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBH
  52620. QRFXGU7Aj64GxJUTFy8bJZ918rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/
  52621. iyK5S9kJRaTepLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl
  52622. MrY=
  52623. -----END CERTIFICATE-----
  52624. DigiCert Global Root G3
  52625. =======================
  52626. -----BEGIN CERTIFICATE-----
  52627. MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQswCQYDVQQGEwJV
  52628. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAwHgYD
  52629. VQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAw
  52630. MDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5k
  52631. aWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0C
  52632. AQYFK4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FGfp4tn+6O
  52633. YwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPOZ9wj/wMco+I+o0IwQDAP
  52634. BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNp
  52635. Yim8S8YwCgYIKoZIzj0EAwMDaAAwZQIxAK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y
  52636. 3maTD/HMsQmP3Wyr+mt/oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34
  52637. VOKa5Vt8sycX
  52638. -----END CERTIFICATE-----
  52639. DigiCert Trusted Root G4
  52640. ========================
  52641. -----BEGIN CERTIFICATE-----
  52642. MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBiMQswCQYDVQQG
  52643. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSEw
  52644. HwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  52645. MTIwMDAwWjBiMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  52646. d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0G
  52647. CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3yithZwuEp
  52648. pz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1Ifxp4VpX6+n6lXFllVcq9o
  52649. k3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDVySAdYyktzuxeTsiT+CFhmzTrBcZe7Fsa
  52650. vOvJz82sNEBfsXpm7nfISKhmV1efVFiODCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGY
  52651. QJB5w3jHtrHEtWoYOAMQjdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6
  52652. MUSaM0C/CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCiEhtm
  52653. mnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADMfRyVw4/3IbKyEbe7
  52654. f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QYuKZ3AeEPlAwhHbJUKSWJbOUOUlFH
  52655. dL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXKchYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8
  52656. oR7FwI+isX4KJpn15GkvmB0t9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud
  52657. DwEB/wQEAwIBhjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD
  52658. ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2SV1EY+CtnJYY
  52659. ZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd+SeuMIW59mdNOj6PWTkiU0Tr
  52660. yF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWcfFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy
  52661. 7zBZLq7gcfJW5GqXb5JQbZaNaHqasjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iah
  52662. ixTXTBmyUEFxPT9NcCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN
  52663. 5r5N0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie4u1Ki7wb
  52664. /UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mIr/OSmbaz5mEP0oUA51Aa
  52665. 5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tK
  52666. G48BtieVU+i2iW1bvGjUI+iLUaJW+fCmgKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP
  52667. 82Z+
  52668. -----END CERTIFICATE-----
  52669. COMODO RSA Certification Authority
  52670. ==================================
  52671. -----BEGIN CERTIFICATE-----
  52672. MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCBhTELMAkGA1UE
  52673. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  52674. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlv
  52675. biBBdXRob3JpdHkwHhcNMTAwMTE5MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMC
  52676. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  52677. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBB
  52678. dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR6FSS0gpWsawNJN3Fz0Rn
  52679. dJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8Xpz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZ
  52680. FGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+
  52681. 5eNu/Nio5JIk2kNrYrhV/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pG
  52682. x8cgoLEfZd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z+pUX
  52683. 2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7wqP/0uK3pN/u6uPQL
  52684. OvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZahSL0896+1DSJMwBGB7FY79tOi4lu3
  52685. sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVICu9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+C
  52686. GCe01a60y1Dma/RMhnEw6abfFobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5
  52687. WdYgGq/yapiqcrxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E
  52688. FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
  52689. DQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvlwFTPoCWOAvn9sKIN9SCYPBMt
  52690. rFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+
  52691. nq6PK7o9mfjYcwlYRm6mnPTXJ9OV2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSg
  52692. tZx8jb8uk2IntznaFxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwW
  52693. sRqZCuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiKboHGhfKp
  52694. pC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmckejkk9u+UJueBPSZI9FoJA
  52695. zMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yLS0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHq
  52696. ZJx64SIDqZxubw5lT2yHh17zbqD5daWbQOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk52
  52697. 7RH89elWsn2/x20Kk4yl0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7I
  52698. LaZRfyHBNVOFBkpdn627G190
  52699. -----END CERTIFICATE-----
  52700. USERTrust RSA Certification Authority
  52701. =====================================
  52702. -----BEGIN CERTIFICATE-----
  52703. MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCBiDELMAkGA1UE
  52704. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  52705. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  52706. dGlvbiBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UE
  52707. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  52708. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  52709. dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCAEmUXNg7D2wiz
  52710. 0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2j
  52711. Y0K2dvKpOyuR+OJv0OwWIJAJPuLodMkYtJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFn
  52712. RghRy4YUVD+8M/5+bJz/Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O
  52713. +T23LLb2VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT79uq
  52714. /nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6c0Plfg6lZrEpfDKE
  52715. Y1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmTYo61Zs8liM2EuLE/pDkP2QKe6xJM
  52716. lXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97lc6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8
  52717. yexDJtC/QV9AqURE9JnnV4eeUB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+
  52718. eLf8ZxXhyVeEHg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd
  52719. BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
  52720. MAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPFUp/L+M+ZBn8b2kMVn54CVVeW
  52721. FPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KOVWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ
  52722. 7l8wXEskEVX/JJpuXior7gtNn3/3ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQ
  52723. Eg9zKC7F4iRO/Fjs8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM
  52724. 8WcRiQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYzeSf7dNXGi
  52725. FSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZXHlKYC6SQK5MNyosycdi
  52726. yA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9c
  52727. J2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRBVXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGw
  52728. sAvgnEzDHNb842m1R0aBL6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gx
  52729. Q+6IHdfGjjxDah2nGN59PRbxYvnKkKj9
  52730. -----END CERTIFICATE-----
  52731. USERTrust ECC Certification Authority
  52732. =====================================
  52733. -----BEGIN CERTIFICATE-----
  52734. MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDELMAkGA1UEBhMC
  52735. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  52736. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  52737. biBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMC
  52738. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  52739. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  52740. biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqfloI+d61SRvU8Za2EurxtW2
  52741. 0eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinngo4N+LZfQYcTxmdwlkWOrfzCjtHDix6Ez
  52742. nPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0GA1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNV
  52743. HQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBB
  52744. HU6+4WMBzzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbWRNZu
  52745. 9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg=
  52746. -----END CERTIFICATE-----
  52747. GlobalSign ECC Root CA - R4
  52748. ===========================
  52749. -----BEGIN CERTIFICATE-----
  52750. MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEkMCIGA1UECxMb
  52751. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  52752. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  52753. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  52754. EwpHbG9iYWxTaWduMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuMZ5049sJQ6fLjkZHAOkrprl
  52755. OQcJFspjsbmG+IpXwVfOQvpzofdlQv8ewQCybnMO/8ch5RikqtlxP6jUuc6MHaNCMEAwDgYDVR0P
  52756. AQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFFSwe61FuOJAf/sKbvu+M8k8o4TV
  52757. MAoGCCqGSM49BAMCA0gAMEUCIQDckqGgE6bPA7DmxCGXkPoUVy0D7O48027KqGx2vKLeuwIgJ6iF
  52758. JzWbVsaj8kfSt24bAgAXqmemFZHe+pTsewv4n4Q=
  52759. -----END CERTIFICATE-----
  52760. GlobalSign ECC Root CA - R5
  52761. ===========================
  52762. -----BEGIN CERTIFICATE-----
  52763. MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEkMCIGA1UECxMb
  52764. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  52765. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  52766. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  52767. EwpHbG9iYWxTaWduMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6
  52768. SFkc8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8kehOvRnkmS
  52769. h5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  52770. BgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYIKoZIzj0EAwMDaAAwZQIxAOVpEslu28Yx
  52771. uglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7
  52772. yFz9SO8NdCKoCOJuxUnOxwy8p2Fp8fc74SrL+SvzZpA3
  52773. -----END CERTIFICATE-----
  52774. Staat der Nederlanden Root CA - G3
  52775. ==================================
  52776. -----BEGIN CERTIFICATE-----
  52777. MIIFdDCCA1ygAwIBAgIEAJiiOTANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  52778. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  52779. Um9vdCBDQSAtIEczMB4XDTEzMTExNDExMjg0MloXDTI4MTExMzIzMDAwMFowWjELMAkGA1UEBhMC
  52780. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  52781. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAL4y
  52782. olQPcPssXFnrbMSkUeiFKrPMSjTysF/zDsccPVMeiAho2G89rcKezIJnByeHaHE6n3WWIkYFsO2t
  52783. x1ueKt6c/DrGlaf1F2cY5y9JCAxcz+bMNO14+1Cx3Gsy8KL+tjzk7FqXxz8ecAgwoNzFs21v0IJy
  52784. EavSgWhZghe3eJJg+szeP4TrjTgzkApyI/o1zCZxMdFyKJLZWyNtZrVtB0LrpjPOktvA9mxjeM3K
  52785. Tj215VKb8b475lRgsGYeCasH/lSJEULR9yS6YHgamPfJEf0WwTUaVHXvQ9Plrk7O53vDxk5hUUur
  52786. mkVLoR9BvUhTFXFkC4az5S6+zqQbwSmEorXLCCN2QyIkHxcE1G6cxvx/K2Ya7Irl1s9N9WMJtxU5
  52787. 1nus6+N86U78dULI7ViVDAZCopz35HCz33JvWjdAidiFpNfxC95DGdRKWCyMijmev4SH8RY7Ngzp
  52788. 07TKbBlBUgmhHbBqv4LvcFEhMtwFdozL92TkA1CvjJFnq8Xy7ljY3r735zHPbMk7ccHViLVlvMDo
  52789. FxcHErVc0qsgk7TmgoNwNsXNo42ti+yjwUOH5kPiNL6VizXtBznaqB16nzaeErAMZRKQFWDZJkBE
  52790. 41ZgpRDUajz9QdwOWke275dhdU/Z/seyHdTtXUmzqWrLZoQT1Vyg3N9udwbRcXXIV2+vD3dbAgMB
  52791. AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRUrfrHkleu
  52792. yjWcLhL75LpdINyUVzANBgkqhkiG9w0BAQsFAAOCAgEAMJmdBTLIXg47mAE6iqTnB/d6+Oea31BD
  52793. U5cqPco8R5gu4RV78ZLzYdqQJRZlwJ9UXQ4DO1t3ApyEtg2YXzTdO2PCwyiBwpwpLiniyMMB8jPq
  52794. KqrMCQj3ZWfGzd/TtiunvczRDnBfuCPRy5FOCvTIeuXZYzbB1N/8Ipf3YF3qKS9Ysr1YvY2WTxB1
  52795. v0h7PVGHoTx0IsL8B3+A3MSs/mrBcDCw6Y5p4ixpgZQJut3+TcCDjJRYwEYgr5wfAvg1VUkvRtTA
  52796. 8KCWAg8zxXHzniN9lLf9OtMJgwYh/WA9rjLA0u6NpvDntIJ8CsxwyXmA+P5M9zWEGYox+wrZ13+b
  52797. 8KKaa8MFSu1BYBQw0aoRQm7TIwIEC8Zl3d1Sd9qBa7Ko+gE4uZbqKmxnl4mUnrzhVNXkanjvSr0r
  52798. mj1AfsbAddJu+2gw7OyLnflJNZoaLNmzlTnVHpL3prllL+U9bTpITAjc5CgSKL59NVzq4BZ+Extq
  52799. 1z7XnvwtdbLBFNUjA9tbbws+eC8N3jONFrdI54OagQ97wUNNVQQXOEpR1VmiiXTTn74eS9fGbbeI
  52800. JG9gkaSChVtWQbzQRKtqE77RLFi3EjNYsjdj3BP1lB0/QFH1T/U67cjF68IeHRaVesd+QnGTbksV
  52801. tzDfqu1XhUisHWrdOWnk4Xl4vs4Fv6EM94B7IWcnMFk=
  52802. -----END CERTIFICATE-----
  52803. Staat der Nederlanden EV Root CA
  52804. ================================
  52805. -----BEGIN CERTIFICATE-----
  52806. MIIFcDCCA1igAwIBAgIEAJiWjTANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQGEwJOTDEeMBwGA1UE
  52807. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSkwJwYDVQQDDCBTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  52808. RVYgUm9vdCBDQTAeFw0xMDEyMDgxMTE5MjlaFw0yMjEyMDgxMTEwMjhaMFgxCzAJBgNVBAYTAk5M
  52809. MR4wHAYDVQQKDBVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xKTAnBgNVBAMMIFN0YWF0IGRlciBOZWRl
  52810. cmxhbmRlbiBFViBSb290IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA48d+ifkk
  52811. SzrSM4M1LGns3Amk41GoJSt5uAg94JG6hIXGhaTK5skuU6TJJB79VWZxXSzFYGgEt9nCUiY4iKTW
  52812. O0Cmws0/zZiTs1QUWJZV1VD+hq2kY39ch/aO5ieSZxeSAgMs3NZmdO3dZ//BYY1jTw+bbRcwJu+r
  52813. 0h8QoPnFfxZpgQNH7R5ojXKhTbImxrpsX23Wr9GxE46prfNeaXUmGD5BKyF/7otdBwadQ8QpCiv8
  52814. Kj6GyzyDOvnJDdrFmeK8eEEzduG/L13lpJhQDBXd4Pqcfzho0LKmeqfRMb1+ilgnQ7O6M5HTp5gV
  52815. XJrm0w912fxBmJc+qiXbj5IusHsMX/FjqTf5m3VpTCgmJdrV8hJwRVXj33NeN/UhbJCONVrJ0yPr
  52816. 08C+eKxCKFhmpUZtcALXEPlLVPxdhkqHz3/KRawRWrUgUY0viEeXOcDPusBCAUCZSCELa6fS/ZbV
  52817. 0b5GnUngC6agIk440ME8MLxwjyx1zNDFjFE7PZQIZCZhfbnDZY8UnCHQqv0XcgOPvZuM5l5Tnrmd
  52818. 74K74bzickFbIZTTRTeU0d8JOV3nI6qaHcptqAqGhYqCvkIH1vI4gnPah1vlPNOePqc7nvQDs/nx
  52819. fRN0Av+7oeX6AHkcpmZBiFxgV6YuCcS6/ZrPpx9Aw7vMWgpVSzs4dlG4Y4uElBbmVvMCAwEAAaNC
  52820. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFP6rAJCYniT8qcwa
  52821. ivsnuL8wbqg7MA0GCSqGSIb3DQEBCwUAA4ICAQDPdyxuVr5Os7aEAJSrR8kN0nbHhp8dB9O2tLsI
  52822. eK9p0gtJ3jPFrK3CiAJ9Brc1AsFgyb/E6JTe1NOpEyVa/m6irn0F3H3zbPB+po3u2dfOWBfoqSmu
  52823. c0iH55vKbimhZF8ZE/euBhD/UcabTVUlT5OZEAFTdfETzsemQUHSv4ilf0X8rLiltTMMgsT7B/Zq
  52824. 5SWEXwbKwYY5EdtYzXc7LMJMD16a4/CrPmEbUCTCwPTxGfARKbalGAKb12NMcIxHowNDXLldRqAN
  52825. b/9Zjr7dn3LDWyvfjFvO5QxGbJKyCqNMVEIYFRIYvdr8unRu/8G2oGTYqV9Vrp9canaW2HNnh/tN
  52826. f1zuacpzEPuKqf2evTY4SUmH9A4U8OmHuD+nT3pajnnUk+S7aFKErGzp85hwVXIy+TSrK0m1zSBi
  52827. 5Dp6Z2Orltxtrpfs/J92VoguZs9btsmksNcFuuEnL5O7Jiqik7Ab846+HUCjuTaPPoIaGl6I6lD4
  52828. WeKDRikL40Rc4ZW2aZCaFG+XroHPaO+Zmr615+F/+PoTRxZMzG0IQOeLeG9QgkRQP2YGiqtDhFZK
  52829. DyAthg710tvSeopLzaXoTvFeJiUBWSOgftL2fiFX1ye8FVdMpEbB4IMeDExNH08GGeL5qPQ6gqGy
  52830. eUN51q1veieQA6TqJIc/2b3Z6fJfUEkc7uzXLg==
  52831. -----END CERTIFICATE-----
  52832. IdenTrust Commercial Root CA 1
  52833. ==============================
  52834. -----BEGIN CERTIFICATE-----
  52835. MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBKMQswCQYDVQQG
  52836. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBS
  52837. b290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQwMTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzES
  52838. MBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENB
  52839. IDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ld
  52840. hNlT3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU+ehcCuz/
  52841. mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gpS0l4PJNgiCL8mdo2yMKi
  52842. 1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1bVoE/c40yiTcdCMbXTMTEl3EASX2MN0C
  52843. XZ/g1Ue9tOsbobtJSdifWwLziuQkkORiT0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl
  52844. 3ZBWzvurpWCdxJ35UrCLvYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzy
  52845. NeVJSQjKVsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZKdHzV
  52846. WYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHTc+XvvqDtMwt0viAg
  52847. xGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hvl7yTmvmcEpB4eoCHFddydJxVdHix
  52848. uuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5NiGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC
  52849. AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZI
  52850. hvcNAQELBQADggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH
  52851. 6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwtLRvM7Kqas6pg
  52852. ghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93nAbowacYXVKV7cndJZ5t+qnt
  52853. ozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3+wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmV
  52854. YjzlVYA211QC//G5Xc7UI2/YRYRKW2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUX
  52855. feu+h1sXIFRRk0pTAwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/ro
  52856. kTLql1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG4iZZRHUe
  52857. 2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZmUlO+KWA2yUPHGNiiskz
  52858. Z2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7R
  52859. cGzM7vRX+Bi6hG6H
  52860. -----END CERTIFICATE-----
  52861. IdenTrust Public Sector Root CA 1
  52862. =================================
  52863. -----BEGIN CERTIFICATE-----
  52864. MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQG
  52865. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3Rv
  52866. ciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcNMzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJV
  52867. UzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBS
  52868. b290IENBIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTy
  52869. P4o7ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGyRBb06tD6
  52870. Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlSbdsHyo+1W/CD80/HLaXI
  52871. rcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF/YTLNiCBWS2ab21ISGHKTN9T0a9SvESf
  52872. qy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoS
  52873. mJxZZoY+rfGwyj4GD3vwEUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFn
  52874. ol57plzy9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9VGxyh
  52875. LrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ2fjXctscvG29ZV/v
  52876. iDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsVWaFHVCkugyhfHMKiq3IXAAaOReyL
  52877. 4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gDW/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8B
  52878. Af8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMw
  52879. DQYJKoZIhvcNAQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj
  52880. t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHVDRDtfULAj+7A
  52881. mgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9TaDKQGXSc3z1i9kKlT/YPyNt
  52882. GtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8GlwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFt
  52883. m6/n6J91eEyrRjuazr8FGF1NFTwWmhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMx
  52884. NRF4eKLg6TCMf4DfWN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4
  52885. Mhn5+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJtshquDDI
  52886. ajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhAGaQdp/lLQzfcaFpPz+vC
  52887. ZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ
  52888. 3Wl9af0AVqW3rLatt8o+Ae+c
  52889. -----END CERTIFICATE-----
  52890. Entrust Root Certification Authority - G2
  52891. =========================================
  52892. -----BEGIN CERTIFICATE-----
  52893. MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMCVVMxFjAUBgNV
  52894. BAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVy
  52895. bXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ug
  52896. b25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIw
  52897. HhcNMDkwNzA3MTcyNTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoT
  52898. DUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMx
  52899. OTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25s
  52900. eTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwggEi
  52901. MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP
  52902. /vaCeb9zYQYKpSfYs1/TRU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXz
  52903. HHfV1IWNcCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hWwcKU
  52904. s/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1U1+cPvQXLOZprE4y
  52905. TGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0jaWvYkxN4FisZDQSA/i2jZRjJKRx
  52906. AgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ6
  52907. 0B7vfec7aVHUbI2fkBJmqzANBgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5Z
  52908. iXMRrEPR9RP/jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ
  52909. Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v1fN2D807iDgi
  52910. nWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4RnAuknZoh8/CbCzB428Hch0P+
  52911. vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmHVHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xO
  52912. e4pIb4tF9g==
  52913. -----END CERTIFICATE-----
  52914. Entrust Root Certification Authority - EC1
  52915. ==========================================
  52916. -----BEGIN CERTIFICATE-----
  52917. MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkGA1UEBhMCVVMx
  52918. FjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVn
  52919. YWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXpl
  52920. ZCB1c2Ugb25seTEzMDEGA1UEAxMqRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  52921. IC0gRUMxMB4XDTEyMTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYw
  52922. FAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2Fs
  52923. LXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQg
  52924. dXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAt
  52925. IEVDMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHy
  52926. AsWfoPZb1YsGGYZPUxBtByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef
  52927. 9eNi1KlHBz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  52928. FLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVCR98crlOZF7ZvHH3h
  52929. vxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nXhTcGtXsI/esni0qU+eH6p44mCOh8
  52930. kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G
  52931. -----END CERTIFICATE-----
  52932. CFCA EV ROOT
  52933. ============
  52934. -----BEGIN CERTIFICATE-----
  52935. MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJDTjEwMC4GA1UE
  52936. CgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNB
  52937. IEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkxMjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEw
  52938. MC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQD
  52939. DAxDRkNBIEVWIFJPT1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnV
  52940. BU03sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpLTIpTUnrD
  52941. 7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5/ZOkVIBMUtRSqy5J35DN
  52942. uF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp7hZZLDRJGqgG16iI0gNyejLi6mhNbiyW
  52943. ZXvKWfry4t3uMCz7zEasxGPrb382KzRzEpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7
  52944. xzbh72fROdOXW3NiGUgthxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9f
  52945. py25IGvPa931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqotaK8K
  52946. gWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNgTnYGmE69g60dWIol
  52947. hdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfVPKPtl8MeNPo4+QgO48BdK4PRVmrJ
  52948. tqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hvcWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAf
  52949. BgNVHSMEGDAWgBTj/i39KNALtbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
  52950. /wQEAwIBBjAdBgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB
  52951. ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObTej/tUxPQ4i9q
  52952. ecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdLjOztUmCypAbqTuv0axn96/Ua
  52953. 4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBSESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sG
  52954. E5uPhnEFtC+NiWYzKXZUmhH4J/qyP5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfX
  52955. BDrDMlI1Dlb4pd19xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjn
  52956. aH9dCi77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN5mydLIhy
  52957. PDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe/v5WOaHIz16eGWRGENoX
  52958. kbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+ZAAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3C
  52959. ekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su
  52960. -----END CERTIFICATE-----
  52961. TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H5
  52962. ====================================================
  52963. -----BEGIN CERTIFICATE-----
  52964. MIIEJzCCAw+gAwIBAgIHAI4X/iQggTANBgkqhkiG9w0BAQsFADCBsTELMAkGA1UEBhMCVFIxDzAN
  52965. BgNVBAcMBkFua2FyYTFNMEsGA1UECgxEVMOcUktUUlVTVCBCaWxnaSDEsGxldGnFn2ltIHZlIEJp
  52966. bGnFn2ltIEfDvHZlbmxpxJ9pIEhpem1ldGxlcmkgQS7Fni4xQjBABgNVBAMMOVTDnFJLVFJVU1Qg
  52967. RWxla3Ryb25payBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsSBINTAeFw0xMzA0MzAw
  52968. ODA3MDFaFw0yMzA0MjgwODA3MDFaMIGxMQswCQYDVQQGEwJUUjEPMA0GA1UEBwwGQW5rYXJhMU0w
  52969. SwYDVQQKDERUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUgQmlsacWfaW0gR8O8dmVubGnE
  52970. n2kgSGl6bWV0bGVyaSBBLsWeLjFCMEAGA1UEAww5VMOcUktUUlVTVCBFbGVrdHJvbmlrIFNlcnRp
  52971. ZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxIEg1MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  52972. CgKCAQEApCUZ4WWe60ghUEoI5RHwWrom/4NZzkQqL/7hzmAD/I0Dpe3/a6i6zDQGn1k19uwsu537
  52973. jVJp45wnEFPzpALFp/kRGml1bsMdi9GYjZOHp3GXDSHHmflS0yxjXVW86B8BSLlg/kJK9siArs1m
  52974. ep5Fimh34khon6La8eHBEJ/rPCmBp+EyCNSgBbGM+42WAA4+Jd9ThiI7/PS98wl+d+yG6w8z5UNP
  52975. 9FR1bSmZLmZaQ9/LXMrI5Tjxfjs1nQ/0xVqhzPMggCTTV+wVunUlm+hkS7M0hO8EuPbJbKoCPrZV
  52976. 4jI3X/xml1/N1p7HIL9Nxqw/dV8c7TKcfGkAaZHjIxhT6QIDAQABo0IwQDAdBgNVHQ4EFgQUVpkH
  52977. HtOsDGlktAxQR95DLL4gwPswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZI
  52978. hvcNAQELBQADggEBAJ5FdnsXSDLyOIspve6WSk6BGLFRRyDN0GSxDsnZAdkJzsiZ3GglE9Rc8qPo
  52979. BP5yCccLqh0lVX6Wmle3usURehnmp349hQ71+S4pL+f5bFgWV1Al9j4uPqrtd3GqqpmWRgqujuwq
  52980. URawXs3qZwQcWDD1YIq9pr1N5Za0/EKJAWv2cMhQOQwt1WbZyNKzMrcbGW3LM/nfpeYVhDfwwvJl
  52981. lpKQd/Ct9JDpEXjXk4nAPQu6KfTomZ1yju2dL+6SfaHx/126M2CFYv4HAqGEVka+lgqaE9chTLd8
  52982. B59OTj+RdPsnnRHM3eaxynFNExc5JsUpISuTKWqW+qtB4Uu2NQvAmxU=
  52983. -----END CERTIFICATE-----
  52984. Certinomis - Root CA
  52985. ====================
  52986. -----BEGIN CERTIFICATE-----
  52987. MIIFkjCCA3qgAwIBAgIBATANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJGUjETMBEGA1UEChMK
  52988. Q2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxHTAbBgNVBAMTFENlcnRpbm9taXMg
  52989. LSBSb290IENBMB4XDTEzMTAyMTA5MTcxOFoXDTMzMTAyMTA5MTcxOFowWjELMAkGA1UEBhMCRlIx
  52990. EzARBgNVBAoTCkNlcnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMR0wGwYDVQQDExRD
  52991. ZXJ0aW5vbWlzIC0gUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANTMCQos
  52992. P5L2fxSeC5yaah1AMGT9qt8OHgZbn1CF6s2Nq0Nn3rD6foCWnoR4kkjW4znuzuRZWJflLieY6pOo
  52993. d5tK8O90gC3rMB+12ceAnGInkYjwSond3IjmFPnVAy//ldu9n+ws+hQVWZUKxkd8aRi5pwP5ynap
  52994. z8dvtF4F/u7BUrJ1Mofs7SlmO/NKFoL21prbcpjp3vDFTKWrteoB4owuZH9kb/2jJZOLyKIOSY00
  52995. 8B/sWEUuNKqEUL3nskoTuLAPrjhdsKkb5nPJWqHZZkCqqU2mNAKthH6yI8H7KsZn9DS2sJVqM09x
  52996. RLWtwHkziOC/7aOgFLScCbAK42C++PhmiM1b8XcF4LVzbsF9Ri6OSyemzTUK/eVNfaoqoynHWmgE
  52997. 6OXWk6RiwsXm9E/G+Z8ajYJJGYrKWUM66A0ywfRMEwNvbqY/kXPLynNvEiCL7sCCeN5LLsJJwx3t
  52998. FvYk9CcbXFcx3FXuqB5vbKziRcxXV4p1VxngtViZSTYxPDMBbRZKzbgqg4SGm/lg0h9tkQPTYKbV
  52999. PZrdd5A9NaSfD171UkRpucC63M9933zZxKyGIjK8e2uR73r4F2iw4lNVYC2vPsKD2NkJK/DAZNuH
  53000. i5HMkesE/Xa0lZrmFAYb1TQdvtj/dBxThZngWVJKYe2InmtJiUZ+IFrZ50rlau7SZRFDAgMBAAGj
  53001. YzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTvkUz1pcMw6C8I
  53002. 6tNxIqSSaHh02TAfBgNVHSMEGDAWgBTvkUz1pcMw6C8I6tNxIqSSaHh02TANBgkqhkiG9w0BAQsF
  53003. AAOCAgEAfj1U2iJdGlg+O1QnurrMyOMaauo++RLrVl89UM7g6kgmJs95Vn6RHJk/0KGRHCwPT5iV
  53004. WVO90CLYiF2cN/z7ZMF4jIuaYAnq1fohX9B0ZedQxb8uuQsLrbWwF6YSjNRieOpWauwK0kDDPAUw
  53005. Pk2Ut59KA9N9J0u2/kTO+hkzGm2kQtHdzMjI1xZSg081lLMSVX3l4kLr5JyTCcBMWwerx20RoFAX
  53006. lCOotQqSD7J6wWAsOMwaplv/8gzjqh8c3LigkyfeY+N/IZ865Z764BNqdeuWXGKRlI5nU7aJ+BIJ
  53007. y29SWwNyhlCVCNSNh4YVH5Uk2KRvms6knZtt0rJ2BobGVgjF6wnaNsIbW0G+YSrjcOa4pvi2WsS9
  53008. Iff/ql+hbHY5ZtbqTFXhADObE5hjyW/QASAJN1LnDE8+zbz1X5YnpyACleAu6AdBBR8Vbtaw5Bng
  53009. DwKTACdyxYvRVB9dSsNAl35VpnzBMwQUAR1JIGkLGZOdblgi90AMRgwjY/M50n92Uaf0yKHxDHYi
  53010. I0ZSKS3io0EHVmmY0gUJvGnHWmHNj4FgFU2A3ZDifcRQ8ow7bkrHxuaAKzyBvBGAFhAn1/DNP3nM
  53011. cyrDflOR1m749fPH0FFNjkulW+YZFzvWgQncItzujrnEj1PhZ7szuIgVRs/taTX/dQ1G885x4cVr
  53012. hkIGuUE=
  53013. -----END CERTIFICATE-----
  53014. OISTE WISeKey Global Root GB CA
  53015. ===============================
  53016. -----BEGIN CERTIFICATE-----
  53017. MIIDtTCCAp2gAwIBAgIQdrEgUnTwhYdGs/gjGvbCwDANBgkqhkiG9w0BAQsFADBtMQswCQYDVQQG
  53018. EwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNl
  53019. ZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQiBDQTAeFw0xNDEyMDExNTAw
  53020. MzJaFw0zOTEyMDExNTEwMzFaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYD
  53021. VQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEds
  53022. b2JhbCBSb290IEdCIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Be3HEokKtaX
  53023. scriHvt9OO+Y9bI5mE4nuBFde9IllIiCFSZqGzG7qFshISvYD06fWvGxWuR51jIjK+FTzJlFXHtP
  53024. rby/h0oLS5daqPZI7H17Dc0hBt+eFf1Biki3IPShehtX1F1Q/7pn2COZH8g/497/b1t3sWtuuMlk
  53025. 9+HKQUYOKXHQuSP8yYFfTvdv37+ErXNku7dCjmn21HYdfp2nuFeKUWdy19SouJVUQHMD9ur06/4o
  53026. Qnc/nSMbsrY9gBQHTC5P99UKFg29ZkM3fiNDecNAhvVMKdqOmq0NpQSHiB6F4+lT1ZvIiwNjeOvg
  53027. GUpuuy9rM2RYk61pv48b74JIxwIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB
  53028. /zAdBgNVHQ4EFgQUNQ/INmNe4qPs+TtmFc5RUuORmj0wEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZI
  53029. hvcNAQELBQADggEBAEBM+4eymYGQfp3FsLAmzYh7KzKNbrghcViXfa43FK8+5/ea4n32cZiZBKpD
  53030. dHij40lhPnOMTZTg+XHEthYOU3gf1qKHLwI5gSk8rxWYITD+KJAAjNHhy/peyP34EEY7onhCkRd0
  53031. VQreUGdNZtGn//3ZwLWoo4rOZvUPQ82nK1d7Y0Zqqi5S2PTt4W2tKZB4SLrhI6qjiey1q5bAtEui
  53032. HZeeevJuQHHfaPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic
  53033. Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM=
  53034. -----END CERTIFICATE-----
  53035. SZAFIR ROOT CA2
  53036. ===============
  53037. -----BEGIN CERTIFICATE-----
  53038. MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQELBQAwUTELMAkG
  53039. A1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6ZW5pb3dhIFMuQS4xGDAWBgNV
  53040. BAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkwNzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJ
  53041. BgNVBAYTAlBMMSgwJgYDVQQKDB9LcmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYD
  53042. VQQDDA9TWkFGSVIgUk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5Q
  53043. qEvNQLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT3PSQ1hNK
  53044. DJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw3gAeqDRHu5rr/gsUvTaE
  53045. 2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr63fE9biCloBK0TXC5ztdyO4mTp4CEHCdJ
  53046. ckm1/zuVnsHMyAHs6A6KCpbns6aH5db5BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwi
  53047. ieDhZNRnvDF5YTy7ykHNXGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0P
  53048. AQH/BAQDAgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsFAAOC
  53049. AQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw8PRBEew/R40/cof5
  53050. O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOGnXkZ7/e7DDWQw4rtTw/1zBLZpD67
  53051. oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCPoky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul
  53052. 4+vJhaAlIDf7js4MNIThPIGyd05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6
  53053. +/NNIxuZMzSgLvWpCz/UXeHPhJ/iGcJfitYgHuNztw==
  53054. -----END CERTIFICATE-----
  53055. Certum Trusted Network CA 2
  53056. ===========================
  53057. -----BEGIN CERTIFICATE-----
  53058. MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCBgDELMAkGA1UE
  53059. BhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMuQS4xJzAlBgNVBAsTHkNlcnR1
  53060. bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIGA1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29y
  53061. ayBDQSAyMCIYDzIwMTExMDA2MDgzOTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQ
  53062. TDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENl
  53063. cnRpZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENB
  53064. IDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWADGSdhhuWZGc/IjoedQF9
  53065. 7/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+o
  53066. CgCXhVqqndwpyeI1B+twTUrWwbNWuKFBOJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40b
  53067. Rr5HMNUuctHFY9rnY3lEfktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2p
  53068. uTRZCr+ESv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1mo130
  53069. GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02isx7QBlrd9pPPV3WZ
  53070. 9fqGGmd4s7+W/jTcvedSVuWz5XV710GRBdxdaeOVDUO5/IOWOZV7bIBaTxNyxtd9KXpEulKkKtVB
  53071. Rgkg/iKgtlswjbyJDNXXcPiHUv3a76xRLgezTv7QCdpw75j6VuZt27VXS9zlLCUVyJ4ueE742pye
  53072. hizKV/Ma5ciSixqClnrDvFASadgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vM
  53073. BhBgu4M1t15n3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  53074. AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZI
  53075. hvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQF/xlhMcQSZDe28cmk4gmb3DW
  53076. Al45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTfCVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuA
  53077. L55MYIR4PSFk1vtBHxgP58l1cb29XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMo
  53078. clm2q8KMZiYcdywmdjWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tM
  53079. pkT/WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jbAoJnwTnb
  53080. w3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksqP/ujmv5zMnHCnsZy4Ypo
  53081. J/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Kob7a6bINDd82Kkhehnlt4Fj1F4jNy3eFm
  53082. ypnTycUm/Q1oBEauttmbjL4ZvrHG8hnjXALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLX
  53083. is7VmFxWlgPF7ncGNf/P5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7
  53084. zAYspsbiDrW5viSP
  53085. -----END CERTIFICATE-----
  53086. Hellenic Academic and Research Institutions RootCA 2015
  53087. =======================================================
  53088. -----BEGIN CERTIFICATE-----
  53089. MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcT
  53090. BkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0
  53091. aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNVBAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNl
  53092. YXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIwMTUwHhcNMTUwNzA3MTAxMTIxWhcNNDAwNjMwMTAx
  53093. MTIxWjCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMg
  53094. QWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNV
  53095. BAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIw
  53096. MTUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDC+Kk/G4n8PDwEXT2QNrCROnk8Zlrv
  53097. bTkBSRq0t89/TSNTt5AA4xMqKKYx8ZEA4yjsriFBzh/a/X0SWwGDD7mwX5nh8hKDgE0GPt+sr+eh
  53098. iGsxr/CL0BgzuNtFajT0AoAkKAoCFZVedioNmToUW/bLy1O8E00BiDeUJRtCvCLYjqOWXjrZMts+
  53099. 6PAQZe104S+nfK8nNLspfZu2zwnI5dMK/IhlZXQK3HMcXM1AsRzUtoSMTFDPaI6oWa7CJ06CojXd
  53100. FPQf/7J31Ycvqm59JCfnxssm5uX+Zwdj2EUN3TpZZTlYepKZcj2chF6IIbjV9Cz82XBST3i4vTwr
  53101. i5WY9bPRaM8gFH5MXF/ni+X1NYEZN9cRCLdmvtNKzoNXADrDgfgXy5I2XdGj2HUb4Ysn6npIQf1F
  53102. GQatJ5lOwXBH3bWfgVMS5bGMSF0xQxfjjMZ6Y5ZLKTBOhE5iGV48zpeQpX8B653g+IuJ3SWYPZK2
  53103. fu/Z8VFRfS0myGlZYeCsargqNhEEelC9MoS+L9xy1dcdFkfkR2YgP/SWxa+OAXqlD3pk9Q0Yh9mu
  53104. iNX6hME6wGkoLfINaFGq46V3xqSQDqE3izEjR8EJCOtu93ib14L8hCCZSRm2Ekax+0VVFqmjZayc
  53105. Bw/qa9wfLgZy7IaIEuQt218FL+TwA9MmM+eAws1CoRc0CwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  53106. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUcRVnyMjJvXVdctA4GGqd83EkVAswDQYJKoZI
  53107. hvcNAQELBQADggIBAHW7bVRLqhBYRjTyYtcWNl0IXtVsyIe9tC5G8jH4fOpCtZMWVdyhDBKg2mF+
  53108. D1hYc2Ryx+hFjtyp8iY/xnmMsVMIM4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6HwbISHTGzrM
  53109. d/K4kPFox/la/vot9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkNaeJK9E10A/+y
  53110. d+2VZ5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRGar9KC/eaj8GsGsVn
  53111. 82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnhX9izjFk0WaSrT2y7Hxjb
  53112. davYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQl033DlZdwJVqwjbDG2jJ9SrcR5q+ss7F
  53113. Jej6A7na+RZukYT1HCjI/CbM1xyQVqdfbzoEvM14iQuODy+jqk+iGxI9FghAD/FGTNeqewjBCvVt
  53114. J94Cj8rDtSvK6evIIVM4pcw72Hc3MKJP2W/R8kCtQXoXxdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGa
  53115. JI7ZjnHKe7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODfqiAeW2GFZECpkJcNrVPSWh2HagCXZWK0vm9q
  53116. p/UsQu0yrbYhnr68
  53117. -----END CERTIFICATE-----
  53118. Hellenic Academic and Research Institutions ECC RootCA 2015
  53119. ===========================================================
  53120. -----BEGIN CERTIFICATE-----
  53121. MIICwzCCAkqgAwIBAgIBADAKBggqhkjOPQQDAjCBqjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0
  53122. aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9u
  53123. cyBDZXJ0LiBBdXRob3JpdHkxRDBCBgNVBAMTO0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJj
  53124. aCBJbnN0aXR1dGlvbnMgRUNDIFJvb3RDQSAyMDE1MB4XDTE1MDcwNzEwMzcxMloXDTQwMDYzMDEw
  53125. MzcxMlowgaoxCzAJBgNVBAYTAkdSMQ8wDQYDVQQHEwZBdGhlbnMxRDBCBgNVBAoTO0hlbGxlbmlj
  53126. IEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9yaXR5MUQwQgYD
  53127. VQQDEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIEVDQyBSb290
  53128. Q0EgMjAxNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABJKgQehLgoRc4vgxEZmGZE4JJS+dQS8KrjVP
  53129. dJWyUWRrjWvmP3CV8AVER6ZyOFB2lQJajq4onvktTpnvLEhvTCUp6NFxW98dwXU3tNf6e3pCnGoK
  53130. Vlp8aQuqgAkkbH7BRqNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  53131. BBYEFLQiC4KZJAEOnLvkDv2/+5cgk5kqMAoGCCqGSM49BAMCA2cAMGQCMGfOFmI4oqxiRaeplSTA
  53132. GiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7SofTUwJCA3sS61kFyjn
  53133. dc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR
  53134. -----END CERTIFICATE-----
  53135. Certplus Root CA G1
  53136. ===================
  53137. -----BEGIN CERTIFICATE-----
  53138. MIIFazCCA1OgAwIBAgISESBVg+QtPlRWhS2DN7cs3EYRMA0GCSqGSIb3DQEBDQUAMD4xCzAJBgNV
  53139. BAYTAkZSMREwDwYDVQQKDAhDZXJ0cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMTAe
  53140. Fw0xNDA1MjYwMDAwMDBaFw0zODAxMTUwMDAwMDBaMD4xCzAJBgNVBAYTAkZSMREwDwYDVQQKDAhD
  53141. ZXJ0cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMTCCAiIwDQYJKoZIhvcNAQEBBQAD
  53142. ggIPADCCAgoCggIBANpQh7bauKk+nWT6VjOaVj0W5QOVsjQcmm1iBdTYj+eJZJ+622SLZOZ5KmHN
  53143. r49aiZFluVj8tANfkT8tEBXgfs+8/H9DZ6itXjYj2JizTfNDnjl8KvzsiNWI7nC9hRYt6kuJPKNx
  53144. Qv4c/dMcLRC4hlTqQ7jbxofaqK6AJc96Jh2qkbBIb6613p7Y1/oA/caP0FG7Yn2ksYyy/yARujVj
  53145. BYZHYEMzkPZHogNPlk2dT8Hq6pyi/jQu3rfKG3akt62f6ajUeD94/vI4CTYd0hYCyOwqaK/1jpTv
  53146. LRN6HkJKHRUxrgwEV/xhc/MxVoYxgKDEEW4wduOU8F8ExKyHcomYxZ3MVwia9Az8fXoFOvpHgDm2
  53147. z4QTd28n6v+WZxcIbekN1iNQMLAVdBM+5S//Ds3EC0pd8NgAM0lm66EYfFkuPSi5YXHLtaW6uOrc
  53148. 4nBvCGrch2c0798wct3zyT8j/zXhviEpIDCB5BmlIOklynMxdCm+4kLV87ImZsdo/Rmz5yCTmehd
  53149. 4F6H50boJZwKKSTUzViGUkAksnsPmBIgJPaQbEfIDbsYIC7Z/fyL8inqh3SV4EJQeIQEQWGw9CEj
  53150. jy3LKCHyamz0GqbFFLQ3ZU+V/YDI+HLlJWvEYLF7bY5KinPOWftwenMGE9nTdDckQQoRb5fc5+R+
  53151. ob0V8rqHDz1oihYHAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0G
  53152. A1UdDgQWBBSowcCbkahDFXxdBie0KlHYlwuBsTAfBgNVHSMEGDAWgBSowcCbkahDFXxdBie0KlHY
  53153. lwuBsTANBgkqhkiG9w0BAQ0FAAOCAgEAnFZvAX7RvUz1isbwJh/k4DgYzDLDKTudQSk0YcbX8ACh
  53154. 66Ryj5QXvBMsdbRX7gp8CXrc1cqh0DQT+Hern+X+2B50ioUHj3/MeXrKls3N/U/7/SMNkPX0XtPG
  53155. YX2eEeAC7gkE2Qfdpoq3DIMku4NQkv5gdRE+2J2winq14J2by5BSS7CTKtQ+FjPlnsZlFT5kOwQ/
  53156. 2wyPX1wdaR+v8+khjPPvl/aatxm2hHSco1S1cE5j2FddUyGbQJJD+tZ3VTNPZNX70Cxqjm0lpu+F
  53157. 6ALEUz65noe8zDUa3qHpimOHZR4RKttjd5cUvpoUmRGywO6wT/gUITJDT5+rosuoD6o7BlXGEilX
  53158. CNQ314cnrUlZp5GrRHpejXDbl85IULFzk/bwg2D5zfHhMf1bfHEhYxQUqq/F3pN+aLHsIqKqkHWe
  53159. tUNy6mSjhEv9DKgma3GX7lZjZuhCVPnHHd/Qj1vfyDBviP4NxDMcU6ij/UgQ8uQKTuEVV/xuZDDC
  53160. VRHc6qnNSlSsKWNEz0pAoNZoWRsz+e86i9sgktxChL8Bq4fA1SCC28a5g4VCXA9DO2pJNdWY9BW/
  53161. +mGBDAkgGNLQFwzLSABQ6XaCjGTXOqAHVcweMcDvOrRl++O/QmueD6i9a5jc2NvLi6Td11n0bt3+
  53162. qsOR0C5CB8AMTVPNJLFMWx5R9N/pkvo=
  53163. -----END CERTIFICATE-----
  53164. Certplus Root CA G2
  53165. ===================
  53166. -----BEGIN CERTIFICATE-----
  53167. MIICHDCCAaKgAwIBAgISESDZkc6uo+jF5//pAq/Pc7xVMAoGCCqGSM49BAMDMD4xCzAJBgNVBAYT
  53168. AkZSMREwDwYDVQQKDAhDZXJ0cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMjAeFw0x
  53169. NDA1MjYwMDAwMDBaFw0zODAxMTUwMDAwMDBaMD4xCzAJBgNVBAYTAkZSMREwDwYDVQQKDAhDZXJ0
  53170. cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMjB2MBAGByqGSM49AgEGBSuBBAAiA2IA
  53171. BM0PW1aC3/BFGtat93nwHcmsltaeTpwftEIRyoa/bfuFo8XlGVzX7qY/aWfYeOKmycTbLXku54uN
  53172. Am8xIk0G42ByRZ0OQneezs/lf4WbGOT8zC5y0xaTTsqZY1yhBSpsBqNjMGEwDgYDVR0PAQH/BAQD
  53173. AgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNqDYwJ5jtpMxjwjFNiPwyCrKGBZMB8GA1Ud
  53174. IwQYMBaAFNqDYwJ5jtpMxjwjFNiPwyCrKGBZMAoGCCqGSM49BAMDA2gAMGUCMHD+sAvZ94OX7PNV
  53175. HdTcswYO/jOYnYs5kGuUIe22113WTNchp+e/IQ8rzfcq3IUHnQIxAIYUFuXcsGXCwI4Un78kFmjl
  53176. vPl5adytRSv3tjFzzAalU5ORGpOucGpnutee5WEaXw==
  53177. -----END CERTIFICATE-----
  53178. OpenTrust Root CA G1
  53179. ====================
  53180. -----BEGIN CERTIFICATE-----
  53181. MIIFbzCCA1egAwIBAgISESCzkFU5fX82bWTCp59rY45nMA0GCSqGSIb3DQEBCwUAMEAxCzAJBgNV
  53182. BAYTAkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEcx
  53183. MB4XDTE0MDUyNjA4NDU1MFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoM
  53184. CU9wZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzEwggIiMA0GCSqGSIb3DQEB
  53185. AQUAA4ICDwAwggIKAoICAQD4eUbalsUwXopxAy1wpLuwxQjczeY1wICkES3d5oeuXT2R0odsN7fa
  53186. Yp6bwiTXj/HbpqbfRm9RpnHLPhsxZ2L3EVs0J9V5ToybWL0iEA1cJwzdMOWo010hOHQX/uMftk87
  53187. ay3bfWAfjH1MBcLrARYVmBSO0ZB3Ij/swjm4eTrwSSTilZHcYTSSjFR077F9jAHiOH3BX2pfJLKO
  53188. YheteSCtqx234LSWSE9mQxAGFiQD4eCcjsZGT44ameGPuY4zbGneWK2gDqdkVBFpRGZPTBKnjix9
  53189. xNRbxQA0MMHZmf4yzgeEtE7NCv82TWLxp2NX5Ntqp66/K7nJ5rInieV+mhxNaMbBGN4zK1FGSxyO
  53190. 9z0M+Yo0FMT7MzUj8czxKselu7Cizv5Ta01BG2Yospb6p64KTrk5M0ScdMGTHPjgniQlQ/GbI4Kq
  53191. 3ywgsNw2TgOzfALU5nsaqocTvz6hdLubDuHAk5/XpGbKuxs74zD0M1mKB3IDVedzagMxbm+WG+Oi
  53192. n6+Sx+31QrclTDsTBM8clq8cIqPQqwWyTBIjUtz9GVsnnB47ev1CI9sjgBPwvFEVVJSmdz7QdFG9
  53193. URQIOTfLHzSpMJ1ShC5VkLG631UAC9hWLbFJSXKAqWLXwPYYEQRVzXR7z2FwefR7LFxckvzluFqr
  53194. TJOVoSfupb7PcSNCupt2LQIDAQABo2MwYTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB
  53195. /zAdBgNVHQ4EFgQUl0YhVyE12jZVx/PxN3DlCPaTKbYwHwYDVR0jBBgwFoAUl0YhVyE12jZVx/Px
  53196. N3DlCPaTKbYwDQYJKoZIhvcNAQELBQADggIBAB3dAmB84DWn5ph76kTOZ0BP8pNuZtQ5iSas000E
  53197. PLuHIT839HEl2ku6q5aCgZG27dmxpGWX4m9kWaSW7mDKHyP7Rbr/jyTwyqkxf3kfgLMtMrpkZ2Cv
  53198. uVnN35pJ06iCsfmYlIrM4LvgBBuZYLFGZdwIorJGnkSI6pN+VxbSFXJfLkur1J1juONI5f6ELlgK
  53199. n0Md/rcYkoZDSw6cMoYsYPXpSOqV7XAp8dUv/TW0V8/bhUiZucJvbI/NeJWsZCj9VrDDb8O+WVLh
  53200. X4SPgPL0DTatdrOjteFkdjpY3H1PXlZs5VVZV6Xf8YpmMIzUUmI4d7S+KNfKNsSbBfD4Fdvb8e80
  53201. nR14SohWZ25g/4/Ii+GOvUKpMwpZQhISKvqxnUOOBZuZ2mKtVzazHbYNeS2WuOvyDEsMpZTGMKcm
  53202. GS3tTAZQMPH9WD25SxdfGbRqhFS0OE85og2WaMMolP3tLR9Ka0OWLpABEPs4poEL0L9109S5zvE/
  53203. bw4cHjdx5RiHdRk/ULlepEU0rbDK5uUTdg8xFKmOLZTW1YVNcxVPS/KyPu1svf0OnWZzsD2097+o
  53204. 4BGkxK51CUpjAEggpsadCwmKtODmzj7HPiY46SvepghJAwSQiumPv+i2tCqjI40cHLI5kqiPAlxA
  53205. OXXUc0ECd97N4EOH1uS6SsNsEn/+KuYj1oxx
  53206. -----END CERTIFICATE-----
  53207. OpenTrust Root CA G2
  53208. ====================
  53209. -----BEGIN CERTIFICATE-----
  53210. MIIFbzCCA1egAwIBAgISESChaRu/vbm9UpaPI+hIvyYRMA0GCSqGSIb3DQEBDQUAMEAxCzAJBgNV
  53211. BAYTAkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEcy
  53212. MB4XDTE0MDUyNjAwMDAwMFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoM
  53213. CU9wZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzIwggIiMA0GCSqGSIb3DQEB
  53214. AQUAA4ICDwAwggIKAoICAQDMtlelM5QQgTJT32F+D3Y5z1zCU3UdSXqWON2ic2rxb95eolq5cSG+
  53215. Ntmh/LzubKh8NBpxGuga2F8ORAbtp+Dz0mEL4DKiltE48MLaARf85KxP6O6JHnSrT78eCbY2albz
  53216. 4e6WiWYkBuTNQjpK3eCasMSCRbP+yatcfD7J6xcvDH1urqWPyKwlCm/61UWY0jUJ9gNDlP7ZvyCV
  53217. eYCYitmJNbtRG6Q3ffyZO6v/v6wNj0OxmXsWEH4db0fEFY8ElggGQgT4hNYdvJGmQr5J1WqIP7wt
  53218. UdGejeBSzFfdNTVY27SPJIjki9/ca1TSgSuyzpJLHB9G+h3Ykst2Z7UJmQnlrBcUVXDGPKBWCgOz
  53219. 3GIZ38i1MH/1PCZ1Eb3XG7OHngevZXHloM8apwkQHZOJZlvoPGIytbU6bumFAYueQ4xncyhZW+vj
  53220. 3CzMpSZyYhK05pyDRPZRpOLAeiRXyg6lPzq1O4vldu5w5pLeFlwoW5cZJ5L+epJUzpM5ChaHvGOz
  53221. 9bGTXOBut9Dq+WIyiET7vycotjCVXRIouZW+j1MY5aIYFuJWpLIsEPUdN6b4t/bQWVyJ98LVtZR0
  53222. 0dX+G7bw5tYee9I8y6jj9RjzIR9u701oBnstXW5DiabA+aC/gh7PU3+06yzbXfZqfUAkBXKJOAGT
  53223. y3HCOV0GEfZvePg3DTmEJwIDAQABo2MwYTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB
  53224. /zAdBgNVHQ4EFgQUajn6QiL35okATV59M4PLuG53hq8wHwYDVR0jBBgwFoAUajn6QiL35okATV59
  53225. M4PLuG53hq8wDQYJKoZIhvcNAQENBQADggIBAJjLq0A85TMCl38th6aP1F5Kr7ge57tx+4BkJamz
  53226. Gj5oXScmp7oq4fBXgwpkTx4idBvpkF/wrM//T2h6OKQQbA2xx6R3gBi2oihEdqc0nXGEL8pZ0keI
  53227. mUEiyTCYYW49qKgFbdEfwFFEVn8nNQLdXpgKQuswv42hm1GqO+qTRmTFAHneIWv2V6CG1wZy7HBG
  53228. S4tz3aAhdT7cHcCP009zHIXZ/n9iyJVvttN7jLpTwm+bREx50B1ws9efAvSyB7DH5fitIw6mVskp
  53229. EndI2S9G/Tvw/HRwkqWOOAgfZDC2t0v7NqwQjqBSM2OdAzVWxWm9xiNaJ5T2pBL4LTM8oValX9YZ
  53230. 6e18CL13zSdkzJTaTkZQh+D5wVOAHrut+0dSixv9ovneDiK3PTNZbNTe9ZUGMg1RGUFcPk8G97kr
  53231. gCf2o6p6fAbhQ8MTOWIaNr3gKC6UAuQpLmBVrkA9sHSSXvAgZJY/X0VdiLWK2gKgW0VU3jg9CcCo
  53232. SmVGFvyqv1ROTVu+OEO3KMqLM6oaJbolXCkvW0pujOotnCr2BXbgd5eAiN1nE28daCSLT7d0geX0
  53233. YJ96Vdc+N9oWaz53rK4YcJUIeSkDiv7BO7M/Gg+kO14fWKGVyasvc0rQLW6aWQ9VGHgtPFGml4vm
  53234. u7JwqkwR3v98KzfUetF3NI/n+UL3PIEMS1IK
  53235. -----END CERTIFICATE-----
  53236. OpenTrust Root CA G3
  53237. ====================
  53238. -----BEGIN CERTIFICATE-----
  53239. MIICITCCAaagAwIBAgISESDm+Ez8JLC+BUCs2oMbNGA/MAoGCCqGSM49BAMDMEAxCzAJBgNVBAYT
  53240. AkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEczMB4X
  53241. DTE0MDUyNjAwMDAwMFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCU9w
  53242. ZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzMwdjAQBgcqhkjOPQIBBgUrgQQA
  53243. IgNiAARK7liuTcpm3gY6oxH84Bjwbhy6LTAMidnW7ptzg6kjFYwvWYpa3RTqnVkrQ7cG7DK2uu5B
  53244. ta1doYXM6h0UZqNnfkbilPPntlahFVmhTzeXuSIevRHr9LIfXsMUmuXZl5mjYzBhMA4GA1UdDwEB
  53245. /wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRHd8MUi2I5DMlv4VBN0BBY3JWIbTAf
  53246. BgNVHSMEGDAWgBRHd8MUi2I5DMlv4VBN0BBY3JWIbTAKBggqhkjOPQQDAwNpADBmAjEAj6jcnboM
  53247. BBf6Fek9LykBl7+BFjNAk2z8+e2AcG+qj9uEwov1NcoG3GRvaBbhj5G5AjEA2Euly8LQCGzpGPta
  53248. 3U1fJAuwACEl74+nBCZx4nxp5V2a+EEfOzmTk51V6s2N8fvB
  53249. -----END CERTIFICATE-----
  53250. ISRG Root X1
  53251. ============
  53252. -----BEGIN CERTIFICATE-----
  53253. MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAwTzELMAkGA1UE
  53254. BhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNoIEdyb3VwMRUwEwYDVQQD
  53255. EwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQG
  53256. EwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMT
  53257. DElTUkcgUm9vdCBYMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54r
  53258. Vygch77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+0TM8ukj1
  53259. 3Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6UA5/TR5d8mUgjU+g4rk8K
  53260. b4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sWT8KOEUt+zwvo/7V3LvSye0rgTBIlDHCN
  53261. Aymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyHB5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ
  53262. 4Q7e2RCOFvu396j3x+UCB5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf
  53263. 1b0SHzUvKBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWnOlFu
  53264. hjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTnjh8BCNAw1FtxNrQH
  53265. usEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbwqHyGO0aoSCqI3Haadr8faqU9GY/r
  53266. OPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CIrU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4G
  53267. A1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY
  53268. 9umbbjANBgkqhkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
  53269. ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ3BebYhtF8GaV
  53270. 0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KKNFtY2PwByVS5uCbMiogziUwt
  53271. hDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJw
  53272. TdwJx4nLCgdNbOhdjsnvzqvHu7UrTkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nx
  53273. e5AW0wdeRlN8NwdCjNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZA
  53274. JzVcoyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq4RgqsahD
  53275. YVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPAmRGunUHBcnWEvgJBQl9n
  53276. JEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57demyPxgcYxn/eR44/KJ4EBs+lVDR3veyJ
  53277. m+kXQ99b21/+jh5Xos1AnX5iItreGCc=
  53278. -----END CERTIFICATE-----
  53279. AC RAIZ FNMT-RCM
  53280. ================
  53281. -----BEGIN CERTIFICATE-----
  53282. MIIFgzCCA2ugAwIBAgIPXZONMGc2yAYdGsdUhGkHMA0GCSqGSIb3DQEBCwUAMDsxCzAJBgNVBAYT
  53283. AkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTAeFw0wODEw
  53284. MjkxNTU5NTZaFw0zMDAxMDEwMDAwMDBaMDsxCzAJBgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJD
  53285. TTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  53286. ggIBALpxgHpMhm5/yBNtwMZ9HACXjywMI7sQmkCpGreHiPibVmr75nuOi5KOpyVdWRHbNi63URcf
  53287. qQgfBBckWKo3Shjf5TnUV/3XwSyRAZHiItQDwFj8d0fsjz50Q7qsNI1NOHZnjrDIbzAzWHFctPVr
  53288. btQBULgTfmxKo0nRIBnuvMApGGWn3v7v3QqQIecaZ5JCEJhfTzC8PhxFtBDXaEAUwED653cXeuYL
  53289. j2VbPNmaUtu1vZ5Gzz3rkQUCwJaydkxNEJY7kvqcfw+Z374jNUUeAlz+taibmSXaXvMiwzn15Cou
  53290. 08YfxGyqxRxqAQVKL9LFwag0Jl1mpdICIfkYtwb1TplvqKtMUejPUBjFd8g5CSxJkjKZqLsXF3mw
  53291. WsXmo8RZZUc1g16p6DULmbvkzSDGm0oGObVo/CK67lWMK07q87Hj/LaZmtVC+nFNCM+HHmpxffnT
  53292. tOmlcYF7wk5HlqX2doWjKI/pgG6BU6VtX7hI+cL5NqYuSf+4lsKMB7ObiFj86xsc3i1w4peSMKGJ
  53293. 47xVqCfWS+2QrYv6YyVZLag13cqXM7zlzced0ezvXg5KkAYmY6252TUtB7p2ZSysV4999AeU14EC
  53294. ll2jB0nVetBX+RvnU0Z1qrB5QstocQjpYL05ac70r8NWQMetUqIJ5G+GR4of6ygnXYMgrwTJbFaa
  53295. i0b1AgMBAAGjgYMwgYAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE
  53296. FPd9xf3E6Jobd2Sn9R2gzL+HYJptMD4GA1UdIAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1o
  53297. dHRwOi8vd3d3LmNlcnQuZm5tdC5lcy9kcGNzLzANBgkqhkiG9w0BAQsFAAOCAgEAB5BK3/MjTvDD
  53298. nFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1RXxlDPiyN8+s
  53299. D8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYMLVN0V2Ue1bLdI4E7pWYjJ2cJ
  53300. j+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrT
  53301. Qfv6MooqtyuGC2mDOL7Nii4LcK2NJpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW
  53302. +YJF1DngoABd15jmfZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7
  53303. Ixjp6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp1txyM/1d
  53304. 8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B9kiABdcPUXmsEKvU7ANm
  53305. 5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wokRqEIr9baRRmW1FMdW4R58MD3R++Lj8UG
  53306. rp1MYp3/RgT408m2ECVAdf4WqslKYIYvuu8wd+RU4riEmViAqhOLUTpPSPaLtrM=
  53307. -----END CERTIFICATE-----
  53308. Amazon Root CA 1
  53309. ================
  53310. -----BEGIN CERTIFICATE-----
  53311. MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsFADA5MQswCQYD
  53312. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAxMB4XDTE1
  53313. MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  53314. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  53315. ggEBALJ4gHHKeNXjca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgH
  53316. FzZM9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qwIFAGbHrQ
  53317. gLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6VOujw5H5SNz/0egwLX0t
  53318. dHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L93FcXmn/6pUCyziKrlA4b9v7LWIbxcce
  53319. VOF34GfID5yHI9Y/QCB/IIDEgEw+OyQmjgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB
  53320. /zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3
  53321. DQEBCwUAA4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDIU5PM
  53322. CCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUsN+gDS63pYaACbvXy
  53323. 8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vvo/ufQJVtMVT8QtPHRh8jrdkPSHCa
  53324. 2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2
  53325. xJNDd2ZhwLnoQdeXeGADbkpyrqXRfboQnoZsG4q5WTP468SQvvG5
  53326. -----END CERTIFICATE-----
  53327. Amazon Root CA 2
  53328. ================
  53329. -----BEGIN CERTIFICATE-----
  53330. MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwFADA5MQswCQYD
  53331. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAyMB4XDTE1
  53332. MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  53333. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  53334. ggIBAK2Wny2cSkxKgXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4
  53335. kHbZW0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg1dKmSYXp
  53336. N+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K8nu+NQWpEjTj82R0Yiw9
  53337. AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvd
  53338. fLC6HM783k81ds8P+HgfajZRRidhW+mez/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAEx
  53339. kv8LV/SasrlX6avvDXbR8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSS
  53340. btqDT6ZjmUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz7Mt0
  53341. Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6+XUyo05f7O0oYtlN
  53342. c/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI0u1ufm8/0i2BWSlmy5A5lREedCf+
  53343. 3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSw
  53344. DPBMMPQFWAJI/TPlUq9LhONmUjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oA
  53345. A7CXDpO8Wqj2LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY
  53346. +gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kSk5Nrp+gvU5LE
  53347. YFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl7uxMMne0nxrpS10gxdr9HIcW
  53348. xkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygmbtmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQ
  53349. gj9sAq+uEjonljYE1x2igGOpm/HlurR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbW
  53350. aQbLU8uz/mtBzUF+fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoV
  53351. Yh63n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE76KlXIx3
  53352. KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H9jVlpNMKVv/1F2Rs76gi
  53353. JUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT4PsJYGw=
  53354. -----END CERTIFICATE-----
  53355. Amazon Root CA 3
  53356. ================
  53357. -----BEGIN CERTIFICATE-----
  53358. MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5MQswCQYDVQQG
  53359. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAzMB4XDTE1MDUy
  53360. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  53361. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZB
  53362. f8ANm+gBG1bG8lKlui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjr
  53363. Zt6jQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSrttvXBp43
  53364. rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkrBqWTrBqYaGFy+uGh0Psc
  53365. eGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteMYyRIHN8wfdVoOw==
  53366. -----END CERTIFICATE-----
  53367. Amazon Root CA 4
  53368. ================
  53369. -----BEGIN CERTIFICATE-----
  53370. MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5MQswCQYDVQQG
  53371. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSA0MB4XDTE1MDUy
  53372. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  53373. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN
  53374. /sGKe0uoe0ZLY7Bi9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri
  53375. 83BkM6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
  53376. HQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WBMAoGCCqGSM49BAMDA2gA
  53377. MGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlwCkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1
  53378. AE47xDqUEpHJWEadIRNyp4iciuRMStuW1KyLa2tJElMzrdfkviT8tQp21KW8EA==
  53379. -----END CERTIFICATE-----
  53380. LuxTrust Global Root 2
  53381. ======================
  53382. -----BEGIN CERTIFICATE-----
  53383. MIIFwzCCA6ugAwIBAgIUCn6m30tEntpqJIWe5rgV0xZ/u7EwDQYJKoZIhvcNAQELBQAwRjELMAkG
  53384. A1UEBhMCTFUxFjAUBgNVBAoMDUx1eFRydXN0IFMuQS4xHzAdBgNVBAMMFkx1eFRydXN0IEdsb2Jh
  53385. bCBSb290IDIwHhcNMTUwMzA1MTMyMTU3WhcNMzUwMzA1MTMyMTU3WjBGMQswCQYDVQQGEwJMVTEW
  53386. MBQGA1UECgwNTHV4VHJ1c3QgUy5BLjEfMB0GA1UEAwwWTHV4VHJ1c3QgR2xvYmFsIFJvb3QgMjCC
  53387. AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANeFl78RmOnwYoNMPIf5U2o3C/IPPIfOb9wm
  53388. Kb3FibrJgz337spbxm1Jc7TJRqMbNBM/wYlFV/TZsfs2ZUv7COJIcRHIbjuend+JZTemhfY7RBi2
  53389. xjcwYkSSl2l9QjAk5A0MiWtj3sXh306pFGxT4GHO9hcvHTy95iJMHZP1EMShduxq3sVs35a0VkBC
  53390. wGKSMKEtFZSg0iAGCW5qbeXrt77U8PEVfIvmTroTzEsnXpk8F12PgX8zPU/TPxvsXD/wPEx1bvKm
  53391. 1Z3aLQdjAsZy6ZS8TEmVT4hSyNvoaYL4zDRbIvCGp4m9SAptZoFtyMhk+wHh9OHe2Z7d21vUKpkm
  53392. FRseTJIpgp7VkoGSQXAZ96Tlk0u8d2cx3Rz9MXANF5kM+Qw5GSoXtTBxVdUPrljhPS80m8+f9niF
  53393. wpN6cj5mj5wWEWCPnolvZ77gR1o7DJpni89Gxq44o/KnvObWhWszJHAiS8sIm7vI+AIpHb4gDEa/
  53394. a4ebsypmQjVGbKq6rfmYe+lQVRQxv7HaLe2ArWgk+2mr2HETMOZns4dA/Yl+8kPREd8vZS9kzl8U
  53395. ubG/Mb2HeFpZZYiq/FkySIbWTLkpS5XTdvN3JW1CHDiDTf2jX5t/Lax5Gw5CMZdjpPuKadUiDTSQ
  53396. MC6otOBttpSsvItO13D8xTiOZCXhTTmQzsmHhFhxAgMBAAGjgagwgaUwDwYDVR0TAQH/BAUwAwEB
  53397. /zBCBgNVHSAEOzA5MDcGByuBKwEBAQowLDAqBggrBgEFBQcCARYeaHR0cHM6Ly9yZXBvc2l0b3J5
  53398. Lmx1eHRydXN0Lmx1MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBT/GCh2+UgFLKGu8SsbK7JT
  53399. +Et8szAdBgNVHQ4EFgQU/xgodvlIBSyhrvErGyuyU/hLfLMwDQYJKoZIhvcNAQELBQADggIBAGoZ
  53400. FO1uecEsh9QNcH7X9njJCwROxLHOk3D+sFTAMs2ZMGQXvw/l4jP9BzZAcg4atmpZ1gDlaCDdLnIN
  53401. H2pkMSCEfUmmWjfrRcmF9dTHF5kH5ptV5AzoqbTOjFu1EVzPig4N1qx3gf4ynCSecs5U89BvolbW
  53402. 7MM3LGVYvlcAGvI1+ut7MV3CwRI9loGIlonBWVx65n9wNOeD4rHh4bhY79SV5GCc8JaXcozrhAIu
  53403. ZY+kt9J/Z93I055cqqmkoCUUBpvsT34tC38ddfEz2O3OuHVtPlu5mB0xDVbYQw8wkbIEa91WvpWA
  53404. VWe+2M2D2RjuLg+GLZKecBPs3lHJQ3gCpU3I+V/EkVhGFndadKpAvAefMLmx9xIX3eP/JEAdemrR
  53405. TxgKqpAd60Ae36EeRJIQmvKN4dFLRp7oRUKX6kWZ8+xm1QL68qZKJKrezrnK+T+Tb/mjuuqlPpmt
  53406. /f97mfVl7vBZKGfXkJWkE4SphMHozs51k2MavDzq1WQfLSoSOcbDWjLtR5EWDrw4wVDej8oqkDQc
  53407. 7kGUnF4ZLvhFSZl0kbAEb+MEWrGrKqv+x9CWttrhSmQGbmBNvUJO/3jaJMobtNeWOWyu8Q6qp31I
  53408. iyBMz2TWuJdGsE7RKlY6oJO9r4Ak4Ap+58rVyuiFVdw2KuGUaJPHZnJED4AhMmwlxyOAgwrr
  53409. -----END CERTIFICATE-----
  53410. TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1
  53411. =============================================
  53412. -----BEGIN CERTIFICATE-----
  53413. MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIxGDAWBgNVBAcT
  53414. D0dlYnplIC0gS29jYWVsaTFCMEAGA1UEChM5VHVya2l5ZSBCaWxpbXNlbCB2ZSBUZWtub2xvamlr
  53415. IEFyYXN0aXJtYSBLdXJ1bXUgLSBUVUJJVEFLMS0wKwYDVQQLEyRLYW11IFNlcnRpZmlrYXN5b24g
  53416. TWVya2V6aSAtIEthbXUgU00xNjA0BgNVBAMTLVRVQklUQUsgS2FtdSBTTSBTU0wgS29rIFNlcnRp
  53417. ZmlrYXNpIC0gU3VydW0gMTAeFw0xMzExMjUwODI1NTVaFw00MzEwMjUwODI1NTVaMIHSMQswCQYD
  53418. VQQGEwJUUjEYMBYGA1UEBxMPR2ViemUgLSBLb2NhZWxpMUIwQAYDVQQKEzlUdXJraXllIEJpbGlt
  53419. c2VsIHZlIFRla25vbG9qaWsgQXJhc3Rpcm1hIEt1cnVtdSAtIFRVQklUQUsxLTArBgNVBAsTJEth
  53420. bXUgU2VydGlmaWthc3lvbiBNZXJrZXppIC0gS2FtdSBTTTE2MDQGA1UEAxMtVFVCSVRBSyBLYW11
  53421. IFNNIFNTTCBLb2sgU2VydGlmaWthc2kgLSBTdXJ1bSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  53422. MIIBCgKCAQEAr3UwM6q7a9OZLBI3hNmNe5eA027n/5tQlT6QlVZC1xl8JoSNkvoBHToP4mQ4t4y8
  53423. 6Ij5iySrLqP1N+RAjhgleYN1Hzv/bKjFxlb4tO2KRKOrbEz8HdDc72i9z+SqzvBV96I01INrN3wc
  53424. wv61A+xXzry0tcXtAA9TNypN9E8Mg/uGz8v+jE69h/mniyFXnHrfA2eJLJ2XYacQuFWQfw4tJzh0
  53425. 3+f92k4S400VIgLI4OD8D62K18lUUMw7D8oWgITQUVbDjlZ/iSIzL+aFCr2lqBs23tPcLG07xxO9
  53426. WSMs5uWk99gL7eqQQESolbuT1dCANLZGeA4fAJNG4e7p+exPFwIDAQABo0IwQDAdBgNVHQ4EFgQU
  53427. ZT/HiobGPN08VFw1+DrtUgxHV8gwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJ
  53428. KoZIhvcNAQELBQADggEBACo/4fEyjq7hmFxLXs9rHmoJ0iKpEsdeV31zVmSAhHqT5Am5EM2fKifh
  53429. AHe+SMg1qIGf5LgsyX8OsNJLN13qudULXjS99HMpw+0mFZx+CFOKWI3QSyjfwbPfIPP54+M638yc
  53430. lNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4lzwDGrpDxpa5RXI4s6ehlj2R
  53431. e37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0j
  53432. q5Rm+K37DwhuJi1/FwcJsoz7UMCflo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM=
  53433. -----END CERTIFICATE-----
  53434. GDCA TrustAUTH R5 ROOT
  53435. ======================
  53436. -----BEGIN CERTIFICATE-----
  53437. MIIFiDCCA3CgAwIBAgIIfQmX/vBH6nowDQYJKoZIhvcNAQELBQAwYjELMAkGA1UEBhMCQ04xMjAw
  53438. BgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZIENPLixMVEQuMR8wHQYDVQQD
  53439. DBZHRENBIFRydXN0QVVUSCBSNSBST09UMB4XDTE0MTEyNjA1MTMxNVoXDTQwMTIzMTE1NTk1OVow
  53440. YjELMAkGA1UEBhMCQ04xMjAwBgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZ
  53441. IENPLixMVEQuMR8wHQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMIICIjANBgkqhkiG9w0B
  53442. AQEFAAOCAg8AMIICCgKCAgEA2aMW8Mh0dHeb7zMNOwZ+Vfy1YI92hhJCfVZmPoiC7XJjDp6L3TQs
  53443. AlFRwxn9WVSEyfFrs0yw6ehGXTjGoqcuEVe6ghWinI9tsJlKCvLriXBjTnnEt1u9ol2x8kECK62p
  53444. OqPseQrsXzrj/e+APK00mxqriCZ7VqKChh/rNYmDf1+uKU49tm7srsHwJ5uu4/Ts765/94Y9cnrr
  53445. pftZTqfrlYwiOXnhLQiPzLyRuEH3FMEjqcOtmkVEs7LXLM3GKeJQEK5cy4KOFxg2fZfmiJqwTTQJ
  53446. 9Cy5WmYqsBebnh52nUpmMUHfP/vFBu8btn4aRjb3ZGM74zkYI+dndRTVdVeSN72+ahsmUPI2JgaQ
  53447. xXABZG12ZuGR224HwGGALrIuL4xwp9E7PLOR5G62xDtw8mySlwnNR30YwPO7ng/Wi64HtloPzgsM
  53448. R6flPri9fcebNaBhlzpBdRfMK5Z3KpIhHtmVdiBnaM8Nvd/WHwlqmuLMc3GkL30SgLdTMEZeS1SZ
  53449. D2fJpcjyIMGC7J0R38IC+xo70e0gmu9lZJIQDSri3nDxGGeCjGHeuLzRL5z7D9Ar7Rt2ueQ5Vfj4
  53450. oR24qoAATILnsn8JuLwwoC8N9VKejveSswoAHQBUlwbgsQfZxw9cZX08bVlX5O2ljelAU58VS6Bx
  53451. 9hoh49pwBiFYFIeFd3mqgnkCAwEAAaNCMEAwHQYDVR0OBBYEFOLJQJ9NzuiaoXzPDj9lxSmIahlR
  53452. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQDRSVfg
  53453. p8xoWLoBDysZzY2wYUWsEe1jUGn4H3++Fo/9nesLqjJHdtJnJO29fDMylyrHBYZmDRd9FBUb1Ov9
  53454. H5r2XpdptxolpAqzkT9fNqyL7FeoPueBihhXOYV0GkLH6VsTX4/5COmSdI31R9KrO9b7eGZONn35
  53455. 6ZLpBN79SWP8bfsUcZNnL0dKt7n/HipzcEYwv1ryL3ml4Y0M2fmyYzeMN2WFcGpcWwlyua1jPLHd
  53456. +PwyvzeG5LuOmCd+uh8W4XAR8gPfJWIyJyYYMoSf/wA6E7qaTfRPuBRwIrHKK5DOKcFw9C+df/KQ
  53457. HtZa37dG/OaG+svgIHZ6uqbL9XzeYqWxi+7egmaKTjowHz+Ay60nugxe19CxVsp3cbK1daFQqUBD
  53458. F8Io2c9Si1vIY9RCPqAzekYu9wogRlR+ak8x8YF+QnQ4ZXMn7sZ8uI7XpTrXmKGcjBBV09tL7ECQ
  53459. 8s1uV9JiDnxXk7Gnbc2dg7sq5+W2O3FYrf3RRbxake5TFW/TRQl1brqQXR4EzzffHqhmsYzmIGrv
  53460. /EhOdJhCrylvLmrH+33RZjEizIYAfmaDDEL0vTSSwxrqT8p+ck0LcIymSLumoRT2+1hEmRSuqguT
  53461. aaApJUqlyyvdimYHFngVV3Eb7PVHhPOeMTd61X8kreS8/f3MboPoDKi3QWwH3b08hpcv0g==
  53462. -----END CERTIFICATE-----
  53463. TrustCor RootCert CA-1
  53464. ======================
  53465. -----BEGIN CERTIFICATE-----
  53466. MIIEMDCCAxigAwIBAgIJANqb7HHzA7AZMA0GCSqGSIb3DQEBCwUAMIGkMQswCQYDVQQGEwJQQTEP
  53467. MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
  53468. U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
  53469. dHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0IENBLTEwHhcNMTYwMjA0MTIzMjE2WhcNMjkx
  53470. MjMxMTcyMzE2WjCBpDELMAkGA1UEBhMCUEExDzANBgNVBAgMBlBhbmFtYTEUMBIGA1UEBwwLUGFu
  53471. YW1hIENpdHkxJDAiBgNVBAoMG1RydXN0Q29yIFN5c3RlbXMgUy4gZGUgUi5MLjEnMCUGA1UECwwe
  53472. VHJ1c3RDb3IgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MR8wHQYDVQQDDBZUcnVzdENvciBSb290Q2Vy
  53473. dCBDQS0xMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv463leLCJhJrMxnHQFgKq1mq
  53474. jQCj/IDHUHuO1CAmujIS2CNUSSUQIpidRtLByZ5OGy4sDjjzGiVoHKZaBeYei0i/mJZ0PmnK6bV4
  53475. pQa81QBeCQryJ3pS/C3Vseq0iWEk8xoT26nPUu0MJLq5nux+AHT6k61sKZKuUbS701e/s/OojZz0
  53476. JEsq1pme9J7+wH5COucLlVPat2gOkEz7cD+PSiyU8ybdY2mplNgQTsVHCJCZGxdNuWxu72CVEY4h
  53477. gLW9oHPY0LJ3xEXqWib7ZnZ2+AYfYW0PVcWDtxBWcgYHpfOxGgMFZA6dWorWhnAbJN7+KIor0Gqw
  53478. /Hqi3LJ5DotlDwIDAQABo2MwYTAdBgNVHQ4EFgQU7mtJPHo/DeOxCbeKyKsZn3MzUOcwHwYDVR0j
  53479. BBgwFoAU7mtJPHo/DeOxCbeKyKsZn3MzUOcwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  53480. AYYwDQYJKoZIhvcNAQELBQADggEBACUY1JGPE+6PHh0RU9otRCkZoB5rMZ5NDp6tPVxBb5UrJKF5
  53481. mDo4Nvu7Zp5I/5CQ7z3UuJu0h3U/IJvOcs+hVcFNZKIZBqEHMwwLKeXx6quj7LUKdJDHfXLy11yf
  53482. ke+Ri7fc7Waiz45mO7yfOgLgJ90WmMCV1Aqk5IGadZQ1nJBfiDcGrVmVCrDRZ9MZyonnMlo2HD6C
  53483. qFqTvsbQZJG2z9m2GM/bftJlo6bEjhcxwft+dtvTheNYsnd6djtsL1Ac59v2Z3kf9YKVmgenFK+P
  53484. 3CghZwnS1k1aHBkcjndcw5QkPTJrS37UeJSDvjdNzl/HHk484IkzlQsPpTLWPFp5LBk=
  53485. -----END CERTIFICATE-----
  53486. TrustCor RootCert CA-2
  53487. ======================
  53488. -----BEGIN CERTIFICATE-----
  53489. MIIGLzCCBBegAwIBAgIIJaHfyjPLWQIwDQYJKoZIhvcNAQELBQAwgaQxCzAJBgNVBAYTAlBBMQ8w
  53490. DQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5MSQwIgYDVQQKDBtUcnVzdENvciBT
  53491. eXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29yIENlcnRpZmljYXRlIEF1dGhvcml0
  53492. eTEfMB0GA1UEAwwWVHJ1c3RDb3IgUm9vdENlcnQgQ0EtMjAeFw0xNjAyMDQxMjMyMjNaFw0zNDEy
  53493. MzExNzI2MzlaMIGkMQswCQYDVQQGEwJQQTEPMA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5h
  53494. bWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3IgU3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5U
  53495. cnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0
  53496. IENBLTIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnIG7CKqJiJJWQdsg4foDSq8Gb
  53497. ZQWU9MEKENUCrO2fk8eHyLAnK0IMPQo+QVqedd2NyuCb7GgypGmSaIwLgQ5WoD4a3SwlFIIvl9Nk
  53498. RvRUqdw6VC0xK5mC8tkq1+9xALgxpL56JAfDQiDyitSSBBtlVkxs1Pu2YVpHI7TYabS3OtB0PAx1
  53499. oYxOdqHp2yqlO/rOsP9+aij9JxzIsekp8VduZLTQwRVtDr4uDkbIXvRR/u8OYzo7cbrPb1nKDOOb
  53500. XUm4TOJXsZiKQlecdu/vvdFoqNL0Cbt3Nb4lggjEFixEIFapRBF37120Hapeaz6LMvYHL1cEksr1
  53501. /p3C6eizjkxLAjHZ5DxIgif3GIJ2SDpxsROhOdUuxTTCHWKF3wP+TfSvPd9cW436cOGlfifHhi5q
  53502. jxLGhF5DUVCcGZt45vz27Ud+ez1m7xMTiF88oWP7+ayHNZ/zgp6kPwqcMWmLmaSISo5uZk3vFsQP
  53503. eSghYA2FFn3XVDjxklb9tTNMg9zXEJ9L/cb4Qr26fHMC4P99zVvh1Kxhe1fVSntb1IVYJ12/+Ctg
  53504. rKAmrhQhJ8Z3mjOAPF5GP/fDsaOGM8boXg25NSyqRsGFAnWAoOsk+xWq5Gd/bnc/9ASKL3x74xdh
  53505. 8N0JqSDIvgmk0H5Ew7IwSjiqqewYmgeCK9u4nBit2uBGF6zPXQIDAQABo2MwYTAdBgNVHQ4EFgQU
  53506. 2f4hQG6UnrybPZx9mCAZ5YwwYrIwHwYDVR0jBBgwFoAU2f4hQG6UnrybPZx9mCAZ5YwwYrIwDwYD
  53507. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQELBQADggIBAJ5Fngw7tu/h
  53508. Osh80QA9z+LqBrWyOrsGS2h60COXdKcs8AjYeVrXWoSK2BKaG9l9XE1wxaX5q+WjiYndAfrs3fnp
  53509. kpfbsEZC89NiqpX+MWcUaViQCqoL7jcjx1BRtPV+nuN79+TMQjItSQzL/0kMmx40/W5ulop5A7Zv
  53510. 2wnL/V9lFDfhOPXzYRZY5LVtDQsEGz9QLX+zx3oaFoBg+Iof6Rsqxvm6ARppv9JYx1RXCI/hOWB3
  53511. S6xZhBqI8d3LT3jX5+EzLfzuQfogsL7L9ziUwOHQhQ+77Sxzq+3+knYaZH9bDTMJBzN7Bj8RpFxw
  53512. PIXAz+OQqIN3+tvmxYxoZxBnpVIt8MSZj3+/0WvitUfW2dCFmU2Umw9Lje4AWkcdEQOsQRivh7dv
  53513. DDqPys/cA8GiCcjl/YBeyGBCARsaU1q7N6a3vLqE6R5sGtRk2tRD/pOLS/IseRYQ1JMLiI+h2IYU
  53514. RpFHmygk71dSTlxCnKr3Sewn6EAes6aJInKc9Q0ztFijMDvd1GpUk74aTfOTlPf8hAs/hCBcNANE
  53515. xdqtvArBAs8e5ZTZ845b2EzwnexhF7sUMlQMAimTHpKG9n/v55IFDlndmQguLvqcAFLTxWYp5KeX
  53516. RKQOKIETNcX2b2TmQcTVL8w0RSXPQQCWPUouwpaYT05KnJe32x+SMsj/D1Fu1uwJ
  53517. -----END CERTIFICATE-----
  53518. TrustCor ECA-1
  53519. ==============
  53520. -----BEGIN CERTIFICATE-----
  53521. MIIEIDCCAwigAwIBAgIJAISCLF8cYtBAMA0GCSqGSIb3DQEBCwUAMIGcMQswCQYDVQQGEwJQQTEP
  53522. MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
  53523. U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
  53524. dHkxFzAVBgNVBAMMDlRydXN0Q29yIEVDQS0xMB4XDTE2MDIwNDEyMzIzM1oXDTI5MTIzMTE3Mjgw
  53525. N1owgZwxCzAJBgNVBAYTAlBBMQ8wDQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5
  53526. MSQwIgYDVQQKDBtUcnVzdENvciBTeXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29y
  53527. IENlcnRpZmljYXRlIEF1dGhvcml0eTEXMBUGA1UEAwwOVHJ1c3RDb3IgRUNBLTEwggEiMA0GCSqG
  53528. SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDPj+ARtZ+odnbb3w9U73NjKYKtR8aja+3+XzP4Q1HpGjOR
  53529. MRegdMTUpwHmspI+ap3tDvl0mEDTPwOABoJA6LHip1GnHYMma6ve+heRK9jGrB6xnhkB1Zem6g23
  53530. xFUfJ3zSCNV2HykVh0A53ThFEXXQmqc04L/NyFIduUd+Dbi7xgz2c1cWWn5DkR9VOsZtRASqnKmc
  53531. p0yJF4OuowReUoCLHhIlERnXDH19MURB6tuvsBzvgdAsxZohmz3tQjtQJvLsznFhBmIhVE5/wZ0+
  53532. fyCMgMsq2JdiyIMzkX2woloPV+g7zPIlstR8L+xNxqE6FXrntl019fZISjZFZtS6mFjBAgMBAAGj
  53533. YzBhMB0GA1UdDgQWBBREnkj1zG1I1KBLf/5ZJC+Dl5mahjAfBgNVHSMEGDAWgBREnkj1zG1I1KBL
  53534. f/5ZJC+Dl5mahjAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsF
  53535. AAOCAQEABT41XBVwm8nHc2FvcivUwo/yQ10CzsSUuZQRg2dd4mdsdXa/uwyqNsatR5Nj3B5+1t4u
  53536. /ukZMjgDfxT2AHMsWbEhBuH7rBiVDKP/mZb3Kyeb1STMHd3BOuCYRLDE5D53sXOpZCz2HAF8P11F
  53537. hcCF5yWPldwX8zyfGm6wyuMdKulMY/okYWLW2n62HGz1Ah3UKt1VkOsqEUc8Ll50soIipX1TH0Xs
  53538. J5F95yIW6MBoNtjG8U+ARDL54dHRHareqKucBK+tIA5kmE2la8BIWJZpTdwHjFGTot+fDz2LYLSC
  53539. jaoITmJF4PkL0uDgPFveXHEnJcLmA4GLEFPjx1WitJ/X5g==
  53540. -----END CERTIFICATE-----
  53541. SSL.com Root Certification Authority RSA
  53542. ========================================
  53543. -----BEGIN CERTIFICATE-----
  53544. MIIF3TCCA8WgAwIBAgIIeyyb0xaAMpkwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UEBhMCVVMxDjAM
  53545. BgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24x
  53546. MTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBSU0EwHhcNMTYw
  53547. MjEyMTczOTM5WhcNNDEwMjEyMTczOTM5WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  53548. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NM
  53549. LmNvbSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTCCAiIwDQYJKoZIhvcNAQEBBQAD
  53550. ggIPADCCAgoCggIBAPkP3aMrfcvQKv7sZ4Wm5y4bunfh4/WvpOz6Sl2RxFdHaxh3a3by/ZPkPQ/C
  53551. Fp4LZsNWlJ4Xg4XOVu/yFv0AYvUiCVToZRdOQbngT0aXqhvIuG5iXmmxX9sqAn78bMrzQdjt0Oj8
  53552. P2FI7bADFB0QDksZ4LtO7IZl/zbzXmcCC52GVWH9ejjt/uIZALdvoVBidXQ8oPrIJZK0bnoix/ge
  53553. oeOy3ZExqysdBP+lSgQ36YWkMyv94tZVNHwZpEpox7Ko07fKoZOI68GXvIz5HdkihCR0xwQ9aqkp
  53554. k8zruFvh/l8lqjRYyMEjVJ0bmBHDOJx+PYZspQ9AhnwC9FwCTyjLrnGfDzrIM/4RJTXq/LrFYD3Z
  53555. fBjVsqnTdXgDciLKOsMf7yzlLqn6niy2UUb9rwPW6mBo6oUWNmuF6R7As93EJNyAKoFBbZQ+yODJ
  53556. gUEAnl6/f8UImKIYLEJAs/lvOCdLToD0PYFH4Ih86hzOtXVcUS4cK38acijnALXRdMbX5J+tB5O2
  53557. UzU1/Dfkw/ZdFr4hc96SCvigY2q8lpJqPvi8ZVWb3vUNiSYE/CUapiVpy8JtynziWV+XrOvvLsi8
  53558. 1xtZPCvM8hnIk2snYxnP/Okm+Mpxm3+T/jRnhE6Z6/yzeAkzcLpmpnbtG3PrGqUNxCITIJRWCk4s
  53559. bE6x/c+cCbqiM+2HAgMBAAGjYzBhMB0GA1UdDgQWBBTdBAkHovV6fVJTEpKV7jiAJQ2mWTAPBgNV
  53560. HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFN0ECQei9Xp9UlMSkpXuOIAlDaZZMA4GA1UdDwEB/wQE
  53561. AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAIBgRlCn7Jp0cHh5wYfGVcpNxJK1ok1iOMq8bs3AD/CUr
  53562. dIWQPXhq9LmLpZc7tRiRux6n+UBbkflVma8eEdBcHadm47GUBwwyOabqG7B52B2ccETjit3E+ZUf
  53563. ijhDPwGFpUenPUayvOUiaPd7nNgsPgohyC0zrL/FgZkxdMF1ccW+sfAjRfSda/wZY52jvATGGAsl
  53564. u1OJD7OAUN5F7kR/q5R4ZJjT9ijdh9hwZXT7DrkT66cPYakylszeu+1jTBi7qUD3oFRuIIhxdRjq
  53565. erQ0cuAjJ3dctpDqhiVAq+8zD8ufgr6iIPv2tS0a5sKFsXQP+8hlAqRSAUfdSSLBv9jra6x+3uxj
  53566. MxW3IwiPxg+NQVrdjsW5j+VFP3jbutIbQLH+cU0/4IGiul607BXgk90IH37hVZkLId6Tngr75qNJ
  53567. vTYw/ud3sqB1l7UtgYgXZSD32pAAn8lSzDLKNXz1PQ/YK9f1JmzJBjSWFupwWRoyeXkLtoh/D1JI
  53568. Pb9s2KJELtFOt3JY04kTlf5Eq/jXixtunLwsoFvVagCvXzfh1foQC5ichucmj87w7G6KVwuA406y
  53569. wKBjYZC6VWg3dGq2ktufoYYitmUnDuy2n0Jg5GfCtdpBC8TTi2EbvPofkSvXRAdeuims2cXp71NI
  53570. WuuA8ShYIc2wBlX7Jz9TkHCpBB5XJ7k=
  53571. -----END CERTIFICATE-----
  53572. SSL.com Root Certification Authority ECC
  53573. ========================================
  53574. -----BEGIN CERTIFICATE-----
  53575. MIICjTCCAhSgAwIBAgIIdebfy8FoW6gwCgYIKoZIzj0EAwIwfDELMAkGA1UEBhMCVVMxDjAMBgNV
  53576. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xMTAv
  53577. BgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEy
  53578. MTgxNDAzWhcNNDEwMjEyMTgxNDAzWjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAO
  53579. BgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNv
  53580. bSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuBBAAiA2IA
  53581. BEVuqVDEpiM2nl8ojRfLliJkP9x6jh3MCLOicSS6jkm5BBtHllirLZXI7Z4INcgn64mMU1jrYor+
  53582. 8FsPazFSY0E7ic3s7LaNGdM0B9y7xgZ/wkWV7Mt/qCPgCemB+vNH06NjMGEwHQYDVR0OBBYEFILR
  53583. hXMw5zUE044CkvvlpNHEIejNMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUgtGFczDnNQTT
  53584. jgKS++Wk0cQh6M0wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2cAMGQCMG/n61kRpGDPYbCW
  53585. e+0F+S8Tkdzt5fxQaxFGRrMcIQBiu77D5+jNB5n5DQtdcj7EqgIwH7y6C+IwJPt8bYBVCpk+gA0z
  53586. 5Wajs6O7pdWLjwkspl1+4vAHCGht0nxpbl/f5Wpl
  53587. -----END CERTIFICATE-----
  53588. SSL.com EV Root Certification Authority RSA R2
  53589. ==============================================
  53590. -----BEGIN CERTIFICATE-----
  53591. MIIF6zCCA9OgAwIBAgIIVrYpzTS8ePYwDQYJKoZIhvcNAQELBQAwgYIxCzAJBgNVBAYTAlVTMQ4w
  53592. DAYDVQQIDAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9u
  53593. MTcwNQYDVQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIy
  53594. MB4XDTE3MDUzMTE4MTQzN1oXDTQyMDUzMDE4MTQzN1owgYIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQI
  53595. DAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMTcwNQYD
  53596. VQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIyMIICIjAN
  53597. BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAjzZlQOHWTcDXtOlG2mvqM0fNTPl9fb69LT3w23jh
  53598. hqXZuglXaO1XPqDQCEGD5yhBJB/jchXQARr7XnAjssufOePPxU7Gkm0mxnu7s9onnQqG6YE3Bf7w
  53599. cXHswxzpY6IXFJ3vG2fThVUCAtZJycxa4bH3bzKfydQ7iEGonL3Lq9ttewkfokxykNorCPzPPFTO
  53600. Zw+oz12WGQvE43LrrdF9HSfvkusQv1vrO6/PgN3B0pYEW3p+pKk8OHakYo6gOV7qd89dAFmPZiw+
  53601. B6KjBSYRaZfqhbcPlgtLyEDhULouisv3D5oi53+aNxPN8k0TayHRwMwi8qFG9kRpnMphNQcAb9Zh
  53602. CBHqurj26bNg5U257J8UZslXWNvNh2n4ioYSA0e/ZhN2rHd9NCSFg83XqpyQGp8hLH94t2S42Oim
  53603. 9HizVcuE0jLEeK6jj2HdzghTreyI/BXkmg3mnxp3zkyPuBQVPWKchjgGAGYS5Fl2WlPAApiiECto
  53604. RHuOec4zSnaqW4EWG7WK2NAAe15itAnWhmMOpgWVSbooi4iTsjQc2KRVbrcc0N6ZVTsj9CLg+Slm
  53605. JuwgUHfbSguPvuUCYHBBXtSuUDkiFCbLsjtzdFVHB3mBOagwE0TlBIqulhMlQg+5U8Sb/M3kHN48
  53606. +qvWBkofZ6aYMBzdLNvcGJVXZsb/XItW9XcCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNV
  53607. HSMEGDAWgBT5YLvU49U09rj1BoAlp3PbRmmonjAdBgNVHQ4EFgQU+WC71OPVNPa49QaAJadz20Zp
  53608. qJ4wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBWs47LCp1Jjr+kxJG7ZhcFUZh1
  53609. ++VQLHqe8RT6q9OKPv+RKY9ji9i0qVQBDb6Thi/5Sm3HXvVX+cpVHBK+Rw82xd9qt9t1wkclf7nx
  53610. Y/hoLVUE0fKNsKTPvDxeH3jnpaAgcLAExbf3cqfeIg29MyVGjGSSJuM+LmOW2puMPfgYCdcDzH2G
  53611. guDKBAdRUNf/ktUM79qGn5nX67evaOI5JpS6aLe/g9Pqemc9YmeuJeVy6OLk7K4S9ksrPJ/psEDz
  53612. OFSz/bdoyNrGj1E8svuR3Bznm53htw1yj+KkxKl4+esUrMZDBcJlOSgYAsOCsp0FvmXtll9ldDz7
  53613. CTUue5wT/RsPXcdtgTpWD8w74a8CLyKsRspGPKAcTNZEtF4uXBVmCeEmKf7GUmG6sXP/wwyc5Wxq
  53614. lD8UykAWlYTzWamsX0xhk23RO8yilQwipmdnRC652dKKQbNmC1r7fSOl8hqw/96bg5Qu0T/fkreR
  53615. rwU7ZcegbLHNYhLDkBvjJc40vG93drEQw/cFGsDWr3RiSBd3kmmQYRzelYB0VI8YHMPzA9C/pEN1
  53616. hlMYegouCRw2n5H9gooiS9EOUCXdywMMF8mDAAhONU2Ki+3wApRmLER/y5UnlhetCTCstnEXbosX
  53617. 9hwJ1C07mKVx01QT2WDz9UtmT/rx7iASjbSsV7FFY6GsdqnC+w==
  53618. -----END CERTIFICATE-----
  53619. SSL.com EV Root Certification Authority ECC
  53620. ===========================================
  53621. -----BEGIN CERTIFICATE-----
  53622. MIIClDCCAhqgAwIBAgIILCmcWxbtBZUwCgYIKoZIzj0EAwIwfzELMAkGA1UEBhMCVVMxDjAMBgNV
  53623. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xNDAy
  53624. BgNVBAMMK1NTTC5jb20gRVYgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYw
  53625. MjEyMTgxNTIzWhcNNDEwMjEyMTgxNTIzWjB/MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  53626. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjE0MDIGA1UEAwwrU1NM
  53627. LmNvbSBFViBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuB
  53628. BAAiA2IABKoSR5CYG/vvw0AHgyBO8TCCogbR8pKGYfL2IWjKAMTH6kMAVIbc/R/fALhBYlzccBYy
  53629. 3h+Z1MzFB8gIH2EWB1E9fVwHU+M1OIzfzZ/ZLg1KthkuWnBaBu2+8KGwytAJKaNjMGEwHQYDVR0O
  53630. BBYEFFvKXuXe0oGqzagtZFG22XKbl+ZPMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUW8pe
  53631. 5d7SgarNqC1kUbbZcpuX5k8wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2gAMGUCMQCK5kCJ
  53632. N+vp1RPZytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZgh5Mm
  53633. m7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg==
  53634. -----END CERTIFICATE-----
  53635. <?php
  53636. if (PHP_SAPI !== 'cli') {
  53637. echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
  53638. }
  53639. setlocale(LC_ALL, 'C');
  53640. require __DIR__.'/../src/bootstrap.php';
  53641. use Composer\Factory;
  53642. use Composer\XdebugHandler;
  53643. use Composer\Console\Application;
  53644. error_reporting(-1);
  53645. // Create output for XdebugHandler and Application
  53646. $output = Factory::createOutput();
  53647. $xdebug = new XdebugHandler($output);
  53648. $xdebug->check();
  53649. unset($xdebug);
  53650. if (function_exists('ini_set')) {
  53651. @ini_set('display_errors', 1);
  53652. $memoryInBytes = function ($value) {
  53653. $unit = strtolower(substr($value, -1, 1));
  53654. $value = (int) $value;
  53655. switch($unit) {
  53656. case 'g':
  53657. $value *= 1024;
  53658. // no break (cumulative multiplier)
  53659. case 'm':
  53660. $value *= 1024;
  53661. // no break (cumulative multiplier)
  53662. case 'k':
  53663. $value *= 1024;
  53664. }
  53665. return $value;
  53666. };
  53667. $memoryLimit = trim(ini_get('memory_limit'));
  53668. // Increase memory_limit if it is lower than 1.5GB
  53669. if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1536) {
  53670. @ini_set('memory_limit', '1536M');
  53671. }
  53672. // Set user defined memory limit
  53673. if ($memoryLimit = getenv('COMPOSER_MEMORY_LIMIT')) {
  53674. @ini_set('memory_limit', $memoryLimit);
  53675. }
  53676. unset($memoryInBytes, $memoryLimit);
  53677. }
  53678. putenv('COMPOSER_BINARY='.realpath($_SERVER['argv'][0]));
  53679. // run the command application
  53680. $application = new Application();
  53681. $application->run(null, $output);
  53682. Copyright (c) Nils Adermann, Jordi Boggiano
  53683. Permission is hereby granted, free of charge, to any person obtaining a copy
  53684. of this software and associated documentation files (the "Software"), to deal
  53685. in the Software without restriction, including without limitation the rights
  53686. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  53687. copies of the Software, and to permit persons to whom the Software is furnished
  53688. to do so, subject to the following conditions:
  53689. The above copyright notice and this permission notice shall be included in all
  53690. copies or substantial portions of the Software.
  53691. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  53692. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  53693. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  53694. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  53695. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  53696. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  53697. THE SOFTWARE.
  53698. Êä*«QÔš1TkD3:ÇQ‘è° ���GBMB