composer.phar 1.9 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968659696597065971659726597365974659756597665977659786597965980659816598265983659846598565986659876598865989659906599165992659936599465995659966599765998659996600066001660026600366004660056600666007660086600966010660116601266013660146601566016660176601866019660206602166022660236602466025660266602766028660296603066031660326603366034660356603666037660386603966040660416604266043660446604566046660476604866049660506605166052660536605466055660566605766058660596606066061660626606366064660656606666067660686606966070660716607266073660746607566076660776607866079660806608166082660836608466085660866608766088660896609066091660926609366094660956609666097660986609966100661016610266103661046610566106661076610866109661106611166112661136611466115661166611766118661196612066121661226612366124661256612666127661286612966130661316613266133661346613566136661376613866139661406614166142661436614466145661466614766148661496615066151661526615366154661556615666157661586615966160661616616266163661646616566166661676616866169661706617166172661736617466175661766617766178661796618066181661826618366184661856618666187661886618966190661916619266193661946619566196661976619866199662006620166202662036620466205662066620766208662096621066211662126621366214662156621666217662186621966220662216622266223662246622566226662276622866229662306623166232662336623466235662366623766238662396624066241662426624366244662456624666247662486624966250662516625266253662546625566256662576625866259662606626166262662636626466265662666626766268662696627066271662726627366274662756627666277662786627966280662816628266283662846628566286662876628866289662906629166292662936629466295662966629766298662996630066301663026630366304663056630666307663086630966310663116631266313663146631566316663176631866319663206632166322663236632466325663266632766328663296633066331663326633366334663356633666337663386633966340663416634266343663446634566346663476634866349663506635166352663536635466355663566635766358663596636066361663626636366364663656636666367663686636966370663716637266373663746637566376663776637866379663806638166382663836638466385663866638766388663896639066391663926639366394663956639666397663986639966400664016640266403664046640566406664076640866409664106641166412664136641466415664166641766418664196642066421664226642366424664256642666427664286642966430664316643266433664346643566436664376643866439664406644166442664436644466445664466644766448664496645066451664526645366454664556645666457664586645966460664616646266463664646646566466664676646866469664706647166472664736647466475664766647766478664796648066481664826648366484664856648666487664886648966490664916649266493664946649566496664976649866499665006650166502665036650466505665066650766508665096651066511665126651366514665156651666517665186651966520665216652266523665246652566526665276652866529665306653166532665336653466535665366653766538665396654066541665426654366544665456654666547665486654966550665516655266553665546655566556665576655866559665606656166562665636656466565665666656766568665696657066571665726657366574665756657666577665786657966580665816658266583665846658566586665876658866589665906659166592665936659466595665966659766598665996660066601666026660366604666056660666607666086660966610666116661266613666146661566616666176661866619666206662166622666236662466625666266662766628666296663066631666326663366634666356663666637666386663966640666416664266643666446664566646666476664866649666506665166652666536665466655666566665766658666596666066661666626666366664666656666666667666686666966670666716667266673666746667566676666776667866679666806668166682666836668466685666866668766688666896669066691666926669366694666956669666697666986669966700667016670266703667046670566706667076670866709667106671166712667136671466715667166671766718667196672066721667226672366724667256672666727667286672966730667316673266733667346673566736667376673866739667406674166742667436674466745667466674766748667496675066751667526675366754667556675666757667586675966760667616676266763667646676566766667676676866769667706677166772667736677466775667766677766778667796678066781667826678366784667856678666787667886678966790667916679266793667946679566796667976679866799668006680166802668036680466805668066680766808668096681066811668126681366814668156681666817668186681966820668216682266823668246682566826668276682866829668306683166832668336683466835668366683766838668396684066841668426684366844668456684666847668486684966850668516685266853668546685566856668576685866859668606686166862668636686466865668666686766868668696687066871668726687366874668756687666877668786687966880668816688266883668846688566886668876688866889668906689166892668936689466895668966689766898668996690066901669026690366904669056690666907669086690966910669116691266913669146691566916669176691866919669206692166922669236692466925669266692766928669296693066931669326693366934669356693666937669386693966940669416694266943669446694566946669476694866949669506695166952669536695466955669566695766958669596696066961669626696366964669656696666967669686696966970669716697266973669746697566976669776697866979669806698166982669836698466985669866698766988669896699066991669926699366994669956699666997669986699967000670016700267003670046700567006670076700867009670106701167012670136701467015670166701767018670196702067021670226702367024670256702667027670286702967030670316703267033670346703567036670376703867039670406704167042670436704467045670466704767048670496705067051670526705367054670556705667057670586705967060670616706267063670646706567066670676706867069670706707167072670736707467075670766707767078670796708067081670826708367084670856708667087670886708967090670916709267093670946709567096670976709867099671006710167102671036710467105671066710767108671096711067111671126711367114671156711667117671186711967120671216712267123671246712567126671276712867129671306713167132671336713467135671366713767138671396714067141671426714367144671456714667147671486714967150671516715267153671546715567156671576715867159671606716167162671636716467165671666716767168671696717067171671726717367174671756717667177671786717967180671816718267183671846718567186671876718867189671906719167192671936719467195671966719767198671996720067201672026720367204672056720667207672086720967210672116721267213672146721567216672176721867219672206722167222672236722467225672266722767228672296723067231672326723367234672356723667237672386723967240672416724267243672446724567246672476724867249672506725167252672536725467255672566725767258672596726067261672626726367264672656726667267672686726967270672716727267273672746727567276672776727867279672806728167282672836728467285672866728767288672896729067291672926729367294672956729667297672986729967300673016730267303673046730567306673076730867309673106731167312673136731467315673166731767318673196732067321673226732367324673256732667327673286732967330673316733267333673346733567336673376733867339673406734167342673436734467345673466734767348673496735067351673526735367354673556735667357673586735967360673616736267363673646736567366673676736867369673706737167372673736737467375673766737767378673796738067381673826738367384673856738667387673886738967390673916739267393673946739567396673976739867399674006740167402674036740467405674066740767408674096741067411674126741367414674156741667417674186741967420674216742267423674246742567426674276742867429674306743167432674336743467435674366743767438674396744067441674426744367444674456744667447674486744967450674516745267453674546745567456674576745867459674606746167462674636746467465674666746767468674696747067471674726747367474674756747667477674786747967480674816748267483674846748567486674876748867489674906749167492674936749467495674966749767498674996750067501675026750367504675056750667507675086750967510675116751267513675146751567516675176751867519675206752167522675236752467525675266752767528675296753067531675326753367534675356753667537675386753967540675416754267543675446754567546675476754867549675506755167552675536755467555675566755767558675596756067561675626756367564675656756667567675686756967570675716757267573675746757567576675776757867579675806758167582675836758467585675866758767588675896759067591675926759367594675956759667597675986759967600676016760267603676046760567606676076760867609676106761167612676136761467615676166761767618676196762067621676226762367624676256762667627676286762967630676316763267633676346763567636676376763867639676406764167642676436764467645676466764767648676496765067651676526765367654676556765667657676586765967660676616766267663676646766567666676676766867669676706767167672676736767467675676766767767678676796768067681676826768367684676856768667687676886768967690676916769267693676946769567696676976769867699677006770167702677036770467705677066770767708677096771067711677126771367714677156771667717677186771967720677216772267723677246772567726677276772867729677306773167732677336773467735677366773767738677396774067741677426774367744677456774667747677486774967750677516775267753677546775567756677576775867759677606776167762677636776467765677666776767768677696777067771677726777367774677756777667777677786777967780677816778267783677846778567786677876778867789677906779167792677936779467795677966779767798677996780067801678026780367804678056780667807678086780967810678116781267813678146781567816678176781867819678206782167822678236782467825678266782767828678296783067831678326783367834678356783667837678386783967840678416784267843678446784567846678476784867849678506785167852678536785467855678566785767858678596786067861678626786367864678656786667867678686786967870678716787267873678746787567876678776787867879678806788167882678836788467885678866788767888678896789067891678926789367894678956789667897678986789967900679016790267903679046790567906679076790867909679106791167912679136791467915679166791767918679196792067921679226792367924679256792667927679286792967930679316793267933679346793567936679376793867939679406794167942679436794467945679466794767948679496795067951679526795367954679556795667957679586795967960679616796267963679646796567966679676796867969679706797167972679736797467975679766797767978679796798067981679826798367984679856798667987679886798967990679916799267993679946799567996679976799867999680006800168002680036800468005680066800768008680096801068011680126801368014680156801668017680186801968020680216802268023680246802568026680276802868029680306803168032680336803468035680366803768038680396804068041680426804368044680456804668047680486804968050680516805268053680546805568056680576805868059680606806168062680636806468065680666806768068680696807068071680726807368074680756807668077680786807968080680816808268083680846808568086680876808868089680906809168092680936809468095680966809768098680996810068101681026810368104681056810668107681086810968110681116811268113681146811568116681176811868119681206812168122681236812468125681266812768128681296813068131681326813368134681356813668137681386813968140681416814268143681446814568146681476814868149681506815168152681536815468155681566815768158681596816068161681626816368164681656816668167681686816968170681716817268173681746817568176681776817868179681806818168182681836818468185681866818768188681896819068191681926819368194681956819668197681986819968200682016820268203682046820568206682076820868209682106821168212682136821468215682166821768218682196822068221682226822368224682256822668227682286822968230682316823268233682346823568236682376823868239682406824168242682436824468245682466824768248682496825068251682526825368254682556825668257682586825968260682616826268263682646826568266682676826868269682706827168272682736827468275682766827768278682796828068281682826828368284682856828668287682886828968290682916829268293682946829568296682976829868299683006830168302683036830468305683066830768308683096831068311683126831368314683156831668317683186831968320683216832268323683246832568326683276832868329683306833168332683336833468335683366833768338683396834068341683426834368344683456834668347683486834968350683516835268353683546835568356683576835868359683606836168362683636836468365683666836768368683696837068371683726837368374683756837668377683786837968380683816838268383683846838568386683876838868389683906839168392683936839468395683966839768398683996840068401684026840368404684056840668407684086840968410684116841268413684146841568416684176841868419684206842168422684236842468425684266842768428684296843068431684326843368434684356843668437684386843968440684416844268443684446844568446684476844868449684506845168452684536845468455684566845768458684596846068461684626846368464684656846668467684686846968470684716847268473684746847568476684776847868479684806848168482684836848468485684866848768488684896849068491684926849368494684956849668497684986849968500685016850268503685046850568506685076850868509685106851168512685136851468515685166851768518685196852068521685226852368524685256852668527685286852968530685316853268533685346853568536685376853868539685406854168542685436854468545685466854768548685496855068551685526855368554685556855668557685586855968560685616856268563685646856568566685676856868569685706857168572685736857468575685766857768578685796858068581685826858368584685856858668587685886858968590685916859268593685946859568596685976859868599686006860168602686036860468605686066860768608686096861068611686126861368614686156861668617686186861968620686216862268623686246862568626686276862868629686306863168632686336863468635686366863768638686396864068641686426864368644686456864668647686486864968650686516865268653686546865568656686576865868659686606866168662686636866468665686666866768668686696867068671686726867368674686756867668677686786867968680686816868268683686846868568686686876868868689686906869168692686936869468695686966869768698686996870068701687026870368704687056870668707687086870968710687116871268713687146871568716687176871868719687206872168722687236872468725687266872768728687296873068731687326873368734687356873668737687386873968740687416874268743687446874568746687476874868749687506875168752687536875468755687566875768758687596876068761687626876368764687656876668767687686876968770687716877268773687746877568776687776877868779687806878168782687836878468785687866878768788687896879068791687926879368794687956879668797687986879968800688016880268803688046880568806688076880868809688106881168812688136881468815688166881768818688196882068821688226882368824688256882668827688286882968830688316883268833688346883568836688376883868839688406884168842688436884468845688466884768848688496885068851688526885368854688556885668857688586885968860688616886268863688646886568866688676886868869688706887168872688736887468875688766887768878688796888068881688826888368884688856888668887688886888968890688916889268893688946889568896688976889868899689006890168902689036890468905689066890768908689096891068911689126891368914689156891668917689186891968920689216892268923689246892568926689276892868929689306893168932689336893468935689366893768938689396894068941689426894368944689456894668947689486894968950689516895268953689546895568956689576895868959689606896168962689636896468965689666896768968689696897068971689726897368974689756897668977689786897968980689816898268983689846898568986689876898868989689906899168992689936899468995689966899768998689996900069001690026900369004690056900669007690086900969010690116901269013690146901569016690176901869019690206902169022690236902469025690266902769028690296903069031690326903369034690356903669037690386903969040690416904269043690446904569046690476904869049690506905169052690536905469055690566905769058690596906069061690626906369064690656906669067690686906969070690716907269073690746907569076690776907869079690806908169082690836908469085690866908769088690896909069091690926909369094690956909669097690986909969100691016910269103691046910569106691076910869109691106911169112691136911469115691166911769118691196912069121691226912369124691256912669127691286912969130691316913269133691346913569136691376913869139691406914169142691436914469145691466914769148691496915069151691526915369154691556915669157691586915969160691616916269163691646916569166691676916869169691706917169172691736917469175691766917769178691796918069181691826918369184691856918669187691886918969190691916919269193691946919569196691976919869199692006920169202692036920469205692066920769208692096921069211692126921369214692156921669217692186921969220692216922269223692246922569226692276922869229692306923169232692336923469235692366923769238692396924069241692426924369244692456924669247692486924969250692516925269253692546925569256692576925869259692606926169262692636926469265692666926769268692696927069271692726927369274692756927669277692786927969280692816928269283692846928569286692876928869289692906929169292692936929469295692966929769298692996930069301693026930369304693056930669307693086930969310693116931269313693146931569316693176931869319693206932169322693236932469325693266932769328693296933069331693326933369334693356933669337693386933969340693416934269343693446934569346693476934869349693506935169352693536935469355693566935769358693596936069361693626936369364693656936669367693686936969370693716937269373693746937569376693776937869379693806938169382693836938469385693866938769388693896939069391693926939369394693956939669397693986939969400694016940269403694046940569406694076940869409694106941169412694136941469415694166941769418694196942069421694226942369424694256942669427694286942969430694316943269433694346943569436694376943869439694406944169442694436944469445694466944769448694496945069451694526945369454694556945669457694586945969460694616946269463694646946569466694676946869469694706947169472694736947469475694766947769478694796948069481694826948369484694856948669487694886948969490694916949269493694946949569496694976949869499695006950169502695036950469505695066950769508695096951069511695126951369514695156951669517695186951969520695216952269523695246952569526695276952869529695306953169532695336953469535695366953769538695396954069541695426954369544695456954669547695486954969550695516955269553695546955569556695576955869559695606956169562695636956469565695666956769568695696957069571695726957369574695756957669577695786957969580695816958269583695846958569586695876958869589695906959169592695936959469595695966959769598695996960069601696026960369604696056960669607696086960969610696116961269613696146961569616696176961869619696206962169622696236962469625696266962769628696296963069631696326963369634696356963669637696386963969640696416964269643696446964569646696476964869649696506965169652696536965469655696566965769658696596966069661696626966369664696656966669667696686966969670696716967269673696746967569676696776967869679696806968169682696836968469685696866968769688696896969069691696926969369694696956969669697696986969969700697016970269703697046970569706697076970869709697106971169712697136971469715697166971769718697196972069721697226972369724697256972669727697286972969730697316973269733697346973569736697376973869739697406974169742697436974469745697466974769748697496975069751697526975369754697556975669757697586975969760697616976269763697646976569766697676976869769697706977169772697736977469775697766977769778697796978069781697826978369784697856978669787697886978969790697916979269793697946979569796697976979869799698006980169802698036980469805698066980769808698096981069811698126981369814698156981669817698186981969820698216982269823698246982569826698276982869829698306983169832698336983469835698366983769838698396984069841698426984369844698456984669847698486984969850698516985269853698546985569856698576985869859698606986169862698636986469865698666986769868698696987069871698726987369874698756987669877698786987969880698816988269883698846988569886698876988869889698906989169892698936989469895698966989769898698996990069901699026990369904699056990669907699086990969910699116991269913699146991569916699176991869919699206992169922699236992469925699266992769928699296993069931699326993369934699356993669937699386993969940699416994269943699446994569946699476994869949699506995169952699536995469955699566995769958699596996069961699626996369964699656996669967699686996969970699716997269973699746997569976699776997869979699806998169982699836998469985699866998769988699896999069991699926999369994699956999669997699986999970000700017000270003700047000570006700077000870009700107001170012700137001470015700167001770018700197002070021700227002370024700257002670027700287002970030700317003270033700347003570036700377003870039700407004170042700437004470045700467004770048700497005070051700527005370054700557005670057700587005970060700617006270063700647006570066700677006870069700707007170072700737007470075700767007770078700797008070081700827008370084700857008670087700887008970090700917009270093700947009570096700977009870099701007010170102701037010470105701067010770108701097011070111701127011370114701157011670117701187011970120701217012270123701247012570126701277012870129701307013170132701337013470135701367013770138701397014070141701427014370144701457014670147701487014970150701517015270153701547015570156701577015870159701607016170162701637016470165701667016770168701697017070171701727017370174701757017670177701787017970180701817018270183701847018570186701877018870189701907019170192701937019470195701967019770198701997020070201702027020370204702057020670207702087020970210702117021270213702147021570216702177021870219702207022170222702237022470225702267022770228702297023070231702327023370234702357023670237702387023970240702417024270243702447024570246702477024870249702507025170252702537025470255702567025770258702597026070261702627026370264702657026670267702687026970270702717027270273702747027570276702777027870279702807028170282702837028470285702867028770288702897029070291702927029370294702957029670297702987029970300703017030270303703047030570306703077030870309703107031170312703137031470315703167031770318703197032070321703227032370324703257032670327703287032970330703317033270333703347033570336703377033870339703407034170342703437034470345703467034770348703497035070351703527035370354703557035670357703587035970360703617036270363703647036570366703677036870369703707037170372703737037470375703767037770378703797038070381703827038370384703857038670387703887038970390703917039270393703947039570396703977039870399704007040170402704037040470405704067040770408704097041070411704127041370414704157041670417704187041970420704217042270423704247042570426704277042870429704307043170432704337043470435704367043770438704397044070441704427044370444704457044670447704487044970450704517045270453704547045570456704577045870459704607046170462704637046470465704667046770468704697047070471704727047370474704757047670477704787047970480704817048270483704847048570486704877048870489704907049170492704937049470495704967049770498704997050070501705027050370504705057050670507705087050970510705117051270513705147051570516705177051870519705207052170522705237052470525705267052770528705297053070531705327053370534705357053670537705387053970540705417054270543705447054570546705477054870549705507055170552705537055470555705567055770558705597056070561705627056370564705657056670567705687056970570705717057270573705747057570576705777057870579705807058170582705837058470585705867058770588705897059070591705927059370594705957059670597705987059970600706017060270603706047060570606706077060870609706107061170612706137061470615706167061770618706197062070621706227062370624706257062670627706287062970630706317063270633706347063570636706377063870639706407064170642706437064470645706467064770648706497065070651706527065370654706557065670657706587065970660706617066270663706647066570666706677066870669706707067170672706737067470675706767067770678706797068070681706827068370684706857068670687706887068970690706917069270693706947069570696706977069870699707007070170702707037070470705707067070770708707097071070711707127071370714707157071670717707187071970720707217072270723707247072570726707277072870729707307073170732707337073470735707367073770738707397074070741707427074370744707457074670747707487074970750707517075270753707547075570756707577075870759707607076170762707637076470765707667076770768707697077070771707727077370774707757077670777707787077970780707817078270783707847078570786707877078870789707907079170792707937079470795707967079770798707997080070801708027080370804708057080670807708087080970810708117081270813708147081570816708177081870819708207082170822708237082470825708267082770828708297083070831708327083370834708357083670837708387083970840708417084270843708447084570846708477084870849708507085170852708537085470855708567085770858708597086070861708627086370864708657086670867708687086970870708717087270873708747087570876708777087870879708807088170882708837088470885708867088770888708897089070891708927089370894708957089670897708987089970900709017090270903709047090570906709077090870909709107091170912709137091470915709167091770918709197092070921709227092370924709257092670927709287092970930709317093270933709347093570936709377093870939709407094170942709437094470945709467094770948709497095070951709527095370954709557095670957709587095970960709617096270963709647096570966709677096870969709707097170972709737097470975709767097770978709797098070981709827098370984709857098670987709887098970990709917099270993709947099570996709977099870999710007100171002710037100471005710067100771008710097101071011710127101371014710157101671017710187101971020710217102271023710247102571026710277102871029710307103171032710337103471035710367103771038710397104071041710427104371044710457104671047710487104971050710517105271053710547105571056710577105871059710607106171062710637106471065710667106771068710697107071071710727107371074710757107671077710787107971080710817108271083710847108571086710877108871089710907109171092710937109471095710967109771098710997110071101711027110371104711057110671107711087110971110711117111271113711147111571116711177111871119711207112171122711237112471125711267112771128711297113071131711327113371134711357113671137711387113971140711417114271143711447114571146711477114871149711507115171152711537115471155711567115771158711597116071161711627116371164711657116671167711687116971170711717117271173711747117571176711777117871179711807118171182711837118471185711867118771188711897119071191711927119371194711957119671197711987119971200712017120271203712047120571206712077120871209712107121171212712137121471215712167121771218712197122071221712227122371224712257122671227712287122971230712317123271233712347123571236712377123871239712407124171242712437124471245712467124771248712497125071251712527125371254712557125671257712587125971260712617126271263712647126571266712677126871269712707127171272712737127471275712767127771278712797128071281712827128371284712857128671287712887128971290712917129271293712947129571296712977129871299713007130171302713037130471305713067130771308713097131071311713127131371314713157131671317713187131971320713217132271323713247132571326713277132871329713307133171332713337133471335713367133771338713397134071341713427134371344713457134671347713487134971350713517135271353713547135571356713577135871359713607136171362713637136471365713667136771368713697137071371713727137371374713757137671377713787137971380713817138271383713847138571386713877138871389713907139171392713937139471395713967139771398713997140071401714027140371404714057140671407714087140971410714117141271413714147141571416714177141871419714207142171422714237142471425714267142771428714297143071431714327143371434714357143671437714387143971440714417144271443714447144571446714477144871449714507145171452714537145471455714567145771458714597146071461714627146371464714657146671467714687146971470714717147271473714747147571476714777147871479714807148171482714837148471485714867148771488714897149071491714927149371494714957149671497714987149971500715017150271503715047150571506715077150871509715107151171512715137151471515715167151771518715197152071521715227152371524715257152671527715287152971530715317153271533715347153571536715377153871539715407154171542715437154471545715467154771548715497155071551715527155371554715557155671557715587155971560715617156271563715647156571566715677156871569715707157171572715737157471575715767157771578715797158071581715827158371584715857158671587715887158971590715917159271593715947159571596715977159871599716007160171602716037160471605716067160771608716097161071611716127161371614716157161671617716187161971620716217162271623716247162571626716277162871629716307163171632716337163471635716367163771638716397164071641716427164371644716457164671647716487164971650716517165271653716547165571656716577165871659716607166171662716637166471665716667166771668716697167071671716727167371674716757167671677716787167971680716817168271683716847168571686716877168871689716907169171692716937169471695716967169771698716997170071701717027170371704717057170671707717087170971710717117171271713717147171571716717177171871719717207172171722717237172471725717267172771728717297173071731717327173371734717357173671737717387173971740717417174271743717447174571746717477174871749717507175171752717537175471755717567175771758717597176071761717627176371764717657176671767717687176971770717717177271773717747177571776717777177871779717807178171782717837178471785717867178771788717897179071791717927179371794717957179671797717987179971800718017180271803718047180571806718077180871809718107181171812718137181471815718167181771818718197182071821718227182371824718257182671827718287182971830718317183271833718347183571836718377183871839718407184171842718437184471845718467184771848718497185071851718527185371854718557185671857718587185971860718617186271863718647186571866718677186871869718707187171872718737187471875718767187771878718797188071881718827188371884718857188671887718887188971890718917189271893718947189571896718977189871899719007190171902719037190471905719067190771908719097191071911719127191371914719157191671917719187191971920719217192271923719247192571926719277192871929719307193171932719337193471935719367193771938719397194071941719427194371944719457194671947719487194971950719517195271953719547195571956719577195871959719607196171962719637196471965719667196771968719697197071971719727197371974719757197671977719787197971980719817198271983719847198571986719877198871989719907199171992719937199471995719967199771998719997200072001720027200372004720057200672007720087200972010720117201272013720147201572016720177201872019720207202172022720237202472025720267202772028720297203072031720327203372034720357203672037720387203972040720417204272043720447204572046720477204872049720507205172052720537205472055720567205772058720597206072061720627206372064720657206672067720687206972070720717207272073720747207572076720777207872079720807208172082720837208472085720867208772088720897209072091720927209372094720957209672097720987209972100721017210272103721047210572106721077210872109721107211172112721137211472115721167211772118721197212072121721227212372124721257212672127721287212972130721317213272133721347213572136721377213872139721407214172142721437214472145721467214772148721497215072151721527215372154721557215672157721587215972160721617216272163721647216572166721677216872169721707217172172721737217472175721767217772178721797218072181721827218372184721857218672187721887218972190721917219272193721947219572196721977219872199722007220172202722037220472205722067220772208722097221072211722127221372214722157221672217722187221972220722217222272223722247222572226722277222872229722307223172232722337223472235722367223772238722397224072241722427224372244722457224672247722487224972250722517225272253722547225572256722577225872259722607226172262722637226472265722667226772268722697227072271722727227372274722757227672277722787227972280722817228272283722847228572286722877228872289722907229172292722937229472295722967229772298722997230072301723027230372304723057230672307723087230972310723117231272313723147231572316723177231872319723207232172322723237232472325723267232772328723297233072331723327233372334723357233672337723387233972340723417234272343723447234572346723477234872349723507235172352723537235472355723567235772358723597236072361723627236372364723657236672367723687236972370723717237272373723747237572376723777237872379723807238172382723837238472385723867238772388723897239072391723927239372394723957239672397723987239972400724017240272403724047240572406724077240872409724107241172412724137241472415724167241772418724197242072421724227242372424724257242672427724287242972430724317243272433724347243572436724377243872439724407244172442724437244472445724467244772448724497245072451724527245372454724557245672457724587245972460724617246272463724647246572466724677246872469724707247172472724737247472475724767247772478724797248072481724827248372484724857248672487724887248972490724917249272493724947249572496724977249872499725007250172502725037250472505725067250772508725097251072511725127251372514725157251672517725187251972520725217252272523725247252572526725277252872529725307253172532725337253472535725367253772538725397254072541725427254372544725457254672547725487254972550725517255272553725547255572556725577255872559725607256172562725637256472565725667256772568725697257072571725727257372574725757257672577725787257972580725817258272583725847258572586725877258872589725907259172592725937259472595725967259772598725997260072601726027260372604726057260672607726087260972610726117261272613726147261572616726177261872619726207262172622726237262472625726267262772628726297263072631726327263372634726357263672637726387263972640726417264272643726447264572646726477264872649726507265172652726537265472655726567265772658726597266072661726627266372664726657266672667726687266972670726717267272673726747267572676726777267872679726807268172682726837268472685726867268772688726897269072691726927269372694726957269672697726987269972700727017270272703727047270572706727077270872709727107271172712727137271472715727167271772718727197272072721727227272372724727257272672727727287272972730727317273272733727347273572736727377273872739727407274172742727437274472745727467274772748727497275072751727527275372754727557275672757727587275972760727617276272763727647276572766727677276872769727707277172772727737277472775727767277772778727797278072781727827278372784727857278672787727887278972790727917279272793727947279572796727977279872799728007280172802728037280472805728067280772808728097281072811728127281372814728157281672817728187281972820728217282272823728247282572826728277282872829728307283172832728337283472835728367283772838728397284072841728427284372844728457284672847728487284972850728517285272853728547285572856728577285872859728607286172862728637286472865728667286772868728697287072871728727287372874728757287672877728787287972880728817288272883728847288572886728877288872889728907289172892728937289472895728967289772898728997290072901729027290372904729057290672907729087290972910729117291272913729147291572916729177291872919729207292172922729237292472925729267292772928729297293072931729327293372934729357293672937729387293972940729417294272943729447294572946729477294872949729507295172952729537295472955729567295772958729597296072961729627296372964729657296672967729687296972970729717297272973729747297572976729777297872979729807298172982729837298472985729867298772988729897299072991729927299372994729957299672997729987299973000730017300273003730047300573006730077300873009730107301173012730137301473015730167301773018730197302073021730227302373024730257302673027730287302973030730317303273033730347303573036730377303873039730407304173042730437304473045730467304773048730497305073051730527305373054730557305673057730587305973060730617306273063730647306573066730677306873069730707307173072730737307473075730767307773078730797308073081730827308373084730857308673087730887308973090730917309273093730947309573096730977309873099731007310173102731037310473105731067310773108731097311073111731127311373114731157311673117731187311973120731217312273123731247312573126731277312873129731307313173132731337313473135731367313773138731397314073141731427314373144731457314673147731487314973150731517315273153731547315573156731577315873159731607316173162731637316473165731667316773168731697317073171731727317373174731757317673177731787317973180731817318273183731847318573186731877318873189731907319173192731937319473195731967319773198731997320073201732027320373204732057320673207732087320973210732117321273213732147321573216732177321873219732207322173222732237322473225732267322773228732297323073231732327323373234732357323673237732387323973240732417324273243732447324573246732477324873249732507325173252732537325473255732567325773258732597326073261732627326373264732657326673267732687326973270732717327273273732747327573276732777327873279732807328173282732837328473285732867328773288732897329073291732927329373294732957329673297732987329973300733017330273303733047330573306733077330873309733107331173312733137331473315733167331773318733197332073321733227332373324733257332673327733287332973330733317333273333733347333573336733377333873339733407334173342733437334473345733467334773348733497335073351733527335373354733557335673357733587335973360733617336273363733647336573366733677336873369733707337173372733737337473375733767337773378733797338073381733827338373384733857338673387733887338973390733917339273393733947339573396733977339873399734007340173402734037340473405734067340773408734097341073411734127341373414734157341673417734187341973420734217342273423734247342573426734277342873429734307343173432734337343473435734367343773438734397344073441734427344373444734457344673447734487344973450734517345273453734547345573456734577345873459734607346173462734637346473465734667346773468734697347073471734727347373474734757347673477734787347973480734817348273483734847348573486734877348873489734907349173492734937349473495734967349773498734997350073501735027350373504735057350673507735087350973510735117351273513735147351573516735177351873519735207352173522735237352473525735267352773528735297353073531735327353373534735357353673537735387353973540735417354273543735447354573546735477354873549735507355173552735537355473555735567355773558735597356073561735627356373564735657356673567735687356973570735717357273573735747357573576735777357873579735807358173582735837358473585735867358773588735897359073591735927359373594735957359673597735987359973600736017360273603736047360573606736077360873609736107361173612736137361473615736167361773618736197362073621736227362373624736257362673627736287362973630736317363273633736347363573636736377363873639736407364173642736437364473645736467364773648736497365073651736527365373654736557365673657736587365973660736617366273663736647366573666736677366873669736707367173672736737367473675736767367773678736797368073681736827368373684736857368673687736887368973690736917369273693736947369573696736977369873699737007370173702737037370473705737067370773708737097371073711737127371373714737157371673717737187371973720737217372273723737247372573726737277372873729737307373173732737337373473735737367373773738737397374073741737427374373744737457374673747737487374973750737517375273753737547375573756737577375873759737607376173762737637376473765737667376773768737697377073771737727377373774737757377673777737787377973780737817378273783737847378573786737877378873789737907379173792737937379473795737967379773798737997380073801738027380373804738057380673807738087380973810738117381273813738147381573816738177381873819738207382173822738237382473825738267382773828738297383073831738327383373834738357383673837738387383973840738417384273843738447384573846738477384873849738507385173852738537385473855738567385773858738597386073861738627386373864738657386673867738687386973870738717387273873738747387573876738777387873879738807388173882738837388473885738867388773888738897389073891738927389373894738957389673897738987389973900739017390273903739047390573906739077390873909739107391173912739137391473915739167391773918739197392073921739227392373924739257392673927739287392973930739317393273933739347393573936739377393873939739407394173942739437394473945739467394773948739497395073951739527395373954739557395673957739587395973960739617396273963739647396573966739677396873969739707397173972739737397473975739767397773978739797398073981739827398373984739857398673987739887398973990739917399273993739947399573996739977399873999740007400174002740037400474005740067400774008740097401074011740127401374014740157401674017740187401974020740217402274023740247402574026740277402874029740307403174032740337403474035740367403774038740397404074041740427404374044740457404674047740487404974050740517405274053740547405574056740577405874059740607406174062740637406474065740667406774068740697407074071740727407374074740757407674077740787407974080740817408274083740847408574086740877408874089740907409174092740937409474095740967409774098740997410074101741027410374104741057410674107741087410974110741117411274113741147411574116741177411874119741207412174122741237412474125741267412774128741297413074131741327413374134741357413674137741387413974140741417414274143741447414574146741477414874149741507415174152741537415474155741567415774158741597416074161741627416374164741657416674167741687416974170741717417274173741747417574176741777417874179741807418174182741837418474185741867418774188741897419074191741927419374194741957419674197741987419974200742017420274203742047420574206742077420874209742107421174212742137421474215742167421774218742197422074221742227422374224742257422674227742287422974230742317423274233742347423574236742377423874239742407424174242742437424474245742467424774248742497425074251742527425374254742557425674257742587425974260742617426274263742647426574266742677426874269742707427174272742737427474275742767427774278742797428074281742827428374284742857428674287742887428974290742917429274293742947429574296742977429874299743007430174302743037430474305743067430774308743097431074311743127431374314743157431674317743187431974320743217432274323743247432574326743277432874329743307433174332743337433474335743367433774338743397434074341743427434374344743457434674347743487434974350743517435274353743547435574356743577435874359743607436174362743637436474365743667436774368743697437074371743727437374374743757437674377743787437974380743817438274383743847438574386743877438874389743907439174392743937439474395743967439774398743997440074401744027440374404744057440674407744087440974410744117441274413744147441574416744177441874419744207442174422744237442474425744267442774428744297443074431744327443374434744357443674437744387443974440744417444274443744447444574446744477444874449744507445174452744537445474455744567445774458744597446074461744627446374464744657446674467744687446974470744717447274473744747447574476744777447874479744807448174482744837448474485744867448774488744897449074491744927449374494744957449674497744987449974500745017450274503745047450574506745077450874509745107451174512745137451474515745167451774518745197452074521745227452374524745257452674527745287452974530745317453274533745347453574536745377453874539745407454174542745437454474545745467454774548745497455074551745527455374554745557455674557745587455974560745617456274563745647456574566745677456874569745707457174572745737457474575745767457774578745797458074581745827458374584745857458674587745887458974590745917459274593745947459574596745977459874599746007460174602746037460474605746067460774608746097461074611746127461374614746157461674617746187461974620746217462274623746247462574626746277462874629746307463174632746337463474635746367463774638746397464074641746427464374644746457464674647746487464974650746517465274653746547465574656746577465874659746607466174662746637466474665746667466774668746697467074671746727467374674746757467674677746787467974680746817468274683746847468574686746877468874689746907469174692746937469474695746967469774698746997470074701747027470374704747057470674707747087470974710747117471274713747147471574716747177471874719747207472174722747237472474725747267472774728747297473074731747327473374734747357473674737747387473974740747417474274743747447474574746747477474874749747507475174752747537475474755747567475774758747597476074761747627476374764747657476674767747687476974770747717477274773747747477574776747777477874779747807478174782747837478474785747867478774788747897479074791747927479374794747957479674797747987479974800748017480274803748047480574806748077480874809748107481174812748137481474815748167481774818748197482074821748227482374824748257482674827748287482974830748317483274833748347483574836748377483874839748407484174842748437484474845748467484774848748497485074851748527485374854748557485674857748587485974860748617486274863748647486574866748677486874869748707487174872748737487474875748767487774878748797488074881748827488374884748857488674887748887488974890748917489274893748947489574896748977489874899749007490174902749037490474905749067490774908749097491074911749127491374914749157491674917749187491974920749217492274923749247492574926749277492874929749307493174932749337493474935749367493774938749397494074941749427494374944749457494674947749487494974950749517495274953749547495574956749577495874959749607496174962749637496474965749667496774968749697497074971749727497374974749757497674977749787497974980749817498274983749847498574986749877498874989749907499174992749937499474995749967499774998749997500075001750027500375004750057500675007750087500975010750117501275013750147501575016750177501875019750207502175022750237502475025750267502775028750297503075031750327503375034750357503675037750387503975040750417504275043750447504575046750477504875049750507505175052750537505475055750567505775058750597506075061750627506375064750657506675067750687506975070750717507275073750747507575076750777507875079750807508175082750837508475085750867508775088750897509075091750927509375094750957509675097750987509975100751017510275103751047510575106751077510875109751107511175112751137511475115751167511775118751197512075121751227512375124751257512675127751287512975130751317513275133751347513575136751377513875139751407514175142751437514475145751467514775148751497515075151751527515375154751557515675157751587515975160751617516275163751647516575166751677516875169751707517175172751737517475175751767517775178751797518075181751827518375184751857518675187751887518975190751917519275193751947519575196751977519875199752007520175202752037520475205752067520775208752097521075211752127521375214752157521675217752187521975220752217522275223752247522575226752277522875229752307523175232752337523475235752367523775238752397524075241752427524375244752457524675247752487524975250752517525275253752547525575256752577525875259752607526175262752637526475265752667526775268752697527075271752727527375274752757527675277752787527975280752817528275283752847528575286752877528875289752907529175292752937529475295752967529775298752997530075301753027530375304753057530675307753087530975310753117531275313753147531575316753177531875319753207532175322753237532475325753267532775328753297533075331753327533375334753357533675337753387533975340753417534275343753447534575346753477534875349753507535175352753537535475355753567535775358753597536075361753627536375364753657536675367753687536975370753717537275373753747537575376753777537875379753807538175382753837538475385753867538775388753897539075391753927539375394753957539675397753987539975400754017540275403754047540575406754077540875409754107541175412754137541475415754167541775418754197542075421754227542375424754257542675427754287542975430754317543275433754347543575436754377543875439754407544175442754437544475445754467544775448754497545075451754527545375454754557545675457754587545975460754617546275463754647546575466754677546875469754707547175472754737547475475754767547775478754797548075481754827548375484754857548675487754887548975490754917549275493754947549575496754977549875499755007550175502755037550475505755067550775508755097551075511755127551375514755157551675517755187551975520755217552275523755247552575526755277552875529755307553175532755337553475535755367553775538755397554075541755427554375544755457554675547755487554975550755517555275553755547555575556755577555875559755607556175562755637556475565755667556775568755697557075571755727557375574755757557675577755787557975580755817558275583755847558575586755877558875589755907559175592755937559475595755967559775598755997560075601756027560375604756057560675607756087560975610756117561275613756147561575616756177561875619756207562175622756237562475625756267562775628756297563075631756327563375634756357563675637756387563975640756417564275643756447564575646756477564875649756507565175652756537565475655756567565775658756597566075661756627566375664756657566675667756687566975670756717567275673756747567575676756777567875679756807568175682756837568475685756867568775688756897569075691756927569375694756957569675697756987569975700757017570275703757047570575706757077570875709757107571175712757137571475715757167571775718757197572075721757227572375724757257572675727757287572975730757317573275733757347573575736757377573875739757407574175742757437574475745757467574775748757497575075751757527575375754757557575675757757587575975760757617576275763757647576575766757677576875769757707577175772757737577475775757767577775778757797578075781757827578375784757857578675787757887578975790757917579275793757947579575796757977579875799758007580175802758037580475805758067580775808758097581075811758127581375814758157581675817758187581975820758217582275823758247582575826758277582875829758307583175832758337583475835758367583775838758397584075841758427584375844758457584675847758487584975850758517585275853758547585575856758577585875859758607586175862758637586475865758667586775868758697587075871758727587375874758757587675877758787587975880758817588275883758847588575886758877588875889758907589175892758937589475895758967589775898758997590075901759027590375904759057590675907759087590975910759117591275913759147591575916759177591875919759207592175922759237592475925759267592775928759297593075931759327593375934759357593675937759387593975940759417594275943759447594575946759477594875949759507595175952759537595475955759567595775958759597596075961759627596375964759657596675967759687596975970759717597275973759747597575976759777597875979759807598175982759837598475985759867598775988759897599075991759927599375994759957599675997759987599976000760017600276003760047600576006760077600876009760107601176012760137601476015760167601776018760197602076021760227602376024760257602676027760287602976030760317603276033760347603576036760377603876039760407604176042760437604476045760467604776048760497605076051760527605376054760557605676057760587605976060760617606276063760647606576066760677606876069760707607176072760737607476075760767607776078760797608076081760827608376084760857608676087760887608976090760917609276093760947609576096760977609876099761007610176102761037610476105761067610776108761097611076111761127611376114761157611676117761187611976120761217612276123761247612576126761277612876129761307613176132761337613476135761367613776138761397614076141761427614376144761457614676147761487614976150761517615276153761547615576156761577615876159761607616176162761637616476165761667616776168761697617076171761727617376174761757617676177761787617976180761817618276183761847618576186761877618876189761907619176192761937619476195761967619776198761997620076201762027620376204762057620676207762087620976210762117621276213762147621576216762177621876219762207622176222762237622476225762267622776228762297623076231762327623376234762357623676237762387623976240762417624276243762447624576246762477624876249762507625176252762537625476255762567625776258762597626076261762627626376264762657626676267762687626976270762717627276273762747627576276762777627876279762807628176282762837628476285762867628776288762897629076291762927629376294762957629676297762987629976300763017630276303763047630576306763077630876309763107631176312763137631476315763167631776318763197632076321763227632376324763257632676327763287632976330763317633276333763347633576336763377633876339763407634176342763437634476345763467634776348763497635076351763527635376354763557635676357763587635976360763617636276363763647636576366763677636876369763707637176372763737637476375763767637776378763797638076381763827638376384763857638676387763887638976390763917639276393763947639576396763977639876399764007640176402764037640476405764067640776408764097641076411764127641376414764157641676417764187641976420764217642276423764247642576426764277642876429764307643176432764337643476435764367643776438764397644076441764427644376444764457644676447764487644976450764517645276453764547645576456764577645876459764607646176462764637646476465764667646776468764697647076471764727647376474764757647676477764787647976480764817648276483764847648576486764877648876489764907649176492764937649476495764967649776498764997650076501765027650376504765057650676507765087650976510765117651276513765147651576516765177651876519765207652176522765237652476525765267652776528765297653076531765327653376534765357653676537765387653976540765417654276543765447654576546765477654876549765507655176552765537655476555765567655776558765597656076561765627656376564765657656676567765687656976570765717657276573765747657576576765777657876579765807658176582765837658476585765867658776588765897659076591765927659376594765957659676597765987659976600766017660276603766047660576606766077660876609766107661176612766137661476615766167661776618766197662076621766227662376624766257662676627766287662976630766317663276633766347663576636766377663876639766407664176642766437664476645766467664776648766497665076651766527665376654766557665676657766587665976660766617666276663766647666576666766677666876669766707667176672766737667476675766767667776678766797668076681766827668376684766857668676687766887668976690766917669276693766947669576696766977669876699767007670176702767037670476705767067670776708767097671076711767127671376714767157671676717767187671976720767217672276723767247672576726767277672876729767307673176732767337673476735767367673776738767397674076741767427674376744767457674676747767487674976750767517675276753767547675576756767577675876759767607676176762767637676476765767667676776768767697677076771767727677376774767757677676777767787677976780767817678276783767847678576786767877678876789767907679176792767937679476795767967679776798767997680076801768027680376804768057680676807768087680976810768117681276813768147681576816768177681876819768207682176822768237682476825768267682776828768297683076831768327683376834768357683676837768387683976840768417684276843768447684576846768477684876849768507685176852768537685476855768567685776858768597686076861768627686376864768657686676867768687686976870768717687276873768747687576876768777687876879768807688176882768837688476885768867688776888768897689076891768927689376894768957689676897768987689976900769017690276903769047690576906769077690876909769107691176912769137691476915769167691776918769197692076921769227692376924769257692676927769287692976930769317693276933769347693576936769377693876939769407694176942769437694476945769467694776948769497695076951769527695376954769557695676957769587695976960769617696276963769647696576966769677696876969769707697176972769737697476975769767697776978769797698076981769827698376984769857698676987769887698976990769917699276993769947699576996769977699876999770007700177002770037700477005770067700777008770097701077011770127701377014770157701677017770187701977020770217702277023770247702577026770277702877029770307703177032770337703477035770367703777038770397704077041770427704377044770457704677047770487704977050770517705277053770547705577056770577705877059770607706177062770637706477065770667706777068770697707077071770727707377074770757707677077770787707977080770817708277083770847708577086770877708877089770907709177092770937709477095770967709777098770997710077101771027710377104771057710677107771087710977110771117711277113771147711577116771177711877119771207712177122771237712477125771267712777128771297713077131771327713377134771357713677137771387713977140771417714277143771447714577146771477714877149771507715177152771537715477155771567715777158771597716077161771627716377164771657716677167771687716977170771717717277173771747717577176771777717877179771807718177182771837718477185771867718777188771897719077191771927719377194771957719677197771987719977200772017720277203772047720577206772077720877209772107721177212772137721477215772167721777218772197722077221772227722377224772257722677227772287722977230772317723277233772347723577236772377723877239772407724177242772437724477245772467724777248772497725077251772527725377254772557725677257772587725977260772617726277263772647726577266772677726877269772707727177272772737727477275772767727777278772797728077281772827728377284772857728677287772887728977290772917729277293772947729577296772977729877299773007730177302773037730477305773067730777308773097731077311773127731377314773157731677317773187731977320773217732277323773247732577326773277732877329773307733177332773337733477335773367733777338773397734077341773427734377344773457734677347773487734977350773517735277353773547735577356773577735877359773607736177362773637736477365773667736777368773697737077371773727737377374773757737677377773787737977380773817738277383773847738577386773877738877389773907739177392773937739477395773967739777398773997740077401774027740377404774057740677407774087740977410774117741277413774147741577416774177741877419774207742177422774237742477425774267742777428774297743077431774327743377434774357743677437774387743977440774417744277443774447744577446774477744877449774507745177452774537745477455774567745777458774597746077461774627746377464774657746677467774687746977470774717747277473774747747577476774777747877479774807748177482774837748477485774867748777488774897749077491774927749377494774957749677497774987749977500775017750277503775047750577506775077750877509775107751177512775137751477515775167751777518775197752077521775227752377524775257752677527775287752977530775317753277533775347753577536775377753877539775407754177542775437754477545775467754777548775497755077551775527755377554775557755677557775587755977560775617756277563775647756577566775677756877569775707757177572775737757477575775767757777578775797758077581775827758377584775857758677587775887758977590775917759277593775947759577596775977759877599776007760177602776037760477605776067760777608776097761077611776127761377614776157761677617776187761977620776217762277623776247762577626776277762877629776307763177632776337763477635776367763777638776397764077641776427764377644776457764677647776487764977650776517765277653776547765577656776577765877659776607766177662776637766477665776667766777668776697767077671776727767377674776757767677677776787767977680776817768277683776847768577686776877768877689776907769177692776937769477695776967769777698776997770077701777027770377704777057770677707777087770977710777117771277713777147771577716777177771877719777207772177722777237772477725777267772777728777297773077731777327773377734777357773677737777387773977740777417774277743777447774577746777477774877749777507775177752777537775477755777567775777758777597776077761777627776377764777657776677767777687776977770777717777277773777747777577776777777777877779777807778177782777837778477785777867778777788777897779077791777927779377794777957779677797777987779977800778017780277803778047780577806778077780877809778107781177812778137781477815778167781777818778197782077821778227782377824778257782677827778287782977830778317783277833778347783577836778377783877839778407784177842778437784477845778467784777848778497785077851778527785377854778557785677857778587785977860778617786277863778647786577866778677786877869778707787177872778737787477875778767787777878778797788077881778827788377884778857788677887778887788977890778917789277893778947789577896778977789877899779007790177902779037790477905779067790777908779097791077911779127791377914779157791677917779187791977920779217792277923779247792577926779277792877929779307793177932779337793477935779367793777938779397794077941779427794377944779457794677947779487794977950779517795277953779547795577956779577795877959779607796177962779637796477965779667796777968779697797077971779727797377974779757797677977779787797977980779817798277983779847798577986779877798877989779907799177992779937799477995779967799777998779997800078001780027800378004780057800678007780087800978010780117801278013780147801578016780177801878019780207802178022780237802478025780267802778028780297803078031780327803378034780357803678037780387803978040780417804278043780447804578046780477804878049780507805178052780537805478055780567805778058780597806078061780627806378064780657806678067780687806978070780717807278073780747807578076780777807878079780807808178082780837808478085780867808778088780897809078091780927809378094780957809678097780987809978100781017810278103781047810578106781077810878109781107811178112781137811478115781167811778118781197812078121781227812378124781257812678127781287812978130781317813278133781347813578136781377813878139781407814178142781437814478145781467814778148781497815078151781527815378154781557815678157781587815978160781617816278163781647816578166781677816878169781707817178172781737817478175781767817778178781797818078181781827818378184781857818678187781887818978190781917819278193781947819578196781977819878199782007820178202782037820478205782067820778208782097821078211782127821378214782157821678217782187821978220782217822278223782247822578226782277822878229782307823178232782337823478235782367823778238782397824078241782427824378244782457824678247782487824978250782517825278253782547825578256782577825878259782607826178262782637826478265782667826778268782697827078271782727827378274782757827678277782787827978280782817828278283782847828578286782877828878289782907829178292782937829478295782967829778298782997830078301783027830378304783057830678307783087830978310783117831278313783147831578316783177831878319783207832178322783237832478325783267832778328783297833078331783327833378334783357833678337783387833978340783417834278343783447834578346783477834878349783507835178352783537835478355783567835778358783597836078361783627836378364783657836678367783687836978370783717837278373783747837578376783777837878379783807838178382783837838478385783867838778388783897839078391783927839378394783957839678397783987839978400784017840278403784047840578406784077840878409784107841178412784137841478415784167841778418784197842078421784227842378424784257842678427784287842978430784317843278433784347843578436784377843878439784407844178442784437844478445784467844778448784497845078451784527845378454784557845678457784587845978460784617846278463784647846578466784677846878469784707847178472784737847478475784767847778478784797848078481784827848378484784857848678487784887848978490784917849278493784947849578496784977849878499785007850178502785037850478505785067850778508785097851078511785127851378514785157851678517785187851978520785217852278523785247852578526785277852878529785307853178532785337853478535785367853778538785397854078541785427854378544785457854678547785487854978550785517855278553785547855578556785577855878559785607856178562785637856478565785667856778568785697857078571785727857378574785757857678577785787857978580785817858278583785847858578586785877858878589785907859178592785937859478595785967859778598785997860078601786027860378604786057860678607786087860978610786117861278613786147861578616786177861878619786207862178622786237862478625786267862778628786297863078631786327863378634786357863678637786387863978640786417864278643786447864578646786477864878649786507865178652786537865478655786567865778658786597866078661786627866378664786657866678667786687866978670786717867278673786747867578676786777867878679786807868178682786837868478685786867868778688786897869078691786927869378694786957869678697786987869978700787017870278703787047870578706787077870878709787107871178712787137871478715787167871778718787197872078721787227872378724787257872678727787287872978730787317873278733787347873578736787377873878739787407874178742787437874478745787467874778748787497875078751787527875378754787557875678757787587875978760787617876278763787647876578766787677876878769787707877178772787737877478775787767877778778787797878078781787827878378784787857878678787787887878978790787917879278793787947879578796787977879878799788007880178802788037880478805788067880778808788097881078811788127881378814788157881678817788187881978820788217882278823788247882578826788277882878829788307883178832788337883478835788367883778838788397884078841788427884378844788457884678847788487884978850788517885278853788547885578856788577885878859788607886178862788637886478865788667886778868788697887078871788727887378874788757887678877788787887978880788817888278883788847888578886788877888878889788907889178892788937889478895788967889778898788997890078901789027890378904789057890678907789087890978910789117891278913789147891578916789177891878919789207892178922789237892478925789267892778928789297893078931789327893378934789357893678937789387893978940789417894278943789447894578946789477894878949789507895178952789537895478955789567895778958789597896078961789627896378964789657896678967789687896978970789717897278973789747897578976789777897878979789807898178982789837898478985789867898778988789897899078991789927899378994789957899678997789987899979000790017900279003790047900579006790077900879009790107901179012790137901479015790167901779018790197902079021790227902379024790257902679027790287902979030790317903279033790347903579036790377903879039790407904179042790437904479045790467904779048790497905079051790527905379054790557905679057790587905979060790617906279063790647906579066790677906879069790707907179072790737907479075790767907779078790797908079081790827908379084790857908679087790887908979090790917909279093790947909579096790977909879099791007910179102791037910479105791067910779108791097911079111791127911379114791157911679117791187911979120791217912279123791247912579126791277912879129791307913179132791337913479135791367913779138791397914079141791427914379144791457914679147791487914979150791517915279153791547915579156791577915879159791607916179162791637916479165791667916779168791697917079171791727917379174791757917679177791787917979180791817918279183791847918579186791877918879189791907919179192791937919479195791967919779198791997920079201792027920379204792057920679207792087920979210792117921279213792147921579216792177921879219792207922179222792237922479225792267922779228792297923079231792327923379234792357923679237792387923979240792417924279243792447924579246792477924879249792507925179252792537925479255792567925779258792597926079261792627926379264792657926679267792687926979270792717927279273792747927579276792777927879279792807928179282792837928479285792867928779288792897929079291792927929379294792957929679297792987929979300793017930279303793047930579306793077930879309793107931179312793137931479315793167931779318793197932079321793227932379324793257932679327793287932979330793317933279333793347933579336793377933879339793407934179342793437934479345793467934779348793497935079351793527935379354793557935679357793587935979360793617936279363793647936579366793677936879369793707937179372793737937479375793767937779378793797938079381793827938379384793857938679387793887938979390793917939279393793947939579396793977939879399794007940179402794037940479405794067940779408794097941079411794127941379414794157941679417794187941979420794217942279423794247942579426794277942879429794307943179432794337943479435794367943779438794397944079441794427944379444794457944679447794487944979450794517945279453794547945579456794577945879459794607946179462794637946479465794667946779468794697947079471794727947379474794757947679477794787947979480794817948279483794847948579486794877948879489794907949179492794937949479495794967949779498794997950079501795027950379504795057950679507795087950979510795117951279513795147951579516795177951879519795207952179522795237952479525795267952779528795297953079531795327953379534795357953679537795387953979540795417954279543795447954579546795477954879549795507955179552795537955479555795567955779558795597956079561795627956379564795657956679567795687956979570795717957279573795747957579576795777957879579795807958179582795837958479585795867958779588795897959079591795927959379594795957959679597795987959979600796017960279603796047960579606796077960879609796107961179612796137961479615796167961779618796197962079621796227962379624796257962679627796287962979630796317963279633796347963579636796377963879639796407964179642796437964479645796467964779648796497965079651796527965379654796557965679657796587965979660796617966279663796647966579666796677966879669796707967179672796737967479675796767967779678796797968079681796827968379684796857968679687796887968979690796917969279693796947969579696796977969879699797007970179702797037970479705797067970779708797097971079711797127971379714797157971679717797187971979720797217972279723797247972579726797277972879729797307973179732797337973479735797367973779738797397974079741797427974379744797457974679747797487974979750797517975279753797547975579756797577975879759797607976179762797637976479765797667976779768797697977079771797727977379774797757977679777797787977979780797817978279783797847978579786797877978879789797907979179792797937979479795797967979779798797997980079801798027980379804798057980679807798087980979810798117981279813798147981579816798177981879819798207982179822798237982479825798267982779828798297983079831798327983379834798357983679837798387983979840798417984279843798447984579846798477984879849798507985179852798537985479855798567985779858798597986079861798627986379864798657986679867798687986979870798717987279873798747987579876798777987879879798807988179882798837988479885798867988779888798897989079891798927989379894798957989679897798987989979900799017990279903799047990579906799077990879909799107991179912799137991479915799167991779918799197992079921799227992379924799257992679927799287992979930799317993279933799347993579936799377993879939799407994179942799437994479945799467994779948799497995079951799527995379954799557995679957799587995979960799617996279963799647996579966799677996879969799707997179972799737997479975799767997779978799797998079981799827998379984799857998679987799887998979990799917999279993799947999579996799977999879999800008000180002800038000480005800068000780008800098001080011800128001380014800158001680017800188001980020800218002280023800248002580026800278002880029800308003180032800338003480035800368003780038800398004080041800428004380044800458004680047800488004980050800518005280053800548005580056800578005880059800608006180062800638006480065800668006780068800698007080071800728007380074800758007680077800788007980080800818008280083800848008580086800878008880089800908009180092800938009480095800968009780098800998010080101801028010380104801058010680107801088010980110801118011280113801148011580116801178011880119801208012180122801238012480125801268012780128801298013080131801328013380134801358013680137801388013980140801418014280143801448014580146801478014880149801508015180152801538015480155801568015780158801598016080161801628016380164801658016680167801688016980170801718017280173801748017580176801778017880179801808018180182801838018480185801868018780188801898019080191801928019380194801958019680197801988019980200802018020280203802048020580206802078020880209802108021180212802138021480215802168021780218802198022080221802228022380224802258022680227802288022980230802318023280233802348023580236802378023880239802408024180242802438024480245802468024780248802498025080251802528025380254802558025680257802588025980260802618026280263802648026580266802678026880269802708027180272802738027480275802768027780278802798028080281802828028380284802858028680287802888028980290802918029280293802948029580296802978029880299803008030180302803038030480305803068030780308803098031080311803128031380314803158031680317803188031980320803218032280323803248032580326803278032880329803308033180332803338033480335803368033780338803398034080341803428034380344803458034680347803488034980350803518035280353803548035580356803578035880359803608036180362803638036480365803668036780368803698037080371803728037380374803758037680377803788037980380803818038280383803848038580386803878038880389803908039180392803938039480395803968039780398803998040080401804028040380404804058040680407804088040980410804118041280413804148041580416804178041880419804208042180422804238042480425804268042780428804298043080431804328043380434804358043680437804388043980440804418044280443804448044580446804478044880449804508045180452804538045480455804568045780458804598046080461804628046380464804658046680467804688046980470804718047280473804748047580476804778047880479804808048180482804838048480485804868048780488804898049080491804928049380494804958049680497804988049980500805018050280503805048050580506805078050880509805108051180512805138051480515805168051780518805198052080521805228052380524805258052680527805288052980530805318053280533805348053580536805378053880539805408054180542805438054480545805468054780548805498055080551805528055380554805558055680557805588055980560805618056280563805648056580566805678056880569805708057180572805738057480575805768057780578805798058080581805828058380584805858058680587805888058980590805918059280593805948059580596805978059880599806008060180602806038060480605806068060780608806098061080611806128061380614806158061680617806188061980620806218062280623806248062580626806278062880629806308063180632806338063480635806368063780638806398064080641806428064380644806458064680647806488064980650806518065280653806548065580656806578065880659806608066180662806638066480665806668066780668806698067080671806728067380674806758067680677806788067980680806818068280683806848068580686806878068880689806908069180692806938069480695806968069780698806998070080701807028070380704807058070680707807088070980710807118071280713807148071580716807178071880719807208072180722807238072480725807268072780728807298073080731807328073380734807358073680737807388073980740807418074280743807448074580746807478074880749807508075180752807538075480755807568075780758807598076080761807628076380764807658076680767807688076980770807718077280773807748077580776807778077880779807808078180782807838078480785807868078780788807898079080791807928079380794807958079680797807988079980800808018080280803808048080580806808078080880809808108081180812808138081480815808168081780818808198082080821808228082380824808258082680827808288082980830808318083280833808348083580836808378083880839808408084180842808438084480845808468084780848808498085080851808528085380854808558085680857808588085980860808618086280863808648086580866808678086880869808708087180872808738087480875808768087780878808798088080881808828088380884808858088680887808888088980890808918089280893808948089580896808978089880899809008090180902809038090480905809068090780908809098091080911809128091380914809158091680917809188091980920809218092280923809248092580926809278092880929809308093180932809338093480935809368093780938809398094080941809428094380944809458094680947809488094980950809518095280953809548095580956809578095880959809608096180962809638096480965809668096780968809698097080971809728097380974809758097680977809788097980980809818098280983809848098580986809878098880989809908099180992809938099480995809968099780998809998100081001810028100381004810058100681007810088100981010810118101281013810148101581016810178101881019810208102181022810238102481025810268102781028810298103081031810328103381034810358103681037810388103981040810418104281043810448104581046810478104881049810508105181052810538105481055810568105781058810598106081061810628106381064810658106681067810688106981070810718107281073810748107581076810778107881079810808108181082810838108481085810868108781088810898109081091810928109381094810958109681097810988109981100811018110281103811048110581106811078110881109811108111181112811138111481115811168111781118811198112081121811228112381124811258112681127811288112981130811318113281133811348113581136811378113881139811408114181142811438114481145811468114781148811498115081151811528115381154811558115681157811588115981160811618116281163811648116581166811678116881169811708117181172811738117481175811768117781178811798118081181811828118381184811858118681187811888118981190811918119281193811948119581196811978119881199812008120181202812038120481205812068120781208812098121081211812128121381214812158121681217812188121981220812218122281223812248122581226812278122881229812308123181232812338123481235812368123781238812398124081241812428124381244812458124681247812488124981250812518125281253812548125581256812578125881259812608126181262812638126481265812668126781268812698127081271812728127381274812758127681277812788127981280812818128281283812848128581286812878128881289812908129181292812938129481295812968129781298812998130081301813028130381304813058130681307813088130981310813118131281313813148131581316813178131881319813208132181322813238132481325813268132781328813298133081331813328133381334813358133681337813388133981340813418134281343813448134581346813478134881349813508135181352813538135481355813568135781358813598136081361813628136381364813658136681367813688136981370813718137281373813748137581376813778137881379813808138181382813838138481385813868138781388813898139081391813928139381394813958139681397813988139981400814018140281403814048140581406814078140881409814108141181412814138141481415814168141781418814198142081421814228142381424814258142681427814288142981430814318143281433814348143581436814378143881439814408144181442814438144481445814468144781448814498145081451814528145381454814558145681457814588145981460814618146281463814648146581466814678146881469814708147181472814738147481475814768147781478814798148081481814828148381484814858148681487814888148981490814918149281493814948149581496814978149881499815008150181502815038150481505815068150781508815098151081511815128151381514815158151681517815188151981520815218152281523815248152581526815278152881529815308153181532815338153481535815368153781538815398154081541815428154381544815458154681547815488154981550815518155281553815548155581556815578155881559815608156181562815638156481565815668156781568815698157081571815728157381574815758157681577815788157981580815818158281583815848158581586815878158881589815908159181592815938159481595815968159781598815998160081601816028160381604816058160681607816088160981610816118161281613816148161581616816178161881619816208162181622816238162481625816268162781628816298163081631816328163381634816358163681637816388163981640816418164281643816448164581646816478164881649816508165181652816538165481655816568165781658816598166081661816628166381664816658166681667816688166981670816718167281673816748167581676816778167881679816808168181682816838168481685816868168781688816898169081691816928169381694816958169681697816988169981700817018170281703817048170581706817078170881709817108171181712817138171481715817168171781718817198172081721817228172381724817258172681727817288172981730817318173281733817348173581736817378173881739817408174181742817438174481745817468174781748817498175081751817528175381754817558175681757817588175981760817618176281763817648176581766817678176881769817708177181772817738177481775817768177781778817798178081781817828178381784817858178681787817888178981790817918179281793817948179581796817978179881799818008180181802818038180481805818068180781808818098181081811818128181381814818158181681817818188181981820818218182281823818248182581826818278182881829818308183181832818338183481835818368183781838818398184081841818428184381844818458184681847818488184981850818518185281853818548185581856818578185881859818608186181862818638186481865818668186781868818698187081871818728187381874818758187681877818788187981880818818188281883818848188581886818878188881889818908189181892818938189481895818968189781898818998190081901819028190381904819058190681907819088190981910819118191281913819148191581916819178191881919819208192181922819238192481925819268192781928819298193081931819328193381934819358193681937819388193981940819418194281943819448194581946819478194881949819508195181952819538195481955819568195781958819598196081961819628196381964819658196681967819688196981970819718197281973819748197581976819778197881979819808198181982819838198481985819868198781988819898199081991819928199381994819958199681997819988199982000820018200282003820048200582006820078200882009820108201182012820138201482015820168201782018820198202082021820228202382024820258202682027820288202982030820318203282033820348203582036820378203882039820408204182042820438204482045820468204782048820498205082051820528205382054820558205682057820588205982060820618206282063820648206582066820678206882069820708207182072820738207482075820768207782078820798208082081820828208382084820858208682087820888208982090820918209282093820948209582096820978209882099821008210182102821038210482105821068210782108821098211082111821128211382114821158211682117821188211982120821218212282123821248212582126821278212882129821308213182132821338213482135821368213782138821398214082141821428214382144821458214682147821488214982150821518215282153821548215582156821578215882159821608216182162821638216482165821668216782168821698217082171821728217382174821758217682177821788217982180821818218282183821848218582186821878218882189821908219182192821938219482195821968219782198821998220082201822028220382204822058220682207822088220982210822118221282213822148221582216822178221882219822208222182222822238222482225822268222782228822298223082231822328223382234822358223682237822388223982240822418224282243822448224582246822478224882249822508225182252822538225482255822568225782258822598226082261822628226382264822658226682267822688226982270822718227282273822748227582276822778227882279822808228182282822838228482285822868228782288822898229082291822928229382294822958229682297822988229982300823018230282303823048230582306823078230882309823108231182312823138231482315823168231782318823198232082321823228232382324823258232682327823288232982330823318233282333823348233582336823378233882339823408234182342823438234482345823468234782348823498235082351823528235382354823558235682357823588235982360823618236282363823648236582366823678236882369823708237182372823738237482375823768237782378823798238082381823828238382384823858238682387823888238982390823918239282393823948239582396823978239882399824008240182402824038240482405824068240782408824098241082411824128241382414824158241682417824188241982420824218242282423824248242582426824278242882429824308243182432824338243482435824368243782438824398244082441824428244382444824458244682447824488244982450824518245282453824548245582456824578245882459824608246182462824638246482465824668246782468824698247082471824728247382474824758247682477824788247982480824818248282483824848248582486824878248882489824908249182492824938249482495824968249782498824998250082501825028250382504825058250682507825088250982510825118251282513825148251582516825178251882519825208252182522825238252482525825268252782528825298253082531825328253382534825358253682537825388253982540825418254282543825448254582546825478254882549825508255182552825538255482555825568255782558825598256082561825628256382564825658256682567825688256982570825718257282573825748257582576825778257882579825808258182582825838258482585825868258782588825898259082591825928259382594825958259682597825988259982600826018260282603826048260582606826078260882609826108261182612826138261482615826168261782618826198262082621826228262382624826258262682627826288262982630826318263282633826348263582636826378263882639826408264182642826438264482645826468264782648826498265082651826528265382654826558265682657826588265982660826618266282663826648266582666826678266882669826708267182672826738267482675826768267782678826798268082681826828268382684826858268682687826888268982690826918269282693826948269582696826978269882699827008270182702827038270482705827068270782708827098271082711827128271382714827158271682717827188271982720827218272282723827248272582726827278272882729827308273182732827338273482735827368273782738827398274082741827428274382744827458274682747827488274982750827518275282753827548275582756827578275882759827608276182762827638276482765827668276782768827698277082771827728277382774827758277682777827788277982780827818278282783827848278582786827878278882789827908279182792827938279482795827968279782798827998280082801828028280382804828058280682807828088280982810828118281282813828148281582816828178281882819828208282182822828238282482825828268282782828828298283082831828328283382834828358283682837828388283982840828418284282843828448284582846828478284882849828508285182852828538285482855828568285782858828598286082861828628286382864828658286682867828688286982870828718287282873828748287582876828778287882879828808288182882828838288482885828868288782888828898289082891828928289382894828958289682897828988289982900829018290282903829048290582906829078290882909829108291182912829138291482915829168291782918829198292082921829228292382924829258292682927829288292982930829318293282933829348293582936829378293882939829408294182942829438294482945829468294782948829498295082951829528295382954829558295682957829588295982960829618296282963829648296582966829678296882969829708297182972829738297482975829768297782978829798298082981829828298382984829858298682987829888298982990829918299282993829948299582996829978299882999830008300183002830038300483005830068300783008830098301083011830128301383014830158301683017830188301983020830218302283023830248302583026830278302883029830308303183032830338303483035830368303783038830398304083041830428304383044830458304683047830488304983050830518305283053830548305583056830578305883059830608306183062830638306483065830668306783068830698307083071830728307383074830758307683077830788307983080830818308283083830848308583086830878308883089830908309183092830938309483095830968309783098830998310083101831028310383104831058310683107831088310983110831118311283113831148311583116831178311883119831208312183122831238312483125831268312783128831298313083131831328313383134831358313683137831388313983140831418314283143831448314583146831478314883149831508315183152831538315483155831568315783158831598316083161831628316383164831658316683167831688316983170831718317283173831748317583176831778317883179831808318183182831838318483185831868318783188831898319083191831928319383194831958319683197831988319983200832018320283203832048320583206832078320883209832108321183212832138321483215832168321783218832198322083221832228322383224832258322683227832288322983230832318323283233832348323583236832378323883239832408324183242832438324483245832468324783248832498325083251832528325383254832558325683257832588325983260832618326283263832648326583266832678326883269832708327183272832738327483275832768327783278832798328083281832828328383284832858328683287832888328983290832918329283293832948329583296832978329883299833008330183302833038330483305833068330783308833098331083311833128331383314833158331683317833188331983320833218332283323833248332583326833278332883329833308333183332833338333483335833368333783338833398334083341833428334383344833458334683347833488334983350833518335283353833548335583356833578335883359833608336183362833638336483365833668336783368833698337083371833728337383374833758337683377833788337983380833818338283383833848338583386833878338883389833908339183392833938339483395833968339783398833998340083401834028340383404834058340683407834088340983410834118341283413834148341583416834178341883419834208342183422834238342483425834268342783428834298343083431834328343383434834358343683437834388343983440834418344283443834448344583446834478344883449834508345183452834538345483455834568345783458834598346083461834628346383464834658346683467834688346983470834718347283473834748347583476834778347883479834808348183482834838348483485834868348783488834898349083491834928349383494834958349683497834988349983500835018350283503835048350583506835078350883509835108351183512835138351483515835168351783518835198352083521835228352383524835258352683527835288352983530835318353283533835348353583536835378353883539835408354183542835438354483545835468354783548835498355083551835528355383554835558355683557835588355983560835618356283563835648356583566835678356883569835708357183572835738357483575835768357783578835798358083581835828358383584835858358683587835888358983590835918359283593835948359583596835978359883599836008360183602836038360483605836068360783608836098361083611836128361383614836158361683617836188361983620836218362283623836248362583626836278362883629836308363183632836338363483635836368363783638836398364083641836428364383644836458364683647836488364983650836518365283653836548365583656836578365883659836608366183662836638366483665836668366783668836698367083671836728367383674836758367683677836788367983680836818368283683836848368583686836878368883689836908369183692836938369483695836968369783698836998370083701837028370383704837058370683707837088370983710837118371283713837148371583716837178371883719837208372183722837238372483725837268372783728837298373083731837328373383734837358373683737837388373983740837418374283743837448374583746837478374883749837508375183752837538375483755837568375783758837598376083761837628376383764837658376683767837688376983770837718377283773837748377583776837778377883779837808378183782837838378483785837868378783788837898379083791837928379383794837958379683797837988379983800838018380283803838048380583806838078380883809838108381183812838138381483815838168381783818838198382083821838228382383824838258382683827838288382983830838318383283833838348383583836838378383883839838408384183842838438384483845838468384783848838498385083851838528385383854838558385683857838588385983860838618386283863838648386583866838678386883869838708387183872838738387483875838768387783878838798388083881838828388383884838858388683887838888388983890838918389283893838948389583896838978389883899839008390183902839038390483905839068390783908839098391083911839128391383914839158391683917839188391983920839218392283923839248392583926839278392883929839308393183932839338393483935839368393783938839398394083941839428394383944839458394683947839488394983950839518395283953839548395583956839578395883959839608396183962839638396483965839668396783968839698397083971839728397383974839758397683977839788397983980839818398283983839848398583986839878398883989839908399183992839938399483995839968399783998839998400084001840028400384004840058400684007840088400984010840118401284013840148401584016840178401884019840208402184022840238402484025840268402784028840298403084031840328403384034840358403684037840388403984040840418404284043840448404584046840478404884049840508405184052840538405484055840568405784058840598406084061840628406384064840658406684067840688406984070840718407284073840748407584076840778407884079840808408184082840838408484085840868408784088840898409084091840928409384094840958409684097840988409984100841018410284103841048410584106841078410884109841108411184112841138411484115841168411784118841198412084121841228412384124841258412684127841288412984130841318413284133841348413584136841378413884139841408414184142841438414484145841468414784148841498415084151841528415384154841558415684157841588415984160841618416284163841648416584166841678416884169841708417184172841738417484175841768417784178841798418084181841828418384184841858418684187841888418984190841918419284193841948419584196841978419884199842008420184202842038420484205842068420784208842098421084211842128421384214842158421684217842188421984220842218422284223842248422584226842278422884229842308423184232842338423484235842368423784238842398424084241842428424384244842458424684247842488424984250842518425284253842548425584256842578425884259842608426184262842638426484265842668426784268842698427084271842728427384274842758427684277842788427984280842818428284283842848428584286842878428884289842908429184292842938429484295842968429784298842998430084301843028430384304843058430684307843088430984310843118431284313843148431584316843178431884319843208432184322843238432484325843268432784328843298433084331843328433384334843358433684337843388433984340843418434284343843448434584346843478434884349843508435184352843538435484355843568435784358843598436084361843628436384364843658436684367843688436984370843718437284373843748437584376843778437884379843808438184382843838438484385843868438784388843898439084391843928439384394843958439684397843988439984400844018440284403844048440584406844078440884409844108441184412844138441484415844168441784418844198442084421844228442384424844258442684427844288442984430844318443284433844348443584436844378443884439844408444184442844438444484445844468444784448844498445084451844528445384454844558445684457844588445984460844618446284463844648446584466844678446884469844708447184472844738447484475844768447784478844798448084481844828448384484844858448684487844888448984490844918449284493844948449584496844978449884499845008450184502845038450484505845068450784508845098451084511845128451384514845158451684517845188451984520845218452284523845248452584526845278452884529845308453184532845338453484535845368453784538845398454084541845428454384544845458454684547845488454984550845518455284553845548455584556845578455884559845608456184562845638456484565845668456784568845698457084571845728457384574845758457684577845788457984580845818458284583845848458584586845878458884589845908459184592845938459484595845968459784598845998460084601846028460384604846058460684607846088460984610846118461284613846148461584616846178461884619846208462184622846238462484625846268462784628846298463084631846328463384634846358463684637846388463984640846418464284643846448464584646846478464884649846508465184652846538465484655846568465784658846598466084661846628466384664846658466684667846688466984670846718467284673846748467584676846778467884679846808468184682846838468484685846868468784688846898469084691846928469384694846958469684697846988469984700847018470284703847048470584706847078470884709847108471184712847138471484715847168471784718847198472084721847228472384724847258472684727847288472984730847318473284733847348473584736847378473884739847408474184742847438474484745847468474784748847498475084751847528475384754847558475684757847588475984760847618476284763847648476584766847678476884769847708477184772847738477484775847768477784778847798478084781847828478384784847858478684787847888478984790847918479284793847948479584796847978479884799848008480184802848038480484805848068480784808848098481084811848128481384814848158481684817848188481984820848218482284823848248482584826848278482884829848308483184832848338483484835848368483784838848398484084841848428484384844848458484684847848488484984850848518485284853848548485584856848578485884859848608486184862848638486484865848668486784868848698487084871848728487384874848758487684877848788487984880848818488284883848848488584886848878488884889848908489184892848938489484895848968489784898848998490084901849028490384904849058490684907849088490984910849118491284913849148491584916849178491884919849208492184922849238492484925849268492784928849298493084931849328493384934849358493684937849388493984940849418494284943849448494584946849478494884949849508495184952849538495484955849568495784958849598496084961849628496384964849658496684967849688496984970849718497284973849748497584976849778497884979849808498184982849838498484985849868498784988849898499084991849928499384994849958499684997849988499985000850018500285003850048500585006850078500885009850108501185012850138501485015850168501785018850198502085021850228502385024850258502685027850288502985030850318503285033850348503585036850378503885039850408504185042850438504485045850468504785048850498505085051850528505385054850558505685057850588505985060850618506285063850648506585066850678506885069850708507185072850738507485075850768507785078850798508085081850828508385084850858508685087850888508985090850918509285093850948509585096850978509885099851008510185102851038510485105851068510785108851098511085111851128511385114851158511685117851188511985120851218512285123851248512585126851278512885129851308513185132851338513485135851368513785138851398514085141851428514385144851458514685147851488514985150851518515285153851548515585156851578515885159851608516185162851638516485165851668516785168851698517085171851728517385174851758517685177851788517985180851818518285183851848518585186851878518885189851908519185192851938519485195851968519785198851998520085201852028520385204852058520685207852088520985210852118521285213852148521585216852178521885219852208522185222852238522485225852268522785228852298523085231852328523385234852358523685237852388523985240852418524285243852448524585246852478524885249852508525185252852538525485255852568525785258852598526085261852628526385264852658526685267852688526985270852718527285273852748527585276852778527885279852808528185282852838528485285852868528785288852898529085291852928529385294852958529685297852988529985300853018530285303853048530585306853078530885309853108531185312853138531485315853168531785318853198532085321853228532385324853258532685327853288532985330853318533285333853348533585336853378533885339853408534185342853438534485345853468534785348853498535085351853528535385354853558535685357853588535985360853618536285363853648536585366853678536885369853708537185372853738537485375853768537785378853798538085381853828538385384853858538685387853888538985390853918539285393853948539585396853978539885399854008540185402854038540485405854068540785408854098541085411854128541385414854158541685417854188541985420854218542285423854248542585426854278542885429854308543185432854338543485435854368543785438854398544085441854428544385444854458544685447854488544985450854518545285453854548545585456854578545885459854608546185462854638546485465854668546785468854698547085471854728547385474854758547685477854788547985480854818548285483854848548585486854878548885489854908549185492854938549485495854968549785498854998550085501855028550385504855058550685507855088550985510855118551285513855148551585516855178551885519855208552185522855238552485525855268552785528855298553085531855328553385534855358553685537855388553985540855418554285543855448554585546855478554885549855508555185552855538555485555855568555785558855598556085561855628556385564855658556685567855688556985570855718557285573855748557585576855778557885579855808558185582855838558485585855868558785588855898559085591855928559385594855958559685597855988559985600856018560285603856048560585606856078560885609856108561185612856138561485615856168561785618856198562085621856228562385624856258562685627856288562985630856318563285633856348563585636856378563885639856408564185642856438564485645856468564785648856498565085651856528565385654856558565685657856588565985660856618566285663856648566585666856678566885669856708567185672856738567485675856768567785678856798568085681856828568385684856858568685687856888568985690856918569285693856948569585696856978569885699857008570185702857038570485705857068570785708857098571085711857128571385714857158571685717857188571985720857218572285723857248572585726857278572885729857308573185732857338573485735857368573785738857398574085741857428574385744857458574685747857488574985750857518575285753857548575585756857578575885759857608576185762857638576485765857668576785768857698577085771857728577385774857758577685777857788577985780857818578285783857848578585786857878578885789857908579185792857938579485795857968579785798857998580085801858028580385804858058580685807858088580985810858118581285813858148581585816858178581885819858208582185822858238582485825858268582785828858298583085831858328583385834858358583685837858388583985840858418584285843858448584585846858478584885849858508585185852858538585485855858568585785858858598586085861858628586385864858658586685867858688586985870858718587285873858748587585876858778587885879858808588185882858838588485885858868588785888858898589085891858928589385894858958589685897858988589985900859018590285903859048590585906859078590885909859108591185912859138591485915859168591785918859198592085921859228592385924859258592685927859288592985930859318593285933859348593585936859378593885939859408594185942859438594485945859468594785948859498595085951859528595385954859558595685957859588595985960859618596285963859648596585966859678596885969859708597185972859738597485975859768597785978859798598085981859828598385984859858598685987859888598985990859918599285993859948599585996859978599885999860008600186002860038600486005860068600786008860098601086011860128601386014860158601686017860188601986020860218602286023860248602586026860278602886029860308603186032860338603486035860368603786038860398604086041860428604386044860458604686047860488604986050860518605286053860548605586056860578605886059860608606186062860638606486065860668606786068860698607086071860728607386074860758607686077860788607986080860818608286083860848608586086860878608886089860908609186092860938609486095860968609786098860998610086101861028610386104861058610686107861088610986110861118611286113861148611586116861178611886119861208612186122861238612486125861268612786128861298613086131861328613386134861358613686137861388613986140861418614286143861448614586146861478614886149861508615186152861538615486155861568615786158861598616086161861628616386164861658616686167861688616986170861718617286173861748617586176861778617886179861808618186182861838618486185861868618786188861898619086191861928619386194861958619686197861988619986200862018620286203862048620586206862078620886209862108621186212862138621486215862168621786218862198622086221862228622386224862258622686227862288622986230862318623286233862348623586236862378623886239862408624186242862438624486245862468624786248862498625086251862528625386254862558625686257862588625986260862618626286263862648626586266862678626886269862708627186272862738627486275862768627786278862798628086281862828628386284862858628686287862888628986290862918629286293862948629586296862978629886299863008630186302863038630486305863068630786308863098631086311863128631386314863158631686317863188631986320863218632286323863248632586326863278632886329863308633186332863338633486335863368633786338863398634086341863428634386344863458634686347863488634986350863518635286353863548635586356863578635886359863608636186362863638636486365863668636786368863698637086371863728637386374863758637686377863788637986380863818638286383863848638586386863878638886389863908639186392863938639486395863968639786398863998640086401864028640386404864058640686407864088640986410864118641286413864148641586416864178641886419864208642186422864238642486425864268642786428864298643086431864328643386434864358643686437864388643986440864418644286443864448644586446864478644886449864508645186452864538645486455864568645786458864598646086461864628646386464864658646686467864688646986470864718647286473864748647586476864778647886479864808648186482864838648486485864868648786488864898649086491864928649386494864958649686497864988649986500865018650286503865048650586506865078650886509865108651186512865138651486515865168651786518865198652086521865228652386524865258652686527865288652986530865318653286533865348653586536865378653886539865408654186542865438654486545865468654786548865498655086551865528655386554865558655686557865588655986560865618656286563865648656586566865678656886569865708657186572865738657486575865768657786578865798658086581865828658386584865858658686587865888658986590865918659286593865948659586596865978659886599866008660186602866038660486605866068660786608866098661086611866128661386614866158661686617866188661986620866218662286623866248662586626866278662886629866308663186632866338663486635866368663786638866398664086641866428664386644866458664686647866488664986650866518665286653866548665586656866578665886659866608666186662866638666486665866668666786668866698667086671866728667386674866758667686677866788667986680866818668286683866848668586686866878668886689866908669186692866938669486695866968669786698866998670086701867028670386704867058670686707867088670986710867118671286713867148671586716867178671886719867208672186722867238672486725867268672786728867298673086731867328673386734867358673686737867388673986740867418674286743867448674586746867478674886749867508675186752867538675486755867568675786758867598676086761867628676386764867658676686767867688676986770867718677286773867748677586776867778677886779867808678186782867838678486785867868678786788867898679086791867928679386794867958679686797867988679986800868018680286803868048680586806868078680886809868108681186812868138681486815868168681786818868198682086821868228682386824868258682686827868288682986830868318683286833868348683586836868378683886839868408684186842868438684486845868468684786848868498685086851868528685386854868558685686857868588685986860868618686286863868648686586866868678686886869868708687186872868738687486875868768687786878868798688086881868828688386884868858688686887868888688986890868918689286893868948689586896868978689886899869008690186902869038690486905869068690786908869098691086911869128691386914869158691686917869188691986920869218692286923869248692586926869278692886929869308693186932869338693486935869368693786938869398694086941869428694386944869458694686947869488694986950869518695286953869548695586956869578695886959869608696186962869638696486965869668696786968869698697086971869728697386974869758697686977869788697986980869818698286983869848698586986869878698886989869908699186992869938699486995869968699786998869998700087001870028700387004870058700687007870088700987010870118701287013870148701587016870178701887019870208702187022870238702487025870268702787028870298703087031870328703387034870358703687037870388703987040870418704287043870448704587046870478704887049870508705187052870538705487055870568705787058870598706087061870628706387064870658706687067870688706987070870718707287073870748707587076870778707887079870808708187082870838708487085870868708787088870898709087091870928709387094870958709687097870988709987100871018710287103871048710587106871078710887109871108711187112871138711487115871168711787118871198712087121871228712387124871258712687127871288712987130871318713287133871348713587136871378713887139871408714187142871438714487145871468714787148871498715087151871528715387154871558715687157871588715987160871618716287163871648716587166871678716887169871708717187172871738717487175871768717787178871798718087181871828718387184871858718687187871888718987190871918719287193871948719587196871978719887199872008720187202872038720487205872068720787208872098721087211872128721387214872158721687217872188721987220872218722287223872248722587226872278722887229872308723187232872338723487235872368723787238872398724087241872428724387244872458724687247872488724987250872518725287253872548725587256872578725887259872608726187262872638726487265872668726787268872698727087271872728727387274872758727687277872788727987280872818728287283872848728587286872878728887289872908729187292872938729487295872968729787298872998730087301873028730387304873058730687307873088730987310873118731287313873148731587316873178731887319873208732187322873238732487325873268732787328873298733087331873328733387334873358733687337873388733987340873418734287343873448734587346873478734887349873508735187352873538735487355873568735787358873598736087361873628736387364873658736687367873688736987370873718737287373873748737587376873778737887379873808738187382873838738487385873868738787388873898739087391873928739387394873958739687397873988739987400874018740287403874048740587406874078740887409874108741187412874138741487415874168741787418874198742087421874228742387424874258742687427874288742987430874318743287433874348743587436874378743887439874408744187442874438744487445874468744787448874498745087451874528745387454874558745687457874588745987460874618746287463874648746587466874678746887469874708747187472874738747487475874768747787478874798748087481874828748387484874858748687487874888748987490874918749287493874948749587496874978749887499875008750187502875038750487505875068750787508875098751087511875128751387514875158751687517875188751987520875218752287523875248752587526875278752887529875308753187532875338753487535875368753787538875398754087541875428754387544875458754687547875488754987550875518755287553875548755587556875578755887559875608756187562875638756487565875668756787568875698757087571875728757387574875758757687577875788757987580875818758287583875848758587586875878758887589875908759187592875938759487595875968759787598875998760087601876028760387604876058760687607876088760987610876118761287613876148761587616876178761887619876208762187622876238762487625876268762787628876298763087631876328763387634876358763687637876388763987640876418764287643876448764587646876478764887649876508765187652876538765487655876568765787658876598766087661876628766387664876658766687667876688766987670876718767287673876748767587676876778767887679876808768187682876838768487685876868768787688876898769087691876928769387694876958769687697876988769987700877018770287703877048770587706877078770887709877108771187712877138771487715877168771787718877198772087721877228772387724877258772687727877288772987730877318773287733877348773587736877378773887739877408774187742877438774487745877468774787748877498775087751877528775387754877558775687757877588775987760877618776287763877648776587766877678776887769877708777187772877738777487775877768777787778877798778087781877828778387784877858778687787877888778987790877918779287793877948779587796877978779887799878008780187802878038780487805878068780787808878098781087811878128781387814878158781687817878188781987820878218782287823878248782587826878278782887829878308783187832878338783487835878368783787838878398784087841878428784387844878458784687847878488784987850878518785287853878548785587856878578785887859878608786187862878638786487865878668786787868878698787087871878728787387874878758787687877878788787987880878818788287883878848788587886878878788887889878908789187892878938789487895878968789787898878998790087901879028790387904879058790687907879088790987910879118791287913879148791587916879178791887919879208792187922879238792487925879268792787928879298793087931879328793387934879358793687937879388793987940879418794287943879448794587946879478794887949879508795187952879538795487955879568795787958879598796087961879628796387964879658796687967879688796987970879718797287973879748797587976879778797887979879808798187982879838798487985879868798787988879898799087991879928799387994879958799687997879988799988000880018800288003880048800588006880078800888009880108801188012880138801488015880168801788018880198802088021880228802388024880258802688027880288802988030880318803288033880348803588036880378803888039880408804188042880438804488045880468804788048880498805088051880528805388054880558805688057880588805988060880618806288063880648806588066880678806888069880708807188072880738807488075880768807788078880798808088081880828808388084880858808688087880888808988090880918809288093880948809588096880978809888099881008810188102881038810488105881068810788108881098811088111881128811388114881158811688117881188811988120881218812288123881248812588126881278812888129881308813188132881338813488135881368813788138881398814088141881428814388144881458814688147881488814988150881518815288153881548815588156881578815888159881608816188162881638816488165881668816788168881698817088171881728817388174881758817688177881788817988180881818818288183881848818588186881878818888189881908819188192881938819488195881968819788198881998820088201882028820388204882058820688207882088820988210882118821288213882148821588216882178821888219882208822188222882238822488225882268822788228882298823088231882328823388234882358823688237882388823988240882418824288243882448824588246882478824888249882508825188252882538825488255882568825788258882598826088261882628826388264882658826688267882688826988270882718827288273882748827588276882778827888279882808828188282882838828488285882868828788288882898829088291882928829388294882958829688297882988829988300883018830288303883048830588306883078830888309883108831188312883138831488315883168831788318883198832088321883228832388324883258832688327883288832988330883318833288333883348833588336883378833888339883408834188342883438834488345883468834788348883498835088351883528835388354883558835688357883588835988360883618836288363883648836588366883678836888369883708837188372883738837488375883768837788378883798838088381883828838388384883858838688387883888838988390883918839288393883948839588396883978839888399884008840188402884038840488405884068840788408884098841088411884128841388414884158841688417884188841988420884218842288423884248842588426884278842888429884308843188432884338843488435884368843788438884398844088441884428844388444884458844688447884488844988450884518845288453884548845588456884578845888459884608846188462884638846488465884668846788468884698847088471884728847388474884758847688477884788847988480884818848288483884848848588486884878848888489884908849188492884938849488495884968849788498884998850088501885028850388504885058850688507885088850988510885118851288513885148851588516885178851888519885208852188522885238852488525885268852788528885298853088531885328853388534885358853688537885388853988540885418854288543885448854588546885478854888549885508855188552885538855488555885568855788558885598856088561885628856388564885658856688567885688856988570885718857288573885748857588576885778857888579885808858188582885838858488585885868858788588885898859088591885928859388594885958859688597885988859988600886018860288603886048860588606886078860888609886108861188612886138861488615886168861788618886198862088621886228862388624886258862688627886288862988630886318863288633886348863588636886378863888639886408864188642886438864488645886468864788648886498865088651886528865388654886558865688657886588865988660886618866288663886648866588666886678866888669886708867188672886738867488675886768867788678886798868088681886828868388684886858868688687886888868988690886918869288693886948869588696886978869888699887008870188702887038870488705887068870788708887098871088711887128871388714887158871688717887188871988720887218872288723887248872588726887278872888729887308873188732887338873488735887368873788738887398874088741887428874388744887458874688747887488874988750887518875288753887548875588756887578875888759887608876188762887638876488765887668876788768887698877088771887728877388774887758877688777887788877988780887818878288783887848878588786887878878888789887908879188792887938879488795887968879788798887998880088801888028880388804888058880688807888088880988810888118881288813888148881588816888178881888819888208882188822888238882488825888268882788828888298883088831888328883388834888358883688837888388883988840888418884288843888448884588846888478884888849888508885188852888538885488855888568885788858888598886088861888628886388864888658886688867888688886988870888718887288873888748887588876888778887888879888808888188882888838888488885888868888788888888898889088891888928889388894888958889688897888988889988900889018890288903889048890588906889078890888909889108891188912889138891488915889168891788918889198892088921889228892388924889258892688927889288892988930889318893288933889348893588936889378893888939889408894188942889438894488945889468894788948889498895088951889528895388954889558895688957889588895988960889618896288963889648896588966889678896888969889708897188972889738897488975889768897788978889798898088981889828898388984889858898688987889888898988990889918899288993889948899588996889978899888999890008900189002890038900489005890068900789008890098901089011890128901389014890158901689017890188901989020890218902289023890248902589026890278902889029890308903189032890338903489035890368903789038890398904089041890428904389044890458904689047890488904989050890518905289053890548905589056890578905889059890608906189062890638906489065890668906789068890698907089071890728907389074890758907689077890788907989080890818908289083890848908589086890878908889089890908909189092890938909489095890968909789098890998910089101891028910389104891058910689107891088910989110891118911289113891148911589116891178911889119891208912189122891238912489125891268912789128891298913089131891328913389134891358913689137891388913989140891418914289143891448914589146891478914889149891508915189152891538915489155891568915789158891598916089161891628916389164891658916689167891688916989170891718917289173891748917589176891778917889179891808918189182891838918489185891868918789188891898919089191891928919389194891958919689197891988919989200892018920289203892048920589206892078920889209892108921189212892138921489215892168921789218892198922089221892228922389224892258922689227892288922989230892318923289233892348923589236892378923889239892408924189242892438924489245892468924789248892498925089251892528925389254892558925689257892588925989260892618926289263892648926589266892678926889269892708927189272892738927489275892768927789278892798928089281892828928389284892858928689287892888928989290892918929289293892948929589296892978929889299893008930189302893038930489305893068930789308893098931089311893128931389314893158931689317893188931989320893218932289323893248932589326893278932889329893308933189332893338933489335893368933789338893398934089341893428934389344893458934689347893488934989350893518935289353893548935589356893578935889359893608936189362893638936489365893668936789368893698937089371893728937389374893758937689377893788937989380893818938289383893848938589386893878938889389893908939189392893938939489395893968939789398893998940089401894028940389404894058940689407894088940989410894118941289413894148941589416894178941889419894208942189422894238942489425894268942789428894298943089431894328943389434894358943689437894388943989440894418944289443894448944589446894478944889449894508945189452894538945489455894568945789458894598946089461894628946389464894658946689467894688946989470894718947289473894748947589476894778947889479894808948189482894838948489485894868948789488894898949089491894928949389494894958949689497894988949989500895018950289503895048950589506895078950889509895108951189512895138951489515895168951789518895198952089521895228952389524895258952689527895288952989530895318953289533895348953589536895378953889539895408954189542895438954489545895468954789548895498955089551895528955389554895558955689557895588955989560895618956289563895648956589566895678956889569895708957189572895738957489575895768957789578895798958089581895828958389584895858958689587895888958989590895918959289593895948959589596895978959889599896008960189602896038960489605896068960789608896098961089611896128961389614896158961689617896188961989620896218962289623896248962589626896278962889629896308963189632896338963489635896368963789638896398964089641896428964389644896458964689647896488964989650896518965289653896548965589656896578965889659896608966189662896638966489665896668966789668896698967089671896728967389674896758967689677896788967989680896818968289683896848968589686896878968889689896908969189692896938969489695896968969789698896998970089701897028970389704897058970689707897088970989710897118971289713897148971589716897178971889719897208972189722897238972489725897268972789728897298973089731897328973389734897358973689737897388973989740897418974289743897448974589746897478974889749897508975189752897538975489755897568975789758897598976089761897628976389764897658976689767897688976989770897718977289773897748977589776897778977889779897808978189782897838978489785897868978789788897898979089791897928979389794897958979689797897988979989800898018980289803898048980589806898078980889809898108981189812898138981489815898168981789818898198982089821898228982389824898258982689827898288982989830898318983289833898348983589836898378983889839898408984189842898438984489845898468984789848898498985089851898528985389854898558985689857898588985989860898618986289863898648986589866898678986889869898708987189872898738987489875898768987789878898798988089881898828988389884898858988689887898888988989890898918989289893898948989589896898978989889899899008990189902899038990489905899068990789908899098991089911899128991389914899158991689917899188991989920899218992289923899248992589926899278992889929899308993189932899338993489935899368993789938899398994089941899428994389944899458994689947899488994989950899518995289953899548995589956899578995889959899608996189962899638996489965899668996789968899698997089971899728997389974899758997689977899788997989980899818998289983899848998589986899878998889989899908999189992899938999489995899968999789998899999000090001900029000390004900059000690007900089000990010900119001290013900149001590016900179001890019900209002190022900239002490025900269002790028900299003090031900329003390034900359003690037900389003990040900419004290043900449004590046900479004890049900509005190052900539005490055900569005790058900599006090061900629006390064900659006690067900689006990070900719007290073900749007590076900779007890079900809008190082900839008490085900869008790088900899009090091900929009390094900959009690097900989009990100901019010290103901049010590106901079010890109901109011190112901139011490115901169011790118901199012090121901229012390124901259012690127901289012990130901319013290133901349013590136901379013890139901409014190142901439014490145901469014790148901499015090151901529015390154901559015690157901589015990160901619016290163901649016590166901679016890169901709017190172901739017490175901769017790178901799018090181901829018390184901859018690187901889018990190901919019290193901949019590196901979019890199902009020190202902039020490205902069020790208902099021090211902129021390214902159021690217902189021990220902219022290223902249022590226902279022890229902309023190232902339023490235902369023790238902399024090241902429024390244902459024690247902489024990250902519025290253902549025590256902579025890259902609026190262902639026490265902669026790268902699027090271902729027390274902759027690277902789027990280902819028290283902849028590286902879028890289902909029190292902939029490295902969029790298902999030090301903029030390304903059030690307903089030990310903119031290313903149031590316903179031890319903209032190322903239032490325903269032790328903299033090331903329033390334903359033690337903389033990340903419034290343903449034590346903479034890349903509035190352903539035490355903569035790358903599036090361903629036390364903659036690367903689036990370903719037290373903749037590376903779037890379903809038190382903839038490385903869038790388903899039090391903929039390394903959039690397903989039990400904019040290403904049040590406904079040890409904109041190412904139041490415904169041790418904199042090421904229042390424904259042690427904289042990430904319043290433904349043590436904379043890439904409044190442904439044490445904469044790448904499045090451904529045390454904559045690457904589045990460904619046290463904649046590466904679046890469904709047190472904739047490475904769047790478904799048090481904829048390484904859048690487904889048990490904919049290493904949049590496904979049890499905009050190502905039050490505905069050790508905099051090511905129051390514905159051690517905189051990520905219052290523905249052590526905279052890529905309053190532905339053490535905369053790538905399054090541905429054390544905459054690547905489054990550905519055290553905549055590556905579055890559905609056190562905639056490565905669056790568905699057090571905729057390574905759057690577905789057990580905819058290583905849058590586905879058890589905909059190592905939059490595905969059790598905999060090601906029060390604906059060690607906089060990610906119061290613906149061590616906179061890619906209062190622906239062490625906269062790628906299063090631906329063390634906359063690637906389063990640906419064290643906449064590646906479064890649906509065190652906539065490655906569065790658906599066090661906629066390664906659066690667906689066990670906719067290673906749067590676906779067890679906809068190682906839068490685906869068790688906899069090691906929069390694906959069690697906989069990700907019070290703907049070590706907079070890709907109071190712907139071490715907169071790718907199072090721907229072390724907259072690727907289072990730907319073290733907349073590736907379073890739907409074190742907439074490745907469074790748907499075090751907529075390754907559075690757907589075990760907619076290763907649076590766907679076890769907709077190772907739077490775907769077790778907799078090781907829078390784907859078690787907889078990790907919079290793907949079590796907979079890799908009080190802908039080490805908069080790808908099081090811908129081390814908159081690817908189081990820908219082290823908249082590826908279082890829908309083190832908339083490835908369083790838908399084090841908429084390844908459084690847908489084990850908519085290853908549085590856908579085890859908609086190862908639086490865908669086790868908699087090871908729087390874908759087690877908789087990880908819088290883908849088590886908879088890889908909089190892908939089490895908969089790898908999090090901909029090390904909059090690907909089090990910909119091290913909149091590916909179091890919909209092190922909239092490925909269092790928909299093090931909329093390934909359093690937909389093990940909419094290943909449094590946909479094890949909509095190952909539095490955909569095790958909599096090961909629096390964909659096690967909689096990970909719097290973909749097590976909779097890979909809098190982909839098490985909869098790988909899099090991909929099390994909959099690997909989099991000910019100291003910049100591006910079100891009910109101191012910139101491015910169101791018910199102091021910229102391024910259102691027910289102991030910319103291033910349103591036910379103891039910409104191042910439104491045910469104791048910499105091051910529105391054910559105691057910589105991060910619106291063910649106591066910679106891069910709107191072910739107491075910769107791078910799108091081910829108391084910859108691087910889108991090910919109291093910949109591096910979109891099911009110191102911039110491105911069110791108911099111091111911129111391114911159111691117911189111991120911219112291123911249112591126911279112891129911309113191132911339113491135911369113791138911399114091141911429114391144911459114691147911489114991150911519115291153911549115591156911579115891159911609116191162911639116491165911669116791168911699117091171911729117391174911759117691177911789117991180911819118291183911849118591186911879118891189911909119191192911939119491195911969119791198911999120091201912029120391204912059120691207912089120991210912119121291213912149121591216912179121891219912209122191222912239122491225912269122791228912299123091231912329123391234912359123691237912389123991240912419124291243912449124591246912479124891249912509125191252912539125491255912569125791258912599126091261912629126391264912659126691267912689126991270912719127291273912749127591276912779127891279912809128191282912839128491285912869128791288912899129091291912929129391294912959129691297912989129991300913019130291303913049130591306913079130891309913109131191312913139131491315913169131791318913199132091321913229132391324913259132691327913289132991330913319133291333913349133591336913379133891339913409134191342913439134491345913469134791348913499135091351913529135391354913559135691357913589135991360913619136291363913649136591366913679136891369913709137191372913739137491375913769137791378913799138091381913829138391384913859138691387913889138991390913919139291393913949139591396913979139891399914009140191402914039140491405914069140791408914099141091411914129141391414914159141691417914189141991420914219142291423914249142591426914279142891429914309143191432914339143491435914369143791438914399144091441914429144391444914459144691447914489144991450914519145291453914549145591456914579145891459914609146191462914639146491465914669146791468914699147091471914729147391474914759147691477914789147991480914819148291483914849148591486914879148891489914909149191492914939149491495914969149791498914999150091501915029150391504915059150691507915089150991510915119151291513915149151591516915179151891519915209152191522915239152491525915269152791528915299153091531915329153391534915359153691537915389153991540915419154291543915449154591546915479154891549915509155191552915539155491555915569155791558915599156091561915629156391564915659156691567915689156991570915719157291573915749157591576915779157891579915809158191582915839158491585915869158791588915899159091591915929159391594915959159691597915989159991600916019160291603916049160591606916079160891609916109161191612916139161491615916169161791618916199162091621916229162391624916259162691627916289162991630916319163291633916349163591636916379163891639916409164191642916439164491645916469164791648916499165091651916529165391654916559165691657916589165991660916619166291663916649166591666916679166891669916709167191672916739167491675916769167791678916799168091681916829168391684916859168691687916889168991690916919169291693916949169591696916979169891699917009170191702917039170491705917069170791708917099171091711917129171391714917159171691717917189171991720917219172291723917249172591726917279172891729917309173191732917339173491735917369173791738917399174091741917429174391744917459174691747917489174991750917519175291753917549175591756917579175891759917609176191762917639176491765917669176791768917699177091771917729177391774917759177691777917789177991780917819178291783917849178591786917879178891789917909179191792917939179491795917969179791798917999180091801918029180391804918059180691807918089180991810918119181291813918149181591816918179181891819918209182191822918239182491825918269182791828918299183091831918329183391834918359183691837918389183991840918419184291843918449184591846918479184891849918509185191852918539185491855918569185791858918599186091861918629186391864918659186691867918689186991870918719187291873918749187591876918779187891879918809188191882918839188491885918869188791888918899189091891918929189391894918959189691897918989189991900919019190291903919049190591906919079190891909919109191191912919139191491915919169191791918919199192091921919229192391924919259192691927919289192991930919319193291933919349193591936919379193891939919409194191942919439194491945919469194791948919499195091951919529195391954919559195691957919589195991960919619196291963919649196591966919679196891969919709197191972919739197491975919769197791978919799198091981919829198391984919859198691987919889198991990919919199291993919949199591996919979199891999920009200192002920039200492005920069200792008920099201092011920129201392014920159201692017920189201992020920219202292023920249202592026920279202892029920309203192032920339203492035920369203792038920399204092041920429204392044920459204692047920489204992050920519205292053920549205592056920579205892059920609206192062920639206492065920669206792068920699207092071920729207392074920759207692077920789207992080920819208292083920849208592086920879208892089920909209192092920939209492095920969209792098920999210092101921029210392104921059210692107921089210992110921119211292113921149211592116921179211892119921209212192122921239212492125921269212792128921299213092131921329213392134921359213692137921389213992140921419214292143921449214592146921479214892149921509215192152921539215492155921569215792158921599216092161921629216392164921659216692167921689216992170921719217292173921749217592176921779217892179921809218192182921839218492185921869218792188921899219092191921929219392194921959219692197921989219992200922019220292203922049220592206922079220892209922109221192212922139221492215922169221792218922199222092221922229222392224922259222692227922289222992230922319223292233922349223592236922379223892239922409224192242922439224492245922469224792248922499225092251922529225392254922559225692257922589225992260922619226292263922649226592266922679226892269922709227192272922739227492275922769227792278922799228092281922829228392284922859228692287922889228992290922919229292293922949229592296922979229892299923009230192302923039230492305923069230792308923099231092311923129231392314923159231692317923189231992320923219232292323923249232592326923279232892329923309233192332923339233492335923369233792338923399234092341923429234392344923459234692347923489234992350923519235292353923549235592356923579235892359923609236192362923639236492365923669236792368923699237092371923729237392374923759237692377923789237992380923819238292383923849238592386923879238892389923909239192392923939239492395923969239792398923999240092401924029240392404924059240692407924089240992410924119241292413924149241592416924179241892419924209242192422924239242492425924269242792428924299243092431924329243392434924359243692437924389243992440924419244292443924449244592446924479244892449924509245192452924539245492455924569245792458924599246092461924629246392464924659246692467924689246992470924719247292473924749247592476924779247892479924809248192482924839248492485924869248792488924899249092491924929249392494924959249692497924989249992500925019250292503925049250592506925079250892509925109251192512925139251492515925169251792518925199252092521925229252392524925259252692527925289252992530925319253292533925349253592536925379253892539925409254192542925439254492545925469254792548925499255092551925529255392554925559255692557925589255992560925619256292563925649256592566925679256892569925709257192572925739257492575925769257792578925799258092581925829258392584925859258692587925889258992590925919259292593925949259592596925979259892599926009260192602926039260492605926069260792608926099261092611926129261392614926159261692617926189261992620926219262292623926249262592626926279262892629926309263192632926339263492635926369263792638926399264092641926429264392644926459264692647926489264992650926519265292653926549265592656926579265892659926609266192662926639266492665926669266792668926699267092671926729267392674926759267692677926789267992680926819268292683926849268592686926879268892689926909269192692926939269492695926969269792698926999270092701927029270392704927059270692707927089270992710927119271292713927149271592716927179271892719927209272192722927239272492725927269272792728927299273092731927329273392734927359273692737927389273992740927419274292743927449274592746
  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') && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.cache_by_default'), FILTER_VALIDATE_BOOLEAN)) {
  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½i��|2_½i��Æ6ä������+���src/Composer/Autoload/ClassMapGenerator.phpõ��|2_õ��Ó–ä5¤���������src/Composer/Cache.phpç��|2_ç��[27¤������%���src/Composer/Command/AboutCommand.phpØ��|2_Ø��ö÷;‡¤������'���src/Composer/Command/ArchiveCommand.phpä��|2_ä��Õ­¤������$���src/Composer/Command/BaseCommand.phpÜ ��|2_Ü ��gô1¤������.���src/Composer/Command/BaseDependencyCommand.phpg��|2_g��öNp¤������1���src/Composer/Command/CheckPlatformReqsCommand.php��|2_���„Ǥ������*���src/Composer/Command/ClearCacheCommand.php½��|2_½��°I¤������&���src/Composer/Command/ConfigCommand.phpÎQ��|2_ÎQ��xþÎ ¤������-���src/Composer/Command/CreateProjectCommand.phpª;��|2_ª;��ò×h¤������'���src/Composer/Command/DependsCommand.phpø��|2_ø��ªeá¤������(���src/Composer/Command/DiagnoseCommand.php%P��|2_%P��"vé…¤������,���src/Composer/Command/DumpAutoloadCommand.phpã ��|2_ã ��© ]†¤������$���src/Composer/Command/ExecCommand.php ��|2_ ��X?!“¤������$���src/Composer/Command/FundCommand.php,
  25. ��|2_,
  26. ��9¤������&���src/Composer/Command/GlobalCommand.phpz ��|2_z ��³çå?¤������$���src/Composer/Command/HomeCommand.php��|2_��qLBŽ¤������$���src/Composer/Command/InitCommand.phpçU��|2_çU��dßG�¤������'���src/Composer/Command/InstallCommand.phpT��|2_T��Þùõ›¤������(���src/Composer/Command/LicensesCommand.phpò��|2_ò��´È¤������(���src/Composer/Command/OutdatedCommand.php ��|2_ ��اc¤������)���src/Composer/Command/ProhibitsCommand.php��|2_��_¤éS¤������&���src/Composer/Command/RemoveCommand.phpá��|2_á��Å1÷&¤������'���src/Composer/Command/RequireCommand.php¯)��|2_¯)��^ %¤������)���src/Composer/Command/RunScriptCommand.php³��|2_³��·ü¤������+���src/Composer/Command/ScriptAliasCommand.php¯��|2_¯��?=Ѥ������&���src/Composer/Command/SearchCommand.phpU ��|2_U ��…ߤ������*���src/Composer/Command/SelfUpdateCommand.phpo@��|2_o@��{ê½^¤������$���src/Composer/Command/ShowCommand.phpƒ‚��|2_ƒ‚��O‘� ¤������&���src/Composer/Command/StatusCommand.phpP��|2_P��:±çú¤������(���src/Composer/Command/SuggestsCommand.php��|2_��ò‚Bɤ������&���src/Composer/Command/UpdateCommand.phpë#��|2_ë#��3<&�¤������(���src/Composer/Command/ValidateCommand.phpk��|2_k��y‚8K¤���������src/Composer/Composer.php~ ��|2_~ ��A‚ßL¤���������src/Composer/Config.php×$��|2_×$��ÝܾS¤������-���src/Composer/Config/ConfigSourceInterface.php��|2_��³ [/¤������(���src/Composer/Config/JsonConfigSource.php¹��|2_¹��”\©-¤������$���src/Composer/Console/Application.phpe8��|2_e8�� X‚¤������,���src/Composer/Console/HtmlOutputFormatter.php3��|2_3��Ú�Eu¤������-���src/Composer/DependencyResolver/Decisions.php6��|2_6��à• ž¤������1���src/Composer/DependencyResolver/DefaultPolicy.php��|2_��õÝv¤������/���src/Composer/DependencyResolver/GenericRule.phpµ��|2_µ��᫤¤������>���src/Composer/DependencyResolver/Operation/InstallOperation.phpC��|2_C��´\õ*¤������I���src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php÷��|2_÷��ïÎà÷¤������K���src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.phpý��|2_ý��3#†¤������@���src/Composer/DependencyResolver/Operation/OperationInterface.phpÓ���|2_Ó���Ùâ&ä¤������=���src/Composer/DependencyResolver/Operation/SolverOperation.php¹��|2_¹��&¢e
  27. ¤������@���src/Composer/DependencyResolver/Operation/UninstallOperation.phpI��|2_I��FûÂɤ������=���src/Composer/DependencyResolver/Operation/UpdateOperation.php'��|2_'��Qúɯ¤������3���src/Composer/DependencyResolver/PolicyInterface.php­��|2_­��Ÿ‹R¤������(���src/Composer/DependencyResolver/Pool.php#��|2_#��ÿ…C�¤������+���src/Composer/DependencyResolver/Problem.phpú��|2_ú��]D5¤������+���src/Composer/DependencyResolver/Request.phpƒ��|2_ƒ��åVP„¤������(���src/Composer/DependencyResolver/Rule.php?��|2_?��¬‘œü¤������1���src/Composer/DependencyResolver/Rule2Literals.php��|2_��tZÅɤ������+���src/Composer/DependencyResolver/RuleSet.phpª
  28. ��|2_ª
  29. ��_΂¤������4���src/Composer/DependencyResolver/RuleSetGenerator.php‹��|2_‹��‡ �¤������3���src/Composer/DependencyResolver/RuleSetIterator.php��|2_��›Cü$¤������2���src/Composer/DependencyResolver/RuleWatchChain.phpi��|2_i��hïš,¤������2���src/Composer/DependencyResolver/RuleWatchGraph.phpá��|2_á��‰rôv¤������1���src/Composer/DependencyResolver/RuleWatchNode.php��|2_���Gd7¤������*���src/Composer/DependencyResolver/Solver.phpf:��|2_f:��Nø1´¤������6���src/Composer/DependencyResolver/SolverBugException.php™��|2_™��Xg6¤������;���src/Composer/DependencyResolver/SolverProblemsException.phpô��|2_ô��×|Ŧ¤������/���src/Composer/DependencyResolver/Transaction.php×��|2_×��Vm쟤������-���src/Composer/Downloader/ArchiveDownloader.phpÆ ��|2_Æ ��G s0¤������1���src/Composer/Downloader/ChangeReportInterface.phpÌ���|2_Ì���¯à¨¿¤������+���src/Composer/Downloader/DownloadManager.php`��|2_`��#ÏX¤������/���src/Composer/Downloader/DownloaderInterface.phpÊ��|2_Ê��gs!l¤������3���src/Composer/Downloader/DvcsDownloaderInterface.phpÑ���|2_Ñ���&Áœ¿¤������*���src/Composer/Downloader/FileDownloader.phpG��|2_G��äOФ������/���src/Composer/Downloader/FilesystemException.php
  30. ��|2_
  31. ��.-‹¤������,���src/Composer/Downloader/FossilDownloader.php‚ ��|2_‚ ��Ü�Ii¤������)���src/Composer/Downloader/GitDownloader.phpû6��|2_û6��Ëv0K¤������*���src/Composer/Downloader/GzipDownloader.phpó��|2_ó��}Úo¤������(���src/Composer/Downloader/HgDownloader.php”��|2_”��ßis̤������*���src/Composer/Downloader/PathDownloader.phpT��|2_T��®–¤������0���src/Composer/Downloader/PearPackageExtractor.phpu��|2_u��z„‡¤������.���src/Composer/Downloader/PerforceDownloader.phpž��|2_ž��Öüñ9¤������*���src/Composer/Downloader/PharDownloader.phpå���|2_å���ÞÉç¤������)���src/Composer/Downloader/RarDownloader.phpž��|2_ž��6 3U¤������)���src/Composer/Downloader/SvnDownloader.phpM��|2_M�� !`¤������)���src/Composer/Downloader/TarDownloader.phpã���|2_ã���Í’X?¤������.���src/Composer/Downloader/TransportException.php=��|2_=��ZÎÈÞ¤������9���src/Composer/Downloader/VcsCapableDownloaderInterface.phpÔ���|2_Ô���`§ôö¤������)���src/Composer/Downloader/VcsDownloader.php¡��|2_¡��( à>¤������(���src/Composer/Downloader/XzDownloader.php§��|2_§��W$;á¤������)���src/Composer/Downloader/ZipDownloader.php���|2_���®Û#s¤������&���src/Composer/EventDispatcher/Event.php ��|2_ ��±™jï¤������0���src/Composer/EventDispatcher/EventDispatcher.php�7��|2_�7��—Øa¡¤������9���src/Composer/EventDispatcher/EventSubscriberInterface.php©���|2_©���h·0¤������9���src/Composer/EventDispatcher/ScriptExecutionException.phpv���|2_v���wZ8S¤������)���src/Composer/Exception/NoSslException.phpf���|2_f���ËíM�¤���������src/Composer/Factory.php_=��|2__=��x"Ť���������src/Composer/IO/BaseIO.php•��|2_•��ìÏA¤���������src/Composer/IO/BufferIO.php¾��|2_¾��X~d¤���������src/Composer/IO/ConsoleIO.php��|2_��üw·¤���������src/Composer/IO/IOInterface.phpì��|2_ì���Õ�¤���������src/Composer/IO/NullIO.phpÀ��|2_À��F`sʤ���������src/Composer/Installer.php¦£��|2_¦£��8Òд¤������*���src/Composer/Installer/BinaryInstaller.php
  32. ��|2_
  33. ��t¤{ø¤������2���src/Composer/Installer/BinaryPresenceInterface.phpË���|2_Ë���À5š¨¤������.���src/Composer/Installer/InstallationManager.php-��|2_-��¾}Œ7¤������)���src/Composer/Installer/InstallerEvent.php��|2_��lÔzi¤������*���src/Composer/Installer/InstallerEvents.phpÞ���|2_Þ���ìŸ@G¤������-���src/Composer/Installer/InstallerInterface.phpã��|2_ã��^ƒ“ʤ������+���src/Composer/Installer/LibraryInstaller.php%��|2_%�� »�̤������/���src/Composer/Installer/MetapackageInstaller.phpÊ��|2_Ê��Ùti·¤������(���src/Composer/Installer/NoopInstaller.php+��|2_+��À·M}¤������'���src/Composer/Installer/PackageEvent.phpe��|2_e��;° ¤������(���src/Composer/Installer/PackageEvents.php¸��|2_¸��dbØs¤������.���src/Composer/Installer/PearBinaryInstaller.phpø ��|2_ø ��*ë•k¤������(���src/Composer/Installer/PearInstaller.php¢��|2_¢��È‚¶Ñ¤������*���src/Composer/Installer/PluginInstaller.php¢��|2_¢��L´a:¤������+���src/Composer/Installer/ProjectInstaller.php��|2_��*0@P¤������4���src/Composer/Installer/SuggestedPackagesReporter.php:��|2_:��‚´UV¤���������src/Composer/Json/JsonFile.phpL��|2_L��rs¤������#���src/Composer/Json/JsonFormatter.phpb��|2_b��ÝNš¤������%���src/Composer/Json/JsonManipulator.php“4��|2_“4��Í®š¤������-���src/Composer/Json/JsonValidationException.php\��|2_\��.Xóܤ������%���src/Composer/Package/AliasPackage.phpî��|2_î��-�×&¤������7���src/Composer/Package/Archiver/ArchivableFilesFilter.php ��|2_ ��yY+¦¤������7���src/Composer/Package/Archiver/ArchivableFilesFinder.phpÞ��|2_Þ�� ²²¹¤������0���src/Composer/Package/Archiver/ArchiveManager.phpÝ ��|2_Ý ��í<´B¤������3���src/Composer/Package/Archiver/ArchiverInterface.php��|2_��ñ´> ¤������3���src/Composer/Package/Archiver/BaseExcludeFilter.php–��|2_–��y¶=Ƥ������7���src/Composer/Package/Archiver/ComposerExcludeFilter.php��|2_��‹SZ0¤������2���src/Composer/Package/Archiver/GitExcludeFilter.phpr��|2_r��3‘Mh¤������1���src/Composer/Package/Archiver/HgExcludeFilter.php ��|2_ �� •¦S¤������.���src/Composer/Package/Archiver/PharArchiver.php?��|2_?��®— u¤������-���src/Composer/Package/Archiver/ZipArchiver.phpX��|2_X��¤k�~¤������$���src/Composer/Package/BasePackage.php ��|2_ ��Î&|'¤������*���src/Composer/Package/Comparer/Comparer.phpR��|2_R��Ïسî¤������(���src/Composer/Package/CompletePackage.php¦��|2_¦��p[Ö¤������1���src/Composer/Package/CompletePackageInterface.php��|2_��Ϋ>¤������+���src/Composer/Package/Dumper/ArrayDumper.phpb ��|2_b ��s•°›¤���������src/Composer/Package/Link.phpˆ��|2_ˆ��å¶Y«¤������7���src/Composer/Package/LinkConstraint/EmptyConstraint.php‚��|2_‚��é~‹¤������?���src/Composer/Package/LinkConstraint/LinkConstraintInterface.phpd��|2_d��¤ôLn¤������7���src/Composer/Package/LinkConstraint/MultiConstraint.php‚��|2_‚��ób`ý¤������:���src/Composer/Package/LinkConstraint/SpecificConstraint.phpi��|2_i��Þ”š%¤������9���src/Composer/Package/LinkConstraint/VersionConstraint.phpX��|2_X��}`y¤������+���src/Composer/Package/Loader/ArrayLoader.php½��|2_½��c
  34. @�¤������7���src/Composer/Package/Loader/InvalidPackageException.phpE��|2_E��xb¾¤������*���src/Composer/Package/Loader/JsonLoader.phpù��|2_ù��!~ˆ{¤������/���src/Composer/Package/Loader/LoaderInterface.php²���|2_²���¦}úΤ������1���src/Composer/Package/Loader/RootPackageLoader.phpë��|2_ë��ÛŠ ›¤������5���src/Composer/Package/Loader/ValidatingArrayLoader.php.B��|2_.B��åpHD¤���������src/Composer/Package/Locker.php="��|2_="��GµF+¤������ ���src/Composer/Package/Package.phpÉ��|2_É��cÃ�h¤������)���src/Composer/Package/PackageInterface.php\��|2_\��xåp¨¤������)���src/Composer/Package/RootAliasPackage.php ��|2_ �� _€ø¤������$���src/Composer/Package/RootPackage.php��|2_��ŽÎ_¤������-���src/Composer/Package/RootPackageInterface.php¹��|2_¹��"maV¤������/���src/Composer/Package/Version/VersionGuesser.php"��|2_"��XTõK¤������.���src/Composer/Package/Version/VersionParser.php¥��|2_¥��ô´à¤������0���src/Composer/Package/Version/VersionSelector.php¨��|2_¨��ý5½,¤������-���src/Composer/Plugin/Capability/Capability.phpW���|2_W���æ_¨1¤������2���src/Composer/Plugin/Capability/CommandProvider.php—���|2_—���ûOâ>¤���������src/Composer/Plugin/Capable.php���|2_���Æq+¤������$���src/Composer/Plugin/CommandEvent.phpâ��|2_â��³ÆÇW¤������$���src/Composer/Plugin/PluginEvents.phpö���|2_ö���á1=z¤������'���src/Composer/Plugin/PluginInterface.phpô���|2_ô���)'*ؤ������%���src/Composer/Plugin/PluginManager.phpª$��|2_ª$��m‰ƒä¤������*���src/Composer/Plugin/PreCommandRunEvent.phpõ��|2_õ��:ðd¤������,���src/Composer/Plugin/PreFileDownloadEvent.php`��|2_`���9-Τ������4���src/Composer/Question/StrictConfirmationQuestion.php��|2_��'.³è¤������+���src/Composer/Repository/ArrayRepository.php¬��|2_¬��cð?¤������.���src/Composer/Repository/ArtifactRepository.phpí��|2_í��q9OS¤������*���src/Composer/Repository/BaseRepository.phpŠ��|2_Š��äÝ÷¤������.���src/Composer/Repository/ComposerRepository.php0U��|2_0U��Ã7L†¤������/���src/Composer/Repository/CompositeRepository.php;��|2_;��¤¯S¤������;���src/Composer/Repository/ConfigurableRepositoryInterface.php…���|2_…���±Ÿ_¤������0���src/Composer/Repository/FilesystemRepository.phpp��|2_p��#ù¤������4���src/Composer/Repository/InstalledArrayRepository.php£���|2_£���/ö~>¤������9���src/Composer/Repository/InstalledFilesystemRepository.php£���|2_£���V
  35. •_¤������8���src/Composer/Repository/InstalledRepositoryInterface.php‡���|2_‡���£9p¤������6���src/Composer/Repository/InvalidRepositoryException.phpn���|2_n���à“똤������-���src/Composer/Repository/PackageRepository.phpj��|2_j��¥ôò̤������*���src/Composer/Repository/PathRepository.phpé��|2_é��J!šˆ¤������2���src/Composer/Repository/Pear/BaseChannelReader.phpI��|2_I��c6³¤������,���src/Composer/Repository/Pear/ChannelInfo.phpÄ��|2_Ä��:T*ɤ������.���src/Composer/Repository/Pear/ChannelReader.phpí��|2_í��?ÈYT¤������4���src/Composer/Repository/Pear/ChannelRest10Reader.php® ��|2_® ��™ÖÛú¤������4���src/Composer/Repository/Pear/ChannelRest11Reader.php& ��|2_& ��òUb¤������5���src/Composer/Repository/Pear/DependencyConstraint.phpq��|2_q��9=¤������/���src/Composer/Repository/Pear/DependencyInfo.phpq��|2_q��fºTò¤������8���src/Composer/Repository/Pear/PackageDependencyParser.php…��|2_…��÷$Li¤������,���src/Composer/Repository/Pear/PackageInfo.php°��|2_°��Ÿ ¸ ¤������,���src/Composer/Repository/Pear/ReleaseInfo.php’��|2_’��o“ŠÃ¤������*���src/Composer/Repository/PearRepository.phpª��|2_ª��)Ÿƒ}¤������.���src/Composer/Repository/PlatformRepository.php;!��|2_;!��äö9¤������-���src/Composer/Repository/RepositoryFactory.php��|2_��è0¹¤������/���src/Composer/Repository/RepositoryInterface.phpÛ��|2_Û��’âÁ¤������-���src/Composer/Repository/RepositoryManager.phpM ��|2_M ��<(;Œ¤������7���src/Composer/Repository/RepositorySecurityException.phpo���|2_o���pÕ«ª¤������/���src/Composer/Repository/Vcs/BitbucketDriver.php• ��|2_• ��$©Rç¤������,���src/Composer/Repository/Vcs/FossilDriver.php³��|2_³��ÐCk¤������2���src/Composer/Repository/Vcs/GitBitbucketDriver.phpë��|2_ë��œ´½X¤������)���src/Composer/Repository/Vcs/GitDriver.php:��|2_:��ÀÕ.p¤������,���src/Composer/Repository/Vcs/GitHubDriver.php 4��|2_ 4�� ˜%i¤������,���src/Composer/Repository/Vcs/GitLabDriver.php¢*��|2_¢*��uÖ|¤������1���src/Composer/Repository/Vcs/HgBitbucketDriver.phpå��|2_å��@)‰L¤������(���src/Composer/Repository/Vcs/HgDriver.phpB��|2_B��»ƒî¤������.���src/Composer/Repository/Vcs/PerforceDriver.phpù ��|2_ù ��&½tÙ¤������)���src/Composer/Repository/Vcs/SvnDriver.php¤��|2_¤�� ¤������)���src/Composer/Repository/Vcs/VcsDriver.phpæ
  36. ��|2_æ
  37. ��eׯ-¤������2���src/Composer/Repository/Vcs/VcsDriverInterface.php÷��|2_÷��ÇX[‰¤������)���src/Composer/Repository/VcsRepository.php˜-��|2_˜-��ø2²¤������1���src/Composer/Repository/VersionCacheInterface.php”���|2_”���A?Rï¤������3���src/Composer/Repository/WritableArrayRepository.php��|2_��¾G*¤������7���src/Composer/Repository/WritableRepositoryInterface.php‰��|2_‰��‘/sï¤������$���src/Composer/Script/CommandEvent.phpW���|2_W���£VZt¤���������src/Composer/Script/Event.phpº��|2_º��ò�»¤¤������$���src/Composer/Script/PackageEvent.phpœ���|2_œ���§ÿÉ ¤������$���src/Composer/Script/ScriptEvents.phpP��|2_P��‡�¶¤������ ���src/Composer/SelfUpdate/Keys.php���|2_��� îÊN¤������$���src/Composer/SelfUpdate/Versions.php”��|2_”��nœz¤������ ���src/Composer/Util/AuthHelper.phpË��|2_Ë��>zx–¤���������src/Composer/Util/Bitbucket.php*��|2_*��,Lšk¤������$���src/Composer/Util/ComposerMirror.php±��|2_±��­½øؤ������%���src/Composer/Util/ConfigValidator.php÷��|2_÷��v•Í¤������"���src/Composer/Util/ErrorHandler.php»��|2_»��O›rk¤������ ���src/Composer/Util/Filesystem.phpm/��|2_m/��Çë¡ú¤���������src/Composer/Util/Git.phpä0��|2_ä0��'‰ïç¤���������src/Composer/Util/GitHub.php| ��|2_| ��`0tü¤���������src/Composer/Util/GitLab.phpù��|2_ù��ž7«£¤���������src/Composer/Util/Hg.php¾��|2_¾��LÓ �¤���������src/Composer/Util/IniHelper.phph��|2_h��;FP¤������$���src/Composer/Util/NoProxyPattern.php|��|2_|��¸|ää¤������#���src/Composer/Util/PackageSorter.phpÞ��|2_Þ��ê×ìY¤���������src/Composer/Util/Perforce.php¸2��|2_¸2��Ás&}¤���������src/Composer/Util/Platform.phpü��|2_ü��s­fç¤������%���src/Composer/Util/ProcessExecutor.php$ ��|2_$ ��¨Nó¤������&���src/Composer/Util/RemoteFilesystem.phpFr��|2_Fr��¡Ò¤���������src/Composer/Util/Silencer.phpé��|2_é��“Vjf¤������!���src/Composer/Util/SpdxLicense.php��|2_��¾7
  38. ñ¤������*���src/Composer/Util/StreamContextFactory.php��|2_��CÉ…ù¤���������src/Composer/Util/Svn.php,��|2_,��Ì žÄ¤���������src/Composer/Util/TlsHelper.phpL
  39. ��|2_L
  40. ��" i¤���������src/Composer/Util/Url.php£��|2_£��3œÉܤ���������src/Composer/Util/Zip.php³��|2_³��äŠÎª¤���������src/Composer/XdebugHandler.phpð��|2_ð��zÓf~¤���������src/bootstrap.php¹��|2_¹��I}œ¤������%���src/Composer/Autoload/ClassLoader.php“4��|2_“4��²z�–¤������#���res/composer-repository-schema.jsonð��|2_ð���GÐà¤���������res/composer-schema.jsonM���|2_M���_Τ������6���vendor/composer/spdx-licenses/res/spdx-exceptions.jsonä
  41. ��|2_ä
  42. ��P•Êª¤������4���vendor/composer/spdx-licenses/res/spdx-licenses.jsonž��|2_ž��¿T‡î¤������4���vendor/symfony/console/Resources/bin/hiddeninput.exe�$��|2_�$��•�¥v¤������&���vendor/symfony/console/Application.php=X��|2_=X��� S’¤������*���vendor/symfony/console/Command/Command.phpî"��|2_î"��x°jÕ¤������.���vendor/symfony/console/Command/HelpCommand.phpØ��|2_Ø��¦Ú-:¤������.���vendor/symfony/console/Command/ListCommand.phpZ��|2_Z��»w`¤������(���vendor/symfony/console/ConsoleEvents.phpé���|2_é���RÛÔe¤������<���vendor/symfony/console/Descriptor/ApplicationDescription.phpÐ��|2_Ð��™Ž5°¤������0���vendor/symfony/console/Descriptor/Descriptor.php���|2_���¿N•¤������9���vendor/symfony/console/Descriptor/DescriptorInterface.phpü���|2_ü���±Qµ¤������4���vendor/symfony/console/Descriptor/JsonDescriptor.phpÜ ��|2_Ü ��*û�ɤ������8���vendor/symfony/console/Descriptor/MarkdownDescriptor.php¶��|2_¶��·Ô;ݤ������4���vendor/symfony/console/Descriptor/TextDescriptor.php¼��|2_¼��òç$¤������3���vendor/symfony/console/Descriptor/XmlDescriptor.php��|2_��b{<¤������4���vendor/symfony/console/Event/ConsoleCommandEvent.php°��|2_°��!�Ȥ������-���vendor/symfony/console/Event/ConsoleEvent.phpÅ��|2_Å��ÒxÛ\¤������6���vendor/symfony/console/Event/ConsoleExceptionEvent.php��|2_��á2é¤������6���vendor/symfony/console/Event/ConsoleTerminateEvent.phpz��|2_z��³,îL¤������=���vendor/symfony/console/Exception/CommandNotFoundException.phpÔ��|2_Ô��È÷ L¤������7���vendor/symfony/console/Exception/ExceptionInterface.phpf���|2_f���¡ABª¤������=���vendor/symfony/console/Exception/InvalidArgumentException.php¦���|2_¦���Ö̽Z¤������;���vendor/symfony/console/Exception/InvalidOptionException.php¦���|2_¦���Ë×H¤������3���vendor/symfony/console/Exception/LogicException.php’���|2_’���ÍO\e¤������5���vendor/symfony/console/Exception/RuntimeException.php–���|2_–���Ùí,6¤������4���vendor/symfony/console/Formatter/OutputFormatter.php6��|2_6��?=¨¤������=���vendor/symfony/console/Formatter/OutputFormatterInterface.phpŒ��|2_Œ��òññÀ¤������9���vendor/symfony/console/Formatter/OutputFormatterStyle.phpF��|2_F��𦴤������B���vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php„��|2_„��÷½G¤������>���vendor/symfony/console/Formatter/OutputFormatterStyleStack.php@��|2_@��G¨ýU¤������6���vendor/symfony/console/Helper/DebugFormatterHelper.phpy��|2_y��Ì8ÆФ������2���vendor/symfony/console/Helper/DescriptorHelper.phpw��|2_w��|¦C¤������.���vendor/symfony/console/Helper/DialogHelper.php��|2_��¹ÜÃ_¤������1���vendor/symfony/console/Helper/FormatterHelper.phpd��|2_d��§×,¸¤������(���vendor/symfony/console/Helper/Helper.php«��|2_«��!�§—¤������1���vendor/symfony/console/Helper/HelperInterface.phpå���|2_å���Š ¤������+���vendor/symfony/console/Helper/HelperSet.phpÊ��|2_Ê��áÏW"¤������2���vendor/symfony/console/Helper/InputAwareHelper.phpc��|2_c��Ìøƒ¤������/���vendor/symfony/console/Helper/ProcessHelper.phpÓ ��|2_Ó ��©w‚R¤������-���vendor/symfony/console/Helper/ProgressBar.phpl%��|2_l%�� díÛ¤������0���vendor/symfony/console/Helper/ProgressHelper.php]��|2_]��ù»‰X¤������3���vendor/symfony/console/Helper/ProgressIndicator.phpN��|2_N��ÿ§³l¤������0���vendor/symfony/console/Helper/QuestionHelper.phpl��|2_l��Ntó¤������7���vendor/symfony/console/Helper/SymfonyQuestionHelper.php–
  43. ��|2_–
  44. ��- ؤ������'���vendor/symfony/console/Helper/Table.phpÄ*��|2_Ä*��¾™ØT¤������+���vendor/symfony/console/Helper/TableCell.php���|2_���åV^¤������-���vendor/symfony/console/Helper/TableHelper.php ��|2_ ��›uô™¤������0���vendor/symfony/console/Helper/TableSeparator.phpÊ���|2_Ê���az¤������,���vendor/symfony/console/Helper/TableStyle.php
  45. ��|2_
  46. ��_ÍI"¤������*���vendor/symfony/console/Input/ArgvInput.php��|2_��×ö†›¤������+���vendor/symfony/console/Input/ArrayInput.php) ��|2_) ��¥ÑC¤������&���vendor/symfony/console/Input/Input.php£ ��|2_£ ��f¡?¤������.���vendor/symfony/console/Input/InputArgument.php��|2_��D £¤������4���vendor/symfony/console/Input/InputAwareInterface.php˜���|2_˜���­O°¤������0���vendor/symfony/console/Input/InputDefinition.php†��|2_†��¤U)¤¤������/���vendor/symfony/console/Input/InputInterface.php£��|2_£��ÆBŒ'¤������,���vendor/symfony/console/Input/InputOption.php ��|2_ ��\¢Ü=¤������,���vendor/symfony/console/Input/StringInput.phpš��|2_š��žµ è¤���������vendor/symfony/console/LICENSE)��|2_)��NUN½¤������/���vendor/symfony/console/Logger/ConsoleLogger.php0 ��|2_0 ��…� ¸¤������0���vendor/symfony/console/Output/BufferedOutput.php_��|2__��‹ >P¤������/���vendor/symfony/console/Output/ConsoleOutput.php±��|2_±��nì!f¤������8���vendor/symfony/console/Output/ConsoleOutputInterface.phpà���|2_à���‡†Æʤ������,���vendor/symfony/console/Output/NullOutput.phpÏ��|2_Ï��®˜‹Z¤������(���vendor/symfony/console/Output/Output.php˜ ��|2_˜ ��0p¤������1���vendor/symfony/console/Output/OutputInterface.php��|2_���ì&¤������.���vendor/symfony/console/Output/StreamOutput.php���|2_���Ä’Oç¤������2���vendor/symfony/console/Question/ChoiceQuestion.phpx
  47. ��|2_x
  48. ��W€!¤������8���vendor/symfony/console/Question/ConfirmationQuestion.phpè��|2_è��/Ô�¤������,���vendor/symfony/console/Question/Question.phpÎ ��|2_Î ��lF¤������ ���vendor/symfony/console/Shell.phpæ��|2_æ��¼XÒA¤������,���vendor/symfony/console/Style/OutputStyle.php\��|2_\��wפ¤������/���vendor/symfony/console/Style/StyleInterface.phpÏ��|2_Ï��&nÅѤ������-���vendor/symfony/console/Style/SymfonyStyle.phpä��|2_ä��­å (¤������3���vendor/symfony/console/Tester/ApplicationTester.phpÏ��|2_Ï��sž9i¤������/���vendor/symfony/console/Tester/CommandTester.phpª��|2_ª��¬K z¤������(���vendor/symfony/debug/BufferingLogger.phpt��|2_t��=�hܤ���������vendor/symfony/debug/Debug.php,��|2_,��Ë~Ž.¤������)���vendor/symfony/debug/DebugClassLoader.phpµ��|2_µ��1rEÓ¤������%���vendor/symfony/debug/ErrorHandler.phpH��|2_H��¹:D#¤������9���vendor/symfony/debug/Exception/ClassNotFoundException.php–��|2_–��i‰æô¤������8���vendor/symfony/debug/Exception/ContextErrorException.php˜��|2_˜��-
  49. d2¤������1���vendor/symfony/debug/Exception/DummyException.php��|2_��®+Ãê¤������6���vendor/symfony/debug/Exception/FatalErrorException.php��|2_��™Ä¤������6���vendor/symfony/debug/Exception/FatalThrowableError.phpW��|2_W��?àèK¤������3���vendor/symfony/debug/Exception/FlattenException.php¼��|2_¼�� פ������7���vendor/symfony/debug/Exception/OutOfMemoryException.php~���|2_~���ë¨oâ¤������=���vendor/symfony/debug/Exception/UndefinedFunctionException.phpš��|2_š���ñJÀ¤������;���vendor/symfony/debug/Exception/UndefinedMethodException.php˜��|2_˜��nöêؤ������)���vendor/symfony/debug/ExceptionHandler.php)3��|2_)3���h5=¤������I���vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.phpA��|2_A��Ϥ¹l¤������E���vendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.php��|2_��ĹBV¤������M���vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.phpx��|2_x��~ò"¤������K���vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.phpO��|2_O���ž¦*¤���������vendor/symfony/debug/LICENSE)��|2_)��NUN½¤������:���vendor/symfony/filesystem/Exception/ExceptionInterface.phpi���|2_i���$ ÿ›¤������=���vendor/symfony/filesystem/Exception/FileNotFoundException.php¼��|2_¼��pí\¶¤������3���vendor/symfony/filesystem/Exception/IOException.php‡��|2_‡��€ü#Ѥ������<���vendor/symfony/filesystem/Exception/IOExceptionInterface.php¦���|2_¦���jÙwM¤������(���vendor/symfony/filesystem/Filesystem.phpc4��|2_c4��‹×@þ¤������!���vendor/symfony/filesystem/LICENSE)��|2_)��NUN½¤������)���vendor/symfony/filesystem/LockHandler.phpö��|2_ö��ŸZµ1¤������1���vendor/symfony/finder/Adapter/AbstractAdapter.php\ ��|2_\ ��hˆB¤������5���vendor/symfony/finder/Adapter/AbstractFindAdapter.php���|2_���HC€/¤������2���vendor/symfony/finder/Adapter/AdapterInterface.php›��|2_›��Mþ¤������0���vendor/symfony/finder/Adapter/BsdFindAdapter.php3��|2_3��75$·¤������0���vendor/symfony/finder/Adapter/GnuFindAdapter.php��|2_��Ÿ`]¤������,���vendor/symfony/finder/Adapter/PhpAdapter.phpô��|2_ô��Þdè;¤������/���vendor/symfony/finder/Comparator/Comparator.php���|2_���¾üœµ¤������3���vendor/symfony/finder/Comparator/DateComparator.php#��|2_#��°Τ������5���vendor/symfony/finder/Comparator/NumberComparator.php|��|2_|��ITÇͤ������9���vendor/symfony/finder/Exception/AccessDeniedException.php„���|2_„���½¾sœ¤������;���vendor/symfony/finder/Exception/AdapterFailureException.php¬��|2_¬��wR¤������6���vendor/symfony/finder/Exception/ExceptionInterface.php„���|2_„���Gz-¤������A���vendor/symfony/finder/Exception/OperationNotPermitedException.php)��|2_)��x§e¤������@���vendor/symfony/finder/Exception/ShellCommandFailureException.phpº��|2_º��˜þ˜¤������/���vendor/symfony/finder/Expression/Expression.php��|2_��i¥:Ť������)���vendor/symfony/finder/Expression/Glob.phpf��|2_f��DÞcj¤������*���vendor/symfony/finder/Expression/Regex.php��|2_��ü(ÃϤ������3���vendor/symfony/finder/Expression/ValueInterface.phpÍ��|2_Í��\p4†¤������ ���vendor/symfony/finder/Finder.phpc.��|2_c.��:ˆ5g¤���������vendor/symfony/finder/Glob.phpL��|2_L��jÍ9פ������7���vendor/symfony/finder/Iterator/CustomFilterIterator.php]��|2_]��ÎoÅƤ������:���vendor/symfony/finder/Iterator/DateRangeFilterIterator.phpx��|2_x��ôP¤������;���vendor/symfony/finder/Iterator/DepthRangeFilterIterator.phpî��|2_î��üÍ�q¤������A���vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.phpí��|2_í��nõH¤������4���vendor/symfony/finder/Iterator/FilePathsIterator.php#��|2_#��G?T½¤������9���vendor/symfony/finder/Iterator/FileTypeFilterIterator.phpZ��|2_Z��(&ø¤������<���vendor/symfony/finder/Iterator/FilecontentFilterIterator.php5��|2_5��ší¤������9���vendor/symfony/finder/Iterator/FilenameFilterIterator.phpr��|2_r��tu¤������1���vendor/symfony/finder/Iterator/FilterIterator.phpÃ��|2_Ã��š+µÞ¤������=���vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php-��|2_-��ºÎÒ_¤������5���vendor/symfony/finder/Iterator/PathFilterIterator.phpÐ��|2_Ð��‚c¤������=���vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php ��|2_ ��ë]í»¤������:���vendor/symfony/finder/Iterator/SizeRangeFilterIterator.phpe��|2_e��Ÿ’áé¤������3���vendor/symfony/finder/Iterator/SortableIterator.php+��|2_+��õÝË ¤���������vendor/symfony/finder/LICENSE)��|2_)��NUN½¤������'���vendor/symfony/finder/Shell/Command.php> ��|2_> ��_~u ¤������%���vendor/symfony/finder/Shell/Shell.phpr��|2_r��þpN¤������%���vendor/symfony/finder/SplFileInfo.php��|2_��þ�íù¤������'���vendor/symfony/polyfill-ctype/Ctype.phpH ��|2_H ��³�Õݤ������%���vendor/symfony/polyfill-ctype/LICENSE)��|2_)��´`e0¤������+���vendor/symfony/polyfill-ctype/bootstrap.phpä��|2_ä��—o£¤������(���vendor/symfony/polyfill-mbstring/LICENSE)��|2_)��“\ª¤������-���vendor/symfony/polyfill-mbstring/Mbstring.php€G��|2_€G��ɖз¤������@���vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php÷@��|2_÷@��õžØ¤������F���vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.phpã��|2_ã��öy_•¤������@���vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.phpfA��|2_fA��Úf”ߤ������.���vendor/symfony/polyfill-mbstring/bootstrap.php)��|2_)��p¼B¤������7���vendor/symfony/process/Exception/ExceptionInterface.phpf���|2_f���]ö>T¤������=���vendor/symfony/process/Exception/InvalidArgumentException.php¨���|2_¨���ÐÀ+_¤������3���vendor/symfony/process/Exception/LogicException.php”���|2_”��� ³ãñ¤������;���vendor/symfony/process/Exception/ProcessFailedException.phpx��|2_x��¨Ìzy¤������=���vendor/symfony/process/Exception/ProcessTimedOutException.php��|2_��﫤������5���vendor/symfony/process/Exception/RuntimeException.php˜���|2_˜���¢Ø:¤������+���vendor/symfony/process/ExecutableFinder.php���|2_���ûus€¤���������vendor/symfony/process/LICENSE)��|2_)��NUN½¤������.���vendor/symfony/process/PhpExecutableFinder.phpÏ��|2_Ï��Î%h¤������%���vendor/symfony/process/PhpProcess.phpü��|2_ü��‡jûü¤������.���vendor/symfony/process/Pipes/AbstractPipes.php½��|2_½��憤������/���vendor/symfony/process/Pipes/PipesInterface.phpD��|2_D��vØ������*���vendor/symfony/process/Pipes/UnixPipes.php>��|2_>��ª•ir¤������-���vendor/symfony/process/Pipes/WindowsPipes.phpp ��|2_p ��âU~ɤ������"���vendor/symfony/process/Process.php·R��|2_·R��Š`Õ¤������)���vendor/symfony/process/ProcessBuilder.phpâ
  50. ��|2_â
  51. ��†M¶¤������'���vendor/symfony/process/ProcessUtils.phpQ��|2_Q��b-$m¤���������vendor/seld/jsonlint/LICENSE"��|2_"��aƒsy¤������@���vendor/seld/jsonlint/src/Seld/JsonLint/DuplicateKeyException.php*��|2_*��•pñ¤������5���vendor/seld/jsonlint/src/Seld/JsonLint/JsonParser.php_2��|2__2��Š–S¤������0���vendor/seld/jsonlint/src/Seld/JsonLint/Lexer.php'��|2_'��T×5ã¤������;���vendor/seld/jsonlint/src/Seld/JsonLint/ParsingException.php��|2_��‰²ñ¤������4���vendor/seld/jsonlint/src/Seld/JsonLint/Undefined.php>���|2_>���ÿqŸŸ¤������(���vendor/justinrainbow/json-schema/LICENSE ��|2_ ��ºç©¤������.���vendor/justinrainbow/json-schema/demo/demo.phpñ��|2_ñ��fC¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php¡ ��|2_¡ ��†wÌl¤������T���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.php�
  52. ��|2_�
  53. ��ÍèÓ¯¤������J���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php§ ��|2_§ ��›Vؤ������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php¼��|2_¼��ÿ Qœ¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.php]��|2_]��VŽU<¤������G���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.phpã ��|2_ã ��á0;¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.php…��|2_…��“TœÚ¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.php‡ ��|2_‡ ��ï›(¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.phpÃ��|2_Ã��©Å¼x¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.php0 ��|2_0 ��×j´˜¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.php��|2_��¥wš‡¤������X���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.phpa��|2_a�� qä������Y���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php—��|2_—��4~¾ ¤������\���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php‰��|2_‰��“µ+j¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.php&��|2_&��4˜©T¤������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.phpS"��|2_S"��¼¾õ:¤������F���vendor/justinrainbow/json-schema/src/JsonSchema/Entity/JsonPointer.phpè��|2_è��{N–¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ExceptionInterface.phpI���|2_I���%|°¤������V���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidArgumentException.php•���|2_•���‹àG¤������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidConfigException.phpl���|2_l���A!Lפ������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaException.phpl���|2_l���è2÷þ¤������]���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaMediaTypeException.phpu���|2_u���=hç¤������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSourceUriException.phpw���|2_w���N-ò[¤������S���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.phpÞ��|2_Þ��\¸
  54. ¤������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ResourceNotFoundException.phpo���|2_o���píÛù¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/RuntimeException.php…���|2_…���%…—¤������^���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UnresolvableJsonPointerException.php€���|2_€���u-#1¤������R���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UriResolverException.phpj���|2_j���å>�¤������Q���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ValidationException.phpf���|2_f���¬¤„þ¤������K���vendor/justinrainbow/json-schema/src/JsonSchema/Iterator/ObjectIterator.phpþ��|2_þ��M�„õ¤������;���vendor/justinrainbow/json-schema/src/JsonSchema/Rfc3339.php ��|2_ ��f4÷³¤������A���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorage.phpœ ��|2_œ ��åfO¤������J���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorageInterface.php��|2_��oŠ+}¤������T���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/AbstractRetriever.phpá���|2_á���[þA�¤������G���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/Curl.php¥��|2_¥��Ô§Lb¤������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/FileGetContents.php%��|2_%��5" ¤������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/PredefinedArray.php,��|2_,��1•5þ¤������X���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php®���|2_®���ÿ‹Áå¤������C���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriResolver.php ��|2_ ��£Ÿ)à¤������D���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriRetriever.phpF��|2_F��¨IaD¤������H���vendor/justinrainbow/json-schema/src/JsonSchema/UriResolverInterface.phpƒ���|2_ƒ���J€¤������I���vendor/justinrainbow/json-schema/src/JsonSchema/UriRetrieverInterface.php…���|2_…���íæe¤������=���vendor/justinrainbow/json-schema/src/JsonSchema/Validator.phpv��|2_v��õÍg¤������%���vendor/composer/spdx-licenses/LICENSE��|2_��Bhí¤������2���vendor/composer/spdx-licenses/src/SpdxLicenses.phpH��|2_H��͉T¤���������vendor/composer/semver/LICENSE��|2_��Bhí¤������)���vendor/composer/semver/src/Comparator.php��|2_��wlƒï¤������<���vendor/composer/semver/src/Constraint/AbstractConstraint.phpî��|2_î��Õ­w-¤������4���vendor/composer/semver/src/Constraint/Constraint.php’ ��|2_’ ��I&â¤������=���vendor/composer/semver/src/Constraint/ConstraintInterface.phpß���|2_ß���0C,‡¤������9���vendor/composer/semver/src/Constraint/EmptyConstraint.phpä��|2_ä��ïõ‚³¤������9���vendor/composer/semver/src/Constraint/MultiConstraint.php,��|2_,��0°=¤������%���vendor/composer/semver/src/Semver.php‚��|2_‚��?nݤ������,���vendor/composer/semver/src/VersionParser.php¸*��|2_¸*��GLÇí¤������!���vendor/composer/ca-bundle/LICENSE��|2_��*!^`¤������*���vendor/composer/ca-bundle/src/CaBundle.phpR��|2_R��!Ã%�¤������&���vendor/composer/xdebug-handler/LICENSE)��|2_)��#Ô;^¤������0���vendor/composer/xdebug-handler/src/PhpConfig.php´��|2_´��*D’�¤������.���vendor/composer/xdebug-handler/src/Process.phpp ��|2_p ��i,i‘¤������-���vendor/composer/xdebug-handler/src/Status.php
  55. ��|2_
  56. ��$Ÿv-¤������4���vendor/composer/xdebug-handler/src/XdebugHandler.php:!��|2_:!�� ðU ¤���������vendor/psr/log/LICENSE=��|2_=��p±ŽO¤������)���vendor/psr/log/Psr/Log/AbstractLogger.php;��|2_;��ñ>3[¤������3���vendor/psr/log/Psr/Log/InvalidArgumentException.php`���|2_`��� ˆX1¤������#���vendor/psr/log/Psr/Log/LogLevel.phpû���|2_û���jðñ8¤������/���vendor/psr/log/Psr/Log/LoggerAwareInterface.php|���|2_|���$£ˆ¤������+���vendor/psr/log/Psr/Log/LoggerAwareTrait.php§���|2_§���T½úB¤������*���vendor/psr/log/Psr/Log/LoggerInterface.phpÈ��|2_È��šx¤������&���vendor/psr/log/Psr/Log/LoggerTrait.phpk��|2_k��£}‰’¤������%���vendor/psr/log/Psr/Log/NullLogger.php ���|2_ ���ÆDi¯¤������)���vendor/psr/log/Psr/Log/Test/DummyTest.phpp���|2_p���Τ������3���vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php ��|2_ ��$/Ò¤������*���vendor/psr/log/Psr/Log/Test/TestLogger.php<��|2_<��þ(åI¤���������vendor/autoload.php‚���|2_‚���Sׄ¤������'���vendor/composer/autoload_namespaces.phpd���|2_d���Z¡¦H¤������!���vendor/composer/autoload_psr4.php÷��|2_÷��Å*š¤������%���vendor/composer/autoload_classmap.phpd���|2_d���Z¡¦H¤������"���vendor/composer/autoload_files.php��|2_��¥� ®¤������!���vendor/composer/autoload_real.phpL��|2_L��_H�¤������#���vendor/composer/autoload_static.php§
  57. ��|2_§
  58. ��‰b?¤���������vendor/composer/ClassLoader.php¨��|2_¨��xää`¤������(���vendor/composer/ca-bundle/res/cacert.pemÇi�|2_Çi�4ËŸ‡¤������ ���bin/composerÊ��|2_Ê���4K¤���������LICENSE.��|2_.�� Õ¤������<?php
  59. namespace Composer\Autoload;
  60. use Composer\Config;
  61. use Composer\EventDispatcher\EventDispatcher;
  62. use Composer\Installer\InstallationManager;
  63. use Composer\IO\IOInterface;
  64. use Composer\Package\AliasPackage;
  65. use Composer\Package\PackageInterface;
  66. use Composer\Repository\InstalledRepositoryInterface;
  67. use Composer\Util\Filesystem;
  68. use Composer\Script\ScriptEvents;
  69. use Composer\Util\PackageSorter;
  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, $scanPsrPackages = false, $suffix = '')
  100. {
  101. if ($this->classMapAuthoritative) {
  102. $scanPsrPackages = true;
  103. }
  104. if ($this->runScripts) {
  105. $this->eventDispatcher->dispatchScript(ScriptEvents::PRE_AUTOLOAD_DUMP, $this->devMode, array(), array(
  106. 'optimize' => (bool) $scanPsrPackages,
  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, $this->devMode === false);
  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. $excluded = null;
  193. if (!empty($autoloads['exclude-from-classmap'])) {
  194. $excluded = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  195. }
  196. $classMap = array();
  197. $ambiguousClasses = array();
  198. $scannedFiles = array();
  199. foreach ($autoloads['classmap'] as $dir) {
  200. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $excluded, null, null, $classMap, $ambiguousClasses, $scannedFiles);
  201. }
  202. if ($scanPsrPackages) {
  203. $namespacesToScan = array();
  204. foreach (array('psr-4', 'psr-0') as $psrType) {
  205. foreach ($autoloads[$psrType] as $namespace => $paths) {
  206. $namespacesToScan[$namespace][] = array('paths' => $paths, 'type' => $psrType);
  207. }
  208. }
  209. krsort($namespacesToScan);
  210. foreach ($namespacesToScan as $namespace => $groups) {
  211. foreach ($groups as $group) {
  212. foreach ($group['paths'] as $dir) {
  213. $dir = $filesystem->normalizePath($filesystem->isAbsolutePath($dir) ? $dir : $basePath.'/'.$dir);
  214. if (!is_dir($dir)) {
  215. continue;
  216. }
  217. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $excluded, $namespace, $group['type'], $classMap, $ambiguousClasses, $scannedFiles);
  218. }
  219. }
  220. }
  221. }
  222. foreach ($ambiguousClasses as $className => $ambigiousPaths) {
  223. $cleanPath = str_replace(array('$vendorDir . \'', '$baseDir . \'', "',\n"), array($vendorPath, $basePath, ''), $classMap[$className]);
  224. $this->io->writeError(
  225. '<warning>Warning: Ambiguous class resolution, "'.$className.'"'.
  226. ' was found '. (count($ambigiousPaths) + 1) .'x: in "'.$cleanPath.'" and "'. implode('", "', $ambigiousPaths) .'", the first will be used.</warning>'
  227. );
  228. }
  229. ksort($classMap);
  230. foreach ($classMap as $class => $code) {
  231. $classmapFile .= ' '.var_export($class, true).' => '.$code;
  232. }
  233. $classmapFile .= ");\n";
  234. if (!$suffix) {
  235. if (!$config->get('autoloader-suffix') && is_readable($vendorPath.'/autoload.php')) {
  236. $content = file_get_contents($vendorPath.'/autoload.php');
  237. if (preg_match('{ComposerAutoloaderInit([^:\s]+)::}', $content, $match)) {
  238. $suffix = $match[1];
  239. }
  240. }
  241. if (!$suffix) {
  242. $suffix = $config->get('autoloader-suffix') ?: md5(uniqid('', true));
  243. }
  244. }
  245. $this->filePutContentsIfModified($targetDir.'/autoload_namespaces.php', $namespacesFile);
  246. $this->filePutContentsIfModified($targetDir.'/autoload_psr4.php', $psr4File);
  247. $this->filePutContentsIfModified($targetDir.'/autoload_classmap.php', $classmapFile);
  248. $includePathFilePath = $targetDir.'/include_paths.php';
  249. if ($includePathFileContents = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  250. $this->filePutContentsIfModified($includePathFilePath, $includePathFileContents);
  251. } elseif (file_exists($includePathFilePath)) {
  252. unlink($includePathFilePath);
  253. }
  254. $includeFilesFilePath = $targetDir.'/autoload_files.php';
  255. if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  256. $this->filePutContentsIfModified($includeFilesFilePath, $includeFilesFileContents);
  257. } elseif (file_exists($includeFilesFilePath)) {
  258. unlink($includeFilesFilePath);
  259. }
  260. $this->filePutContentsIfModified($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath, $staticPhpVersion));
  261. $this->filePutContentsIfModified($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
  262. $this->filePutContentsIfModified($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion));
  263. $this->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
  264. $this->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
  265. if ($this->runScripts) {
  266. $this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode, array(), array(
  267. 'optimize' => (bool) $scanPsrPackages,
  268. ));
  269. }
  270. return count($classMap);
  271. }
  272. private function filePutContentsIfModified($path, $content)
  273. {
  274. $currentContent = @file_get_contents($path);
  275. if (!$currentContent || ($currentContent != $content)) {
  276. return file_put_contents($path, $content);
  277. }
  278. return 0;
  279. }
  280. private function addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $excluded, $namespaceFilter, $autoloadType, array $classMap, array &$ambiguousClasses, array &$scannedFiles)
  281. {
  282. foreach ($this->generateClassMap($dir, $excluded, $namespaceFilter, $autoloadType, true, $scannedFiles) as $class => $path) {
  283. $pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";
  284. if (!isset($classMap[$class])) {
  285. $classMap[$class] = $pathCode;
  286. } elseif ($this->io && $classMap[$class] !== $pathCode && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($classMap[$class].' '.$path, '\\', '/'))) {
  287. $ambiguousClasses[$class][] = $path;
  288. }
  289. }
  290. return $classMap;
  291. }
  292. private function generateClassMap($dir, $excluded, $namespaceFilter, $autoloadType, $showAmbiguousWarning, array &$scannedFiles)
  293. {
  294. return ClassMapGenerator::createMap($dir, $excluded, $showAmbiguousWarning ? $this->io : null, $namespaceFilter, $autoloadType, $scannedFiles);
  295. }
  296. public function buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages)
  297. {
  298. $packageMap = array(array($mainPackage, ''));
  299. foreach ($packages as $package) {
  300. if ($package instanceof AliasPackage) {
  301. continue;
  302. }
  303. $this->validatePackage($package);
  304. $packageMap[] = array(
  305. $package,
  306. $installationManager->getInstallPath($package),
  307. );
  308. }
  309. return $packageMap;
  310. }
  311. protected function validatePackage(PackageInterface $package)
  312. {
  313. $autoload = $package->getAutoload();
  314. if (!empty($autoload['psr-4']) && null !== $package->getTargetDir()) {
  315. $name = $package->getName();
  316. $package->getTargetDir();
  317. throw new \InvalidArgumentException("PSR-4 autoloading is incompatible with the target-dir property, remove the target-dir in package '$name'.");
  318. }
  319. if (!empty($autoload['psr-4'])) {
  320. foreach ($autoload['psr-4'] as $namespace => $dirs) {
  321. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  322. throw new \InvalidArgumentException("psr-4 namespaces must end with a namespace separator, '$namespace' does not, use '$namespace\\'.");
  323. }
  324. }
  325. }
  326. }
  327. public function parseAutoloads(array $packageMap, PackageInterface $mainPackage, $filterOutRequireDevPackages = false)
  328. {
  329. $mainPackageMap = array_shift($packageMap);
  330. if ($filterOutRequireDevPackages) {
  331. $packageMap = $this->filterPackageMap($packageMap, $mainPackage);
  332. }
  333. $sortedPackageMap = $this->sortPackageMap($packageMap);
  334. $sortedPackageMap[] = $mainPackageMap;
  335. array_unshift($packageMap, $mainPackageMap);
  336. $psr0 = $this->parseAutoloadsType($packageMap, 'psr-0', $mainPackage);
  337. $psr4 = $this->parseAutoloadsType($packageMap, 'psr-4', $mainPackage);
  338. $classmap = $this->parseAutoloadsType(array_reverse($sortedPackageMap), 'classmap', $mainPackage);
  339. $files = $this->parseAutoloadsType($sortedPackageMap, 'files', $mainPackage);
  340. $exclude = $this->parseAutoloadsType($sortedPackageMap, 'exclude-from-classmap', $mainPackage);
  341. krsort($psr0);
  342. krsort($psr4);
  343. return array(
  344. 'psr-0' => $psr0,
  345. 'psr-4' => $psr4,
  346. 'classmap' => $classmap,
  347. 'files' => $files,
  348. 'exclude-from-classmap' => $exclude,
  349. );
  350. }
  351. public function createLoader(array $autoloads)
  352. {
  353. $loader = new ClassLoader();
  354. if (isset($autoloads['psr-0'])) {
  355. foreach ($autoloads['psr-0'] as $namespace => $path) {
  356. $loader->add($namespace, $path);
  357. }
  358. }
  359. if (isset($autoloads['psr-4'])) {
  360. foreach ($autoloads['psr-4'] as $namespace => $path) {
  361. $loader->addPsr4($namespace, $path);
  362. }
  363. }
  364. if (isset($autoloads['classmap'])) {
  365. $excluded = null;
  366. if (!empty($autoloads['exclude-from-classmap'])) {
  367. $excluded = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  368. }
  369. $scannedFiles = array();
  370. foreach ($autoloads['classmap'] as $dir) {
  371. try {
  372. $loader->addClassMap($this->generateClassMap($dir, $excluded, null, null, false, $scannedFiles));
  373. } catch (\RuntimeException $e) {
  374. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  375. }
  376. }
  377. }
  378. return $loader;
  379. }
  380. protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  381. {
  382. $includePaths = array();
  383. foreach ($packageMap as $item) {
  384. list($package, $installPath) = $item;
  385. if (null !== $package->getTargetDir() && strlen($package->getTargetDir()) > 0) {
  386. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  387. }
  388. foreach ($package->getIncludePaths() as $includePath) {
  389. $includePath = trim($includePath, '/');
  390. $includePaths[] = empty($installPath) ? $includePath : $installPath.'/'.$includePath;
  391. }
  392. }
  393. if (!$includePaths) {
  394. return;
  395. }
  396. $includePathsCode = '';
  397. foreach ($includePaths as $path) {
  398. $includePathsCode .= " " . $this->getPathCode($filesystem, $basePath, $vendorPath, $path) . ",\n";
  399. }
  400. return <<<EOF
  401. <?php
  402. // include_paths.php @generated by Composer
  403. \$vendorDir = $vendorPathCode;
  404. \$baseDir = $appBaseDirCode;
  405. return array(
  406. $includePathsCode);
  407. EOF;
  408. }
  409. protected function getIncludeFilesFile(array $files, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  410. {
  411. $filesCode = '';
  412. foreach ($files as $fileIdentifier => $functionFile) {
  413. $filesCode .= ' ' . var_export($fileIdentifier, true) . ' => '
  414. . $this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile) . ",\n";
  415. }
  416. if (!$filesCode) {
  417. return false;
  418. }
  419. return <<<EOF
  420. <?php
  421. // autoload_files.php @generated by Composer
  422. \$vendorDir = $vendorPathCode;
  423. \$baseDir = $appBaseDirCode;
  424. return array(
  425. $filesCode);
  426. EOF;
  427. }
  428. protected function getPathCode(Filesystem $filesystem, $basePath, $vendorPath, $path)
  429. {
  430. if (!$filesystem->isAbsolutePath($path)) {
  431. $path = $basePath . '/' . $path;
  432. }
  433. $path = $filesystem->normalizePath($path);
  434. $baseDir = '';
  435. if (strpos($path.'/', $vendorPath.'/') === 0) {
  436. $path = substr($path, strlen($vendorPath));
  437. $baseDir = '$vendorDir';
  438. if ($path !== false) {
  439. $baseDir .= " . ";
  440. }
  441. } else {
  442. $path = $filesystem->normalizePath($filesystem->findShortestPath($basePath, $path, true));
  443. if (!$filesystem->isAbsolutePath($path)) {
  444. $baseDir = '$baseDir . ';
  445. $path = '/' . $path;
  446. }
  447. }
  448. if (strpos($path, '.phar') !== false) {
  449. $baseDir = "'phar://' . " . $baseDir;
  450. }
  451. return $baseDir . (($path !== false) ? var_export($path, true) : "");
  452. }
  453. protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix)
  454. {
  455. $lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode) - 1];
  456. if ("'" === $lastChar || '"' === $lastChar) {
  457. $vendorPathToTargetDirCode = substr($vendorPathToTargetDirCode, 0, -1).'/autoload_real.php'.$lastChar;
  458. } else {
  459. $vendorPathToTargetDirCode .= " . '/autoload_real.php'";
  460. }
  461. return <<<AUTOLOAD
  462. <?php
  463. // autoload.php @generated by Composer
  464. require_once $vendorPathToTargetDirCode;
  465. return ComposerAutoloaderInit$suffix::getLoader();
  466. AUTOLOAD;
  467. }
  468. protected function getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $useIncludeFiles, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion = 70000)
  469. {
  470. $file = <<<HEADER
  471. <?php
  472. // autoload_real.php @generated by Composer
  473. class ComposerAutoloaderInit$suffix
  474. {
  475. private static \$loader;
  476. public static function loadClassLoader(\$class)
  477. {
  478. if ('Composer\\Autoload\\ClassLoader' === \$class) {
  479. require __DIR__ . '/ClassLoader.php';
  480. }
  481. }
  482. /**
  483. * @return \Composer\Autoload\ClassLoader
  484. */
  485. public static function getLoader()
  486. {
  487. if (null !== self::\$loader) {
  488. return self::\$loader;
  489. }
  490. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true, $prependAutoloader);
  491. self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader();
  492. spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
  493. HEADER;
  494. if ($useIncludePath) {
  495. $file .= <<<'INCLUDE_PATH'
  496. $includePaths = require __DIR__ . '/include_paths.php';
  497. $includePaths[] = get_include_path();
  498. set_include_path(implode(PATH_SEPARATOR, $includePaths));
  499. INCLUDE_PATH;
  500. }
  501. $file .= <<<STATIC_INIT
  502. \$useStaticLoader = PHP_VERSION_ID >= $staticPhpVersion && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  503. if (\$useStaticLoader) {
  504. require_once __DIR__ . '/autoload_static.php';
  505. call_user_func(\Composer\Autoload\ComposerStaticInit$suffix::getInitializer(\$loader));
  506. } else {
  507. STATIC_INIT;
  508. if (!$this->classMapAuthoritative) {
  509. $file .= <<<'PSR04'
  510. $map = require __DIR__ . '/autoload_namespaces.php';
  511. foreach ($map as $namespace => $path) {
  512. $loader->set($namespace, $path);
  513. }
  514. $map = require __DIR__ . '/autoload_psr4.php';
  515. foreach ($map as $namespace => $path) {
  516. $loader->setPsr4($namespace, $path);
  517. }
  518. PSR04;
  519. }
  520. if ($useClassMap) {
  521. $file .= <<<'CLASSMAP'
  522. $classMap = require __DIR__ . '/autoload_classmap.php';
  523. if ($classMap) {
  524. $loader->addClassMap($classMap);
  525. }
  526. CLASSMAP;
  527. }
  528. $file .= " }\n\n";
  529. if ($this->classMapAuthoritative) {
  530. $file .= <<<'CLASSMAPAUTHORITATIVE'
  531. $loader->setClassMapAuthoritative(true);
  532. CLASSMAPAUTHORITATIVE;
  533. }
  534. if ($this->apcu) {
  535. $apcuPrefix = substr(base64_encode(md5(uniqid('', true), true)), 0, -3);
  536. $file .= <<<APCU
  537. \$loader->setApcuPrefix('$apcuPrefix');
  538. APCU;
  539. }
  540. if ($useGlobalIncludePath) {
  541. $file .= <<<'INCLUDEPATH'
  542. $loader->setUseIncludePath(true);
  543. INCLUDEPATH;
  544. }
  545. if ($targetDirLoader) {
  546. $file .= <<<REGISTER_TARGET_DIR_AUTOLOAD
  547. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'autoload'), true, true);
  548. REGISTER_TARGET_DIR_AUTOLOAD;
  549. }
  550. $file .= <<<REGISTER_LOADER
  551. \$loader->register($prependAutoloader);
  552. REGISTER_LOADER;
  553. if ($useIncludeFiles) {
  554. $file .= <<<INCLUDE_FILES
  555. if (\$useStaticLoader) {
  556. \$includeFiles = Composer\Autoload\ComposerStaticInit$suffix::\$files;
  557. } else {
  558. \$includeFiles = require __DIR__ . '/autoload_files.php';
  559. }
  560. foreach (\$includeFiles as \$fileIdentifier => \$file) {
  561. composerRequire$suffix(\$fileIdentifier, \$file);
  562. }
  563. INCLUDE_FILES;
  564. }
  565. $file .= <<<METHOD_FOOTER
  566. return \$loader;
  567. }
  568. METHOD_FOOTER;
  569. $file .= $targetDirLoader;
  570. if ($useIncludeFiles) {
  571. return $file . <<<FOOTER
  572. }
  573. function composerRequire$suffix(\$fileIdentifier, \$file)
  574. {
  575. if (empty(\$GLOBALS['__composer_autoload_files'][\$fileIdentifier])) {
  576. require \$file;
  577. \$GLOBALS['__composer_autoload_files'][\$fileIdentifier] = true;
  578. }
  579. }
  580. FOOTER;
  581. }
  582. return $file . <<<FOOTER
  583. }
  584. FOOTER;
  585. }
  586. protected function getStaticFile($suffix, $targetDir, $vendorPath, $basePath, &$staticPhpVersion)
  587. {
  588. $staticPhpVersion = 50600;
  589. $file = <<<HEADER
  590. <?php
  591. // autoload_static.php @generated by Composer
  592. namespace Composer\Autoload;
  593. class ComposerStaticInit$suffix
  594. {
  595. HEADER;
  596. $loader = new ClassLoader();
  597. $map = require $targetDir . '/autoload_namespaces.php';
  598. foreach ($map as $namespace => $path) {
  599. $loader->set($namespace, $path);
  600. }
  601. $map = require $targetDir . '/autoload_psr4.php';
  602. foreach ($map as $namespace => $path) {
  603. $loader->setPsr4($namespace, $path);
  604. }
  605. $classMap = require $targetDir . '/autoload_classmap.php';
  606. if ($classMap) {
  607. $loader->addClassMap($classMap);
  608. }
  609. $filesystem = new Filesystem();
  610. $vendorPathCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  611. $vendorPharPathCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  612. $appBaseDirCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  613. $appBaseDirPharCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  614. $absoluteVendorPathCode = ' => ' . substr(var_export(rtrim($vendorDir, '\\/') . '/', true), 0, -1);
  615. $absoluteVendorPharPathCode = ' => ' . substr(var_export(rtrim('phar://' . $vendorDir, '\\/') . '/', true), 0, -1);
  616. $absoluteAppBaseDirCode = ' => ' . substr(var_export(rtrim($baseDir, '\\/') . '/', true), 0, -1);
  617. $absoluteAppBaseDirPharCode = ' => ' . substr(var_export(rtrim('phar://' . $baseDir, '\\/') . '/', true), 0, -1);
  618. $initializer = '';
  619. $prefix = "\0Composer\Autoload\ClassLoader\0";
  620. $prefixLen = strlen($prefix);
  621. if (file_exists($targetDir . '/autoload_files.php')) {
  622. $maps = array('files' => require $targetDir . '/autoload_files.php');
  623. } else {
  624. $maps = array();
  625. }
  626. foreach ((array) $loader as $prop => $value) {
  627. if ($value && 0 === strpos($prop, $prefix)) {
  628. $maps[substr($prop, $prefixLen)] = $value;
  629. }
  630. }
  631. foreach ($maps as $prop => $value) {
  632. if (count($value) > 32767) {
  633. $staticPhpVersion = 70000;
  634. }
  635. $value = strtr(
  636. var_export($value, true),
  637. array(
  638. $absoluteVendorPathCode => $vendorPathCode,
  639. $absoluteVendorPharPathCode => $vendorPharPathCode,
  640. $absoluteAppBaseDirCode => $appBaseDirCode,
  641. $absoluteAppBaseDirPharCode => $appBaseDirPharCode,
  642. )
  643. );
  644. $value = ltrim(preg_replace('/^ */m', ' $0$0', $value));
  645. $file .= sprintf(" public static $%s = %s;\n\n", $prop, $value);
  646. if ('files' !== $prop) {
  647. $initializer .= " \$loader->$prop = ComposerStaticInit$suffix::\$$prop;\n";
  648. }
  649. }
  650. return $file . <<<INITIALIZER
  651. public static function getInitializer(ClassLoader \$loader)
  652. {
  653. return \Closure::bind(function () use (\$loader) {
  654. $initializer
  655. }, null, ClassLoader::class);
  656. }
  657. }
  658. INITIALIZER;
  659. }
  660. protected function parseAutoloadsType(array $packageMap, $type, PackageInterface $mainPackage)
  661. {
  662. $autoloads = array();
  663. foreach ($packageMap as $item) {
  664. list($package, $installPath) = $item;
  665. $autoload = $package->getAutoload();
  666. if ($this->devMode && $package === $mainPackage) {
  667. $autoload = array_merge_recursive($autoload, $package->getDevAutoload());
  668. }
  669. if (!isset($autoload[$type]) || !is_array($autoload[$type])) {
  670. continue;
  671. }
  672. if (null !== $package->getTargetDir() && $package !== $mainPackage) {
  673. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  674. }
  675. foreach ($autoload[$type] as $namespace => $paths) {
  676. foreach ((array) $paths as $path) {
  677. if (($type === 'files' || $type === 'classmap' || $type === 'exclude-from-classmap') && $package->getTargetDir() && !is_readable($installPath.'/'.$path)) {
  678. if ($package === $mainPackage) {
  679. $targetDir = str_replace('\\<dirsep\\>', '[\\\\/]', preg_quote(str_replace(array('/', '\\'), '<dirsep>', $package->getTargetDir())));
  680. $path = ltrim(preg_replace('{^'.$targetDir.'}', '', ltrim($path, '\\/')), '\\/');
  681. } else {
  682. $path = $package->getTargetDir() . '/' . $path;
  683. }
  684. }
  685. if ($type === 'exclude-from-classmap') {
  686. $path = preg_replace('{/+}', '/', preg_quote(trim(strtr($path, '\\', '/'), '/')));
  687. $path = str_replace('\\*\\*', '.+?', $path);
  688. $path = str_replace('\\*', '[^/]+?', $path);
  689. $updir = null;
  690. $path = preg_replace_callback(
  691. '{^((?:(?:\\\\\\.){1,2}+/)+)}',
  692. function ($matches) use (&$updir) {
  693. if (isset($matches[1])) {
  694. $updir = str_replace('\\.', '.', $matches[1]);
  695. }
  696. return '';
  697. },
  698. $path
  699. );
  700. if (empty($installPath)) {
  701. $installPath = strtr(getcwd(), '\\', '/');
  702. }
  703. $resolvedPath = realpath($installPath . '/' . $updir);
  704. $autoloads[] = preg_quote(strtr($resolvedPath, '\\', '/')) . '/' . $path . '($|/)';
  705. continue;
  706. }
  707. $relativePath = empty($installPath) ? (empty($path) ? '.' : $path) : $installPath.'/'.$path;
  708. if ($type === 'files') {
  709. $autoloads[$this->getFileIdentifier($package, $path)] = $relativePath;
  710. continue;
  711. } elseif ($type === 'classmap') {
  712. $autoloads[] = $relativePath;
  713. continue;
  714. }
  715. $autoloads[$namespace][] = $relativePath;
  716. }
  717. }
  718. }
  719. return $autoloads;
  720. }
  721. protected function getFileIdentifier(PackageInterface $package, $path)
  722. {
  723. return md5($package->getName() . ':' . $path);
  724. }
  725. protected function filterPackageMap(array $packageMap, PackageInterface $mainPackage)
  726. {
  727. $packages = array();
  728. $include = array();
  729. $replacedBy = array();
  730. foreach ($packageMap as $item) {
  731. $package = $item[0];
  732. $name = $package->getName();
  733. $packages[$name] = $package;
  734. foreach ($package->getReplaces() as $replace) {
  735. $replacedBy[$replace->getTarget()] = $name;
  736. }
  737. }
  738. $add = function (PackageInterface $package) use (&$add, $packages, &$include, $replacedBy) {
  739. foreach ($package->getRequires() as $link) {
  740. $target = $link->getTarget();
  741. if (isset($replacedBy[$target])) {
  742. $target = $replacedBy[$target];
  743. }
  744. if (!isset($include[$target])) {
  745. $include[$target] = true;
  746. if (isset($packages[$target])) {
  747. $add($packages[$target]);
  748. }
  749. }
  750. }
  751. };
  752. $add($mainPackage);
  753. return array_filter(
  754. $packageMap,
  755. function ($item) use ($include) {
  756. $package = $item[0];
  757. foreach ($package->getNames() as $name) {
  758. if (isset($include[$name])) {
  759. return true;
  760. }
  761. }
  762. return false;
  763. }
  764. );
  765. }
  766. protected function sortPackageMap(array $packageMap)
  767. {
  768. $packages = array();
  769. $paths = array();
  770. foreach ($packageMap as $item) {
  771. list($package, $path) = $item;
  772. $name = $package->getName();
  773. $packages[$name] = $package;
  774. $paths[$name] = $path;
  775. }
  776. $sortedPackages = PackageSorter::sortPackages($packages);
  777. $sortedPackageMap = array();
  778. foreach ($sortedPackages as $package) {
  779. $name = $package->getName();
  780. $sortedPackageMap[] = array($packages[$name], $paths[$name]);
  781. }
  782. return $sortedPackageMap;
  783. }
  784. protected function safeCopy($source, $target)
  785. {
  786. if (!file_exists($target) || !file_exists($source) || !$this->filesAreEqual($source, $target)) {
  787. $source = fopen($source, 'r');
  788. $target = fopen($target, 'w+');
  789. stream_copy_to_stream($source, $target);
  790. fclose($source);
  791. fclose($target);
  792. }
  793. }
  794. private function filesAreEqual($a, $b)
  795. {
  796. if (filesize($a) !== filesize($b)) {
  797. return false;
  798. }
  799. $ah = fopen($a, 'rb');
  800. $bh = fopen($b, 'rb');
  801. $result = true;
  802. while (!feof($ah)) {
  803. if (fread($ah, 8192) != fread($bh, 8192)) {
  804. $result = false;
  805. break;
  806. }
  807. }
  808. fclose($ah);
  809. fclose($bh);
  810. return $result;
  811. }
  812. }
  813. <?php
  814. namespace Composer\Autoload;
  815. use Symfony\Component\Finder\Finder;
  816. use Composer\IO\IOInterface;
  817. use Composer\Util\Filesystem;
  818. class ClassMapGenerator
  819. {
  820. public static function dump($dirs, $file)
  821. {
  822. $maps = array();
  823. foreach ($dirs as $dir) {
  824. $maps = array_merge($maps, static::createMap($dir));
  825. }
  826. file_put_contents($file, sprintf('<?php return %s;', var_export($maps, true)));
  827. }
  828. public static function createMap($path, $excluded = null, IOInterface $io = null, $namespace = null, $autoloadType = null, &$scannedFiles = array())
  829. {
  830. if (is_string($path)) {
  831. $basePath = $path;
  832. if (is_file($path)) {
  833. $path = array(new \SplFileInfo($path));
  834. } elseif (is_dir($path)) {
  835. $path = Finder::create()->files()->followLinks()->name('/\.(php|inc|hh)$/')->in($path);
  836. } else {
  837. throw new \RuntimeException(
  838. 'Could not scan for classes inside "'.$path.
  839. '" which does not appear to be a file nor a folder'
  840. );
  841. }
  842. } elseif (null !== $autoloadType) {
  843. throw new \RuntimeException('Path must be a string when specifying an autoload type');
  844. }
  845. $map = array();
  846. $filesystem = new Filesystem();
  847. $cwd = realpath(getcwd());
  848. foreach ($path as $file) {
  849. $filePath = $file->getPathname();
  850. if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), array('php', 'inc', 'hh'))) {
  851. continue;
  852. }
  853. if (!$filesystem->isAbsolutePath($filePath)) {
  854. $filePath = $cwd . '/' . $filePath;
  855. $filePath = $filesystem->normalizePath($filePath);
  856. } else {
  857. $filePath = preg_replace('{[\\\\/]{2,}}', '/', $filePath);
  858. }
  859. $realPath = realpath($filePath);
  860. if (isset($scannedFiles[$realPath])) {
  861. continue;
  862. }
  863. if ($excluded && preg_match($excluded, strtr($realPath, '\\', '/'))) {
  864. continue;
  865. }
  866. if ($excluded && preg_match($excluded, strtr($filePath, '\\', '/'))) {
  867. continue;
  868. }
  869. $classes = self::findClasses($filePath);
  870. if (null !== $autoloadType) {
  871. list($classes, $validClasses) = self::filterByNamespace($classes, $filePath, $namespace, $autoloadType, $basePath, $io);
  872. if ($validClasses) {
  873. $scannedFiles[$realPath] = true;
  874. }
  875. } else {
  876. $scannedFiles[$realPath] = true;
  877. }
  878. foreach ($classes as $class) {
  879. if ( null !== $namespace && '' !== $namespace && 0 !== strpos($class, $namespace)) {
  880. continue;
  881. }
  882. if (!isset($map[$class])) {
  883. $map[$class] = $filePath;
  884. } elseif ($io && $map[$class] !== $filePath && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($map[$class].' '.$filePath, '\\', '/'))) {
  885. $io->writeError(
  886. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  887. ' was found in both "'.$map[$class].'" and "'.$filePath.'", the first will be used.</warning>'
  888. );
  889. }
  890. }
  891. }
  892. return $map;
  893. }
  894. private static function filterByNamespace($classes, $filePath, $baseNamespace, $namespaceType, $basePath, $io)
  895. {
  896. $validClasses = array();
  897. $rejectedClasses = array();
  898. $realSubPath = substr($filePath, strlen($basePath) + 1);
  899. $realSubPath = substr($realSubPath, 0, strrpos($realSubPath, '.'));
  900. foreach ($classes as $class) {
  901. if ('' !== $baseNamespace && 0 !== strpos($class, $baseNamespace)) {
  902. continue;
  903. }
  904. if ('psr-0' === $namespaceType) {
  905. $namespaceLength = strrpos($class, '\\');
  906. if (false !== $namespaceLength) {
  907. $namespace = substr($class, 0, $namespaceLength + 1);
  908. $className = substr($class, $namespaceLength + 1);
  909. $subPath = str_replace('\\', DIRECTORY_SEPARATOR, $namespace)
  910. . str_replace('_', DIRECTORY_SEPARATOR, $className);
  911. }
  912. else {
  913. $subPath = str_replace('_', DIRECTORY_SEPARATOR, $class);
  914. }
  915. } elseif ('psr-4' === $namespaceType) {
  916. $subNamespace = ('' !== $baseNamespace) ? substr($class, strlen($baseNamespace)) : $class;
  917. $subPath = str_replace('\\', DIRECTORY_SEPARATOR, $subNamespace);
  918. } else {
  919. throw new \RuntimeException("namespaceType must be psr-0 or psr-4, $namespaceType given");
  920. }
  921. if ($subPath === $realSubPath) {
  922. $validClasses[] = $class;
  923. } else {
  924. $rejectedClasses[] = $class;
  925. }
  926. }
  927. if (empty($validClasses)) {
  928. foreach ($rejectedClasses as $class) {
  929. trigger_error(
  930. "Class $class located in ".preg_replace('{^'.preg_quote(getcwd()).'}', '.', $filePath, 1)." does not comply with $namespaceType autoloading standard. It will not autoload anymore in Composer v2.0.",
  931. E_USER_DEPRECATED
  932. );
  933. }
  934. }
  935. return array($classes, $validClasses);
  936. }
  937. private static function findClasses($path)
  938. {
  939. $extraTypes = PHP_VERSION_ID < 50400 ? '' : '|trait';
  940. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>=')) {
  941. $extraTypes .= '|enum';
  942. }
  943. $contents = @php_strip_whitespace($path);
  944. if (!$contents) {
  945. if (!file_exists($path)) {
  946. $message = 'File at "%s" does not exist, check your classmap definitions';
  947. } elseif (!is_readable($path)) {
  948. $message = 'File at "%s" is not readable, check its permissions';
  949. } elseif ('' === trim(file_get_contents($path))) {
  950. return array();
  951. } else {
  952. $message = 'File at "%s" could not be parsed as PHP, it may be binary or corrupted';
  953. }
  954. $error = error_get_last();
  955. if (isset($error['message'])) {
  956. $message .= PHP_EOL . 'The following message may be helpful:' . PHP_EOL . $error['message'];
  957. }
  958. throw new \RuntimeException(sprintf($message, $path));
  959. }
  960. if (!preg_match('{\b(?:class|interface'.$extraTypes.')\s}i', $contents)) {
  961. return array();
  962. }
  963. $contents = preg_replace('{<<<[ \t]*([\'"]?)(\w+)\\1(?:\r\n|\n|\r)(?:.*?)(?:\r\n|\n|\r)(?:\s*)\\2(?=\s+|[;,.)])}s', 'null', $contents);
  964. $contents = preg_replace('{"[^"\\\\]*+(\\\\.[^"\\\\]*+)*+"|\'[^\'\\\\]*+(\\\\.[^\'\\\\]*+)*+\'}s', 'null', $contents);
  965. if (substr($contents, 0, 2) !== '<?') {
  966. $contents = preg_replace('{^.+?<\?}s', '<?', $contents, 1, $replacements);
  967. if ($replacements === 0) {
  968. return array();
  969. }
  970. }
  971. $contents = preg_replace('{\?>(?:[^<]++|<(?!\?))*+<\?}s', '?><?', $contents);
  972. $pos = strrpos($contents, '?>');
  973. if (false !== $pos && false === strpos(substr($contents, $pos), '<?')) {
  974. $contents = substr($contents, 0, $pos);
  975. }
  976. if (preg_match('{(<\?)(?!(php|hh))}i', $contents)) {
  977. $contents = preg_replace('{//.* | /\*(?:[^*]++|\*(?!/))*\*/}x', '', $contents);
  978. }
  979. preg_match_all('{
  980. (?:
  981. \b(?<![\$:>])(?P<type>class|interface'.$extraTypes.') \s++ (?P<name>[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+)
  982. | \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*+ [\{;]
  983. )
  984. }ix', $contents, $matches);
  985. $classes = array();
  986. $namespace = '';
  987. for ($i = 0, $len = count($matches['type']); $i < $len; $i++) {
  988. if (!empty($matches['ns'][$i])) {
  989. $namespace = str_replace(array(' ', "\t", "\r", "\n"), '', $matches['nsname'][$i]) . '\\';
  990. } else {
  991. $name = $matches['name'][$i];
  992. if ($name === 'extends' || $name === 'implements') {
  993. continue;
  994. }
  995. if ($name[0] === ':') {
  996. $name = 'xhp'.substr(str_replace(array('-', ':'), array('_', '__'), $name), 1);
  997. } elseif ($matches['type'][$i] === 'enum') {
  998. $name = rtrim($name, ':');
  999. }
  1000. $classes[] = ltrim($namespace . $name, '\\');
  1001. }
  1002. }
  1003. return $classes;
  1004. }
  1005. }
  1006. <?php
  1007. namespace Composer;
  1008. use Composer\IO\IOInterface;
  1009. use Composer\Util\Filesystem;
  1010. use Composer\Util\Silencer;
  1011. use Symfony\Component\Finder\Finder;
  1012. class Cache
  1013. {
  1014. private static $cacheCollected = false;
  1015. private $io;
  1016. private $root;
  1017. private $enabled = true;
  1018. private $allowList;
  1019. private $filesystem;
  1020. public function __construct(IOInterface $io, $cacheDir, $allowList = 'a-z0-9.', Filesystem $filesystem = null)
  1021. {
  1022. $this->io = $io;
  1023. $this->root = rtrim($cacheDir, '/\\') . '/';
  1024. $this->allowList = $allowList;
  1025. $this->filesystem = $filesystem ?: new Filesystem();
  1026. if (!self::isUsable($cacheDir)) {
  1027. $this->enabled = false;
  1028. return;
  1029. }
  1030. if (
  1031. (!is_dir($this->root) && !Silencer::call('mkdir', $this->root, 0777, true))
  1032. || !is_writable($this->root)
  1033. ) {
  1034. $this->io->writeError('<warning>Cannot create cache directory ' . $this->root . ', or directory is not writable. Proceeding without cache</warning>');
  1035. $this->enabled = false;
  1036. }
  1037. }
  1038. public static function isUsable($path)
  1039. {
  1040. return !preg_match('{(^|[\\\\/])(\$null|nul|NUL|/dev/null)([\\\\/]|$)}', $path);
  1041. }
  1042. public function isEnabled()
  1043. {
  1044. return $this->enabled;
  1045. }
  1046. public function getRoot()
  1047. {
  1048. return $this->root;
  1049. }
  1050. public function read($file)
  1051. {
  1052. if ($this->enabled) {
  1053. $file = preg_replace('{[^'.$this->allowList.']}i', '-', $file);
  1054. if (file_exists($this->root . $file)) {
  1055. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  1056. return file_get_contents($this->root . $file);
  1057. }
  1058. }
  1059. return false;
  1060. }
  1061. public function write($file, $contents)
  1062. {
  1063. if ($this->enabled) {
  1064. $file = preg_replace('{[^'.$this->allowList.']}i', '-', $file);
  1065. $this->io->writeError('Writing '.$this->root . $file.' into cache', true, IOInterface::DEBUG);
  1066. try {
  1067. return file_put_contents($this->root . $file, $contents);
  1068. } catch (\ErrorException $e) {
  1069. $this->io->writeError('<warning>Failed to write into cache: '.$e->getMessage().'</warning>', true, IOInterface::DEBUG);
  1070. if (preg_match('{^file_put_contents\(\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) {
  1071. unlink($this->root . $file);
  1072. $message = sprintf(
  1073. '<warning>Writing %1$s into cache failed after %2$u of %3$u bytes written, only %4$u bytes of free space available</warning>',
  1074. $this->root . $file,
  1075. $m[1],
  1076. $m[2],
  1077. @disk_free_space($this->root . dirname($file))
  1078. );
  1079. $this->io->writeError($message);
  1080. return false;
  1081. }
  1082. throw $e;
  1083. }
  1084. }
  1085. return false;
  1086. }
  1087. public function copyFrom($file, $source)
  1088. {
  1089. if ($this->enabled) {
  1090. $file = preg_replace('{[^'.$this->allowList.']}i', '-', $file);
  1091. $this->filesystem->ensureDirectoryExists(dirname($this->root . $file));
  1092. if (!file_exists($source)) {
  1093. $this->io->writeError('<error>'.$source.' does not exist, can not write into cache</error>');
  1094. } elseif ($this->io->isDebug()) {
  1095. $this->io->writeError('Writing '.$this->root . $file.' into cache from '.$source);
  1096. }
  1097. return copy($source, $this->root . $file);
  1098. }
  1099. return false;
  1100. }
  1101. public function copyTo($file, $target)
  1102. {
  1103. if ($this->enabled) {
  1104. $file = preg_replace('{[^'.$this->allowList.']}i', '-', $file);
  1105. if (file_exists($this->root . $file)) {
  1106. try {
  1107. touch($this->root . $file, filemtime($this->root . $file), time());
  1108. } catch (\ErrorException $e) {
  1109. Silencer::call('touch', $this->root . $file);
  1110. }
  1111. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  1112. return copy($this->root . $file, $target);
  1113. }
  1114. }
  1115. return false;
  1116. }
  1117. public function gcIsNecessary()
  1118. {
  1119. return (!self::$cacheCollected && !mt_rand(0, 50));
  1120. }
  1121. public function remove($file)
  1122. {
  1123. if ($this->enabled) {
  1124. $file = preg_replace('{[^'.$this->allowList.']}i', '-', $file);
  1125. if (file_exists($this->root . $file)) {
  1126. return $this->filesystem->unlink($this->root . $file);
  1127. }
  1128. }
  1129. return false;
  1130. }
  1131. public function clear()
  1132. {
  1133. if ($this->enabled) {
  1134. $this->filesystem->emptyDirectory($this->root);
  1135. return true;
  1136. }
  1137. return false;
  1138. }
  1139. public function gc($ttl, $maxSize)
  1140. {
  1141. if ($this->enabled) {
  1142. $expire = new \DateTime();
  1143. $expire->modify('-'.$ttl.' seconds');
  1144. $finder = $this->getFinder()->date('until '.$expire->format('Y-m-d H:i:s'));
  1145. foreach ($finder as $file) {
  1146. $this->filesystem->unlink($file->getPathname());
  1147. }
  1148. $totalSize = $this->filesystem->size($this->root);
  1149. if ($totalSize > $maxSize) {
  1150. $iterator = $this->getFinder()->sortByAccessedTime()->getIterator();
  1151. while ($totalSize > $maxSize && $iterator->valid()) {
  1152. $filepath = $iterator->current()->getPathname();
  1153. $totalSize -= $this->filesystem->size($filepath);
  1154. $this->filesystem->unlink($filepath);
  1155. $iterator->next();
  1156. }
  1157. }
  1158. self::$cacheCollected = true;
  1159. return true;
  1160. }
  1161. return false;
  1162. }
  1163. public function sha1($file)
  1164. {
  1165. if ($this->enabled) {
  1166. $file = preg_replace('{[^'.$this->allowList.']}i', '-', $file);
  1167. if (file_exists($this->root . $file)) {
  1168. return sha1_file($this->root . $file);
  1169. }
  1170. }
  1171. return false;
  1172. }
  1173. public function sha256($file)
  1174. {
  1175. if ($this->enabled) {
  1176. $file = preg_replace('{[^'.$this->allowList.']}i', '-', $file);
  1177. if (file_exists($this->root . $file)) {
  1178. return hash_file('sha256', $this->root . $file);
  1179. }
  1180. }
  1181. return false;
  1182. }
  1183. protected function getFinder()
  1184. {
  1185. return Finder::create()->in($this->root)->files();
  1186. }
  1187. }
  1188. <?php
  1189. namespace Composer\Command;
  1190. use Symfony\Component\Console\Input\InputInterface;
  1191. use Symfony\Component\Console\Output\OutputInterface;
  1192. class AboutCommand extends BaseCommand
  1193. {
  1194. protected function configure()
  1195. {
  1196. $this
  1197. ->setName('about')
  1198. ->setDescription('Shows the short information about Composer.')
  1199. ->setHelp(
  1200. <<<EOT
  1201. <info>php composer.phar about</info>
  1202. EOT
  1203. )
  1204. ;
  1205. }
  1206. protected function execute(InputInterface $input, OutputInterface $output)
  1207. {
  1208. $this->getIO()->write(
  1209. <<<EOT
  1210. <info>Composer - Dependency Manager for PHP</info>
  1211. <comment>Composer is a dependency manager tracking local dependencies of your projects and libraries.
  1212. See https://getcomposer.org/ for more information.</comment>
  1213. EOT
  1214. );
  1215. return 0;
  1216. }
  1217. }
  1218. <?php
  1219. namespace Composer\Command;
  1220. use Composer\Factory;
  1221. use Composer\IO\IOInterface;
  1222. use Composer\Config;
  1223. use Composer\Composer;
  1224. use Composer\Repository\CompositeRepository;
  1225. use Composer\Repository\RepositoryFactory;
  1226. use Composer\Script\ScriptEvents;
  1227. use Composer\Plugin\CommandEvent;
  1228. use Composer\Plugin\PluginEvents;
  1229. use Composer\Util\Filesystem;
  1230. use Symfony\Component\Console\Input\InputArgument;
  1231. use Symfony\Component\Console\Input\InputInterface;
  1232. use Symfony\Component\Console\Input\InputOption;
  1233. use Symfony\Component\Console\Output\OutputInterface;
  1234. class ArchiveCommand extends BaseCommand
  1235. {
  1236. protected function configure()
  1237. {
  1238. $this
  1239. ->setName('archive')
  1240. ->setDescription('Creates an archive of this composer package.')
  1241. ->setDefinition(array(
  1242. new InputArgument('package', InputArgument::OPTIONAL, 'The package to archive instead of the current project'),
  1243. new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'),
  1244. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the resulting archive: tar or zip'),
  1245. new InputOption('dir', null, InputOption::VALUE_REQUIRED, 'Write the archive to this directory'),
  1246. new InputOption('file', null, InputOption::VALUE_REQUIRED, 'Write the archive with the given file name.'
  1247. .' Note that the format will be appended.'),
  1248. new InputOption('ignore-filters', false, InputOption::VALUE_NONE, 'Ignore filters when saving package'),
  1249. ))
  1250. ->setHelp(
  1251. <<<EOT
  1252. The <info>archive</info> command creates an archive of the specified format
  1253. containing the files and directories of the Composer project or the specified
  1254. package in the specified version and writes it to the specified directory.
  1255. <info>php composer.phar archive [--format=zip] [--dir=/foo] [package [version]]</info>
  1256. Read more at https://getcomposer.org/doc/03-cli.md#archive
  1257. EOT
  1258. )
  1259. ;
  1260. }
  1261. protected function execute(InputInterface $input, OutputInterface $output)
  1262. {
  1263. $composer = $this->getComposer(false);
  1264. $config = null;
  1265. if ($composer) {
  1266. $config = $composer->getConfig();
  1267. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'archive', $input, $output);
  1268. $eventDispatcher = $composer->getEventDispatcher();
  1269. $eventDispatcher->dispatch($commandEvent->getName(), $commandEvent);
  1270. $eventDispatcher->dispatchScript(ScriptEvents::PRE_ARCHIVE_CMD);
  1271. }
  1272. if (!$config) {
  1273. $config = Factory::createConfig();
  1274. }
  1275. if (null === $input->getOption('format')) {
  1276. $input->setOption('format', $config->get('archive-format'));
  1277. }
  1278. if (null === $input->getOption('dir')) {
  1279. $input->setOption('dir', $config->get('archive-dir'));
  1280. }
  1281. $returnCode = $this->archive(
  1282. $this->getIO(),
  1283. $config,
  1284. $input->getArgument('package'),
  1285. $input->getArgument('version'),
  1286. $input->getOption('format'),
  1287. $input->getOption('dir'),
  1288. $input->getOption('file'),
  1289. $input->getOption('ignore-filters'),
  1290. $composer
  1291. );
  1292. if (0 === $returnCode && $composer) {
  1293. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ARCHIVE_CMD);
  1294. }
  1295. return $returnCode;
  1296. }
  1297. protected function archive(IOInterface $io, Config $config, $packageName = null, $version = null, $format = 'tar', $dest = '.', $fileName = null, $ignoreFilters = false, Composer $composer = null)
  1298. {
  1299. if ($composer) {
  1300. $archiveManager = $composer->getArchiveManager();
  1301. } else {
  1302. $factory = new Factory;
  1303. $downloadManager = $factory->createDownloadManager($io, $config);
  1304. $archiveManager = $factory->createArchiveManager($config, $downloadManager);
  1305. }
  1306. if ($packageName) {
  1307. $package = $this->selectPackage($io, $packageName, $version);
  1308. if (!$package) {
  1309. return 1;
  1310. }
  1311. } else {
  1312. $package = $this->getComposer()->getPackage();
  1313. }
  1314. $io->writeError('<info>Creating the archive into "'.$dest.'".</info>');
  1315. $packagePath = $archiveManager->archive($package, $format, $dest, $fileName, $ignoreFilters);
  1316. $fs = new Filesystem;
  1317. $shortPath = $fs->findShortestPath(getcwd(), $packagePath, true);
  1318. $io->writeError('Created: ', false);
  1319. $io->write(strlen($shortPath) < strlen($packagePath) ? $shortPath : $packagePath);
  1320. return 0;
  1321. }
  1322. protected function selectPackage(IOInterface $io, $packageName, $version = null)
  1323. {
  1324. $io->writeError('<info>Searching for the specified package.</info>');
  1325. if ($composer = $this->getComposer(false)) {
  1326. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  1327. $repo = new CompositeRepository(array_merge(array($localRepo), $composer->getRepositoryManager()->getRepositories()));
  1328. } else {
  1329. $defaultRepos = RepositoryFactory::defaultRepos($this->getIO());
  1330. $io->writeError('No composer.json found in the current directory, searching packages from ' . implode(', ', array_keys($defaultRepos)));
  1331. $repo = new CompositeRepository($defaultRepos);
  1332. }
  1333. $packages = $repo->findPackages($packageName, $version);
  1334. if (count($packages) > 1) {
  1335. $package = reset($packages);
  1336. $io->writeError('<info>Found multiple matches, selected '.$package->getPrettyString().'.</info>');
  1337. $io->writeError('Alternatives were '.implode(', ', array_map(function ($p) {
  1338. return $p->getPrettyString();
  1339. }, $packages)).'.');
  1340. $io->writeError('<comment>Please use a more specific constraint to pick a different package.</comment>');
  1341. } elseif ($packages) {
  1342. $package = reset($packages);
  1343. $io->writeError('<info>Found an exact match '.$package->getPrettyString().'.</info>');
  1344. } else {
  1345. $io->writeError('<error>Could not find a package matching '.$packageName.'.</error>');
  1346. return false;
  1347. }
  1348. return $package;
  1349. }
  1350. }
  1351. <?php
  1352. namespace Composer\Command;
  1353. use Composer\Composer;
  1354. use Composer\Config;
  1355. use Composer\Console\Application;
  1356. use Composer\Factory;
  1357. use Composer\IO\IOInterface;
  1358. use Composer\IO\NullIO;
  1359. use Composer\Plugin\PreCommandRunEvent;
  1360. use Composer\Plugin\PluginEvents;
  1361. use Symfony\Component\Console\Input\InputInterface;
  1362. use Symfony\Component\Console\Output\OutputInterface;
  1363. use Symfony\Component\Console\Command\Command;
  1364. abstract class BaseCommand extends Command
  1365. {
  1366. private $composer;
  1367. private $io;
  1368. public function getComposer($required = true, $disablePlugins = null)
  1369. {
  1370. if (null === $this->composer) {
  1371. $application = $this->getApplication();
  1372. if ($application instanceof Application) {
  1373. $this->composer = $application->getComposer($required, $disablePlugins);
  1374. } elseif ($required) {
  1375. throw new \RuntimeException(
  1376. 'Could not create a Composer\Composer instance, you must inject '.
  1377. 'one if this command is not used with a Composer\Console\Application instance'
  1378. );
  1379. }
  1380. }
  1381. return $this->composer;
  1382. }
  1383. public function setComposer(Composer $composer)
  1384. {
  1385. $this->composer = $composer;
  1386. }
  1387. public function resetComposer()
  1388. {
  1389. $this->composer = null;
  1390. $this->getApplication()->resetComposer();
  1391. }
  1392. public function isProxyCommand()
  1393. {
  1394. return false;
  1395. }
  1396. public function getIO()
  1397. {
  1398. if (null === $this->io) {
  1399. $application = $this->getApplication();
  1400. if ($application instanceof Application) {
  1401. $this->io = $application->getIO();
  1402. } else {
  1403. $this->io = new NullIO();
  1404. }
  1405. }
  1406. return $this->io;
  1407. }
  1408. public function setIO(IOInterface $io)
  1409. {
  1410. $this->io = $io;
  1411. }
  1412. protected function initialize(InputInterface $input, OutputInterface $output)
  1413. {
  1414. $disablePlugins = $input->hasParameterOption('--no-plugins');
  1415. $composer = $this->getComposer(false, $disablePlugins);
  1416. if (null === $composer) {
  1417. $composer = Factory::createGlobal($this->getIO(), $disablePlugins);
  1418. }
  1419. if ($composer) {
  1420. $preCommandRunEvent = new PreCommandRunEvent(PluginEvents::PRE_COMMAND_RUN, $input, $this->getName());
  1421. $composer->getEventDispatcher()->dispatch($preCommandRunEvent->getName(), $preCommandRunEvent);
  1422. }
  1423. if (true === $input->hasParameterOption(array('--no-ansi')) && $input->hasOption('no-progress')) {
  1424. $input->setOption('no-progress', true);
  1425. }
  1426. parent::initialize($input, $output);
  1427. }
  1428. protected function getPreferredInstallOptions(Config $config, InputInterface $input, $keepVcsRequiresPreferSource = false)
  1429. {
  1430. $preferSource = false;
  1431. $preferDist = false;
  1432. switch ($config->get('preferred-install')) {
  1433. case 'source':
  1434. $preferSource = true;
  1435. break;
  1436. case 'dist':
  1437. $preferDist = true;
  1438. break;
  1439. case 'auto':
  1440. default:
  1441. break;
  1442. }
  1443. if ($input->getOption('prefer-source') || $input->getOption('prefer-dist') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'))) {
  1444. $preferSource = $input->getOption('prefer-source') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'));
  1445. $preferDist = $input->getOption('prefer-dist');
  1446. }
  1447. return array($preferSource, $preferDist);
  1448. }
  1449. }
  1450. <?php
  1451. namespace Composer\Command;
  1452. use Composer\DependencyResolver\Pool;
  1453. use Composer\Package\Link;
  1454. use Composer\Package\PackageInterface;
  1455. use Composer\Repository\ArrayRepository;
  1456. use Composer\Repository\CompositeRepository;
  1457. use Composer\Repository\PlatformRepository;
  1458. use Composer\Repository\RepositoryFactory;
  1459. use Composer\Plugin\CommandEvent;
  1460. use Composer\Plugin\PluginEvents;
  1461. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  1462. use Composer\Package\Version\VersionParser;
  1463. use Symfony\Component\Console\Helper\Table;
  1464. use Symfony\Component\Console\Input\InputArgument;
  1465. use Symfony\Component\Console\Input\InputInterface;
  1466. use Symfony\Component\Console\Input\InputOption;
  1467. use Symfony\Component\Console\Output\OutputInterface;
  1468. class BaseDependencyCommand extends BaseCommand
  1469. {
  1470. const ARGUMENT_PACKAGE = 'package';
  1471. const ARGUMENT_CONSTRAINT = 'constraint';
  1472. const OPTION_RECURSIVE = 'recursive';
  1473. const OPTION_TREE = 'tree';
  1474. protected $colors;
  1475. protected function configure()
  1476. {
  1477. $this->setDefinition(array(
  1478. new InputArgument(self::ARGUMENT_PACKAGE, InputArgument::REQUIRED, 'Package to inspect'),
  1479. new InputArgument(self::ARGUMENT_CONSTRAINT, InputArgument::OPTIONAL, 'Optional version constraint', '*'),
  1480. new InputOption(self::OPTION_RECURSIVE, 'r', InputOption::VALUE_NONE, 'Recursively resolves up to the root package'),
  1481. new InputOption(self::OPTION_TREE, 't', InputOption::VALUE_NONE, 'Prints the results as a nested tree'),
  1482. ));
  1483. }
  1484. protected function doExecute(InputInterface $input, OutputInterface $output, $inverted = false)
  1485. {
  1486. $composer = $this->getComposer();
  1487. $commandEvent = new CommandEvent(PluginEvents::COMMAND, $this->getName(), $input, $output);
  1488. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  1489. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  1490. $repository = new CompositeRepository(array(
  1491. new ArrayRepository(array($composer->getPackage())),
  1492. $composer->getRepositoryManager()->getLocalRepository(),
  1493. new PlatformRepository(array(), $platformOverrides),
  1494. ));
  1495. $pool = new Pool();
  1496. $pool->addRepository($repository);
  1497. list($needle, $textConstraint) = array_pad(
  1498. explode(':', $input->getArgument(self::ARGUMENT_PACKAGE)),
  1499. 2,
  1500. $input->getArgument(self::ARGUMENT_CONSTRAINT)
  1501. );
  1502. $packages = $pool->whatProvides(strtolower($needle));
  1503. if (empty($packages)) {
  1504. throw new \InvalidArgumentException(sprintf('Could not find package "%s" in your project', $needle));
  1505. }
  1506. if (!$repository->findPackage($needle, $textConstraint)) {
  1507. $defaultRepos = new CompositeRepository(RepositoryFactory::defaultRepos($this->getIO()));
  1508. if ($match = $defaultRepos->findPackage($needle, $textConstraint)) {
  1509. $repository->addRepository(new ArrayRepository(array(clone $match)));
  1510. }
  1511. }
  1512. $needles = array($needle);
  1513. if ($inverted) {
  1514. foreach ($packages as $package) {
  1515. $needles = array_merge($needles, array_map(function (Link $link) {
  1516. return $link->getTarget();
  1517. }, $package->getReplaces()));
  1518. }
  1519. }
  1520. if ('*' !== $textConstraint) {
  1521. $versionParser = new VersionParser();
  1522. $constraint = $versionParser->parseConstraints($textConstraint);
  1523. } else {
  1524. $constraint = null;
  1525. }
  1526. $renderTree = $input->getOption(self::OPTION_TREE);
  1527. $recursive = $renderTree || $input->getOption(self::OPTION_RECURSIVE);
  1528. $results = $repository->getDependents($needles, $constraint, $inverted, $recursive);
  1529. if (empty($results)) {
  1530. $extra = (null !== $constraint) ? sprintf(' in versions %smatching %s', $inverted ? 'not ' : '', $textConstraint) : '';
  1531. $this->getIO()->writeError(sprintf(
  1532. '<info>There is no installed package depending on "%s"%s</info>',
  1533. $needle,
  1534. $extra
  1535. ));
  1536. } elseif ($renderTree) {
  1537. $this->initStyles($output);
  1538. $root = $packages[0];
  1539. $this->getIO()->write(sprintf('<info>%s</info> %s %s', $root->getPrettyName(), $root->getPrettyVersion(), $root->getDescription()));
  1540. $this->printTree($results);
  1541. } else {
  1542. $this->printTable($output, $results);
  1543. }
  1544. return 0;
  1545. }
  1546. protected function printTable(OutputInterface $output, $results)
  1547. {
  1548. $table = array();
  1549. $doubles = array();
  1550. do {
  1551. $queue = array();
  1552. $rows = array();
  1553. foreach ($results as $result) {
  1554. list($package, $link, $children) = $result;
  1555. $unique = (string) $link;
  1556. if (isset($doubles[$unique])) {
  1557. continue;
  1558. }
  1559. $doubles[$unique] = true;
  1560. $version = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '-' : $package->getPrettyVersion();
  1561. $rows[] = array($package->getPrettyName(), $version, $link->getDescription(), sprintf('%s (%s)', $link->getTarget(), $link->getPrettyConstraint()));
  1562. if ($children) {
  1563. $queue = array_merge($queue, $children);
  1564. }
  1565. }
  1566. $results = $queue;
  1567. $table = array_merge($rows, $table);
  1568. } while (!empty($results));
  1569. $renderer = new Table($output);
  1570. $renderer->setStyle('compact');
  1571. $rendererStyle = $renderer->getStyle();
  1572. if (method_exists($rendererStyle, 'setVerticalBorderChars')) {
  1573. $rendererStyle->setVerticalBorderChars('');
  1574. } else {
  1575. $rendererStyle->setVerticalBorderChar('');
  1576. }
  1577. $rendererStyle->setCellRowContentFormat('%s ');
  1578. $renderer->setRows($table)->render();
  1579. }
  1580. protected function initStyles(OutputInterface $output)
  1581. {
  1582. $this->colors = array(
  1583. 'green',
  1584. 'yellow',
  1585. 'cyan',
  1586. 'magenta',
  1587. 'blue',
  1588. );
  1589. foreach ($this->colors as $color) {
  1590. $style = new OutputFormatterStyle($color);
  1591. $output->getFormatter()->setStyle($color, $style);
  1592. }
  1593. }
  1594. protected function printTree($results, $prefix = '', $level = 1)
  1595. {
  1596. $count = count($results);
  1597. $idx = 0;
  1598. foreach ($results as $result) {
  1599. list($package, $link, $children) = $result;
  1600. $color = $this->colors[$level % count($this->colors)];
  1601. $prevColor = $this->colors[($level - 1) % count($this->colors)];
  1602. $isLast = (++$idx == $count);
  1603. $versionText = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '' : $package->getPrettyVersion();
  1604. $packageText = rtrim(sprintf('<%s>%s</%1$s> %s', $color, $package->getPrettyName(), $versionText));
  1605. $linkText = sprintf('%s <%s>%s</%2$s> %s', $link->getDescription(), $prevColor, $link->getTarget(), $link->getPrettyConstraint());
  1606. $circularWarn = $children === false ? '(circular dependency aborted here)' : '';
  1607. $this->writeTreeLine(rtrim(sprintf("%s%s%s (%s) %s", $prefix, $isLast ? '└──' : '├──', $packageText, $linkText, $circularWarn)));
  1608. if ($children) {
  1609. $this->printTree($children, $prefix . ($isLast ? ' ' : '│ '), $level + 1);
  1610. }
  1611. }
  1612. }
  1613. private function writeTreeLine($line)
  1614. {
  1615. $io = $this->getIO();
  1616. if (!$io->isDecorated()) {
  1617. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  1618. }
  1619. $io->write($line);
  1620. }
  1621. }
  1622. <?php
  1623. namespace Composer\Command;
  1624. use Composer\Package\Link;
  1625. use Composer\Package\PackageInterface;
  1626. use Composer\Semver\Constraint\Constraint;
  1627. use Symfony\Component\Console\Helper\Table;
  1628. use Symfony\Component\Console\Input\InputInterface;
  1629. use Symfony\Component\Console\Input\InputOption;
  1630. use Symfony\Component\Console\Output\OutputInterface;
  1631. use Composer\Repository\PlatformRepository;
  1632. class CheckPlatformReqsCommand extends BaseCommand
  1633. {
  1634. protected function configure()
  1635. {
  1636. $this->setName('check-platform-reqs')
  1637. ->setDescription('Check that platform requirements are satisfied.')
  1638. ->setDefinition(array(
  1639. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables checking of require-dev packages requirements.'),
  1640. ))
  1641. ->setHelp(
  1642. <<<EOT
  1643. Checks that your PHP and extensions versions match the platform requirements of the installed packages.
  1644. Unlike update/install, this command will ignore config.platform settings and check the real platform packages so you can be certain you have the required platform dependencies.
  1645. <info>php composer.phar check-platform-reqs</info>
  1646. EOT
  1647. );
  1648. }
  1649. protected function execute(InputInterface $input, OutputInterface $output)
  1650. {
  1651. $composer = $this->getComposer();
  1652. $requires = $composer->getPackage()->getRequires();
  1653. if ($input->getOption('no-dev')) {
  1654. $dependencies = $composer->getLocker()->getLockedRepository(!$input->getOption('no-dev'))->getPackages();
  1655. } else {
  1656. $dependencies = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  1657. if (!$dependencies) {
  1658. $dependencies = $composer->getLocker()->getLockedRepository(true)->getPackages();
  1659. }
  1660. $requires += $composer->getPackage()->getDevRequires();
  1661. }
  1662. foreach ($requires as $require => $link) {
  1663. $requires[$require] = array($link);
  1664. }
  1665. foreach ($dependencies as $package) {
  1666. foreach ($package->getRequires() as $require => $link) {
  1667. $requires[$require][] = $link;
  1668. }
  1669. }
  1670. ksort($requires);
  1671. $platformRepo = new PlatformRepository(array(), array());
  1672. $currentPlatformPackages = $platformRepo->getPackages();
  1673. $currentPlatformPackageMap = array();
  1674. foreach ($currentPlatformPackages as $currentPlatformPackage) {
  1675. $currentPlatformPackageMap[$currentPlatformPackage->getName()] = $currentPlatformPackage;
  1676. }
  1677. $results = array();
  1678. $exitCode = 0;
  1679. foreach ($requires as $require => $links) {
  1680. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $require)) {
  1681. if (isset($currentPlatformPackageMap[$require])) {
  1682. $pass = true;
  1683. $version = $currentPlatformPackageMap[$require]->getVersion();
  1684. foreach ($links as $link) {
  1685. if (!$link->getConstraint()->matches(new Constraint('=', $version))) {
  1686. $results[] = array(
  1687. $currentPlatformPackageMap[$require]->getPrettyName(),
  1688. $currentPlatformPackageMap[$require]->getPrettyVersion(),
  1689. $link,
  1690. '<error>failed</error>',
  1691. );
  1692. $pass = false;
  1693. $exitCode = max($exitCode, 1);
  1694. }
  1695. }
  1696. if ($pass) {
  1697. $results[] = array(
  1698. $currentPlatformPackageMap[$require]->getPrettyName(),
  1699. $currentPlatformPackageMap[$require]->getPrettyVersion(),
  1700. null,
  1701. '<info>success</info>',
  1702. );
  1703. }
  1704. } else {
  1705. $results[] = array(
  1706. $require,
  1707. 'n/a',
  1708. $links[0],
  1709. '<error>missing</error>',
  1710. );
  1711. $exitCode = max($exitCode, 2);
  1712. }
  1713. }
  1714. }
  1715. $this->printTable($output, $results);
  1716. return $exitCode;
  1717. }
  1718. protected function printTable(OutputInterface $output, $results)
  1719. {
  1720. $table = array();
  1721. $rows = array();
  1722. foreach ($results as $result) {
  1723. list($platformPackage, $version, $link, $status) = $result;
  1724. $rows[] = array(
  1725. $platformPackage,
  1726. $version,
  1727. $link ? sprintf('%s %s %s (%s)', $link->getSource(), $link->getDescription(), $link->getTarget(), $link->getPrettyConstraint()) : '',
  1728. $status,
  1729. );
  1730. }
  1731. $table = array_merge($rows, $table);
  1732. $renderer = new Table($output);
  1733. $renderer->setStyle('compact');
  1734. $rendererStyle = $renderer->getStyle();
  1735. if (method_exists($rendererStyle, 'setVerticalBorderChars')) {
  1736. $rendererStyle->setVerticalBorderChars('');
  1737. } else {
  1738. $rendererStyle->setVerticalBorderChar('');
  1739. }
  1740. $rendererStyle->setCellRowContentFormat('%s ');
  1741. $renderer->setRows($table)->render();
  1742. }
  1743. }
  1744. <?php
  1745. namespace Composer\Command;
  1746. use Composer\Cache;
  1747. use Composer\Factory;
  1748. use Symfony\Component\Console\Input\InputInterface;
  1749. use Symfony\Component\Console\Output\OutputInterface;
  1750. class ClearCacheCommand extends BaseCommand
  1751. {
  1752. protected function configure()
  1753. {
  1754. $this
  1755. ->setName('clear-cache')
  1756. ->setAliases(array('clearcache', 'cc'))
  1757. ->setDescription('Clears composer\'s internal package cache.')
  1758. ->setHelp(
  1759. <<<EOT
  1760. The <info>clear-cache</info> deletes all cached packages from composer's
  1761. cache directory.
  1762. Read more at https://getcomposer.org/doc/03-cli.md#clear-cache-clearcache-cc
  1763. EOT
  1764. )
  1765. ;
  1766. }
  1767. protected function execute(InputInterface $input, OutputInterface $output)
  1768. {
  1769. $config = Factory::createConfig();
  1770. $io = $this->getIO();
  1771. $cachePaths = array(
  1772. 'cache-vcs-dir' => $config->get('cache-vcs-dir'),
  1773. 'cache-repo-dir' => $config->get('cache-repo-dir'),
  1774. 'cache-files-dir' => $config->get('cache-files-dir'),
  1775. 'cache-dir' => $config->get('cache-dir'),
  1776. );
  1777. foreach ($cachePaths as $key => $cachePath) {
  1778. $cachePath = realpath($cachePath);
  1779. if (!$cachePath) {
  1780. $io->writeError("<info>Cache directory does not exist ($key): $cachePath</info>");
  1781. continue;
  1782. }
  1783. $cache = new Cache($io, $cachePath);
  1784. if (!$cache->isEnabled()) {
  1785. $io->writeError("<info>Cache is not enabled ($key): $cachePath</info>");
  1786. continue;
  1787. }
  1788. $io->writeError("<info>Clearing cache ($key): $cachePath</info>");
  1789. $cache->clear();
  1790. }
  1791. $io->writeError('<info>All caches cleared.</info>');
  1792. return 0;
  1793. }
  1794. }
  1795. <?php
  1796. namespace Composer\Command;
  1797. use Composer\Util\Platform;
  1798. use Composer\Util\Silencer;
  1799. use Symfony\Component\Console\Input\InputInterface;
  1800. use Symfony\Component\Console\Input\InputArgument;
  1801. use Symfony\Component\Console\Input\InputOption;
  1802. use Symfony\Component\Console\Output\OutputInterface;
  1803. use Composer\Config;
  1804. use Composer\Config\JsonConfigSource;
  1805. use Composer\Factory;
  1806. use Composer\IO\IOInterface;
  1807. use Composer\Json\JsonFile;
  1808. use Composer\Semver\VersionParser;
  1809. use Composer\Package\BasePackage;
  1810. class ConfigCommand extends BaseCommand
  1811. {
  1812. protected $config;
  1813. protected $configFile;
  1814. protected $configSource;
  1815. protected $authConfigFile;
  1816. protected $authConfigSource;
  1817. protected function configure()
  1818. {
  1819. $this
  1820. ->setName('config')
  1821. ->setDescription('Sets config options.')
  1822. ->setDefinition(array(
  1823. new InputOption('global', 'g', InputOption::VALUE_NONE, 'Apply command to the global config file'),
  1824. new InputOption('editor', 'e', InputOption::VALUE_NONE, 'Open editor'),
  1825. new InputOption('auth', 'a', InputOption::VALUE_NONE, 'Affect auth config file (only used for --editor)'),
  1826. new InputOption('unset', null, InputOption::VALUE_NONE, 'Unset the given setting-key'),
  1827. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List configuration settings'),
  1828. new InputOption('file', 'f', InputOption::VALUE_REQUIRED, 'If you want to choose a different composer.json or config.json'),
  1829. new InputOption('absolute', null, InputOption::VALUE_NONE, 'Returns absolute paths when fetching *-dir config values instead of relative'),
  1830. new InputArgument('setting-key', null, 'Setting key'),
  1831. new InputArgument('setting-value', InputArgument::IS_ARRAY, 'Setting value'),
  1832. ))
  1833. ->setHelp(
  1834. <<<EOT
  1835. This command allows you to edit composer config settings and repositories
  1836. in either the local composer.json file or the global config.json file.
  1837. Additionally it lets you edit most properties in the local composer.json.
  1838. To set a config setting:
  1839. <comment>%command.full_name% bin-dir bin/</comment>
  1840. To read a config setting:
  1841. <comment>%command.full_name% bin-dir</comment>
  1842. Outputs: <info>bin</info>
  1843. To edit the global config.json file:
  1844. <comment>%command.full_name% --global</comment>
  1845. To add a repository:
  1846. <comment>%command.full_name% repositories.foo vcs https://bar.com</comment>
  1847. To remove a repository (repo is a short alias for repositories):
  1848. <comment>%command.full_name% --unset repo.foo</comment>
  1849. To disable packagist:
  1850. <comment>%command.full_name% repo.packagist false</comment>
  1851. You can alter repositories in the global config.json file by passing in the
  1852. <info>--global</info> option.
  1853. To add or edit suggested packages you can use:
  1854. <comment>%command.full_name% suggest.package reason for the suggestion</comment>
  1855. To add or edit extra properties you can use:
  1856. <comment>%command.full_name% extra.property value</comment>
  1857. To edit the file in an external editor:
  1858. <comment>%command.full_name% --editor</comment>
  1859. To choose your editor you can set the "EDITOR" env variable.
  1860. To get a list of configuration values in the file:
  1861. <comment>%command.full_name% --list</comment>
  1862. You can always pass more than one option. As an example, if you want to edit the
  1863. global config.json file.
  1864. <comment>%command.full_name% --editor --global</comment>
  1865. Read more at https://getcomposer.org/doc/03-cli.md#config
  1866. EOT
  1867. )
  1868. ;
  1869. }
  1870. protected function initialize(InputInterface $input, OutputInterface $output)
  1871. {
  1872. parent::initialize($input, $output);
  1873. if ($input->getOption('global') && null !== $input->getOption('file')) {
  1874. throw new \RuntimeException('--file and --global can not be combined');
  1875. }
  1876. $io = $this->getIO();
  1877. $this->config = Factory::createConfig($io);
  1878. $configFile = $input->getOption('global')
  1879. ? ($this->config->get('home') . '/config.json')
  1880. : ($input->getOption('file') ?: Factory::getComposerFile());
  1881. if (
  1882. ($configFile === 'composer.json' || $configFile === './composer.json')
  1883. && !file_exists($configFile)
  1884. && realpath(getcwd()) === realpath($this->config->get('home'))
  1885. ) {
  1886. file_put_contents($configFile, "{\n}\n");
  1887. }
  1888. $this->configFile = new JsonFile($configFile, null, $io);
  1889. $this->configSource = new JsonConfigSource($this->configFile);
  1890. $authConfigFile = $input->getOption('global')
  1891. ? ($this->config->get('home') . '/auth.json')
  1892. : dirname(realpath($configFile)) . '/auth.json';
  1893. $this->authConfigFile = new JsonFile($authConfigFile, null, $io);
  1894. $this->authConfigSource = new JsonConfigSource($this->authConfigFile, true);
  1895. if ($input->getOption('global') && !$this->configFile->exists()) {
  1896. touch($this->configFile->getPath());
  1897. $this->configFile->write(array('config' => new \ArrayObject));
  1898. Silencer::call('chmod', $this->configFile->getPath(), 0600);
  1899. }
  1900. if ($input->getOption('global') && !$this->authConfigFile->exists()) {
  1901. touch($this->authConfigFile->getPath());
  1902. $this->authConfigFile->write(array('bitbucket-oauth' => new \ArrayObject, 'github-oauth' => new \ArrayObject, 'gitlab-oauth' => new \ArrayObject, 'gitlab-token' => new \ArrayObject, 'http-basic' => new \ArrayObject, 'bearer' => new \ArrayObject));
  1903. Silencer::call('chmod', $this->authConfigFile->getPath(), 0600);
  1904. }
  1905. if (!$this->configFile->exists()) {
  1906. throw new \RuntimeException(sprintf('File "%s" cannot be found in the current directory', $configFile));
  1907. }
  1908. }
  1909. protected function execute(InputInterface $input, OutputInterface $output)
  1910. {
  1911. if ($input->getOption('editor')) {
  1912. $editor = escapeshellcmd(getenv('EDITOR'));
  1913. if (!$editor) {
  1914. if (Platform::isWindows()) {
  1915. $editor = 'notepad';
  1916. } else {
  1917. foreach (array('editor', 'vim', 'vi', 'nano', 'pico', 'ed') as $candidate) {
  1918. if (exec('which '.$candidate)) {
  1919. $editor = $candidate;
  1920. break;
  1921. }
  1922. }
  1923. }
  1924. }
  1925. $file = $input->getOption('auth') ? $this->authConfigFile->getPath() : $this->configFile->getPath();
  1926. system($editor . ' ' . $file . (Platform::isWindows() ? '' : ' > `tty`'));
  1927. return 0;
  1928. }
  1929. if (!$input->getOption('global')) {
  1930. $this->config->merge($this->configFile->read());
  1931. $this->config->merge(array('config' => $this->authConfigFile->exists() ? $this->authConfigFile->read() : array()));
  1932. }
  1933. if ($input->getOption('list')) {
  1934. $this->listConfiguration($this->config->all(), $this->config->raw(), $output);
  1935. return 0;
  1936. }
  1937. $settingKey = $input->getArgument('setting-key');
  1938. if (!$settingKey) {
  1939. return 0;
  1940. }
  1941. if (array() !== $input->getArgument('setting-value') && $input->getOption('unset')) {
  1942. throw new \RuntimeException('You can not combine a setting value with --unset');
  1943. }
  1944. if (array() === $input->getArgument('setting-value') && !$input->getOption('unset')) {
  1945. $properties = array('name', 'type', 'description', 'homepage', 'version', 'minimum-stability', 'prefer-stable', 'keywords', 'license', 'extra');
  1946. $rawData = $this->configFile->read();
  1947. $data = $this->config->all();
  1948. if (preg_match('/^repos?(?:itories)?(?:\.(.+))?/', $settingKey, $matches)) {
  1949. if (!isset($matches[1]) || $matches[1] === '') {
  1950. $value = isset($data['repositories']) ? $data['repositories'] : array();
  1951. } else {
  1952. if (!isset($data['repositories'][$matches[1]])) {
  1953. throw new \InvalidArgumentException('There is no '.$matches[1].' repository defined');
  1954. }
  1955. $value = $data['repositories'][$matches[1]];
  1956. }
  1957. } elseif (strpos($settingKey, '.')) {
  1958. $bits = explode('.', $settingKey);
  1959. if ($bits[0] === 'extra') {
  1960. $data = $rawData;
  1961. } else {
  1962. $data = $data['config'];
  1963. }
  1964. $match = false;
  1965. foreach ($bits as $bit) {
  1966. $key = isset($key) ? $key.'.'.$bit : $bit;
  1967. $match = false;
  1968. if (isset($data[$key])) {
  1969. $match = true;
  1970. $data = $data[$key];
  1971. unset($key);
  1972. }
  1973. }
  1974. if (!$match) {
  1975. throw new \RuntimeException($settingKey.' is not defined.');
  1976. }
  1977. $value = $data;
  1978. } elseif (isset($data['config'][$settingKey])) {
  1979. $value = $this->config->get($settingKey, $input->getOption('absolute') ? 0 : Config::RELATIVE_PATHS);
  1980. } elseif (in_array($settingKey, $properties, true) && isset($rawData[$settingKey])) {
  1981. $value = $rawData[$settingKey];
  1982. } else {
  1983. throw new \RuntimeException($settingKey.' is not defined');
  1984. }
  1985. if (is_array($value)) {
  1986. $value = json_encode($value);
  1987. }
  1988. $this->getIO()->write($value, true, IOInterface::QUIET);
  1989. return 0;
  1990. }
  1991. $values = $input->getArgument('setting-value');
  1992. $booleanValidator = function ($val) {
  1993. return in_array($val, array('true', 'false', '1', '0'), true);
  1994. };
  1995. $booleanNormalizer = function ($val) {
  1996. return $val !== 'false' && (bool) $val;
  1997. };
  1998. $uniqueConfigValues = array(
  1999. 'process-timeout' => array('is_numeric', 'intval'),
  2000. 'use-include-path' => array($booleanValidator, $booleanNormalizer),
  2001. 'use-github-api' => array($booleanValidator, $booleanNormalizer),
  2002. 'preferred-install' => array(
  2003. function ($val) {
  2004. return in_array($val, array('auto', 'source', 'dist'), true);
  2005. },
  2006. function ($val) {
  2007. return $val;
  2008. },
  2009. ),
  2010. 'store-auths' => array(
  2011. function ($val) {
  2012. return in_array($val, array('true', 'false', 'prompt'), true);
  2013. },
  2014. function ($val) {
  2015. if ('prompt' === $val) {
  2016. return 'prompt';
  2017. }
  2018. return $val !== 'false' && (bool) $val;
  2019. },
  2020. ),
  2021. 'notify-on-install' => array($booleanValidator, $booleanNormalizer),
  2022. 'vendor-dir' => array('is_string', function ($val) {
  2023. return $val;
  2024. }),
  2025. 'bin-dir' => array('is_string', function ($val) {
  2026. return $val;
  2027. }),
  2028. 'archive-dir' => array('is_string', function ($val) {
  2029. return $val;
  2030. }),
  2031. 'archive-format' => array('is_string', function ($val) {
  2032. return $val;
  2033. }),
  2034. 'data-dir' => array('is_string', function ($val) {
  2035. return $val;
  2036. }),
  2037. 'cache-dir' => array('is_string', function ($val) {
  2038. return $val;
  2039. }),
  2040. 'cache-files-dir' => array('is_string', function ($val) {
  2041. return $val;
  2042. }),
  2043. 'cache-repo-dir' => array('is_string', function ($val) {
  2044. return $val;
  2045. }),
  2046. 'cache-vcs-dir' => array('is_string', function ($val) {
  2047. return $val;
  2048. }),
  2049. 'cache-ttl' => array('is_numeric', 'intval'),
  2050. 'cache-files-ttl' => array('is_numeric', 'intval'),
  2051. 'cache-files-maxsize' => array(
  2052. function ($val) {
  2053. return preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $val) > 0;
  2054. },
  2055. function ($val) {
  2056. return $val;
  2057. },
  2058. ),
  2059. 'bin-compat' => array(
  2060. function ($val) {
  2061. return in_array($val, array('auto', 'full'));
  2062. },
  2063. function ($val) {
  2064. return $val;
  2065. },
  2066. ),
  2067. 'discard-changes' => array(
  2068. function ($val) {
  2069. return in_array($val, array('stash', 'true', 'false', '1', '0'), true);
  2070. },
  2071. function ($val) {
  2072. if ('stash' === $val) {
  2073. return 'stash';
  2074. }
  2075. return $val !== 'false' && (bool) $val;
  2076. },
  2077. ),
  2078. 'autoloader-suffix' => array('is_string', function ($val) {
  2079. return $val === 'null' ? null : $val;
  2080. }),
  2081. 'sort-packages' => array($booleanValidator, $booleanNormalizer),
  2082. 'optimize-autoloader' => array($booleanValidator, $booleanNormalizer),
  2083. 'classmap-authoritative' => array($booleanValidator, $booleanNormalizer),
  2084. 'apcu-autoloader' => array($booleanValidator, $booleanNormalizer),
  2085. 'prepend-autoloader' => array($booleanValidator, $booleanNormalizer),
  2086. 'disable-tls' => array($booleanValidator, $booleanNormalizer),
  2087. 'secure-http' => array($booleanValidator, $booleanNormalizer),
  2088. 'cafile' => array(
  2089. function ($val) {
  2090. return file_exists($val) && is_readable($val);
  2091. },
  2092. function ($val) {
  2093. return $val === 'null' ? null : $val;
  2094. },
  2095. ),
  2096. 'capath' => array(
  2097. function ($val) {
  2098. return is_dir($val) && is_readable($val);
  2099. },
  2100. function ($val) {
  2101. return $val === 'null' ? null : $val;
  2102. },
  2103. ),
  2104. 'github-expose-hostname' => array($booleanValidator, $booleanNormalizer),
  2105. 'htaccess-protect' => array($booleanValidator, $booleanNormalizer),
  2106. 'lock' => array($booleanValidator, $booleanNormalizer),
  2107. );
  2108. $multiConfigValues = array(
  2109. 'github-protocols' => array(
  2110. function ($vals) {
  2111. if (!is_array($vals)) {
  2112. return 'array expected';
  2113. }
  2114. foreach ($vals as $val) {
  2115. if (!in_array($val, array('git', 'https', 'ssh'))) {
  2116. return 'valid protocols include: git, https, ssh';
  2117. }
  2118. }
  2119. return true;
  2120. },
  2121. function ($vals) {
  2122. return $vals;
  2123. },
  2124. ),
  2125. 'github-domains' => array(
  2126. function ($vals) {
  2127. if (!is_array($vals)) {
  2128. return 'array expected';
  2129. }
  2130. return true;
  2131. },
  2132. function ($vals) {
  2133. return $vals;
  2134. },
  2135. ),
  2136. 'gitlab-domains' => array(
  2137. function ($vals) {
  2138. if (!is_array($vals)) {
  2139. return 'array expected';
  2140. }
  2141. return true;
  2142. },
  2143. function ($vals) {
  2144. return $vals;
  2145. },
  2146. ),
  2147. );
  2148. if ($input->getOption('unset') && (isset($uniqueConfigValues[$settingKey]) || isset($multiConfigValues[$settingKey]))) {
  2149. if ($settingKey === 'disable-tls' && $this->config->get('disable-tls')) {
  2150. $this->getIO()->writeError('<info>You are now running Composer with SSL/TLS protection enabled.</info>');
  2151. }
  2152. $this->configSource->removeConfigSetting($settingKey);
  2153. return 0;
  2154. }
  2155. if (isset($uniqueConfigValues[$settingKey])) {
  2156. $this->handleSingleValue($settingKey, $uniqueConfigValues[$settingKey], $values, 'addConfigSetting');
  2157. return 0;
  2158. }
  2159. if (isset($multiConfigValues[$settingKey])) {
  2160. $this->handleMultiValue($settingKey, $multiConfigValues[$settingKey], $values, 'addConfigSetting');
  2161. return 0;
  2162. }
  2163. if (preg_match('/^preferred-install\.(.+)/', $settingKey, $matches)) {
  2164. if ($input->getOption('unset')) {
  2165. $this->configSource->removeConfigSetting($settingKey);
  2166. return 0;
  2167. }
  2168. list($validator) = $uniqueConfigValues['preferred-install'];
  2169. if (!$validator($values[0])) {
  2170. throw new \RuntimeException('Invalid value for '.$settingKey.'. Should be one of: auto, source, or dist');
  2171. }
  2172. $this->configSource->addConfigSetting($settingKey, $values[0]);
  2173. return 0;
  2174. }
  2175. $uniqueProps = array(
  2176. 'name' => array('is_string', function ($val) {
  2177. return $val;
  2178. }),
  2179. 'type' => array('is_string', function ($val) {
  2180. return $val;
  2181. }),
  2182. 'description' => array('is_string', function ($val) {
  2183. return $val;
  2184. }),
  2185. 'homepage' => array('is_string', function ($val) {
  2186. return $val;
  2187. }),
  2188. 'version' => array('is_string', function ($val) {
  2189. return $val;
  2190. }),
  2191. 'minimum-stability' => array(
  2192. function ($val) {
  2193. return isset(BasePackage::$stabilities[VersionParser::normalizeStability($val)]);
  2194. },
  2195. function ($val) {
  2196. return VersionParser::normalizeStability($val);
  2197. },
  2198. ),
  2199. 'prefer-stable' => array($booleanValidator, $booleanNormalizer),
  2200. );
  2201. $multiProps = array(
  2202. 'keywords' => array(
  2203. function ($vals) {
  2204. if (!is_array($vals)) {
  2205. return 'array expected';
  2206. }
  2207. return true;
  2208. },
  2209. function ($vals) {
  2210. return $vals;
  2211. },
  2212. ),
  2213. 'license' => array(
  2214. function ($vals) {
  2215. if (!is_array($vals)) {
  2216. return 'array expected';
  2217. }
  2218. return true;
  2219. },
  2220. function ($vals) {
  2221. return $vals;
  2222. },
  2223. ),
  2224. );
  2225. if ($input->getOption('global') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]) || substr($settingKey, 0, 6) === 'extra.')) {
  2226. 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');
  2227. }
  2228. if ($input->getOption('unset') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]))) {
  2229. $this->configSource->removeProperty($settingKey);
  2230. return 0;
  2231. }
  2232. if (isset($uniqueProps[$settingKey])) {
  2233. $this->handleSingleValue($settingKey, $uniqueProps[$settingKey], $values, 'addProperty');
  2234. return 0;
  2235. }
  2236. if (isset($multiProps[$settingKey])) {
  2237. $this->handleMultiValue($settingKey, $multiProps[$settingKey], $values, 'addProperty');
  2238. return 0;
  2239. }
  2240. if (preg_match('/^repos?(?:itories)?\.(.+)/', $settingKey, $matches)) {
  2241. if ($input->getOption('unset')) {
  2242. $this->configSource->removeRepository($matches[1]);
  2243. return 0;
  2244. }
  2245. if (2 === count($values)) {
  2246. $this->configSource->addRepository($matches[1], array(
  2247. 'type' => $values[0],
  2248. 'url' => $values[1],
  2249. ));
  2250. return 0;
  2251. }
  2252. if (1 === count($values)) {
  2253. $value = strtolower($values[0]);
  2254. if (true === $booleanValidator($value)) {
  2255. if (false === $booleanNormalizer($value)) {
  2256. $this->configSource->addRepository($matches[1], false);
  2257. return 0;
  2258. }
  2259. } else {
  2260. $value = JsonFile::parseJson($values[0]);
  2261. $this->configSource->addRepository($matches[1], $value);
  2262. return 0;
  2263. }
  2264. }
  2265. throw new \RuntimeException('You must pass the type and a url. Example: php composer.phar config repositories.foo vcs https://bar.com');
  2266. }
  2267. if (preg_match('/^extra\.(.+)/', $settingKey, $matches)) {
  2268. if ($input->getOption('unset')) {
  2269. $this->configSource->removeProperty($settingKey);
  2270. return 0;
  2271. }
  2272. $this->configSource->addProperty($settingKey, $values[0]);
  2273. return 0;
  2274. }
  2275. if (preg_match('/^suggest\.(.+)/', $settingKey, $matches)) {
  2276. if ($input->getOption('unset')) {
  2277. $this->configSource->removeProperty($settingKey);
  2278. return 0;
  2279. }
  2280. $this->configSource->addProperty($settingKey, implode(' ', $values));
  2281. return 0;
  2282. }
  2283. if (in_array($settingKey, array('suggest', 'extra'), true) && $input->getOption('unset')) {
  2284. $this->configSource->removeProperty($settingKey);
  2285. return 0;
  2286. }
  2287. if (preg_match('/^platform\.(.+)/', $settingKey, $matches)) {
  2288. if ($input->getOption('unset')) {
  2289. $this->configSource->removeConfigSetting($settingKey);
  2290. return 0;
  2291. }
  2292. $this->configSource->addConfigSetting($settingKey, $values[0]);
  2293. return 0;
  2294. }
  2295. if ($settingKey === 'platform' && $input->getOption('unset')) {
  2296. $this->configSource->removeConfigSetting($settingKey);
  2297. return 0;
  2298. }
  2299. if (preg_match('/^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|bearer)\.(.+)/', $settingKey, $matches)) {
  2300. if ($input->getOption('unset')) {
  2301. $this->authConfigSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2302. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2303. return 0;
  2304. }
  2305. if ($matches[1] === 'bitbucket-oauth') {
  2306. if (2 !== count($values)) {
  2307. throw new \RuntimeException('Expected two arguments (consumer-key, consumer-secret), got '.count($values));
  2308. }
  2309. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2310. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('consumer-key' => $values[0], 'consumer-secret' => $values[1]));
  2311. } elseif (in_array($matches[1], array('github-oauth', 'gitlab-oauth', 'gitlab-token', 'bearer'), true)) {
  2312. if (1 !== count($values)) {
  2313. throw new \RuntimeException('Too many arguments, expected only one token');
  2314. }
  2315. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2316. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], $values[0]);
  2317. } elseif ($matches[1] === 'http-basic') {
  2318. if (2 !== count($values)) {
  2319. throw new \RuntimeException('Expected two arguments (username, password), got '.count($values));
  2320. }
  2321. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2322. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('username' => $values[0], 'password' => $values[1]));
  2323. }
  2324. return 0;
  2325. }
  2326. if (preg_match('/^scripts\.(.+)/', $settingKey, $matches)) {
  2327. if ($input->getOption('unset')) {
  2328. $this->configSource->removeProperty($settingKey);
  2329. return 0;
  2330. }
  2331. $this->configSource->addProperty($settingKey, count($values) > 1 ? $values : $values[0]);
  2332. return 0;
  2333. }
  2334. throw new \InvalidArgumentException('Setting '.$settingKey.' does not exist or is not supported by this command');
  2335. }
  2336. protected function handleSingleValue($key, array $callbacks, array $values, $method)
  2337. {
  2338. list($validator, $normalizer) = $callbacks;
  2339. if (1 !== count($values)) {
  2340. throw new \RuntimeException('You can only pass one value. Example: php composer.phar config process-timeout 300');
  2341. }
  2342. if (true !== $validation = $validator($values[0])) {
  2343. throw new \RuntimeException(sprintf(
  2344. '"%s" is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2345. $values[0]
  2346. ));
  2347. }
  2348. $normalizedValue = $normalizer($values[0]);
  2349. if ($key === 'disable-tls') {
  2350. if (!$normalizedValue && $this->config->get('disable-tls')) {
  2351. $this->getIO()->writeError('<info>You are now running Composer with SSL/TLS protection enabled.</info>');
  2352. } elseif ($normalizedValue && !$this->config->get('disable-tls')) {
  2353. $this->getIO()->writeError('<warning>You are now running Composer with SSL/TLS protection disabled.</warning>');
  2354. }
  2355. }
  2356. return call_user_func(array($this->configSource, $method), $key, $normalizedValue);
  2357. }
  2358. protected function handleMultiValue($key, array $callbacks, array $values, $method)
  2359. {
  2360. list($validator, $normalizer) = $callbacks;
  2361. if (true !== $validation = $validator($values)) {
  2362. throw new \RuntimeException(sprintf(
  2363. '%s is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2364. json_encode($values)
  2365. ));
  2366. }
  2367. return call_user_func(array($this->configSource, $method), $key, $normalizer($values));
  2368. }
  2369. protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, $k = null)
  2370. {
  2371. $origK = $k;
  2372. $io = $this->getIO();
  2373. foreach ($contents as $key => $value) {
  2374. if ($k === null && !in_array($key, array('config', 'repositories'))) {
  2375. continue;
  2376. }
  2377. $rawVal = isset($rawContents[$key]) ? $rawContents[$key] : null;
  2378. if (is_array($value) && (!is_numeric(key($value)) || ($key === 'repositories' && null === $k))) {
  2379. $k .= preg_replace('{^config\.}', '', $key . '.');
  2380. $this->listConfiguration($value, $rawVal, $output, $k);
  2381. $k = $origK;
  2382. continue;
  2383. }
  2384. if (is_array($value)) {
  2385. $value = array_map(function ($val) {
  2386. return is_array($val) ? json_encode($val) : $val;
  2387. }, $value);
  2388. $value = '['.implode(', ', $value).']';
  2389. }
  2390. if (is_bool($value)) {
  2391. $value = var_export($value, true);
  2392. }
  2393. if (is_string($rawVal) && $rawVal != $value) {
  2394. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $rawVal . ' (' . $value . ')</info>', true, IOInterface::QUIET);
  2395. } else {
  2396. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $value . '</info>', true, IOInterface::QUIET);
  2397. }
  2398. }
  2399. }
  2400. }
  2401. <?php
  2402. namespace Composer\Command;
  2403. use Composer\Config;
  2404. use Composer\Factory;
  2405. use Composer\Installer;
  2406. use Composer\Installer\ProjectInstaller;
  2407. use Composer\Installer\InstallationManager;
  2408. use Composer\Installer\SuggestedPackagesReporter;
  2409. use Composer\IO\IOInterface;
  2410. use Composer\Package\BasePackage;
  2411. use Composer\DependencyResolver\Pool;
  2412. use Composer\DependencyResolver\Operation\InstallOperation;
  2413. use Composer\Package\Version\VersionSelector;
  2414. use Composer\Package\AliasPackage;
  2415. use Composer\Repository\RepositoryFactory;
  2416. use Composer\Repository\CompositeRepository;
  2417. use Composer\Repository\PlatformRepository;
  2418. use Composer\Repository\InstalledFilesystemRepository;
  2419. use Composer\Script\ScriptEvents;
  2420. use Composer\Util\Silencer;
  2421. use Symfony\Component\Console\Input\InputArgument;
  2422. use Symfony\Component\Console\Input\InputInterface;
  2423. use Symfony\Component\Console\Input\InputOption;
  2424. use Symfony\Component\Console\Output\OutputInterface;
  2425. use Symfony\Component\Finder\Finder;
  2426. use Composer\Json\JsonFile;
  2427. use Composer\Config\JsonConfigSource;
  2428. use Composer\Util\Filesystem;
  2429. use Composer\Package\Version\VersionParser;
  2430. class CreateProjectCommand extends BaseCommand
  2431. {
  2432. protected $suggestedPackagesReporter;
  2433. protected function configure()
  2434. {
  2435. $this
  2436. ->setName('create-project')
  2437. ->setDescription('Creates new project from a package into given directory.')
  2438. ->setDefinition(array(
  2439. new InputArgument('package', InputArgument::OPTIONAL, 'Package name to be installed'),
  2440. new InputArgument('directory', InputArgument::OPTIONAL, 'Directory where the files should be created'),
  2441. new InputArgument('version', InputArgument::OPTIONAL, 'Version, will default to latest'),
  2442. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum-stability allowed (unless a version is specified).'),
  2443. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  2444. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  2445. new InputOption('repository', null, InputOption::VALUE_REQUIRED, 'Pick a different repository (as url or json config) to look for the package.'),
  2446. new InputOption('repository-url', null, InputOption::VALUE_REQUIRED, 'DEPRECATED: Use --repository instead.'),
  2447. new InputOption('add-repository', null, InputOption::VALUE_NONE, 'Add the repository option to the composer.json.'),
  2448. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  2449. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  2450. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  2451. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Whether to prevent execution of all defined scripts in the root package.'),
  2452. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  2453. 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.'),
  2454. new InputOption('keep-vcs', null, InputOption::VALUE_NONE, 'Whether to prevent deleting the vcs folder.'),
  2455. new InputOption('remove-vcs', null, InputOption::VALUE_NONE, 'Whether to force deletion of the vcs folder without prompting.'),
  2456. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Whether to skip installation of the package dependencies.'),
  2457. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  2458. ))
  2459. ->setHelp(
  2460. <<<EOT
  2461. The <info>create-project</info> command creates a new project from a given
  2462. package into a new directory. If executed without params and in a directory
  2463. with a composer.json file it installs the packages for the current project.
  2464. You can use this command to bootstrap new projects or setup a clean
  2465. version-controlled installation for developers of your project.
  2466. <info>php composer.phar create-project vendor/project target-directory [version]</info>
  2467. You can also specify the version with the package name using = or : as separator.
  2468. <info>php composer.phar create-project vendor/project:version target-directory</info>
  2469. To install unstable packages, either specify the version you want, or use the
  2470. --stability=dev (where dev can be one of RC, beta, alpha or dev).
  2471. To setup a developer workable version you should create the project using the source
  2472. controlled code by appending the <info>'--prefer-source'</info> flag.
  2473. To install a package from another repository than the default one you
  2474. can pass the <info>'--repository=https://myrepository.org'</info> flag.
  2475. Read more at https://getcomposer.org/doc/03-cli.md#create-project
  2476. EOT
  2477. )
  2478. ;
  2479. }
  2480. protected function execute(InputInterface $input, OutputInterface $output)
  2481. {
  2482. $config = Factory::createConfig();
  2483. $io = $this->getIO();
  2484. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input, true);
  2485. if ($input->getOption('dev')) {
  2486. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  2487. }
  2488. if ($input->getOption('no-custom-installers')) {
  2489. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  2490. $input->setOption('no-plugins', true);
  2491. }
  2492. return $this->installProject(
  2493. $io,
  2494. $config,
  2495. $input,
  2496. $input->getArgument('package'),
  2497. $input->getArgument('directory'),
  2498. $input->getArgument('version'),
  2499. $input->getOption('stability'),
  2500. $preferSource,
  2501. $preferDist,
  2502. !$input->getOption('no-dev'),
  2503. $input->getOption('repository') ?: $input->getOption('repository-url'),
  2504. $input->getOption('no-plugins'),
  2505. $input->getOption('no-scripts'),
  2506. $input->getOption('no-progress'),
  2507. $input->getOption('no-install'),
  2508. $input->getOption('ignore-platform-reqs'),
  2509. !$input->getOption('no-secure-http'),
  2510. $input->getOption('add-repository')
  2511. );
  2512. }
  2513. 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, $noProgress = false, $noInstall = false, $ignorePlatformReqs = false, $secureHttp = true, $addRepository = false)
  2514. {
  2515. $oldCwd = getcwd();
  2516. $io->loadConfiguration($config);
  2517. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($io);
  2518. if ($packageName !== null) {
  2519. $installedFromVcs = $this->installRootPackage($io, $config, $packageName, $directory, $packageVersion, $stability, $preferSource, $preferDist, $installDevPackages, $repository, $disablePlugins, $noScripts, $noProgress, $ignorePlatformReqs, $secureHttp);
  2520. } else {
  2521. $installedFromVcs = false;
  2522. }
  2523. $composer = Factory::create($io, null, $disablePlugins);
  2524. if ($repository !== null && $addRepository) {
  2525. if ($composer->getLocker()->isLocked()) {
  2526. $io->writeError('<error>Adding a repository when creating a project that provides a composer.lock file is not supported</error>');
  2527. return false;
  2528. }
  2529. $repoConfig = RepositoryFactory::configFromString($io, $composer->getConfig(), $repository, true);
  2530. $composerJsonRepositoriesConfig = $composer->getConfig()->getRepositories();
  2531. $name = RepositoryFactory::generateRepositoryName(0, $repoConfig, $composerJsonRepositoriesConfig);
  2532. $configSource = new JsonConfigSource(new JsonFile('composer.json'));
  2533. $configSource->addRepository($name, $repoConfig);
  2534. $composer = Factory::create($io, null, $disablePlugins);
  2535. }
  2536. $composer->getDownloadManager()->setOutputProgress(!$noProgress);
  2537. $fs = new Filesystem();
  2538. if ($noScripts === false) {
  2539. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ROOT_PACKAGE_INSTALL, $installDevPackages);
  2540. }
  2541. $config = $composer->getConfig();
  2542. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  2543. if ($noInstall === false) {
  2544. $installer = Installer::create($io, $composer);
  2545. $installer->setPreferSource($preferSource)
  2546. ->setPreferDist($preferDist)
  2547. ->setDevMode($installDevPackages)
  2548. ->setRunScripts(!$noScripts)
  2549. ->setIgnorePlatformRequirements($ignorePlatformReqs)
  2550. ->setSuggestedPackagesReporter($this->suggestedPackagesReporter)
  2551. ->setOptimizeAutoloader($config->get('optimize-autoloader'))
  2552. ->setClassMapAuthoritative($config->get('classmap-authoritative'))
  2553. ->setApcuAutoloader($config->get('apcu-autoloader'));
  2554. if ($disablePlugins) {
  2555. $installer->disablePlugins();
  2556. }
  2557. $status = $installer->run();
  2558. if (0 !== $status) {
  2559. return $status;
  2560. }
  2561. }
  2562. $hasVcs = $installedFromVcs;
  2563. if (
  2564. !$input->getOption('keep-vcs')
  2565. && $installedFromVcs
  2566. && (
  2567. $input->getOption('remove-vcs')
  2568. || !$io->isInteractive()
  2569. || $io->askConfirmation('<info>Do you want to remove the existing VCS (.git, .svn..) history?</info> [<comment>Y,n</comment>]? ', true)
  2570. )
  2571. ) {
  2572. $finder = new Finder();
  2573. $finder->depth(0)->directories()->in(getcwd())->ignoreVCS(false)->ignoreDotFiles(false);
  2574. foreach (array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg', '.fslckout', '_FOSSIL_') as $vcsName) {
  2575. $finder->name($vcsName);
  2576. }
  2577. try {
  2578. $dirs = iterator_to_array($finder);
  2579. unset($finder);
  2580. foreach ($dirs as $dir) {
  2581. if (!$fs->removeDirectory($dir)) {
  2582. throw new \RuntimeException('Could not remove '.$dir);
  2583. }
  2584. }
  2585. } catch (\Exception $e) {
  2586. $io->writeError('<error>An error occurred while removing the VCS metadata: '.$e->getMessage().'</error>');
  2587. }
  2588. $hasVcs = false;
  2589. }
  2590. if (!$hasVcs) {
  2591. $package = $composer->getPackage();
  2592. $configSource = new JsonConfigSource(new JsonFile('composer.json'));
  2593. foreach (BasePackage::$supportedLinkTypes as $type => $meta) {
  2594. foreach ($package->{'get'.$meta['method']}() as $link) {
  2595. if ($link->getPrettyConstraint() === 'self.version') {
  2596. $configSource->addLink($type, $link->getTarget(), $package->getPrettyVersion());
  2597. }
  2598. }
  2599. }
  2600. }
  2601. if ($noScripts === false) {
  2602. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_CREATE_PROJECT_CMD, $installDevPackages);
  2603. }
  2604. chdir($oldCwd);
  2605. $vendorComposerDir = $config->get('vendor-dir').'/composer';
  2606. if (is_dir($vendorComposerDir) && $fs->isDirEmpty($vendorComposerDir)) {
  2607. Silencer::call('rmdir', $vendorComposerDir);
  2608. $vendorDir = $config->get('vendor-dir');
  2609. if (is_dir($vendorDir) && $fs->isDirEmpty($vendorDir)) {
  2610. Silencer::call('rmdir', $vendorDir);
  2611. }
  2612. }
  2613. return 0;
  2614. }
  2615. 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, $noProgress = false, $ignorePlatformReqs = false, $secureHttp = true)
  2616. {
  2617. if (!$secureHttp) {
  2618. $config->merge(array('config' => array('secure-http' => false)));
  2619. }
  2620. if (null === $repository) {
  2621. $sourceRepo = new CompositeRepository(RepositoryFactory::defaultRepos($io, $config));
  2622. } else {
  2623. $sourceRepo = RepositoryFactory::fromString($io, $config, $repository, true);
  2624. }
  2625. $parser = new VersionParser();
  2626. $requirements = $parser->parseNameVersionPairs(array($packageName));
  2627. $name = strtolower($requirements[0]['name']);
  2628. if (!$packageVersion && isset($requirements[0]['version'])) {
  2629. $packageVersion = $requirements[0]['version'];
  2630. }
  2631. if (null === $directory) {
  2632. $parts = explode("/", $name, 2);
  2633. $directory = getcwd() . DIRECTORY_SEPARATOR . array_pop($parts);
  2634. }
  2635. $fs = new Filesystem();
  2636. if (!$fs->isAbsolutePath($directory)) {
  2637. $directory = getcwd() . DIRECTORY_SEPARATOR . $directory;
  2638. }
  2639. $io->writeError('<info>Creating a "' . $packageName . '" project at "' . $fs->findShortestPath(getcwd(), $directory, true) . '"</info>');
  2640. if (file_exists($directory)) {
  2641. if (!is_dir($directory)) {
  2642. throw new \InvalidArgumentException('Cannot create project directory at "'.$directory.'", it exists as a file.');
  2643. } elseif (!$fs->isDirEmpty($directory)) {
  2644. throw new \InvalidArgumentException('Project directory "'.$directory.'" is not empty.');
  2645. }
  2646. }
  2647. if (null === $stability) {
  2648. if (preg_match('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) {
  2649. $stability = $match[1];
  2650. } else {
  2651. $stability = VersionParser::parseStability($packageVersion);
  2652. }
  2653. }
  2654. $stability = VersionParser::normalizeStability($stability);
  2655. if (!isset(BasePackage::$stabilities[$stability])) {
  2656. throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities)));
  2657. }
  2658. $pool = new Pool($stability);
  2659. $pool->addRepository($sourceRepo);
  2660. $phpVersion = null;
  2661. $prettyPhpVersion = null;
  2662. if (!$ignorePlatformReqs) {
  2663. $platformOverrides = $config->get('platform') ?: array();
  2664. $platform = new PlatformRepository(array(), $platformOverrides);
  2665. $phpPackage = $platform->findPackage('php', '*');
  2666. $phpVersion = $phpPackage->getVersion();
  2667. $prettyPhpVersion = $phpPackage->getPrettyVersion();
  2668. }
  2669. $versionSelector = new VersionSelector($pool);
  2670. $package = $versionSelector->findBestCandidate($name, $packageVersion, $phpVersion, $stability);
  2671. if (!$package) {
  2672. $errorMessage = "Could not find package $name with " . ($packageVersion ? "version $packageVersion" : "stability $stability");
  2673. if ($phpVersion && $versionSelector->findBestCandidate($name, $packageVersion, null, $stability)) {
  2674. throw new \InvalidArgumentException($errorMessage .' in a version installable using your PHP version '.$prettyPhpVersion.'.');
  2675. }
  2676. throw new \InvalidArgumentException($errorMessage .'.');
  2677. }
  2678. if (function_exists('pcntl_async_signals') && function_exists('pcntl_signal')) {
  2679. @mkdir($directory, 0777, true);
  2680. if ($realDir = realpath($directory)) {
  2681. pcntl_async_signals(true);
  2682. pcntl_signal(SIGINT, function () use ($realDir) {
  2683. $fs = new Filesystem();
  2684. $fs->removeDirectory($realDir);
  2685. exit(130);
  2686. });
  2687. }
  2688. }
  2689. $io->writeError('<info>Installing ' . $package->getName() . ' (' . $package->getFullPrettyVersion(false) . ')</info>');
  2690. if ($disablePlugins) {
  2691. $io->writeError('<info>Plugins have been disabled.</info>');
  2692. }
  2693. if ($package instanceof AliasPackage) {
  2694. $package = $package->getAliasOf();
  2695. }
  2696. $dm = $this->createDownloadManager($io, $config);
  2697. $dm->setPreferSource($preferSource)
  2698. ->setPreferDist($preferDist)
  2699. ->setOutputProgress(!$noProgress);
  2700. $projectInstaller = new ProjectInstaller($directory, $dm);
  2701. $im = $this->createInstallationManager();
  2702. $im->addInstaller($projectInstaller);
  2703. $im->install(new InstalledFilesystemRepository(new JsonFile('php://memory')), new InstallOperation($package));
  2704. $im->notifyInstalls($io);
  2705. $this->suggestedPackagesReporter->addSuggestionsFromPackage($package);
  2706. $installedFromVcs = 'source' === $package->getInstallationSource();
  2707. $io->writeError('<info>Created project in ' . $directory . '</info>');
  2708. chdir($directory);
  2709. $_SERVER['COMPOSER_ROOT_VERSION'] = $package->getPrettyVersion();
  2710. putenv('COMPOSER_ROOT_VERSION='.$_SERVER['COMPOSER_ROOT_VERSION']);
  2711. return $installedFromVcs;
  2712. }
  2713. protected function createDownloadManager(IOInterface $io, Config $config)
  2714. {
  2715. $factory = new Factory();
  2716. return $factory->createDownloadManager($io, $config);
  2717. }
  2718. protected function createInstallationManager()
  2719. {
  2720. return new InstallationManager();
  2721. }
  2722. }
  2723. <?php
  2724. namespace Composer\Command;
  2725. use Symfony\Component\Console\Input\InputInterface;
  2726. use Symfony\Component\Console\Output\OutputInterface;
  2727. class DependsCommand extends BaseDependencyCommand
  2728. {
  2729. protected function configure()
  2730. {
  2731. parent::configure();
  2732. $this
  2733. ->setName('depends')
  2734. ->setAliases(array('why'))
  2735. ->setDescription('Shows which packages cause the given package to be installed.')
  2736. ->setHelp(
  2737. <<<EOT
  2738. Displays detailed information about where a package is referenced.
  2739. <info>php composer.phar depends composer/composer</info>
  2740. Read more at https://getcomposer.org/doc/03-cli.md#depends-why-
  2741. EOT
  2742. )
  2743. ;
  2744. }
  2745. protected function execute(InputInterface $input, OutputInterface $output)
  2746. {
  2747. return parent::doExecute($input, $output, false);
  2748. }
  2749. }
  2750. <?php
  2751. namespace Composer\Command;
  2752. use Composer\Composer;
  2753. use Composer\Factory;
  2754. use Composer\Config;
  2755. use Composer\Downloader\TransportException;
  2756. use Composer\Repository\PlatformRepository;
  2757. use Composer\Plugin\CommandEvent;
  2758. use Composer\Plugin\PluginEvents;
  2759. use Composer\Util\ConfigValidator;
  2760. use Composer\Util\IniHelper;
  2761. use Composer\Util\ProcessExecutor;
  2762. use Composer\Util\RemoteFilesystem;
  2763. use Composer\Util\StreamContextFactory;
  2764. use Composer\SelfUpdate\Keys;
  2765. use Composer\SelfUpdate\Versions;
  2766. use Composer\IO\NullIO;
  2767. use Symfony\Component\Console\Input\InputInterface;
  2768. use Symfony\Component\Console\Output\OutputInterface;
  2769. class DiagnoseCommand extends BaseCommand
  2770. {
  2771. protected $rfs;
  2772. protected $process;
  2773. protected $exitCode = 0;
  2774. protected function configure()
  2775. {
  2776. $this
  2777. ->setName('diagnose')
  2778. ->setDescription('Diagnoses the system to identify common errors.')
  2779. ->setHelp(
  2780. <<<EOT
  2781. The <info>diagnose</info> command checks common errors to help debugging problems.
  2782. The process exit code will be 1 in case of warnings and 2 for errors.
  2783. Read more at https://getcomposer.org/doc/03-cli.md#diagnose
  2784. EOT
  2785. )
  2786. ;
  2787. }
  2788. protected function execute(InputInterface $input, OutputInterface $output)
  2789. {
  2790. $composer = $this->getComposer(false);
  2791. $io = $this->getIO();
  2792. if ($composer) {
  2793. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'diagnose', $input, $output);
  2794. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  2795. $io->write('Checking composer.json: ', false);
  2796. $this->outputResult($this->checkComposerSchema());
  2797. }
  2798. if ($composer) {
  2799. $config = $composer->getConfig();
  2800. } else {
  2801. $config = Factory::createConfig();
  2802. }
  2803. $config->merge(array('config' => array('secure-http' => false)));
  2804. $config->prohibitUrlByConfig('http://repo.packagist.org', new NullIO);
  2805. $this->rfs = Factory::createRemoteFilesystem($io, $config);
  2806. $this->process = new ProcessExecutor($io);
  2807. $io->write('Checking platform settings: ', false);
  2808. $this->outputResult($this->checkPlatform());
  2809. $io->write('Checking git settings: ', false);
  2810. $this->outputResult($this->checkGit());
  2811. $io->write('Checking http connectivity to packagist: ', false);
  2812. $this->outputResult($this->checkHttp('http', $config));
  2813. $io->write('Checking https connectivity to packagist: ', false);
  2814. $this->outputResult($this->checkHttp('https', $config));
  2815. $opts = stream_context_get_options(StreamContextFactory::getContext('http://example.org'));
  2816. if (!empty($opts['http']['proxy'])) {
  2817. $io->write('Checking HTTP proxy: ', false);
  2818. $this->outputResult($this->checkHttpProxy());
  2819. $io->write('Checking HTTP proxy support for request_fulluri: ', false);
  2820. $this->outputResult($this->checkHttpProxyFullUriRequestParam());
  2821. $io->write('Checking HTTPS proxy support for request_fulluri: ', false);
  2822. $this->outputResult($this->checkHttpsProxyFullUriRequestParam());
  2823. }
  2824. if ($oauth = $config->get('github-oauth')) {
  2825. foreach ($oauth as $domain => $token) {
  2826. $io->write('Checking '.$domain.' oauth access: ', false);
  2827. $this->outputResult($this->checkGithubOauth($domain, $token));
  2828. }
  2829. } else {
  2830. $io->write('Checking github.com rate limit: ', false);
  2831. try {
  2832. $rate = $this->getGithubRateLimit('github.com');
  2833. if (!is_array($rate)) {
  2834. $this->outputResult($rate);
  2835. } elseif (10 > $rate['remaining']) {
  2836. $io->write('<warning>WARNING</warning>');
  2837. $io->write(sprintf(
  2838. '<comment>Github has a rate limit on their API. '
  2839. . 'You currently have <options=bold>%u</options=bold> '
  2840. . 'out of <options=bold>%u</options=bold> requests left.' . PHP_EOL
  2841. . 'See https://developer.github.com/v3/#rate-limiting and also' . PHP_EOL
  2842. . ' https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens</comment>',
  2843. $rate['remaining'],
  2844. $rate['limit']
  2845. ));
  2846. } else {
  2847. $this->outputResult(true);
  2848. }
  2849. } catch (\Exception $e) {
  2850. if ($e instanceof TransportException && $e->getCode() === 401) {
  2851. $this->outputResult('<comment>The oauth token for github.com seems invalid, run "composer config --global --unset github-oauth.github.com" to remove it</comment>');
  2852. } else {
  2853. $this->outputResult($e);
  2854. }
  2855. }
  2856. }
  2857. $io->write('Checking disk free space: ', false);
  2858. $this->outputResult($this->checkDiskSpace($config));
  2859. if ('phar:' === substr(__FILE__, 0, 5)) {
  2860. $io->write('Checking pubkeys: ', false);
  2861. $this->outputResult($this->checkPubKeys($config));
  2862. $io->write('Checking composer version: ', false);
  2863. $this->outputResult($this->checkVersion($config));
  2864. }
  2865. $io->write(sprintf('Composer version: <comment>%s</comment>', Composer::VERSION));
  2866. $platformOverrides = $config->get('platform') ?: array();
  2867. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  2868. $phpPkg = $platformRepo->findPackage('php', '*');
  2869. $phpVersion = $phpPkg->getPrettyVersion();
  2870. if (false !== strpos($phpPkg->getDescription(), 'overridden')) {
  2871. $phpVersion .= ' - ' . $phpPkg->getDescription();
  2872. }
  2873. $io->write(sprintf('PHP version: <comment>%s</comment>', $phpVersion));
  2874. if (defined('PHP_BINARY')) {
  2875. $io->write(sprintf('PHP binary path: <comment>%s</comment>', PHP_BINARY));
  2876. }
  2877. $io->write(sprintf('OpenSSL version: <comment>%s</comment>', OPENSSL_VERSION_TEXT));
  2878. return $this->exitCode;
  2879. }
  2880. private function checkComposerSchema()
  2881. {
  2882. $validator = new ConfigValidator($this->getIO());
  2883. list($errors, , $warnings) = $validator->validate(Factory::getComposerFile());
  2884. if ($errors || $warnings) {
  2885. $messages = array(
  2886. 'error' => $errors,
  2887. 'warning' => $warnings,
  2888. );
  2889. $output = '';
  2890. foreach ($messages as $style => $msgs) {
  2891. foreach ($msgs as $msg) {
  2892. $output .= '<' . $style . '>' . $msg . '</' . $style . '>' . PHP_EOL;
  2893. }
  2894. }
  2895. return rtrim($output);
  2896. }
  2897. return true;
  2898. }
  2899. private function checkGit()
  2900. {
  2901. $this->process->execute('git config color.ui', $output);
  2902. if (strtolower(trim($output)) === 'always') {
  2903. 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>';
  2904. }
  2905. return true;
  2906. }
  2907. private function checkHttp($proto, Config $config)
  2908. {
  2909. $result = $this->checkConnectivity();
  2910. if ($result !== true) {
  2911. return $result;
  2912. }
  2913. $disableTls = false;
  2914. $result = array();
  2915. if ($proto === 'https' && $config->get('disable-tls') === true) {
  2916. $disableTls = true;
  2917. $result[] = '<warning>Composer is configured to disable SSL/TLS protection. This will leave remote HTTPS requests vulnerable to Man-In-The-Middle attacks.</warning>';
  2918. }
  2919. if ($proto === 'https' && !extension_loaded('openssl') && !$disableTls) {
  2920. $result[] = '<error>Composer is configured to use SSL/TLS protection but the openssl extension is not available.</error>';
  2921. }
  2922. try {
  2923. $this->rfs->getContents('packagist.org', $proto . '://repo.packagist.org/packages.json', false);
  2924. } catch (TransportException $e) {
  2925. if (false !== strpos($e->getMessage(), 'cafile')) {
  2926. $result[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
  2927. $result[] = '<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>';
  2928. $result[] = '<error>You can alternatively disable this error, at your own risk, by enabling the \'disable-tls\' option.</error>';
  2929. } else {
  2930. array_unshift($result, '[' . get_class($e) . '] ' . $e->getMessage());
  2931. }
  2932. }
  2933. if (count($result) > 0) {
  2934. return $result;
  2935. }
  2936. return true;
  2937. }
  2938. private function checkHttpProxy()
  2939. {
  2940. $result = $this->checkConnectivity();
  2941. if ($result !== true) {
  2942. return $result;
  2943. }
  2944. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  2945. try {
  2946. $json = json_decode($this->rfs->getContents('packagist.org', $protocol . '://repo.packagist.org/packages.json', false), true);
  2947. $hash = reset($json['provider-includes']);
  2948. $hash = $hash['sha256'];
  2949. $path = str_replace('%hash%', $hash, key($json['provider-includes']));
  2950. $provider = $this->rfs->getContents('packagist.org', $protocol . '://repo.packagist.org/'.$path, false);
  2951. if (hash('sha256', $provider) !== $hash) {
  2952. return 'It seems that your proxy is modifying http traffic on the fly';
  2953. }
  2954. } catch (\Exception $e) {
  2955. return $e;
  2956. }
  2957. return true;
  2958. }
  2959. private function checkHttpProxyFullUriRequestParam()
  2960. {
  2961. $result = $this->checkConnectivity();
  2962. if ($result !== true) {
  2963. return $result;
  2964. }
  2965. $url = 'http://repo.packagist.org/packages.json';
  2966. try {
  2967. $this->rfs->getContents('packagist.org', $url, false);
  2968. } catch (TransportException $e) {
  2969. try {
  2970. $this->rfs->getContents('packagist.org', $url, false, array('http' => array('request_fulluri' => false)));
  2971. } catch (TransportException $e) {
  2972. return 'Unable to assess the situation, maybe packagist.org is down ('.$e->getMessage().')';
  2973. }
  2974. 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"';
  2975. }
  2976. return true;
  2977. }
  2978. private function checkHttpsProxyFullUriRequestParam()
  2979. {
  2980. $result = $this->checkConnectivity();
  2981. if ($result !== true) {
  2982. return $result;
  2983. }
  2984. if (!extension_loaded('openssl')) {
  2985. return 'You need the openssl extension installed for this check';
  2986. }
  2987. $url = 'https://api.github.com/repos/Seldaek/jsonlint/zipball/1.0.0';
  2988. try {
  2989. $this->rfs->getContents('github.com', $url, false);
  2990. } catch (TransportException $e) {
  2991. try {
  2992. $this->rfs->getContents('github.com', $url, false, array('http' => array('request_fulluri' => false)));
  2993. } catch (TransportException $e) {
  2994. return 'Unable to assess the situation, maybe github is down ('.$e->getMessage().')';
  2995. }
  2996. return 'It seems there is a problem with your proxy server, try setting the "HTTPS_PROXY_REQUEST_FULLURI" environment variable to "false"';
  2997. }
  2998. return true;
  2999. }
  3000. private function checkGithubOauth($domain, $token)
  3001. {
  3002. $result = $this->checkConnectivity();
  3003. if ($result !== true) {
  3004. return $result;
  3005. }
  3006. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  3007. try {
  3008. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/' : 'https://'.$domain.'/api/v3/';
  3009. return $this->rfs->getContents($domain, $url, false, array(
  3010. 'retry-auth-failure' => false,
  3011. )) ? true : 'Unexpected error';
  3012. } catch (\Exception $e) {
  3013. if ($e instanceof TransportException && $e->getCode() === 401) {
  3014. return '<comment>The oauth token for '.$domain.' seems invalid, run "composer config --global --unset github-oauth.'.$domain.'" to remove it</comment>';
  3015. }
  3016. return $e;
  3017. }
  3018. }
  3019. private function getGithubRateLimit($domain, $token = null)
  3020. {
  3021. $result = $this->checkConnectivity();
  3022. if ($result !== true) {
  3023. return $result;
  3024. }
  3025. if ($token) {
  3026. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  3027. }
  3028. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/rate_limit' : 'https://'.$domain.'/api/rate_limit';
  3029. $json = $this->rfs->getContents($domain, $url, false, array('retry-auth-failure' => false));
  3030. $data = json_decode($json, true);
  3031. return $data['resources']['core'];
  3032. }
  3033. private function checkDiskSpace($config)
  3034. {
  3035. $minSpaceFree = 1024 * 1024;
  3036. if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  3037. || (($df = @disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  3038. ) {
  3039. return '<error>The disk hosting '.$dir.' is full</error>';
  3040. }
  3041. return true;
  3042. }
  3043. private function checkPubKeys($config)
  3044. {
  3045. $home = $config->get('home');
  3046. $errors = array();
  3047. $io = $this->getIO();
  3048. if (file_exists($home.'/keys.tags.pub') && file_exists($home.'/keys.dev.pub')) {
  3049. $io->write('');
  3050. }
  3051. if (file_exists($home.'/keys.tags.pub')) {
  3052. $io->write('Tags Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.tags.pub'));
  3053. } else {
  3054. $errors[] = '<error>Missing pubkey for tags verification</error>';
  3055. }
  3056. if (file_exists($home.'/keys.dev.pub')) {
  3057. $io->write('Dev Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.dev.pub'));
  3058. } else {
  3059. $errors[] = '<error>Missing pubkey for dev verification</error>';
  3060. }
  3061. if ($errors) {
  3062. $errors[] = '<error>Run composer self-update --update-keys to set them up</error>';
  3063. }
  3064. return $errors ?: true;
  3065. }
  3066. private function checkVersion($config)
  3067. {
  3068. $result = $this->checkConnectivity();
  3069. if ($result !== true) {
  3070. return $result;
  3071. }
  3072. $versionsUtil = new Versions($config, $this->rfs);
  3073. try {
  3074. $latest = $versionsUtil->getLatest();
  3075. } catch (\Exception $e) {
  3076. return $e;
  3077. }
  3078. if (Composer::VERSION !== $latest['version'] && Composer::VERSION !== '@package_version@') {
  3079. return '<comment>You are not running the latest '.$versionsUtil->getChannel().' version, run `composer self-update` to update ('.Composer::VERSION.' => '.$latest['version'].')</comment>';
  3080. }
  3081. return true;
  3082. }
  3083. private function outputResult($result)
  3084. {
  3085. $io = $this->getIO();
  3086. if (true === $result) {
  3087. $io->write('<info>OK</info>');
  3088. return;
  3089. }
  3090. $hadError = false;
  3091. $hadWarning = false;
  3092. if ($result instanceof \Exception) {
  3093. $result = '<error>['.get_class($result).'] '.$result->getMessage().'</error>';
  3094. }
  3095. if (!$result) {
  3096. $hadError = true;
  3097. } else {
  3098. if (!is_array($result)) {
  3099. $result = array($result);
  3100. }
  3101. foreach ($result as $message) {
  3102. if (false !== strpos($message, '<error>')) {
  3103. $hadError = true;
  3104. } elseif (false !== strpos($message, '<warning>')) {
  3105. $hadWarning = true;
  3106. }
  3107. }
  3108. }
  3109. if ($hadError) {
  3110. $io->write('<error>FAIL</error>');
  3111. $this->exitCode = max($this->exitCode, 2);
  3112. } elseif ($hadWarning) {
  3113. $io->write('<warning>WARNING</warning>');
  3114. $this->exitCode = max($this->exitCode, 1);
  3115. }
  3116. if ($result) {
  3117. foreach ($result as $message) {
  3118. $io->write($message);
  3119. }
  3120. }
  3121. }
  3122. private function checkPlatform()
  3123. {
  3124. $output = '';
  3125. $out = function ($msg, $style) use (&$output) {
  3126. $output .= '<'.$style.'>'.$msg.'</'.$style.'>'.PHP_EOL;
  3127. };
  3128. $errors = array();
  3129. $warnings = array();
  3130. $displayIniMessage = false;
  3131. $iniMessage = PHP_EOL.PHP_EOL.IniHelper::getMessage();
  3132. $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.';
  3133. if (!function_exists('json_decode')) {
  3134. $errors['json'] = true;
  3135. }
  3136. if (!extension_loaded('Phar')) {
  3137. $errors['phar'] = true;
  3138. }
  3139. if (!extension_loaded('filter')) {
  3140. $errors['filter'] = true;
  3141. }
  3142. if (!extension_loaded('hash')) {
  3143. $errors['hash'] = true;
  3144. }
  3145. if (!extension_loaded('iconv') && !extension_loaded('mbstring')) {
  3146. $errors['iconv_mbstring'] = true;
  3147. }
  3148. if (!filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
  3149. $errors['allow_url_fopen'] = true;
  3150. }
  3151. if (extension_loaded('ionCube Loader') && ioncube_loader_iversion() < 40009) {
  3152. $errors['ioncube'] = ioncube_loader_version();
  3153. }
  3154. if (PHP_VERSION_ID < 50302) {
  3155. $errors['php'] = PHP_VERSION;
  3156. }
  3157. if (!isset($errors['php']) && PHP_VERSION_ID < 50304) {
  3158. $warnings['php'] = PHP_VERSION;
  3159. }
  3160. if (!extension_loaded('openssl')) {
  3161. $errors['openssl'] = true;
  3162. }
  3163. if (extension_loaded('openssl') && OPENSSL_VERSION_NUMBER < 0x1000100f) {
  3164. $warnings['openssl_version'] = true;
  3165. }
  3166. if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) {
  3167. $warnings['apc_cli'] = true;
  3168. }
  3169. if (!extension_loaded('zlib')) {
  3170. $warnings['zlib'] = true;
  3171. }
  3172. ob_start();
  3173. phpinfo(INFO_GENERAL);
  3174. $phpinfo = ob_get_clean();
  3175. if (preg_match('{Configure Command(?: *</td><td class="v">| *=> *)(.*?)(?:</td>|$)}m', $phpinfo, $match)) {
  3176. $configure = $match[1];
  3177. if (false !== strpos($configure, '--enable-sigchild')) {
  3178. $warnings['sigchild'] = true;
  3179. }
  3180. if (false !== strpos($configure, '--with-curlwrappers')) {
  3181. $warnings['curlwrappers'] = true;
  3182. }
  3183. }
  3184. if (filter_var(ini_get('xdebug.profiler_enabled'), FILTER_VALIDATE_BOOLEAN)) {
  3185. $warnings['xdebug_profile'] = true;
  3186. } elseif (extension_loaded('xdebug')) {
  3187. $warnings['xdebug_loaded'] = true;
  3188. }
  3189. if (defined('PHP_WINDOWS_VERSION_BUILD')
  3190. && (version_compare(PHP_VERSION, '7.2.23', '<')
  3191. || (version_compare(PHP_VERSION, '7.3.0', '>=')
  3192. && version_compare(PHP_VERSION, '7.3.10', '<')))) {
  3193. $warnings['onedrive'] = PHP_VERSION;
  3194. }
  3195. if (!empty($errors)) {
  3196. foreach ($errors as $error => $current) {
  3197. switch ($error) {
  3198. case 'json':
  3199. $text = PHP_EOL."The json extension is missing.".PHP_EOL;
  3200. $text .= "Install it or recompile php without --disable-json";
  3201. break;
  3202. case 'phar':
  3203. $text = PHP_EOL."The phar extension is missing.".PHP_EOL;
  3204. $text .= "Install it or recompile php without --disable-phar";
  3205. break;
  3206. case 'filter':
  3207. $text = PHP_EOL."The filter extension is missing.".PHP_EOL;
  3208. $text .= "Install it or recompile php without --disable-filter";
  3209. break;
  3210. case 'hash':
  3211. $text = PHP_EOL."The hash extension is missing.".PHP_EOL;
  3212. $text .= "Install it or recompile php without --disable-hash";
  3213. break;
  3214. case 'iconv_mbstring':
  3215. $text = PHP_EOL."The iconv OR mbstring extension is required and both are missing.".PHP_EOL;
  3216. $text .= "Install either of them or recompile php without --disable-iconv";
  3217. break;
  3218. case 'unicode':
  3219. $text = PHP_EOL."The detect_unicode setting must be disabled.".PHP_EOL;
  3220. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3221. $text .= " detect_unicode = Off";
  3222. $displayIniMessage = true;
  3223. break;
  3224. case 'suhosin':
  3225. $text = PHP_EOL."The suhosin.executor.include.whitelist setting is incorrect.".PHP_EOL;
  3226. $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;
  3227. $text .= " suhosin.executor.include.whitelist = phar ".$current;
  3228. $displayIniMessage = true;
  3229. break;
  3230. case 'php':
  3231. $text = PHP_EOL."Your PHP ({$current}) is too old, you must upgrade to PHP 5.3.2 or higher.";
  3232. break;
  3233. case 'allow_url_fopen':
  3234. $text = PHP_EOL."The allow_url_fopen setting is incorrect.".PHP_EOL;
  3235. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3236. $text .= " allow_url_fopen = On";
  3237. $displayIniMessage = true;
  3238. break;
  3239. case 'ioncube':
  3240. $text = PHP_EOL."Your ionCube Loader extension ($current) is incompatible with Phar files.".PHP_EOL;
  3241. $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;
  3242. $text .= " zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so";
  3243. $displayIniMessage = true;
  3244. break;
  3245. case 'openssl':
  3246. $text = PHP_EOL."The openssl extension is missing, which means that secure HTTPS transfers are impossible.".PHP_EOL;
  3247. $text .= "If possible you should enable it or recompile php with --with-openssl";
  3248. break;
  3249. }
  3250. $out($text, 'error');
  3251. }
  3252. $output .= PHP_EOL;
  3253. }
  3254. if (!empty($warnings)) {
  3255. foreach ($warnings as $warning => $current) {
  3256. switch ($warning) {
  3257. case 'apc_cli':
  3258. $text = "The apc.enable_cli setting is incorrect.".PHP_EOL;
  3259. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3260. $text .= " apc.enable_cli = Off";
  3261. $displayIniMessage = true;
  3262. break;
  3263. case 'zlib':
  3264. $text = 'The zlib extension is not loaded, this can slow down Composer a lot.'.PHP_EOL;
  3265. $text .= 'If possible, enable it or recompile php with --with-zlib'.PHP_EOL;
  3266. $displayIniMessage = true;
  3267. break;
  3268. case 'sigchild':
  3269. $text = "PHP was compiled with --enable-sigchild which can cause issues on some platforms.".PHP_EOL;
  3270. $text .= "Recompile it without this flag if possible, see also:".PHP_EOL;
  3271. $text .= " https://bugs.php.net/bug.php?id=22999";
  3272. break;
  3273. case 'curlwrappers':
  3274. $text = "PHP was compiled with --with-curlwrappers which will cause issues with HTTP authentication and GitHub.".PHP_EOL;
  3275. $text .= " Recompile it without this flag if possible";
  3276. break;
  3277. case 'php':
  3278. $text = "Your PHP ({$current}) is quite old, upgrading to PHP 5.3.4 or higher is recommended.".PHP_EOL;
  3279. $text .= " Composer works with 5.3.2+ for most people, but there might be edge case issues.";
  3280. break;
  3281. case 'openssl_version':
  3282. $opensslVersion = strstr(trim(strstr(OPENSSL_VERSION_TEXT, ' ')), ' ', true);
  3283. $opensslVersion = $opensslVersion ?: OPENSSL_VERSION_TEXT;
  3284. $text = "The OpenSSL library ({$opensslVersion}) used by PHP does not support TLSv1.2 or TLSv1.1.".PHP_EOL;
  3285. $text .= "If possible you should upgrade OpenSSL to version 1.0.1 or above.";
  3286. break;
  3287. case 'xdebug_loaded':
  3288. $text = "The xdebug extension is loaded, this can slow down Composer a little.".PHP_EOL;
  3289. $text .= " Disabling it when using Composer is recommended.";
  3290. break;
  3291. case 'xdebug_profile':
  3292. $text = "The xdebug.profiler_enabled setting is enabled, this can slow down Composer a lot.".PHP_EOL;
  3293. $text .= "Add the following to the end of your `php.ini` to disable it:".PHP_EOL;
  3294. $text .= " xdebug.profiler_enabled = 0";
  3295. $displayIniMessage = true;
  3296. break;
  3297. case 'onedrive':
  3298. $text = "The Windows OneDrive folder is not supported on PHP versions below 7.2.23 and 7.3.10.".PHP_EOL;
  3299. $text .= "Upgrade your PHP ({$current}) to use this location with Composer.".PHP_EOL;
  3300. break;
  3301. }
  3302. $out($text, 'comment');
  3303. }
  3304. }
  3305. if ($displayIniMessage) {
  3306. $out($iniMessage, 'comment');
  3307. }
  3308. return !$warnings && !$errors ? true : $output;
  3309. }
  3310. private function checkConnectivity()
  3311. {
  3312. if (!ini_get('allow_url_fopen')) {
  3313. $result = '<info>Skipped because allow_url_fopen is missing.</info>';
  3314. return $result;
  3315. }
  3316. return true;
  3317. }
  3318. }
  3319. <?php
  3320. namespace Composer\Command;
  3321. use Composer\Plugin\CommandEvent;
  3322. use Composer\Plugin\PluginEvents;
  3323. use Symfony\Component\Console\Input\InputInterface;
  3324. use Symfony\Component\Console\Input\InputOption;
  3325. use Symfony\Component\Console\Output\OutputInterface;
  3326. class DumpAutoloadCommand extends BaseCommand
  3327. {
  3328. protected function configure()
  3329. {
  3330. $this
  3331. ->setName('dump-autoload')
  3332. ->setAliases(array('dumpautoload'))
  3333. ->setDescription('Dumps the autoloader.')
  3334. ->setDefinition(array(
  3335. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  3336. new InputOption('optimize', 'o', InputOption::VALUE_NONE, 'Optimizes PSR0 and PSR4 packages to be loaded with classmaps too, good for production.'),
  3337. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize`.'),
  3338. new InputOption('apcu', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  3339. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables autoload-dev rules.'),
  3340. ))
  3341. ->setHelp(
  3342. <<<EOT
  3343. <info>php composer.phar dump-autoload</info>
  3344. Read more at https://getcomposer.org/doc/03-cli.md#dump-autoload-dumpautoload-
  3345. EOT
  3346. )
  3347. ;
  3348. }
  3349. protected function execute(InputInterface $input, OutputInterface $output)
  3350. {
  3351. $composer = $this->getComposer();
  3352. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'dump-autoload', $input, $output);
  3353. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3354. $installationManager = $composer->getInstallationManager();
  3355. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  3356. $package = $composer->getPackage();
  3357. $config = $composer->getConfig();
  3358. $optimize = $input->getOption('optimize') || $config->get('optimize-autoloader');
  3359. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  3360. $apcu = $input->getOption('apcu') || $config->get('apcu-autoloader');
  3361. if ($authoritative) {
  3362. $this->getIO()->write('<info>Generating optimized autoload files (authoritative)</info>');
  3363. } elseif ($optimize) {
  3364. $this->getIO()->write('<info>Generating optimized autoload files</info>');
  3365. } else {
  3366. $this->getIO()->write('<info>Generating autoload files</info>');
  3367. }
  3368. $generator = $composer->getAutoloadGenerator();
  3369. $generator->setDevMode(!$input->getOption('no-dev'));
  3370. $generator->setClassMapAuthoritative($authoritative);
  3371. $generator->setApcu($apcu);
  3372. $generator->setRunScripts(!$input->getOption('no-scripts'));
  3373. $numberOfClasses = $generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize);
  3374. if ($authoritative) {
  3375. $this->getIO()->write('<info>Generated optimized autoload files (authoritative) containing '. $numberOfClasses .' classes</info>');
  3376. } elseif ($optimize) {
  3377. $this->getIO()->write('<info>Generated optimized autoload files containing '. $numberOfClasses .' classes</info>');
  3378. } else {
  3379. $this->getIO()->write('<info>Generated autoload files</info>');
  3380. }
  3381. return 0;
  3382. }
  3383. }
  3384. <?php
  3385. namespace Composer\Command;
  3386. use Symfony\Component\Console\Input\InputInterface;
  3387. use Symfony\Component\Console\Input\InputOption;
  3388. use Symfony\Component\Console\Output\OutputInterface;
  3389. use Symfony\Component\Console\Input\InputArgument;
  3390. class ExecCommand extends BaseCommand
  3391. {
  3392. protected function configure()
  3393. {
  3394. $this
  3395. ->setName('exec')
  3396. ->setDescription('Executes a vendored binary/script.')
  3397. ->setDefinition(array(
  3398. new InputOption('list', 'l', InputOption::VALUE_NONE),
  3399. new InputArgument('binary', InputArgument::OPTIONAL, 'The binary to run, e.g. phpunit'),
  3400. new InputArgument(
  3401. 'args',
  3402. InputArgument::IS_ARRAY | InputArgument::OPTIONAL,
  3403. 'Arguments to pass to the binary. Use <info>--</info> to separate from composer arguments'
  3404. ),
  3405. ))
  3406. ->setHelp(
  3407. <<<EOT
  3408. Executes a vendored binary/script.
  3409. Read more at https://getcomposer.org/doc/03-cli.md#exec
  3410. EOT
  3411. )
  3412. ;
  3413. }
  3414. protected function execute(InputInterface $input, OutputInterface $output)
  3415. {
  3416. $composer = $this->getComposer();
  3417. $binDir = $composer->getConfig()->get('bin-dir');
  3418. if ($input->getOption('list') || !$input->getArgument('binary')) {
  3419. $bins = glob($binDir . '/*');
  3420. $bins = array_merge($bins, array_map(function ($e) {
  3421. return "$e (local)";
  3422. }, $composer->getPackage()->getBinaries()));
  3423. if (!$bins) {
  3424. throw new \RuntimeException("No binaries found in composer.json or in bin-dir ($binDir)");
  3425. }
  3426. $this->getIO()->write(
  3427. <<<EOT
  3428. <comment>Available binaries:</comment>
  3429. EOT
  3430. );
  3431. foreach ($bins as $bin) {
  3432. if (isset($previousBin) && $bin === $previousBin.'.bat') {
  3433. continue;
  3434. }
  3435. $previousBin = $bin;
  3436. $bin = basename($bin);
  3437. $this->getIO()->write(
  3438. <<<EOT
  3439. <info>- $bin</info>
  3440. EOT
  3441. );
  3442. }
  3443. return 0;
  3444. }
  3445. $binary = $input->getArgument('binary');
  3446. $dispatcher = $composer->getEventDispatcher();
  3447. $dispatcher->addListener('__exec_command', $binary);
  3448. if ($output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL) {
  3449. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  3450. }
  3451. if (getcwd() !== $this->getApplication()->getInitialWorkingDirectory()) {
  3452. try {
  3453. chdir($this->getApplication()->getInitialWorkingDirectory());
  3454. } catch (\Exception $e) {
  3455. throw new \RuntimeException('Could not switch back to working directory "'.$this->getApplication()->getInitialWorkingDirectory().'"', 0, $e);
  3456. }
  3457. }
  3458. return $dispatcher->dispatchScript('__exec_command', true, $input->getArgument('args'));
  3459. }
  3460. }
  3461. <?php
  3462. namespace Composer\Command;
  3463. use Composer\Package\CompletePackageInterface;
  3464. use Composer\Package\AliasPackage;
  3465. use Composer\Repository\CompositeRepository;
  3466. use Symfony\Component\Console\Input\InputInterface;
  3467. use Symfony\Component\Console\Input\InputOption;
  3468. use Symfony\Component\Console\Output\OutputInterface;
  3469. class FundCommand extends BaseCommand
  3470. {
  3471. protected function configure()
  3472. {
  3473. $this->setName('fund')
  3474. ->setDescription('Discover how to help fund the maintenance of your dependencies.')
  3475. ;
  3476. }
  3477. protected function execute(InputInterface $input, OutputInterface $output)
  3478. {
  3479. $composer = $this->getComposer();
  3480. $repo = $composer->getRepositoryManager()->getLocalRepository();
  3481. $remoteRepos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  3482. $fundings = array();
  3483. foreach ($repo->getPackages() as $package) {
  3484. if ($package instanceof AliasPackage) {
  3485. continue;
  3486. }
  3487. $latest = $remoteRepos->findPackage($package->getName(), 'dev-master');
  3488. if ($latest instanceof CompletePackageInterface && $latest->getFunding()) {
  3489. $fundings = $this->insertFundingData($fundings, $latest);
  3490. continue;
  3491. }
  3492. if ($package instanceof CompletePackageInterface && $package->getFunding()) {
  3493. $fundings = $this->insertFundingData($fundings, $package);
  3494. }
  3495. }
  3496. ksort($fundings);
  3497. $io = $this->getIO();
  3498. if ($fundings) {
  3499. $prev = null;
  3500. $io->write('The following packages were found in your dependencies which publish funding information:');
  3501. foreach ($fundings as $vendor => $links) {
  3502. $io->write('');
  3503. $io->write(sprintf("<comment>%s</comment>", $vendor));
  3504. foreach ($links as $url => $packages) {
  3505. $line = sprintf(' <info>%s</info>', implode(', ', $packages));
  3506. if ($prev !== $line) {
  3507. $io->write($line);
  3508. $prev = $line;
  3509. }
  3510. $io->write(sprintf(' %s', $url));
  3511. }
  3512. }
  3513. $io->write("");
  3514. $io->write("Please consider following these links and sponsoring the work of package authors!");
  3515. $io->write("Thank you!");
  3516. } else {
  3517. $io->write("No funding links were found in your package dependencies. This doesn't mean they don't need your support!");
  3518. }
  3519. return 0;
  3520. }
  3521. private function insertFundingData(array $fundings, CompletePackageInterface $package)
  3522. {
  3523. foreach ($package->getFunding() as $fundingOption) {
  3524. list($vendor, $packageName) = explode('/', $package->getPrettyName());
  3525. if (empty($fundingOption['url'])) {
  3526. continue;
  3527. }
  3528. $url = $fundingOption['url'];
  3529. if (!empty($fundingOption['type']) && $fundingOption['type'] === 'github' && preg_match('{^https://github.com/([^/]+)$}', $url, $match)) {
  3530. $url = 'https://github.com/sponsors/'.$match[1];
  3531. }
  3532. $fundings[$vendor][$url][] = $packageName;
  3533. }
  3534. return $fundings;
  3535. }
  3536. }
  3537. <?php
  3538. namespace Composer\Command;
  3539. use Composer\Factory;
  3540. use Composer\Util\Filesystem;
  3541. use Symfony\Component\Console\Input\InputInterface;
  3542. use Symfony\Component\Console\Input\InputArgument;
  3543. use Symfony\Component\Console\Input\StringInput;
  3544. use Symfony\Component\Console\Output\OutputInterface;
  3545. class GlobalCommand extends BaseCommand
  3546. {
  3547. protected function configure()
  3548. {
  3549. $this
  3550. ->setName('global')
  3551. ->setDescription('Allows running commands in the global composer dir ($COMPOSER_HOME).')
  3552. ->setDefinition(array(
  3553. new InputArgument('command-name', InputArgument::REQUIRED, ''),
  3554. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  3555. ))
  3556. ->setHelp(
  3557. <<<EOT
  3558. Use this command as a wrapper to run other Composer commands
  3559. within the global context of COMPOSER_HOME.
  3560. You can use this to install CLI utilities globally, all you need
  3561. is to add the COMPOSER_HOME/vendor/bin dir to your PATH env var.
  3562. COMPOSER_HOME is c:\Users\<user>\AppData\Roaming\Composer on Windows
  3563. and /home/<user>/.composer on unix systems.
  3564. If your system uses freedesktop.org standards, then it will first check
  3565. XDG_CONFIG_HOME or default to /home/<user>/.config/composer
  3566. Note: This path may vary depending on customizations to bin-dir in
  3567. composer.json or the environmental variable COMPOSER_BIN_DIR.
  3568. Read more at https://getcomposer.org/doc/03-cli.md#global
  3569. EOT
  3570. )
  3571. ;
  3572. }
  3573. public function run(InputInterface $input, OutputInterface $output)
  3574. {
  3575. $tokens = preg_split('{\s+}', $input->__toString());
  3576. $args = array();
  3577. foreach ($tokens as $token) {
  3578. if ($token && $token[0] !== '-') {
  3579. $args[] = $token;
  3580. if (count($args) >= 2) {
  3581. break;
  3582. }
  3583. }
  3584. }
  3585. if (count($args) < 2) {
  3586. return parent::run($input, $output);
  3587. }
  3588. $config = Factory::createConfig();
  3589. $home = $config->get('home');
  3590. if (!is_dir($home)) {
  3591. $fs = new Filesystem();
  3592. $fs->ensureDirectoryExists($home);
  3593. if (!is_dir($home)) {
  3594. throw new \RuntimeException('Could not create home directory');
  3595. }
  3596. }
  3597. try {
  3598. chdir($home);
  3599. } catch (\Exception $e) {
  3600. throw new \RuntimeException('Could not switch to home directory "'.$home.'"', 0, $e);
  3601. }
  3602. $this->getIO()->writeError('<info>Changed current directory to '.$home.'</info>');
  3603. $input = new StringInput(preg_replace('{\bg(?:l(?:o(?:b(?:a(?:l)?)?)?)?)?\b}', '', $input->__toString(), 1));
  3604. $this->getApplication()->resetComposer();
  3605. return $this->getApplication()->run($input, $output);
  3606. }
  3607. public function isProxyCommand()
  3608. {
  3609. return true;
  3610. }
  3611. }
  3612. <?php
  3613. namespace Composer\Command;
  3614. use Composer\Package\CompletePackageInterface;
  3615. use Composer\Repository\RepositoryInterface;
  3616. use Composer\Repository\ArrayRepository;
  3617. use Composer\Repository\RepositoryFactory;
  3618. use Composer\Util\Platform;
  3619. use Composer\Util\ProcessExecutor;
  3620. use Symfony\Component\Console\Input\InputArgument;
  3621. use Symfony\Component\Console\Input\InputOption;
  3622. use Symfony\Component\Console\Input\InputInterface;
  3623. use Symfony\Component\Console\Output\OutputInterface;
  3624. class HomeCommand extends BaseCommand
  3625. {
  3626. protected function configure()
  3627. {
  3628. $this
  3629. ->setName('browse')
  3630. ->setAliases(array('home'))
  3631. ->setDescription('Opens the package\'s repository URL or homepage in your browser.')
  3632. ->setDefinition(array(
  3633. new InputArgument('packages', InputArgument::IS_ARRAY, 'Package(s) to browse to.'),
  3634. new InputOption('homepage', 'H', InputOption::VALUE_NONE, 'Open the homepage instead of the repository URL.'),
  3635. new InputOption('show', 's', InputOption::VALUE_NONE, 'Only show the homepage or repository URL.'),
  3636. ))
  3637. ->setHelp(
  3638. <<<EOT
  3639. The home command opens or shows a package's repository URL or
  3640. homepage in your default browser.
  3641. To open the homepage by default, use -H or --homepage.
  3642. To show instead of open the repository or homepage URL, use -s or --show.
  3643. Read more at https://getcomposer.org/doc/03-cli.md#browse-home
  3644. EOT
  3645. );
  3646. }
  3647. protected function execute(InputInterface $input, OutputInterface $output)
  3648. {
  3649. $repos = $this->initializeRepos();
  3650. $io = $this->getIO();
  3651. $return = 0;
  3652. $packages = $input->getArgument('packages');
  3653. if (!$packages) {
  3654. $io->writeError('No package specified, opening homepage for the root package');
  3655. $packages = array($this->getComposer()->getPackage()->getName());
  3656. }
  3657. foreach ($packages as $packageName) {
  3658. $handled = false;
  3659. $packageExists = false;
  3660. foreach ($repos as $repo) {
  3661. foreach ($repo->findPackages($packageName) as $package) {
  3662. $packageExists = true;
  3663. if ($package instanceof CompletePackageInterface && $this->handlePackage($package, $input->getOption('homepage'), $input->getOption('show'))) {
  3664. $handled = true;
  3665. break 2;
  3666. }
  3667. }
  3668. }
  3669. if (!$packageExists) {
  3670. $return = 1;
  3671. $io->writeError('<warning>Package '.$packageName.' not found</warning>');
  3672. }
  3673. if (!$handled) {
  3674. $return = 1;
  3675. $io->writeError('<warning>'.($input->getOption('homepage') ? 'Invalid or missing homepage' : 'Invalid or missing repository URL').' for '.$packageName.'</warning>');
  3676. }
  3677. }
  3678. return $return;
  3679. }
  3680. private function handlePackage(CompletePackageInterface $package, $showHomepage, $showOnly)
  3681. {
  3682. $support = $package->getSupport();
  3683. $url = isset($support['source']) ? $support['source'] : $package->getSourceUrl();
  3684. if (!$url || $showHomepage) {
  3685. $url = $package->getHomepage();
  3686. }
  3687. if (!$url || !filter_var($url, FILTER_VALIDATE_URL)) {
  3688. return false;
  3689. }
  3690. if ($showOnly) {
  3691. $this->getIO()->write(sprintf('<info>%s</info>', $url));
  3692. } else {
  3693. $this->openBrowser($url);
  3694. }
  3695. return true;
  3696. }
  3697. private function openBrowser($url)
  3698. {
  3699. $url = ProcessExecutor::escape($url);
  3700. $process = new ProcessExecutor($this->getIO());
  3701. if (Platform::isWindows()) {
  3702. return $process->execute('start "web" explorer "' . $url . '"', $output);
  3703. }
  3704. $linux = $process->execute('which xdg-open', $output);
  3705. $osx = $process->execute('which open', $output);
  3706. if (0 === $linux) {
  3707. $process->execute('xdg-open ' . $url, $output);
  3708. } elseif (0 === $osx) {
  3709. $process->execute('open ' . $url, $output);
  3710. } else {
  3711. $this->getIO()->writeError('No suitable browser opening command found, open yourself: ' . $url);
  3712. }
  3713. }
  3714. private function initializeRepos()
  3715. {
  3716. $composer = $this->getComposer(false);
  3717. if ($composer) {
  3718. return array_merge(
  3719. array(new ArrayRepository(array($composer->getPackage()))),
  3720. array($composer->getRepositoryManager()->getLocalRepository()),
  3721. $composer->getRepositoryManager()->getRepositories()
  3722. );
  3723. }
  3724. return RepositoryFactory::defaultRepos($this->getIO());
  3725. }
  3726. }
  3727. <?php
  3728. namespace Composer\Command;
  3729. use Composer\DependencyResolver\Pool;
  3730. use Composer\Factory;
  3731. use Composer\Json\JsonFile;
  3732. use Composer\Package\BasePackage;
  3733. use Composer\Package\Package;
  3734. use Composer\Package\Version\VersionParser;
  3735. use Composer\Package\Version\VersionSelector;
  3736. use Composer\Repository\CompositeRepository;
  3737. use Composer\Repository\PlatformRepository;
  3738. use Composer\Repository\RepositoryFactory;
  3739. use Composer\Util\ProcessExecutor;
  3740. use Symfony\Component\Console\Input\ArrayInput;
  3741. use Symfony\Component\Console\Input\InputInterface;
  3742. use Symfony\Component\Console\Input\InputOption;
  3743. use Symfony\Component\Console\Output\OutputInterface;
  3744. use Symfony\Component\Process\ExecutableFinder;
  3745. use Symfony\Component\Process\Process;
  3746. class InitCommand extends BaseCommand
  3747. {
  3748. protected $repos;
  3749. private $gitConfig;
  3750. private $pools;
  3751. protected function configure()
  3752. {
  3753. $this
  3754. ->setName('init')
  3755. ->setDescription('Creates a basic composer.json file in current directory.')
  3756. ->setDefinition(array(
  3757. new InputOption('name', null, InputOption::VALUE_REQUIRED, 'Name of the package'),
  3758. new InputOption('description', null, InputOption::VALUE_REQUIRED, 'Description of package'),
  3759. new InputOption('author', null, InputOption::VALUE_REQUIRED, 'Author name of package'),
  3760. new InputOption('type', null, InputOption::VALUE_OPTIONAL, 'Type of package (e.g. library, project, metapackage, composer-plugin)'),
  3761. new InputOption('homepage', null, InputOption::VALUE_REQUIRED, 'Homepage of package'),
  3762. 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"'),
  3763. 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"'),
  3764. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum stability (empty or one of: '.implode(', ', array_keys(BasePackage::$stabilities)).')'),
  3765. new InputOption('license', 'l', InputOption::VALUE_REQUIRED, 'License of package'),
  3766. new InputOption('repository', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Add custom repositories, either by URL or using JSON arrays'),
  3767. ))
  3768. ->setHelp(
  3769. <<<EOT
  3770. The <info>init</info> command creates a basic composer.json file
  3771. in the current directory.
  3772. <info>php composer.phar init</info>
  3773. Read more at https://getcomposer.org/doc/03-cli.md#init
  3774. EOT
  3775. )
  3776. ;
  3777. }
  3778. protected function execute(InputInterface $input, OutputInterface $output)
  3779. {
  3780. $io = $this->getIO();
  3781. $allowList = array('name', 'description', 'author', 'type', 'homepage', 'require', 'require-dev', 'stability', 'license');
  3782. $options = array_filter(array_intersect_key($input->getOptions(), array_flip($allowList)));
  3783. if (isset($options['author'])) {
  3784. $options['authors'] = $this->formatAuthors($options['author']);
  3785. unset($options['author']);
  3786. }
  3787. $repositories = $input->getOption('repository');
  3788. if ($repositories) {
  3789. $config = Factory::createConfig($io);
  3790. foreach ($repositories as $repo) {
  3791. $options['repositories'][] = RepositoryFactory::configFromString($io, $config, $repo);
  3792. }
  3793. }
  3794. if (isset($options['stability'])) {
  3795. $options['minimum-stability'] = $options['stability'];
  3796. unset($options['stability']);
  3797. }
  3798. $options['require'] = isset($options['require']) ? $this->formatRequirements($options['require']) : new \stdClass;
  3799. if (array() === $options['require']) {
  3800. $options['require'] = new \stdClass;
  3801. }
  3802. if (isset($options['require-dev'])) {
  3803. $options['require-dev'] = $this->formatRequirements($options['require-dev']);
  3804. if (array() === $options['require-dev']) {
  3805. $options['require-dev'] = new \stdClass;
  3806. }
  3807. }
  3808. $file = new JsonFile(Factory::getComposerFile());
  3809. $json = $file->encode($options);
  3810. if ($input->isInteractive()) {
  3811. $io->writeError(array('', $json, ''));
  3812. if (!$io->askConfirmation('Do you confirm generation [<comment>yes</comment>]? ', true)) {
  3813. $io->writeError('<error>Command aborted</error>');
  3814. return 1;
  3815. }
  3816. }
  3817. $file->write($options);
  3818. if ($input->isInteractive() && is_dir('.git')) {
  3819. $ignoreFile = realpath('.gitignore');
  3820. if (false === $ignoreFile) {
  3821. $ignoreFile = realpath('.') . '/.gitignore';
  3822. }
  3823. if (!$this->hasVendorIgnore($ignoreFile)) {
  3824. $question = 'Would you like the <info>vendor</info> directory added to your <info>.gitignore</info> [<comment>yes</comment>]? ';
  3825. if ($io->askConfirmation($question, true)) {
  3826. $this->addVendorIgnore($ignoreFile);
  3827. }
  3828. }
  3829. }
  3830. $question = 'Would you like to install dependencies now [<comment>yes</comment>]? ';
  3831. if ($input->isInteractive() && $this->hasDependencies($options) && $io->askConfirmation($question, true)) {
  3832. $this->installDependencies($output);
  3833. }
  3834. return 0;
  3835. }
  3836. protected function interact(InputInterface $input, OutputInterface $output)
  3837. {
  3838. $git = $this->getGitConfig();
  3839. $io = $this->getIO();
  3840. $formatter = $this->getHelperSet()->get('formatter');
  3841. $repositories = $input->getOption('repository');
  3842. if ($repositories) {
  3843. $config = Factory::createConfig($io);
  3844. $repos = array(new PlatformRepository);
  3845. $createDefaultPackagistRepo = true;
  3846. foreach ($repositories as $repo) {
  3847. $repoConfig = RepositoryFactory::configFromString($io, $config, $repo);
  3848. if (
  3849. (isset($repoConfig['packagist']) && $repoConfig === array('packagist' => false))
  3850. || (isset($repoConfig['packagist.org']) && $repoConfig === array('packagist.org' => false))
  3851. ) {
  3852. $createDefaultPackagistRepo = false;
  3853. continue;
  3854. }
  3855. $repos[] = RepositoryFactory::createRepo($io, $config, $repoConfig);
  3856. }
  3857. if ($createDefaultPackagistRepo) {
  3858. $repos[] = RepositoryFactory::createRepo($io, $config, array(
  3859. 'type' => 'composer',
  3860. 'url' => 'https://repo.packagist.org',
  3861. ));
  3862. }
  3863. $this->repos = new CompositeRepository($repos);
  3864. unset($repos, $config, $repositories);
  3865. }
  3866. $io->writeError(array(
  3867. '',
  3868. $formatter->formatBlock('Welcome to the Composer config generator', 'bg=blue;fg=white', true),
  3869. '',
  3870. ));
  3871. $io->writeError(array(
  3872. '',
  3873. 'This command will guide you through creating your composer.json config.',
  3874. '',
  3875. ));
  3876. $cwd = realpath(".");
  3877. if (!$name = $input->getOption('name')) {
  3878. $name = basename($cwd);
  3879. $name = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  3880. $name = strtolower($name);
  3881. if (!empty($_SERVER['COMPOSER_DEFAULT_VENDOR'])) {
  3882. $name = $_SERVER['COMPOSER_DEFAULT_VENDOR'] . '/' . $name;
  3883. } elseif (isset($git['github.user'])) {
  3884. $name = $git['github.user'] . '/' . $name;
  3885. } elseif (!empty($_SERVER['USERNAME'])) {
  3886. $name = $_SERVER['USERNAME'] . '/' . $name;
  3887. } elseif (!empty($_SERVER['USER'])) {
  3888. $name = $_SERVER['USER'] . '/' . $name;
  3889. } elseif (get_current_user()) {
  3890. $name = get_current_user() . '/' . $name;
  3891. } else {
  3892. $name .= '/' . $name;
  3893. }
  3894. $name = strtolower($name);
  3895. } else {
  3896. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}D', $name)) {
  3897. throw new \InvalidArgumentException(
  3898. '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_.-]+'
  3899. );
  3900. }
  3901. }
  3902. $name = $io->askAndValidate(
  3903. 'Package name (<vendor>/<name>) [<comment>'.$name.'</comment>]: ',
  3904. function ($value) use ($name) {
  3905. if (null === $value) {
  3906. return $name;
  3907. }
  3908. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}D', $value)) {
  3909. throw new \InvalidArgumentException(
  3910. '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_.-]+'
  3911. );
  3912. }
  3913. return $value;
  3914. },
  3915. null,
  3916. $name
  3917. );
  3918. $input->setOption('name', $name);
  3919. $description = $input->getOption('description') ?: false;
  3920. $description = $io->ask(
  3921. 'Description [<comment>'.$description.'</comment>]: ',
  3922. $description
  3923. );
  3924. $input->setOption('description', $description);
  3925. if (null === $author = $input->getOption('author')) {
  3926. if (!empty($_SERVER['COMPOSER_DEFAULT_AUTHOR'])) {
  3927. $author_name = $_SERVER['COMPOSER_DEFAULT_AUTHOR'];
  3928. } elseif (isset($git['user.name'])) {
  3929. $author_name = $git['user.name'];
  3930. }
  3931. if (!empty($_SERVER['COMPOSER_DEFAULT_EMAIL'])) {
  3932. $author_email = $_SERVER['COMPOSER_DEFAULT_EMAIL'];
  3933. } elseif (isset($git['user.email'])) {
  3934. $author_email = $git['user.email'];
  3935. }
  3936. if (isset($author_name) && isset($author_email)) {
  3937. $author = sprintf('%s <%s>', $author_name, $author_email);
  3938. }
  3939. }
  3940. $self = $this;
  3941. $author = $io->askAndValidate(
  3942. 'Author [<comment>'.$author.'</comment>, n to skip]: ',
  3943. function ($value) use ($self, $author) {
  3944. if ($value === 'n' || $value === 'no') {
  3945. return;
  3946. }
  3947. $value = $value ?: $author;
  3948. $author = $self->parseAuthorString($value);
  3949. return sprintf('%s <%s>', $author['name'], $author['email']);
  3950. },
  3951. null,
  3952. $author
  3953. );
  3954. $input->setOption('author', $author);
  3955. $minimumStability = $input->getOption('stability') ?: null;
  3956. $minimumStability = $io->askAndValidate(
  3957. 'Minimum Stability [<comment>'.$minimumStability.'</comment>]: ',
  3958. function ($value) use ($minimumStability) {
  3959. if (null === $value) {
  3960. return $minimumStability;
  3961. }
  3962. if (!isset(BasePackage::$stabilities[$value])) {
  3963. throw new \InvalidArgumentException(
  3964. 'Invalid minimum stability "'.$value.'". Must be empty or one of: '.
  3965. implode(', ', array_keys(BasePackage::$stabilities))
  3966. );
  3967. }
  3968. return $value;
  3969. },
  3970. null,
  3971. $minimumStability
  3972. );
  3973. $input->setOption('stability', $minimumStability);
  3974. $type = $input->getOption('type') ?: false;
  3975. $type = $io->ask(
  3976. 'Package Type (e.g. library, project, metapackage, composer-plugin) [<comment>'.$type.'</comment>]: ',
  3977. $type
  3978. );
  3979. $input->setOption('type', $type);
  3980. if (null === $license = $input->getOption('license')) {
  3981. if (!empty($_SERVER['COMPOSER_DEFAULT_LICENSE'])) {
  3982. $license = $_SERVER['COMPOSER_DEFAULT_LICENSE'];
  3983. }
  3984. }
  3985. $license = $io->ask(
  3986. 'License [<comment>'.$license.'</comment>]: ',
  3987. $license
  3988. );
  3989. $input->setOption('license', $license);
  3990. $io->writeError(array('', 'Define your dependencies.', ''));
  3991. $repos = $this->getRepos();
  3992. $preferredStability = $minimumStability ?: 'stable';
  3993. $phpVersion = $repos->findPackage('php', '*')->getPrettyVersion();
  3994. $question = 'Would you like to define your dependencies (require) interactively [<comment>yes</comment>]? ';
  3995. $require = $input->getOption('require');
  3996. $requirements = array();
  3997. if ($require || $io->askConfirmation($question, true)) {
  3998. $requirements = $this->determineRequirements($input, $output, $require, $phpVersion, $preferredStability);
  3999. }
  4000. $input->setOption('require', $requirements);
  4001. $question = 'Would you like to define your dev dependencies (require-dev) interactively [<comment>yes</comment>]? ';
  4002. $requireDev = $input->getOption('require-dev');
  4003. $devRequirements = array();
  4004. if ($requireDev || $io->askConfirmation($question, true)) {
  4005. $devRequirements = $this->determineRequirements($input, $output, $requireDev, $phpVersion, $preferredStability);
  4006. }
  4007. $input->setOption('require-dev', $devRequirements);
  4008. }
  4009. public function parseAuthorString($author)
  4010. {
  4011. if (preg_match('/^(?P<name>[- .,\p{L}\p{N}\p{Mn}\'’"()]+) <(?P<email>.+?)>$/u', $author, $match)) {
  4012. if ($this->isValidEmail($match['email'])) {
  4013. return array(
  4014. 'name' => trim($match['name']),
  4015. 'email' => $match['email'],
  4016. );
  4017. }
  4018. }
  4019. throw new \InvalidArgumentException(
  4020. 'Invalid author string. Must be in the format: '.
  4021. 'John Smith <john@example.com>'
  4022. );
  4023. }
  4024. protected function findPackages($name)
  4025. {
  4026. return $this->getRepos()->search($name);
  4027. }
  4028. protected function getRepos()
  4029. {
  4030. if (!$this->repos) {
  4031. $this->repos = new CompositeRepository(array_merge(
  4032. array(new PlatformRepository),
  4033. RepositoryFactory::defaultRepos($this->getIO())
  4034. ));
  4035. }
  4036. return $this->repos;
  4037. }
  4038. final protected function determineRequirements(InputInterface $input, OutputInterface $output, $requires = array(), $phpVersion = null, $preferredStability = 'stable', $checkProvidedVersions = true, $fixed = false)
  4039. {
  4040. if ($requires) {
  4041. $requires = $this->normalizeRequirements($requires);
  4042. $result = array();
  4043. $io = $this->getIO();
  4044. foreach ($requires as $requirement) {
  4045. if (!isset($requirement['version'])) {
  4046. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $phpVersion, $preferredStability, null, null, $fixed);
  4047. $requirement['version'] = $version;
  4048. $requirement['name'] = $name;
  4049. $io->writeError(sprintf(
  4050. 'Using version <info>%s</info> for <info>%s</info>',
  4051. $requirement['version'],
  4052. $requirement['name']
  4053. ));
  4054. } else {
  4055. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $phpVersion, $preferredStability, $checkProvidedVersions ? $requirement['version'] : null, 'dev', $fixed);
  4056. $requirement['name'] = $name;
  4057. }
  4058. $result[] = $requirement['name'] . ' ' . $requirement['version'];
  4059. }
  4060. return $result;
  4061. }
  4062. $versionParser = new VersionParser();
  4063. $composer = $this->getComposer(false);
  4064. $installedRepo = $composer ? $composer->getRepositoryManager()->getLocalRepository() : null;
  4065. $existingPackages = array();
  4066. if ($installedRepo) {
  4067. foreach ($installedRepo->getPackages() as $package) {
  4068. $existingPackages[] = $package->getName();
  4069. }
  4070. }
  4071. foreach ($requires as $requiredPackage) {
  4072. $existingPackages[] = substr($requiredPackage, 0, strpos($requiredPackage, ' '));
  4073. }
  4074. unset($composer, $installedRepo, $requiredPackage);
  4075. $io = $this->getIO();
  4076. while (null !== $package = $io->ask('Search for a package: ')) {
  4077. $matches = $this->findPackages($package);
  4078. if (count($matches)) {
  4079. foreach ($matches as $position => $foundPackage) {
  4080. if (in_array($foundPackage['name'], $existingPackages, true)) {
  4081. unset($matches[$position]);
  4082. }
  4083. }
  4084. $matches = array_values($matches);
  4085. $exactMatch = null;
  4086. $choices = array();
  4087. foreach ($matches as $position => $foundPackage) {
  4088. $abandoned = '';
  4089. if (isset($foundPackage['abandoned'])) {
  4090. if (is_string($foundPackage['abandoned'])) {
  4091. $replacement = sprintf('Use %s instead', $foundPackage['abandoned']);
  4092. } else {
  4093. $replacement = 'No replacement was suggested';
  4094. }
  4095. $abandoned = sprintf('<warning>Abandoned. %s.</warning>', $replacement);
  4096. }
  4097. $choices[] = sprintf(' <info>%5s</info> %s %s', "[$position]", $foundPackage['name'], $abandoned);
  4098. if ($foundPackage['name'] === $package) {
  4099. $exactMatch = true;
  4100. break;
  4101. }
  4102. }
  4103. if (!$exactMatch) {
  4104. $io->writeError(array(
  4105. '',
  4106. sprintf('Found <info>%s</info> packages matching <info>%s</info>', count($matches), $package),
  4107. '',
  4108. ));
  4109. $io->writeError($choices);
  4110. $io->writeError('');
  4111. $validator = function ($selection) use ($matches, $versionParser) {
  4112. if ('' === $selection) {
  4113. return false;
  4114. }
  4115. if (is_numeric($selection) && isset($matches[(int) $selection])) {
  4116. $package = $matches[(int) $selection];
  4117. return $package['name'];
  4118. }
  4119. if (preg_match('{^\s*(?P<name>[\S/]+)(?:\s+(?P<version>\S+))?\s*$}', $selection, $packageMatches)) {
  4120. if (isset($packageMatches['version'])) {
  4121. $versionParser->parseConstraints($packageMatches['version']);
  4122. return $packageMatches['name'].' '.$packageMatches['version'];
  4123. }
  4124. return $packageMatches['name'];
  4125. }
  4126. throw new \Exception('Not a valid selection');
  4127. };
  4128. $package = $io->askAndValidate(
  4129. 'Enter package # to add, or the complete package name if it is not listed: ',
  4130. $validator,
  4131. 3,
  4132. false
  4133. );
  4134. }
  4135. if (false !== $package && false === strpos($package, ' ')) {
  4136. $validator = function ($input) {
  4137. $input = trim($input);
  4138. return $input ?: false;
  4139. };
  4140. $constraint = $io->askAndValidate(
  4141. 'Enter the version constraint to require (or leave blank to use the latest version): ',
  4142. $validator,
  4143. 3,
  4144. false
  4145. );
  4146. if (false === $constraint) {
  4147. list($name, $constraint) = $this->findBestVersionAndNameForPackage($input, $package, $phpVersion, $preferredStability);
  4148. $io->writeError(sprintf(
  4149. 'Using version <info>%s</info> for <info>%s</info>',
  4150. $constraint,
  4151. $package
  4152. ));
  4153. }
  4154. $package .= ' '.$constraint;
  4155. }
  4156. if (false !== $package) {
  4157. $requires[] = $package;
  4158. $existingPackages[] = substr($package, 0, strpos($package, ' '));
  4159. }
  4160. }
  4161. }
  4162. return $requires;
  4163. }
  4164. protected function formatAuthors($author)
  4165. {
  4166. return array($this->parseAuthorString($author));
  4167. }
  4168. protected function formatRequirements(array $requirements)
  4169. {
  4170. $requires = array();
  4171. $requirements = $this->normalizeRequirements($requirements);
  4172. foreach ($requirements as $requirement) {
  4173. $requires[$requirement['name']] = $requirement['version'];
  4174. }
  4175. return $requires;
  4176. }
  4177. protected function getGitConfig()
  4178. {
  4179. if (null !== $this->gitConfig) {
  4180. return $this->gitConfig;
  4181. }
  4182. $finder = new ExecutableFinder();
  4183. $gitBin = $finder->find('git');
  4184. if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
  4185. $cmd = new Process(array($gitBin, 'config', '-l'));
  4186. } else {
  4187. $cmd = new Process(sprintf('%s config -l', ProcessExecutor::escape($gitBin)));
  4188. }
  4189. $cmd->run();
  4190. if ($cmd->isSuccessful()) {
  4191. $this->gitConfig = array();
  4192. preg_match_all('{^([^=]+)=(.*)$}m', $cmd->getOutput(), $matches, PREG_SET_ORDER);
  4193. foreach ($matches as $match) {
  4194. $this->gitConfig[$match[1]] = $match[2];
  4195. }
  4196. return $this->gitConfig;
  4197. }
  4198. return $this->gitConfig = array();
  4199. }
  4200. protected function hasVendorIgnore($ignoreFile, $vendor = 'vendor')
  4201. {
  4202. if (!file_exists($ignoreFile)) {
  4203. return false;
  4204. }
  4205. $pattern = sprintf('{^/?%s(/\*?)?$}', preg_quote($vendor));
  4206. $lines = file($ignoreFile, FILE_IGNORE_NEW_LINES);
  4207. foreach ($lines as $line) {
  4208. if (preg_match($pattern, $line)) {
  4209. return true;
  4210. }
  4211. }
  4212. return false;
  4213. }
  4214. protected function normalizeRequirements(array $requirements)
  4215. {
  4216. $parser = new VersionParser();
  4217. return $parser->parseNameVersionPairs($requirements);
  4218. }
  4219. protected function addVendorIgnore($ignoreFile, $vendor = '/vendor/')
  4220. {
  4221. $contents = "";
  4222. if (file_exists($ignoreFile)) {
  4223. $contents = file_get_contents($ignoreFile);
  4224. if ("\n" !== substr($contents, 0, -1)) {
  4225. $contents .= "\n";
  4226. }
  4227. }
  4228. file_put_contents($ignoreFile, $contents . $vendor. "\n");
  4229. }
  4230. protected function isValidEmail($email)
  4231. {
  4232. if (!function_exists('filter_var')) {
  4233. return true;
  4234. }
  4235. if (PHP_VERSION_ID < 50303) {
  4236. return true;
  4237. }
  4238. return false !== filter_var($email, FILTER_VALIDATE_EMAIL);
  4239. }
  4240. private function getPool(InputInterface $input, $minimumStability = null)
  4241. {
  4242. $key = $minimumStability ?: 'default';
  4243. if (!isset($this->pools[$key])) {
  4244. $this->pools[$key] = $pool = new Pool($minimumStability ?: $this->getMinimumStability($input));
  4245. $pool->addRepository($this->getRepos());
  4246. }
  4247. return $this->pools[$key];
  4248. }
  4249. private function getMinimumStability(InputInterface $input)
  4250. {
  4251. if ($input->hasOption('stability')) {
  4252. return VersionParser::normalizeStability($input->getOption('stability') ?: 'stable');
  4253. }
  4254. $file = Factory::getComposerFile();
  4255. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  4256. if (!empty($composer['minimum-stability'])) {
  4257. return VersionParser::normalizeStability($composer['minimum-stability']);
  4258. }
  4259. }
  4260. return 'stable';
  4261. }
  4262. private function findBestVersionAndNameForPackage(InputInterface $input, $name, $phpVersion, $preferredStability = 'stable', $requiredVersion = null, $minimumStability = null, $fixed = null)
  4263. {
  4264. $versionSelector = new VersionSelector($this->getPool($input, $minimumStability));
  4265. $ignorePlatformReqs = $input->hasOption('ignore-platform-reqs') && $input->getOption('ignore-platform-reqs');
  4266. if ($ignorePlatformReqs) {
  4267. $phpVersion = null;
  4268. }
  4269. $package = $versionSelector->findBestCandidate($name, $requiredVersion, $phpVersion, $preferredStability);
  4270. if (!$package) {
  4271. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  4272. return array($name, $requiredVersion ?: '*');
  4273. }
  4274. if ($phpVersion && $versionSelector->findBestCandidate($name, $requiredVersion, null, $preferredStability)) {
  4275. throw new \InvalidArgumentException(sprintf(
  4276. 'Package %s at version %s has a PHP requirement incompatible with your PHP version (%s)',
  4277. $name,
  4278. $requiredVersion,
  4279. $phpVersion
  4280. ));
  4281. }
  4282. if ($requiredVersion && $versionSelector->findBestCandidate($name, null, $phpVersion, $preferredStability)) {
  4283. throw new \InvalidArgumentException(sprintf(
  4284. 'Could not find package %s in a version matching %s',
  4285. $name,
  4286. $requiredVersion
  4287. ));
  4288. }
  4289. if ($phpVersion && $versionSelector->findBestCandidate($name)) {
  4290. throw new \InvalidArgumentException(sprintf(
  4291. 'Could not find package %s in any version matching your PHP version (%s)',
  4292. $name,
  4293. $phpVersion
  4294. ));
  4295. }
  4296. $similar = $this->findSimilar($name);
  4297. if ($similar) {
  4298. if ($requiredVersion === null && in_array($name, $similar, true)) {
  4299. throw new \InvalidArgumentException(sprintf(
  4300. 'Could not find a version of package %s matching your minimum-stability (%s). Require it with an explicit version constraint allowing its desired stability.',
  4301. $name,
  4302. $this->getMinimumStability($input)
  4303. ));
  4304. }
  4305. throw new \InvalidArgumentException(sprintf(
  4306. "Could not find package %s.\n\nDid you mean " . (count($similar) > 1 ? 'one of these' : 'this') . "?\n %s",
  4307. $name,
  4308. implode("\n ", $similar)
  4309. ));
  4310. }
  4311. throw new \InvalidArgumentException(sprintf(
  4312. '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).',
  4313. $name,
  4314. $this->getMinimumStability($input)
  4315. ));
  4316. }
  4317. return array(
  4318. $package->getPrettyName(),
  4319. $fixed ? $package->getPrettyVersion() : $versionSelector->findRecommendedRequireVersion($package),
  4320. );
  4321. }
  4322. private function findSimilar($package)
  4323. {
  4324. try {
  4325. $results = $this->repos->search($package);
  4326. } catch (\Exception $e) {
  4327. return array();
  4328. }
  4329. $similarPackages = array();
  4330. $installedRepo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
  4331. foreach ($results as $result) {
  4332. if ($installedRepo->findPackage($result['name'], '*')) {
  4333. continue;
  4334. }
  4335. $similarPackages[$result['name']] = levenshtein($package, $result['name']);
  4336. }
  4337. asort($similarPackages);
  4338. return array_keys(array_slice($similarPackages, 0, 5));
  4339. }
  4340. private function installDependencies($output)
  4341. {
  4342. try {
  4343. $installCommand = $this->getApplication()->find('install');
  4344. $installCommand->run(new ArrayInput(array()), $output);
  4345. } catch (\Exception $e) {
  4346. $this->getIO()->writeError('Could not install dependencies. Run `composer install` to see more information.');
  4347. }
  4348. }
  4349. private function hasDependencies($options)
  4350. {
  4351. $requires = (array) $options['require'];
  4352. $devRequires = isset($options['require-dev']) ? (array) $options['require-dev'] : array();
  4353. return !empty($requires) || !empty($devRequires);
  4354. }
  4355. }
  4356. <?php
  4357. namespace Composer\Command;
  4358. use Composer\Installer;
  4359. use Composer\Plugin\CommandEvent;
  4360. use Composer\Plugin\PluginEvents;
  4361. use Symfony\Component\Console\Input\InputInterface;
  4362. use Symfony\Component\Console\Input\InputOption;
  4363. use Symfony\Component\Console\Input\InputArgument;
  4364. use Symfony\Component\Console\Output\OutputInterface;
  4365. class InstallCommand extends BaseCommand
  4366. {
  4367. protected function configure()
  4368. {
  4369. $this
  4370. ->setName('install')
  4371. ->setAliases(array('i'))
  4372. ->setDescription('Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.')
  4373. ->setDefinition(array(
  4374. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  4375. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  4376. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  4377. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  4378. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  4379. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  4380. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  4381. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4382. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4383. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  4384. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  4385. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4386. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4387. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4388. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4389. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Should not be provided, use composer require instead to add a given package to composer.json.'),
  4390. ))
  4391. ->setHelp(
  4392. <<<EOT
  4393. The <info>install</info> command reads the composer.lock file from
  4394. the current directory, processes it, and downloads and installs all the
  4395. libraries and dependencies outlined in that file. If the file does not
  4396. exist it will look for composer.json and do the same.
  4397. <info>php composer.phar install</info>
  4398. Read more at https://getcomposer.org/doc/03-cli.md#install-i
  4399. EOT
  4400. )
  4401. ;
  4402. }
  4403. protected function execute(InputInterface $input, OutputInterface $output)
  4404. {
  4405. $io = $this->getIO();
  4406. if ($args = $input->getArgument('packages')) {
  4407. $io->writeError('<error>Invalid argument '.implode(' ', $args).'. Use "composer require '.implode(' ', $args).'" instead to add packages to your composer.json.</error>');
  4408. return 1;
  4409. }
  4410. if ($input->getOption('no-custom-installers')) {
  4411. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  4412. $input->setOption('no-plugins', true);
  4413. }
  4414. if ($input->getOption('dev')) {
  4415. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  4416. }
  4417. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4418. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4419. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'install', $input, $output);
  4420. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4421. $install = Installer::create($io, $composer);
  4422. $config = $composer->getConfig();
  4423. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  4424. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  4425. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  4426. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  4427. $install
  4428. ->setDryRun($input->getOption('dry-run'))
  4429. ->setVerbose($input->getOption('verbose'))
  4430. ->setPreferSource($preferSource)
  4431. ->setPreferDist($preferDist)
  4432. ->setDevMode(!$input->getOption('no-dev'))
  4433. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  4434. ->setRunScripts(!$input->getOption('no-scripts'))
  4435. ->setSkipSuggest($input->getOption('no-suggest'))
  4436. ->setOptimizeAutoloader($optimize)
  4437. ->setClassMapAuthoritative($authoritative)
  4438. ->setApcuAutoloader($apcu)
  4439. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4440. ;
  4441. if ($input->getOption('no-plugins')) {
  4442. $install->disablePlugins();
  4443. }
  4444. return $install->run();
  4445. }
  4446. }
  4447. <?php
  4448. namespace Composer\Command;
  4449. use Composer\Json\JsonFile;
  4450. use Composer\Plugin\CommandEvent;
  4451. use Composer\Plugin\PluginEvents;
  4452. use Composer\Package\PackageInterface;
  4453. use Composer\Repository\RepositoryInterface;
  4454. use Symfony\Component\Console\Helper\Table;
  4455. use Symfony\Component\Console\Input\InputInterface;
  4456. use Symfony\Component\Console\Input\InputOption;
  4457. use Symfony\Component\Console\Output\OutputInterface;
  4458. class LicensesCommand extends BaseCommand
  4459. {
  4460. protected function configure()
  4461. {
  4462. $this
  4463. ->setName('licenses')
  4464. ->setDescription('Shows information about licenses of dependencies.')
  4465. ->setDefinition(array(
  4466. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4467. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
  4468. ))
  4469. ->setHelp(
  4470. <<<EOT
  4471. The license command displays detailed information about the licenses of
  4472. the installed dependencies.
  4473. Read more at https://getcomposer.org/doc/03-cli.md#licenses
  4474. EOT
  4475. )
  4476. ;
  4477. }
  4478. protected function execute(InputInterface $input, OutputInterface $output)
  4479. {
  4480. $composer = $this->getComposer();
  4481. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'licenses', $input, $output);
  4482. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4483. $root = $composer->getPackage();
  4484. $repo = $composer->getRepositoryManager()->getLocalRepository();
  4485. if ($input->getOption('no-dev')) {
  4486. $packages = $this->filterRequiredPackages($repo, $root);
  4487. } else {
  4488. $packages = $this->appendPackages($repo->getPackages(), array());
  4489. }
  4490. ksort($packages);
  4491. $io = $this->getIO();
  4492. switch ($format = $input->getOption('format')) {
  4493. case 'text':
  4494. $io->write('Name: <comment>'.$root->getPrettyName().'</comment>');
  4495. $io->write('Version: <comment>'.$root->getFullPrettyVersion().'</comment>');
  4496. $io->write('Licenses: <comment>'.(implode(', ', $root->getLicense()) ?: 'none').'</comment>');
  4497. $io->write('Dependencies:');
  4498. $io->write('');
  4499. $table = new Table($output);
  4500. $table->setStyle('compact');
  4501. $tableStyle = $table->getStyle();
  4502. if (method_exists($tableStyle, 'setVerticalBorderChars')) {
  4503. $tableStyle->setVerticalBorderChars('');
  4504. } else {
  4505. $tableStyle->setVerticalBorderChar('');
  4506. }
  4507. $tableStyle->setCellRowContentFormat('%s ');
  4508. $table->setHeaders(array('Name', 'Version', 'License'));
  4509. foreach ($packages as $package) {
  4510. $table->addRow(array(
  4511. $package->getPrettyName(),
  4512. $package->getFullPrettyVersion(),
  4513. implode(', ', $package->getLicense()) ?: 'none',
  4514. ));
  4515. }
  4516. $table->render();
  4517. break;
  4518. case 'json':
  4519. $dependencies = array();
  4520. foreach ($packages as $package) {
  4521. $dependencies[$package->getPrettyName()] = array(
  4522. 'version' => $package->getFullPrettyVersion(),
  4523. 'license' => $package->getLicense(),
  4524. );
  4525. }
  4526. $io->write(JsonFile::encode(array(
  4527. 'name' => $root->getPrettyName(),
  4528. 'version' => $root->getFullPrettyVersion(),
  4529. 'license' => $root->getLicense(),
  4530. 'dependencies' => $dependencies,
  4531. )));
  4532. break;
  4533. default:
  4534. throw new \RuntimeException(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  4535. }
  4536. return 0;
  4537. }
  4538. private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array())
  4539. {
  4540. $requires = array_keys($package->getRequires());
  4541. $packageListNames = array_keys($bucket);
  4542. $packages = array_filter(
  4543. $repo->getPackages(),
  4544. function ($package) use ($requires, $packageListNames) {
  4545. return in_array($package->getName(), $requires) && !in_array($package->getName(), $packageListNames);
  4546. }
  4547. );
  4548. $bucket = $this->appendPackages($packages, $bucket);
  4549. foreach ($packages as $package) {
  4550. $bucket = $this->filterRequiredPackages($repo, $package, $bucket);
  4551. }
  4552. return $bucket;
  4553. }
  4554. public function appendPackages(array $packages, array $bucket)
  4555. {
  4556. foreach ($packages as $package) {
  4557. $bucket[$package->getName()] = $package;
  4558. }
  4559. return $bucket;
  4560. }
  4561. }
  4562. <?php
  4563. namespace Composer\Command;
  4564. use Symfony\Component\Console\Input\InputInterface;
  4565. use Symfony\Component\Console\Input\InputArgument;
  4566. use Symfony\Component\Console\Input\ArrayInput;
  4567. use Symfony\Component\Console\Input\InputOption;
  4568. use Symfony\Component\Console\Output\OutputInterface;
  4569. class OutdatedCommand extends ShowCommand
  4570. {
  4571. protected function configure()
  4572. {
  4573. $this
  4574. ->setName('outdated')
  4575. ->setDescription('Shows a list of installed packages that have updates available, including their latest version.')
  4576. ->setDefinition(array(
  4577. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  4578. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show only packages that are outdated (this is the default, but present here for compat with `show`'),
  4579. new InputOption('all', 'a', InputOption::VALUE_NONE, 'Show all installed packages with their latest versions'),
  4580. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  4581. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  4582. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  4583. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4584. new InputOption('ignore', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore specified package(s). Use it with the --outdated option if you don\'t want to be informed about new versions of some packages.'),
  4585. ))
  4586. ->setHelp(
  4587. <<<EOT
  4588. The outdated command is just a proxy for `composer show -l`
  4589. The color coding (or signage if you have ANSI colors disabled) for dependency versions is as such:
  4590. - <info>green</info> (=): Dependency is in the latest version and is up to date.
  4591. - <comment>yellow</comment> (~): Dependency has a new version available that includes backwards
  4592. compatibility breaks according to semver, so upgrade when you can but it
  4593. may involve work.
  4594. - <highlight>red</highlight> (!): Dependency has a new version that is semver-compatible and you should upgrade it.
  4595. Read more at https://getcomposer.org/doc/03-cli.md#outdated
  4596. EOT
  4597. )
  4598. ;
  4599. }
  4600. protected function execute(InputInterface $input, OutputInterface $output)
  4601. {
  4602. $args = array(
  4603. 'command' => 'show',
  4604. '--latest' => true,
  4605. );
  4606. if (!$input->getOption('all')) {
  4607. $args['--outdated'] = true;
  4608. }
  4609. if ($input->getOption('direct')) {
  4610. $args['--direct'] = true;
  4611. }
  4612. if ($input->getArgument('package')) {
  4613. $args['package'] = $input->getArgument('package');
  4614. }
  4615. if ($input->getOption('strict')) {
  4616. $args['--strict'] = true;
  4617. }
  4618. if ($input->getOption('minor-only')) {
  4619. $args['--minor-only'] = true;
  4620. }
  4621. $args['--format'] = $input->getOption('format');
  4622. $args['--ignore'] = $input->getOption('ignore');
  4623. $input = new ArrayInput($args);
  4624. return $this->getApplication()->run($input, $output);
  4625. }
  4626. public function isProxyCommand()
  4627. {
  4628. return true;
  4629. }
  4630. }
  4631. <?php
  4632. namespace Composer\Command;
  4633. use Symfony\Component\Console\Input\InputInterface;
  4634. use Symfony\Component\Console\Output\OutputInterface;
  4635. class ProhibitsCommand extends BaseDependencyCommand
  4636. {
  4637. protected function configure()
  4638. {
  4639. parent::configure();
  4640. $this
  4641. ->setName('prohibits')
  4642. ->setAliases(array('why-not'))
  4643. ->setDescription('Shows which packages prevent the given package from being installed.')
  4644. ->setHelp(
  4645. <<<EOT
  4646. Displays detailed information about why a package cannot be installed.
  4647. <info>php composer.phar prohibits composer/composer</info>
  4648. Read more at https://getcomposer.org/doc/03-cli.md#prohibits-why-not-
  4649. EOT
  4650. )
  4651. ;
  4652. }
  4653. protected function execute(InputInterface $input, OutputInterface $output)
  4654. {
  4655. return parent::doExecute($input, $output, true);
  4656. }
  4657. }
  4658. <?php
  4659. namespace Composer\Command;
  4660. use Composer\Config\JsonConfigSource;
  4661. use Composer\Installer;
  4662. use Composer\Plugin\CommandEvent;
  4663. use Composer\Plugin\PluginEvents;
  4664. use Composer\Json\JsonFile;
  4665. use Composer\Factory;
  4666. use Symfony\Component\Console\Input\InputInterface;
  4667. use Symfony\Component\Console\Input\InputOption;
  4668. use Symfony\Component\Console\Input\InputArgument;
  4669. use Symfony\Component\Console\Output\OutputInterface;
  4670. use Composer\Package\BasePackage;
  4671. class RemoveCommand extends BaseCommand
  4672. {
  4673. protected function configure()
  4674. {
  4675. $this
  4676. ->setName('remove')
  4677. ->setDescription('Removes a package from the require or require-dev.')
  4678. ->setDefinition(array(
  4679. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'Packages that should be removed.'),
  4680. new InputOption('dev', null, InputOption::VALUE_NONE, 'Removes a package from the require-dev section.'),
  4681. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4682. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4683. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4684. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4685. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated with explicit dependencies. (Deprecrated, is now default behavior)'),
  4686. new InputOption('no-update-with-dependencies', null, InputOption::VALUE_NONE, 'Does not allow inherited dependencies to be updated with explicit dependencies.'),
  4687. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4688. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4689. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4690. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4691. ))
  4692. ->setHelp(
  4693. <<<EOT
  4694. The <info>remove</info> command removes a package from the current
  4695. list of installed packages
  4696. <info>php composer.phar remove</info>
  4697. Read more at https://getcomposer.org/doc/03-cli.md#remove
  4698. EOT
  4699. )
  4700. ;
  4701. }
  4702. protected function execute(InputInterface $input, OutputInterface $output)
  4703. {
  4704. $packages = $input->getArgument('packages');
  4705. $packages = array_map('strtolower', $packages);
  4706. $file = Factory::getComposerFile();
  4707. $jsonFile = new JsonFile($file);
  4708. $composer = $jsonFile->read();
  4709. $composerBackup = file_get_contents($jsonFile->getPath());
  4710. $json = new JsonConfigSource($jsonFile);
  4711. $type = $input->getOption('dev') ? 'require-dev' : 'require';
  4712. $altType = !$input->getOption('dev') ? 'require-dev' : 'require';
  4713. $io = $this->getIO();
  4714. if ($input->getOption('update-with-dependencies')) {
  4715. $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>');
  4716. }
  4717. foreach (array('require', 'require-dev') as $linkType) {
  4718. if (isset($composer[$linkType])) {
  4719. foreach ($composer[$linkType] as $name => $version) {
  4720. $composer[$linkType][strtolower($name)] = $name;
  4721. }
  4722. }
  4723. }
  4724. foreach ($packages as $package) {
  4725. if (isset($composer[$type][$package])) {
  4726. $json->removeLink($type, $composer[$type][$package]);
  4727. } elseif (isset($composer[$altType][$package])) {
  4728. $io->writeError('<warning>' . $composer[$altType][$package] . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
  4729. if ($io->isInteractive()) {
  4730. if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ', true)) {
  4731. $json->removeLink($altType, $composer[$altType][$package]);
  4732. }
  4733. }
  4734. } elseif (isset($composer[$type]) && $matches = preg_grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$type]))) {
  4735. foreach ($matches as $matchedPackage) {
  4736. $json->removeLink($type, $matchedPackage);
  4737. }
  4738. } elseif (isset($composer[$altType]) && $matches = preg_grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$altType]))) {
  4739. foreach ($matches as $matchedPackage) {
  4740. $io->writeError('<warning>' . $matchedPackage . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
  4741. if ($io->isInteractive()) {
  4742. if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ', true)) {
  4743. $json->removeLink($altType, $matchedPackage);
  4744. }
  4745. }
  4746. }
  4747. } else {
  4748. $io->writeError('<warning>'.$package.' is not required in your composer.json and has not been removed</warning>');
  4749. }
  4750. }
  4751. if ($input->getOption('no-update')) {
  4752. return 0;
  4753. }
  4754. $this->resetComposer();
  4755. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4756. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4757. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'remove', $input, $output);
  4758. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4759. $install = Installer::create($io, $composer);
  4760. $updateDevMode = !$input->getOption('update-no-dev');
  4761. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4762. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4763. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4764. $install
  4765. ->setVerbose($input->getOption('verbose'))
  4766. ->setDevMode($updateDevMode)
  4767. ->setOptimizeAutoloader($optimize)
  4768. ->setClassMapAuthoritative($authoritative)
  4769. ->setApcuAutoloader($apcu)
  4770. ->setUpdate(true)
  4771. ->setUpdateAllowList($packages)
  4772. ->setAllowListTransitiveDependencies(!$input->getOption('no-update-with-dependencies'))
  4773. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4774. ->setRunScripts(!$input->getOption('no-scripts'))
  4775. ;
  4776. $status = $install->run();
  4777. if ($status !== 0) {
  4778. $io->writeError("\n".'<error>Removal failed, reverting '.$file.' to its original content.</error>');
  4779. file_put_contents($jsonFile->getPath(), $composerBackup);
  4780. }
  4781. return $status;
  4782. }
  4783. }
  4784. <?php
  4785. namespace Composer\Command;
  4786. use Symfony\Component\Console\Input\InputInterface;
  4787. use Symfony\Component\Console\Input\InputArgument;
  4788. use Symfony\Component\Console\Input\InputOption;
  4789. use Symfony\Component\Console\Output\OutputInterface;
  4790. use Composer\Factory;
  4791. use Composer\Installer;
  4792. use Composer\Json\JsonFile;
  4793. use Composer\Json\JsonManipulator;
  4794. use Composer\Package\Version\VersionParser;
  4795. use Composer\Plugin\CommandEvent;
  4796. use Composer\Plugin\PluginEvents;
  4797. use Composer\Repository\CompositeRepository;
  4798. use Composer\Repository\PlatformRepository;
  4799. use Composer\IO\IOInterface;
  4800. use Composer\Util\Silencer;
  4801. class RequireCommand extends InitCommand
  4802. {
  4803. private $newlyCreated;
  4804. private $json;
  4805. private $file;
  4806. private $composerBackup;
  4807. protected function configure()
  4808. {
  4809. $this
  4810. ->setName('require')
  4811. ->setDescription('Adds required packages to your composer.json and installs them.')
  4812. ->setDefinition(array(
  4813. 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"'),
  4814. new InputOption('dev', null, InputOption::VALUE_NONE, 'Add requirement to require-dev.'),
  4815. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  4816. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  4817. new InputOption('fixed', null, InputOption::VALUE_NONE, 'Write fixed version to the composer.json.'),
  4818. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4819. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  4820. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4821. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4822. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4823. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated, except those that are root requirements.'),
  4824. new InputOption('update-with-all-dependencies', null, InputOption::VALUE_NONE, 'Allows all inherited dependencies to be updated, including those that are root requirements.'),
  4825. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4826. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  4827. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  4828. new InputOption('sort-packages', null, InputOption::VALUE_NONE, 'Sorts packages when adding/updating a new dependency'),
  4829. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4830. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4831. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4832. ))
  4833. ->setHelp(
  4834. <<<EOT
  4835. The require command adds required packages to your composer.json and installs them.
  4836. If you do not specify a package, composer will prompt you to search for a package, and given results, provide a list of
  4837. matches to require.
  4838. If you do not specify a version constraint, composer will choose a suitable one based on the available package versions.
  4839. If you do not want to install the new dependencies immediately you can call it with --no-update
  4840. Read more at https://getcomposer.org/doc/03-cli.md#require
  4841. EOT
  4842. )
  4843. ;
  4844. }
  4845. protected function execute(InputInterface $input, OutputInterface $output)
  4846. {
  4847. if (function_exists('pcntl_async_signals') && function_exists('pcntl_signal')) {
  4848. pcntl_async_signals(true);
  4849. pcntl_signal(SIGINT, array($this, 'revertComposerFile'));
  4850. pcntl_signal(SIGTERM, array($this, 'revertComposerFile'));
  4851. pcntl_signal(SIGHUP, array($this, 'revertComposerFile'));
  4852. }
  4853. $this->file = Factory::getComposerFile();
  4854. $io = $this->getIO();
  4855. $this->newlyCreated = !file_exists($this->file);
  4856. if ($this->newlyCreated && !file_put_contents($this->file, "{\n}\n")) {
  4857. $io->writeError('<error>'.$this->file.' could not be created.</error>');
  4858. return 1;
  4859. }
  4860. if (!is_readable($this->file) && false === Silencer::call('file_get_contents', $this->file)) {
  4861. $io->writeError('<error>'.$this->file.' is not readable.</error>');
  4862. return 1;
  4863. }
  4864. if (filesize($this->file) === 0) {
  4865. file_put_contents($this->file, "{\n}\n");
  4866. }
  4867. $this->json = new JsonFile($this->file);
  4868. $this->composerBackup = file_get_contents($this->json->getPath());
  4869. if (!is_writable($this->file) && !Silencer::call('file_put_contents', $this->file, $this->composerBackup)) {
  4870. $io->writeError('<error>'.$this->file.' is not writable.</error>');
  4871. return 1;
  4872. }
  4873. if ($input->getOption('fixed') === true) {
  4874. $config = $this->json->read();
  4875. $packageType = empty($config['type']) ? 'library' : $config['type'];
  4876. if ($packageType !== 'project') {
  4877. $io->writeError('<error>"--fixed" option is allowed for "project" package types only to prevent possible misuses.</error>');
  4878. if (empty($config['type'])) {
  4879. $io->writeError('<error>If your package is not library, you should explicitly specify "type" parameter in composer.json.</error>');
  4880. }
  4881. return 1;
  4882. }
  4883. }
  4884. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4885. $repos = $composer->getRepositoryManager()->getRepositories();
  4886. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  4887. $this->repos = new CompositeRepository(array_merge(
  4888. array(new PlatformRepository(array(), $platformOverrides)),
  4889. $repos
  4890. ));
  4891. if ($composer->getPackage()->getPreferStable()) {
  4892. $preferredStability = 'stable';
  4893. } else {
  4894. $preferredStability = $composer->getPackage()->getMinimumStability();
  4895. }
  4896. $phpVersion = $this->repos->findPackage('php', '*')->getPrettyVersion();
  4897. try {
  4898. $requirements = $this->determineRequirements($input, $output, $input->getArgument('packages'), $phpVersion, $preferredStability, !$input->getOption('no-update'), $input->getOption('fixed'));
  4899. } catch (\Exception $e) {
  4900. if ($this->newlyCreated) {
  4901. throw new \RuntimeException('No composer.json present in the current directory, this may be the cause of the following exception.', 0, $e);
  4902. }
  4903. throw $e;
  4904. }
  4905. $requireKey = $input->getOption('dev') ? 'require-dev' : 'require';
  4906. $removeKey = $input->getOption('dev') ? 'require' : 'require-dev';
  4907. $requirements = $this->formatRequirements($requirements);
  4908. $versionParser = new VersionParser();
  4909. foreach ($requirements as $package => $constraint) {
  4910. if (strtolower($package) === $composer->getPackage()->getName()) {
  4911. $io->writeError(sprintf('<error>Root package \'%s\' cannot require itself in its composer.json</error>', $package));
  4912. return 1;
  4913. }
  4914. $versionParser->parseConstraints($constraint);
  4915. }
  4916. $sortPackages = $input->getOption('sort-packages') || $composer->getConfig()->get('sort-packages');
  4917. if (!$this->updateFileCleanly($this->json, $requirements, $requireKey, $removeKey, $sortPackages)) {
  4918. $composerDefinition = $this->json->read();
  4919. foreach ($requirements as $package => $version) {
  4920. $composerDefinition[$requireKey][$package] = $version;
  4921. unset($composerDefinition[$removeKey][$package]);
  4922. }
  4923. $this->json->write($composerDefinition);
  4924. }
  4925. $io->writeError('<info>'.$this->file.' has been '.($this->newlyCreated ? 'created' : 'updated').'</info>');
  4926. if ($input->getOption('no-update')) {
  4927. return 0;
  4928. }
  4929. try {
  4930. return $this->doUpdate($input, $output, $io, $requirements);
  4931. } catch (\Exception $e) {
  4932. $this->revertComposerFile(false);
  4933. throw $e;
  4934. }
  4935. }
  4936. private function doUpdate(InputInterface $input, OutputInterface $output, IOInterface $io, array $requirements)
  4937. {
  4938. $this->resetComposer();
  4939. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4940. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4941. $updateDevMode = !$input->getOption('update-no-dev');
  4942. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4943. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4944. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4945. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'require', $input, $output);
  4946. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4947. $install = Installer::create($io, $composer);
  4948. $install
  4949. ->setVerbose($input->getOption('verbose'))
  4950. ->setPreferSource($input->getOption('prefer-source'))
  4951. ->setPreferDist($input->getOption('prefer-dist'))
  4952. ->setDevMode($updateDevMode)
  4953. ->setRunScripts(!$input->getOption('no-scripts'))
  4954. ->setSkipSuggest($input->getOption('no-suggest'))
  4955. ->setOptimizeAutoloader($optimize)
  4956. ->setClassMapAuthoritative($authoritative)
  4957. ->setApcuAutoloader($apcu)
  4958. ->setUpdate(true)
  4959. ->setUpdateAllowList(array_keys($requirements))
  4960. ->setAllowListTransitiveDependencies($input->getOption('update-with-dependencies'))
  4961. ->setAllowListAllDependencies($input->getOption('update-with-all-dependencies'))
  4962. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4963. ->setPreferStable($input->getOption('prefer-stable'))
  4964. ->setPreferLowest($input->getOption('prefer-lowest'))
  4965. ;
  4966. $status = $install->run();
  4967. if ($status !== 0) {
  4968. $this->revertComposerFile(false);
  4969. }
  4970. return $status;
  4971. }
  4972. private function updateFileCleanly($json, array $new, $requireKey, $removeKey, $sortPackages)
  4973. {
  4974. $contents = file_get_contents($json->getPath());
  4975. $manipulator = new JsonManipulator($contents);
  4976. foreach ($new as $package => $constraint) {
  4977. if (!$manipulator->addLink($requireKey, $package, $constraint, $sortPackages)) {
  4978. return false;
  4979. }
  4980. if (!$manipulator->removeSubNode($removeKey, $package)) {
  4981. return false;
  4982. }
  4983. }
  4984. file_put_contents($json->getPath(), $manipulator->getContents());
  4985. return true;
  4986. }
  4987. protected function interact(InputInterface $input, OutputInterface $output)
  4988. {
  4989. return;
  4990. }
  4991. public function revertComposerFile($hardExit = true)
  4992. {
  4993. $io = $this->getIO();
  4994. if ($this->newlyCreated) {
  4995. $io->writeError("\n".'<error>Installation failed, deleting '.$this->file.'.</error>');
  4996. unlink($this->json->getPath());
  4997. } else {
  4998. $io->writeError("\n".'<error>Installation failed, reverting '.$this->file.' to its original content.</error>');
  4999. file_put_contents($this->json->getPath(), $this->composerBackup);
  5000. }
  5001. if ($hardExit) {
  5002. exit(1);
  5003. }
  5004. }
  5005. }
  5006. <?php
  5007. namespace Composer\Command;
  5008. use Composer\Script\Event as ScriptEvent;
  5009. use Composer\Script\ScriptEvents;
  5010. use Composer\Util\ProcessExecutor;
  5011. use Symfony\Component\Console\Input\InputInterface;
  5012. use Symfony\Component\Console\Input\InputOption;
  5013. use Symfony\Component\Console\Input\InputArgument;
  5014. use Symfony\Component\Console\Output\OutputInterface;
  5015. use Symfony\Component\Console\Helper\Table;
  5016. class RunScriptCommand extends BaseCommand
  5017. {
  5018. protected $scriptEvents = array(
  5019. ScriptEvents::PRE_INSTALL_CMD,
  5020. ScriptEvents::POST_INSTALL_CMD,
  5021. ScriptEvents::PRE_UPDATE_CMD,
  5022. ScriptEvents::POST_UPDATE_CMD,
  5023. ScriptEvents::PRE_STATUS_CMD,
  5024. ScriptEvents::POST_STATUS_CMD,
  5025. ScriptEvents::POST_ROOT_PACKAGE_INSTALL,
  5026. ScriptEvents::POST_CREATE_PROJECT_CMD,
  5027. ScriptEvents::PRE_ARCHIVE_CMD,
  5028. ScriptEvents::POST_ARCHIVE_CMD,
  5029. ScriptEvents::PRE_AUTOLOAD_DUMP,
  5030. ScriptEvents::POST_AUTOLOAD_DUMP,
  5031. );
  5032. protected function configure()
  5033. {
  5034. $this
  5035. ->setName('run-script')
  5036. ->setAliases(array('run'))
  5037. ->setDescription('Runs the scripts defined in composer.json.')
  5038. ->setDefinition(array(
  5039. new InputArgument('script', InputArgument::OPTIONAL, 'Script name to run.'),
  5040. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  5041. new InputOption('timeout', null, InputOption::VALUE_REQUIRED, 'Sets script timeout in seconds, or 0 for never.'),
  5042. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  5043. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  5044. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List scripts.'),
  5045. ))
  5046. ->setHelp(
  5047. <<<EOT
  5048. The <info>run-script</info> command runs scripts defined in composer.json:
  5049. <info>php composer.phar run-script post-update-cmd</info>
  5050. Read more at https://getcomposer.org/doc/03-cli.md#run-script
  5051. EOT
  5052. )
  5053. ;
  5054. }
  5055. protected function execute(InputInterface $input, OutputInterface $output)
  5056. {
  5057. if ($input->getOption('list')) {
  5058. return $this->listScripts($output);
  5059. } elseif (!$input->getArgument('script')) {
  5060. throw new \RuntimeException('Missing required argument "script"');
  5061. }
  5062. $script = $input->getArgument('script');
  5063. if (!in_array($script, $this->scriptEvents)) {
  5064. if (defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  5065. throw new \InvalidArgumentException(sprintf('Script "%s" cannot be run with this command', $script));
  5066. }
  5067. }
  5068. $composer = $this->getComposer();
  5069. $devMode = $input->getOption('dev') || !$input->getOption('no-dev');
  5070. $event = new ScriptEvent($script, $composer, $this->getIO(), $devMode);
  5071. $hasListeners = $composer->getEventDispatcher()->hasEventListeners($event);
  5072. if (!$hasListeners) {
  5073. throw new \InvalidArgumentException(sprintf('Script "%s" is not defined in this package', $script));
  5074. }
  5075. $args = $input->getArgument('args');
  5076. if (null !== $timeout = $input->getOption('timeout')) {
  5077. if (!ctype_digit($timeout)) {
  5078. throw new \RuntimeException('Timeout value must be numeric and positive if defined, or 0 for forever');
  5079. }
  5080. ProcessExecutor::setTimeout((int) $timeout);
  5081. }
  5082. return $composer->getEventDispatcher()->dispatchScript($script, $devMode, $args);
  5083. }
  5084. protected function listScripts(OutputInterface $output)
  5085. {
  5086. $scripts = $this->getComposer()->getPackage()->getScripts();
  5087. if (!count($scripts)) {
  5088. return 0;
  5089. }
  5090. $io = $this->getIO();
  5091. $io->writeError('<info>scripts:</info>');
  5092. $table = array();
  5093. foreach ($scripts as $name => $script) {
  5094. $description = '';
  5095. try {
  5096. $cmd = $this->getApplication()->find($name);
  5097. if ($cmd instanceof ScriptAliasCommand) {
  5098. $description = $cmd->getDescription();
  5099. }
  5100. } catch (\Symfony\Component\Console\Exception\CommandNotFoundException $e) {
  5101. }
  5102. $table[] = array(' '.$name, $description);
  5103. }
  5104. $renderer = new Table($output);
  5105. $renderer->setStyle('compact');
  5106. $rendererStyle = $renderer->getStyle();
  5107. if (method_exists($rendererStyle, 'setVerticalBorderChars')) {
  5108. $rendererStyle->setVerticalBorderChars('');
  5109. } else {
  5110. $rendererStyle->setVerticalBorderChar('');
  5111. }
  5112. $rendererStyle->setCellRowContentFormat('%s ');
  5113. $renderer->setRows($table)->render();
  5114. return 0;
  5115. }
  5116. }
  5117. <?php
  5118. namespace Composer\Command;
  5119. use Symfony\Component\Console\Input\InputInterface;
  5120. use Symfony\Component\Console\Input\InputOption;
  5121. use Symfony\Component\Console\Input\InputArgument;
  5122. use Symfony\Component\Console\Output\OutputInterface;
  5123. class ScriptAliasCommand extends BaseCommand
  5124. {
  5125. private $script;
  5126. private $description;
  5127. public function __construct($script, $description)
  5128. {
  5129. $this->script = $script;
  5130. $this->description = empty($description) ? 'Runs the '.$script.' script as defined in composer.json.' : $description;
  5131. parent::__construct();
  5132. }
  5133. protected function configure()
  5134. {
  5135. $this
  5136. ->setName($this->script)
  5137. ->setDescription($this->description)
  5138. ->setDefinition(array(
  5139. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  5140. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  5141. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  5142. ))
  5143. ->setHelp(
  5144. <<<EOT
  5145. The <info>run-script</info> command runs scripts defined in composer.json:
  5146. <info>php composer.phar run-script post-update-cmd</info>
  5147. Read more at https://getcomposer.org/doc/03-cli.md#run-script
  5148. EOT
  5149. )
  5150. ;
  5151. }
  5152. protected function execute(InputInterface $input, OutputInterface $output)
  5153. {
  5154. $composer = $this->getComposer();
  5155. $args = $input->getArguments();
  5156. return $composer->getEventDispatcher()->dispatchScript($this->script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args']);
  5157. }
  5158. }
  5159. <?php
  5160. namespace Composer\Command;
  5161. use Composer\Factory;
  5162. use Symfony\Component\Console\Input\InputInterface;
  5163. use Symfony\Component\Console\Input\InputArgument;
  5164. use Symfony\Component\Console\Input\InputOption;
  5165. use Symfony\Component\Console\Output\OutputInterface;
  5166. use Composer\Repository\CompositeRepository;
  5167. use Composer\Repository\PlatformRepository;
  5168. use Composer\Repository\RepositoryInterface;
  5169. use Composer\Plugin\CommandEvent;
  5170. use Composer\Plugin\PluginEvents;
  5171. class SearchCommand extends BaseCommand
  5172. {
  5173. protected $matches;
  5174. protected $lowMatches = array();
  5175. protected $tokens;
  5176. protected $output;
  5177. protected $onlyName;
  5178. protected function configure()
  5179. {
  5180. $this
  5181. ->setName('search')
  5182. ->setDescription('Searches for packages.')
  5183. ->setDefinition(array(
  5184. new InputOption('only-name', 'N', InputOption::VALUE_NONE, 'Search only in name'),
  5185. new InputOption('type', 't', InputOption::VALUE_REQUIRED, 'Search for a specific package type'),
  5186. new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'),
  5187. ))
  5188. ->setHelp(
  5189. <<<EOT
  5190. The search command searches for packages by its name
  5191. <info>php composer.phar search symfony composer</info>
  5192. Read more at https://getcomposer.org/doc/03-cli.md#search
  5193. EOT
  5194. )
  5195. ;
  5196. }
  5197. protected function execute(InputInterface $input, OutputInterface $output)
  5198. {
  5199. $platformRepo = new PlatformRepository;
  5200. $io = $this->getIO();
  5201. if (!($composer = $this->getComposer(false))) {
  5202. $composer = Factory::create($this->getIO(), array(), $input->hasParameterOption('--no-plugins'));
  5203. }
  5204. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  5205. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  5206. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  5207. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'search', $input, $output);
  5208. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5209. $onlyName = $input->getOption('only-name');
  5210. $type = $input->getOption('type') ?: null;
  5211. $flags = $onlyName ? RepositoryInterface::SEARCH_NAME : RepositoryInterface::SEARCH_FULLTEXT;
  5212. $results = $repos->search(implode(' ', $input->getArgument('tokens')), $flags, $type);
  5213. foreach ($results as $result) {
  5214. $io->write($result['name'] . (isset($result['description']) ? ' '. $result['description'] : ''));
  5215. }
  5216. return 0;
  5217. }
  5218. }
  5219. <?php
  5220. namespace Composer\Command;
  5221. use Composer\Composer;
  5222. use Composer\Factory;
  5223. use Composer\Config;
  5224. use Composer\Util\Filesystem;
  5225. use Composer\Util\Platform;
  5226. use Composer\SelfUpdate\Keys;
  5227. use Composer\SelfUpdate\Versions;
  5228. use Composer\IO\IOInterface;
  5229. use Composer\Downloader\FilesystemException;
  5230. use Symfony\Component\Console\Input\InputInterface;
  5231. use Symfony\Component\Console\Input\InputOption;
  5232. use Symfony\Component\Console\Input\InputArgument;
  5233. use Symfony\Component\Console\Output\OutputInterface;
  5234. use Symfony\Component\Finder\Finder;
  5235. class SelfUpdateCommand extends BaseCommand
  5236. {
  5237. const HOMEPAGE = 'getcomposer.org';
  5238. const OLD_INSTALL_EXT = '-old.phar';
  5239. protected function configure()
  5240. {
  5241. $this
  5242. ->setName('self-update')
  5243. ->setAliases(array('selfupdate'))
  5244. ->setDescription('Updates composer.phar to the latest version.')
  5245. ->setDefinition(array(
  5246. new InputOption('rollback', 'r', InputOption::VALUE_NONE, 'Revert to an older installation of composer'),
  5247. 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'),
  5248. new InputArgument('version', InputArgument::OPTIONAL, 'The version to update to'),
  5249. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  5250. new InputOption('update-keys', null, InputOption::VALUE_NONE, 'Prompt user for a key update'),
  5251. new InputOption('stable', null, InputOption::VALUE_NONE, 'Force an update to the stable channel'),
  5252. new InputOption('preview', null, InputOption::VALUE_NONE, 'Force an update to the preview channel'),
  5253. new InputOption('snapshot', null, InputOption::VALUE_NONE, 'Force an update to the snapshot channel'),
  5254. new InputOption('1', null, InputOption::VALUE_NONE, 'Force an update to the stable channel, but only use 1.x versions'),
  5255. new InputOption('2', null, InputOption::VALUE_NONE, 'Force an update to the stable channel, but only use 2.x versions'),
  5256. new InputOption('set-channel-only', null, InputOption::VALUE_NONE, 'Only store the channel as the default one and then exit'),
  5257. ))
  5258. ->setHelp(
  5259. <<<EOT
  5260. The <info>self-update</info> command checks getcomposer.org for newer
  5261. versions of composer and if found, installs the latest.
  5262. <info>php composer.phar self-update</info>
  5263. Read more at https://getcomposer.org/doc/03-cli.md#self-update-selfupdate-
  5264. EOT
  5265. )
  5266. ;
  5267. }
  5268. protected function execute(InputInterface $input, OutputInterface $output)
  5269. {
  5270. $config = Factory::createConfig();
  5271. if ($config->get('disable-tls') === true) {
  5272. $baseUrl = 'http://' . self::HOMEPAGE;
  5273. } else {
  5274. $baseUrl = 'https://' . self::HOMEPAGE;
  5275. }
  5276. $io = $this->getIO();
  5277. $remoteFilesystem = Factory::createRemoteFilesystem($io, $config);
  5278. $versionsUtil = new Versions($config, $remoteFilesystem);
  5279. $requestedChannel = null;
  5280. foreach (Versions::$channels as $channel) {
  5281. if ($input->getOption($channel)) {
  5282. $requestedChannel = $channel;
  5283. $versionsUtil->setChannel($channel);
  5284. break;
  5285. }
  5286. }
  5287. if ($input->getOption('set-channel-only')) {
  5288. return 0;
  5289. }
  5290. $cacheDir = $config->get('cache-dir');
  5291. $rollbackDir = $config->get('data-dir');
  5292. $home = $config->get('home');
  5293. $localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0];
  5294. if ($input->getOption('update-keys')) {
  5295. return $this->fetchKeys($io, $config);
  5296. }
  5297. if (!file_exists($localFilename)) {
  5298. throw new FilesystemException('Composer update failed: the "'.$localFilename.'" is not accessible');
  5299. }
  5300. $tmpDir = is_writable(dirname($localFilename)) ? dirname($localFilename) : $cacheDir;
  5301. if (!is_writable($tmpDir)) {
  5302. throw new FilesystemException('Composer update failed: the "'.$tmpDir.'" directory used to download the temp file could not be written');
  5303. }
  5304. if (function_exists('posix_getpwuid') && function_exists('posix_geteuid')) {
  5305. $composeUser = posix_getpwuid(posix_geteuid());
  5306. $homeOwner = posix_getpwuid(fileowner($home));
  5307. if (isset($composeUser['name']) && isset($homeOwner['name']) && $composeUser['name'] !== $homeOwner['name']) {
  5308. $io->writeError('<warning>You are running composer as "'.$composeUser['name'].'", while "'.$home.'" is owned by "'.$homeOwner['name'].'"</warning>');
  5309. }
  5310. }
  5311. if ($input->getOption('rollback')) {
  5312. return $this->rollback($output, $rollbackDir, $localFilename);
  5313. }
  5314. $latest = $versionsUtil->getLatest();
  5315. $latestStable = $versionsUtil->getLatest('stable');
  5316. $latestVersion = $latest['version'];
  5317. $updateVersion = $input->getArgument('version') ?: $latestVersion;
  5318. if ($requestedChannel && is_numeric($requestedChannel) && substr($latestStable['version'], 0, 1) !== $requestedChannel) {
  5319. $io->writeError('<warning>Warning: You forced the install of '.$latestVersion.' via --'.$requestedChannel.', but '.$latestStable['version'].' is the latest stable version. Updating to it via composer self-update --stable is recommended.</warning>');
  5320. }
  5321. if (preg_match('{^[0-9a-f]{40}$}', $updateVersion) && $updateVersion !== $latestVersion) {
  5322. $io->writeError('<error>You can not update to a specific SHA-1 as those phars are not available for download</error>');
  5323. return 1;
  5324. }
  5325. if (Composer::VERSION === $updateVersion) {
  5326. $io->writeError(sprintf('<info>You are already using composer version %s (%s channel).</info>', $updateVersion, $versionsUtil->getChannel()));
  5327. if ($input->getOption('clean-backups')) {
  5328. $this->cleanBackups($rollbackDir, $this->getLastBackupVersion($rollbackDir));
  5329. }
  5330. return 0;
  5331. }
  5332. $tempFilename = $tmpDir . '/' . basename($localFilename, '.phar').'-temp.phar';
  5333. $backupFile = sprintf(
  5334. '%s/%s-%s%s',
  5335. $rollbackDir,
  5336. strtr(Composer::RELEASE_DATE, ' :', '_-'),
  5337. preg_replace('{^([0-9a-f]{7})[0-9a-f]{33}$}', '$1', Composer::VERSION),
  5338. self::OLD_INSTALL_EXT
  5339. );
  5340. $updatingToTag = !preg_match('{^[0-9a-f]{40}$}', $updateVersion);
  5341. $io->write(sprintf("Updating to version <info>%s</info> (%s channel).", $updateVersion, $versionsUtil->getChannel()));
  5342. $remoteFilename = $baseUrl . ($updatingToTag ? "/download/{$updateVersion}/composer.phar" : '/composer.phar');
  5343. $signature = $remoteFilesystem->getContents(self::HOMEPAGE, $remoteFilename.'.sig', false);
  5344. $io->writeError(' ', false);
  5345. $remoteFilesystem->copy(self::HOMEPAGE, $remoteFilename, $tempFilename, !$input->getOption('no-progress'));
  5346. $io->writeError('');
  5347. if (!file_exists($tempFilename) || !$signature) {
  5348. $io->writeError('<error>The download of the new composer version failed for an unexpected reason</error>');
  5349. return 1;
  5350. }
  5351. if (!extension_loaded('openssl') && $config->get('disable-tls')) {
  5352. $io->writeError('<warning>Skipping phar signature verification as you have disabled OpenSSL via config.disable-tls</warning>');
  5353. } else {
  5354. if (!extension_loaded('openssl')) {
  5355. throw new \RuntimeException('The openssl extension is required for phar signatures to be verified but it is not available. '
  5356. . '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.');
  5357. }
  5358. $sigFile = 'file://'.$home.'/' . ($updatingToTag ? 'keys.tags.pub' : 'keys.dev.pub');
  5359. if (!file_exists($sigFile)) {
  5360. file_put_contents(
  5361. $home.'/keys.dev.pub',
  5362. <<<DEVPUBKEY
  5363. -----BEGIN PUBLIC KEY-----
  5364. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnBDHjZS6e0ZMoK3xTD7f
  5365. FNCzlXjX/Aie2dit8QXA03pSrOTbaMnxON3hUL47Lz3g1SC6YJEMVHr0zYq4elWi
  5366. i3ecFEgzLcj+pZM5X6qWu2Ozz4vWx3JYo1/a/HYdOuW9e3lwS8VtS0AVJA+U8X0A
  5367. hZnBmGpltHhO8hPKHgkJtkTUxCheTcbqn4wGHl8Z2SediDcPTLwqezWKUfrYzu1f
  5368. o/j3WFwFs6GtK4wdYtiXr+yspBZHO3y1udf8eFFGcb2V3EaLOrtfur6XQVizjOuk
  5369. 8lw5zzse1Qp/klHqbDRsjSzJ6iL6F4aynBc6Euqt/8ccNAIz0rLjLhOraeyj4eNn
  5370. 8iokwMKiXpcrQLTKH+RH1JCuOVxQ436bJwbSsp1VwiqftPQieN+tzqy+EiHJJmGf
  5371. TBAbWcncicCk9q2md+AmhNbvHO4PWbbz9TzC7HJb460jyWeuMEvw3gNIpEo2jYa9
  5372. pMV6cVqnSa+wOc0D7pC9a6bne0bvLcm3S+w6I5iDB3lZsb3A9UtRiSP7aGSo7D72
  5373. 8tC8+cIgZcI7k9vjvOqH+d7sdOU2yPCnRY6wFh62/g8bDnUpr56nZN1G89GwM4d4
  5374. r/TU7BQQIzsZgAiqOGXvVklIgAMiV0iucgf3rNBLjjeNEwNSTTG9F0CtQ+7JLwaE
  5375. wSEuAuRm+pRqi8BRnQ/GKUcCAwEAAQ==
  5376. -----END PUBLIC KEY-----
  5377. DEVPUBKEY
  5378. );
  5379. file_put_contents(
  5380. $home.'/keys.tags.pub',
  5381. <<<TAGSPUBKEY
  5382. -----BEGIN PUBLIC KEY-----
  5383. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0Vi/2K6apCVj76nCnCl2
  5384. MQUPdK+A9eqkYBacXo2wQBYmyVlXm2/n/ZsX6pCLYPQTHyr5jXbkQzBw8SKqPdlh
  5385. vA7NpbMeNCz7wP/AobvUXM8xQuXKbMDTY2uZ4O7sM+PfGbptKPBGLe8Z8d2sUnTO
  5386. bXtX6Lrj13wkRto7st/w/Yp33RHe9SlqkiiS4MsH1jBkcIkEHsRaveZzedUaxY0M
  5387. mba0uPhGUInpPzEHwrYqBBEtWvP97t2vtfx8I5qv28kh0Y6t+jnjL1Urid2iuQZf
  5388. noCMFIOu4vksK5HxJxxrN0GOmGmwVQjOOtxkwikNiotZGPR4KsVj8NnBrLX7oGuM
  5389. nQvGciiu+KoC2r3HDBrpDeBVdOWxDzT5R4iI0KoLzFh2pKqwbY+obNPS2bj+2dgJ
  5390. rV3V5Jjry42QOCBN3c88wU1PKftOLj2ECpewY6vnE478IipiEu7EAdK8Zwj2LmTr
  5391. RKQUSa9k7ggBkYZWAeO/2Ag0ey3g2bg7eqk+sHEq5ynIXd5lhv6tC5PBdHlWipDK
  5392. tl2IxiEnejnOmAzGVivE1YGduYBjN+mjxDVy8KGBrjnz1JPgAvgdwJ2dYw4Rsc/e
  5393. TzCFWGk/HM6a4f0IzBWbJ5ot0PIi4amk07IotBXDWwqDiQTwyuGCym5EqWQ2BD95
  5394. RGv89BPD+2DLnJysngsvVaUCAwEAAQ==
  5395. -----END PUBLIC KEY-----
  5396. TAGSPUBKEY
  5397. );
  5398. }
  5399. $pubkeyid = openssl_pkey_get_public($sigFile);
  5400. $algo = defined('OPENSSL_ALGO_SHA384') ? OPENSSL_ALGO_SHA384 : 'SHA384';
  5401. if (!in_array('sha384', array_map('strtolower', openssl_get_md_methods()))) {
  5402. throw new \RuntimeException('SHA384 is not supported by your openssl extension, could not verify the phar file integrity');
  5403. }
  5404. $signature = json_decode($signature, true);
  5405. $signature = base64_decode($signature['sha384']);
  5406. $verified = 1 === openssl_verify(file_get_contents($tempFilename), $signature, $pubkeyid, $algo);
  5407. openssl_free_key($pubkeyid);
  5408. if (!$verified) {
  5409. 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');
  5410. }
  5411. }
  5412. if ($input->getOption('clean-backups')) {
  5413. $this->cleanBackups($rollbackDir);
  5414. }
  5415. if (!$this->setLocalPhar($localFilename, $tempFilename, $backupFile)) {
  5416. @unlink($tempFilename);
  5417. return 1;
  5418. }
  5419. if (file_exists($backupFile)) {
  5420. $io->writeError(sprintf(
  5421. 'Use <info>composer self-update --rollback</info> to return to version <comment>%s</comment>',
  5422. Composer::VERSION
  5423. ));
  5424. } else {
  5425. $io->writeError('<warning>A backup of the current version could not be written to '.$backupFile.', no rollback possible</warning>');
  5426. }
  5427. return 0;
  5428. }
  5429. protected function fetchKeys(IOInterface $io, Config $config)
  5430. {
  5431. if (!$io->isInteractive()) {
  5432. throw new \RuntimeException('Public keys can not be fetched in non-interactive mode, please run Composer interactively');
  5433. }
  5434. $io->write('Open <info>https://composer.github.io/pubkeys.html</info> to find the latest keys');
  5435. $validator = function ($value) {
  5436. if (!preg_match('{^-----BEGIN PUBLIC KEY-----$}', trim($value))) {
  5437. throw new \UnexpectedValueException('Invalid input');
  5438. }
  5439. return trim($value)."\n";
  5440. };
  5441. $devKey = '';
  5442. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $devKey, $match)) {
  5443. $devKey = $io->askAndValidate('Enter Dev / Snapshot Public Key (including lines with -----): ', $validator);
  5444. while ($line = $io->ask('')) {
  5445. $devKey .= trim($line)."\n";
  5446. if (trim($line) === '-----END PUBLIC KEY-----') {
  5447. break;
  5448. }
  5449. }
  5450. }
  5451. file_put_contents($keyPath = $config->get('home').'/keys.dev.pub', $match[0]);
  5452. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  5453. $tagsKey = '';
  5454. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $tagsKey, $match)) {
  5455. $tagsKey = $io->askAndValidate('Enter Tags Public Key (including lines with -----): ', $validator);
  5456. while ($line = $io->ask('')) {
  5457. $tagsKey .= trim($line)."\n";
  5458. if (trim($line) === '-----END PUBLIC KEY-----') {
  5459. break;
  5460. }
  5461. }
  5462. }
  5463. file_put_contents($keyPath = $config->get('home').'/keys.tags.pub', $match[0]);
  5464. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  5465. $io->write('Public keys stored in '.$config->get('home'));
  5466. }
  5467. protected function rollback(OutputInterface $output, $rollbackDir, $localFilename)
  5468. {
  5469. $rollbackVersion = $this->getLastBackupVersion($rollbackDir);
  5470. if (!$rollbackVersion) {
  5471. throw new \UnexpectedValueException('Composer rollback failed: no installation to roll back to in "'.$rollbackDir.'"');
  5472. }
  5473. $oldFile = $rollbackDir . '/' . $rollbackVersion . self::OLD_INSTALL_EXT;
  5474. if (!is_file($oldFile)) {
  5475. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be found');
  5476. }
  5477. if (!is_readable($oldFile)) {
  5478. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be read');
  5479. }
  5480. $io = $this->getIO();
  5481. $io->writeError(sprintf("Rolling back to version <info>%s</info>.", $rollbackVersion));
  5482. if (!$this->setLocalPhar($localFilename, $oldFile)) {
  5483. return 1;
  5484. }
  5485. return 0;
  5486. }
  5487. protected function setLocalPhar($localFilename, $newFilename, $backupTarget = null)
  5488. {
  5489. $io = $this->getIO();
  5490. @chmod($newFilename, fileperms($localFilename));
  5491. if (!$this->validatePhar($newFilename, $error)) {
  5492. $io->writeError('<error>The '.($backupTarget ? 'update' : 'backup').' file is corrupted ('.$error.')</error>');
  5493. if ($backupTarget) {
  5494. $io->writeError('<error>Please re-run the self-update command to try again.</error>');
  5495. }
  5496. return false;
  5497. }
  5498. if ($backupTarget) {
  5499. @copy($localFilename, $backupTarget);
  5500. }
  5501. try {
  5502. rename($newFilename, $localFilename);
  5503. return true;
  5504. } catch (\Exception $e) {
  5505. if (!is_writable(dirname($localFilename))
  5506. && $io->isInteractive()
  5507. && $this->isWindowsNonAdminUser($isCygwin)) {
  5508. return $this->tryAsWindowsAdmin($localFilename, $newFilename, $isCygwin);
  5509. }
  5510. $action = 'Composer '.($backupTarget ? 'update' : 'rollback');
  5511. throw new FilesystemException($action.' failed: "'.$localFilename.'" could not be written.'.PHP_EOL.$e->getMessage());
  5512. }
  5513. }
  5514. protected function cleanBackups($rollbackDir, $except = null)
  5515. {
  5516. $finder = $this->getOldInstallationFinder($rollbackDir);
  5517. $io = $this->getIO();
  5518. $fs = new Filesystem;
  5519. foreach ($finder as $file) {
  5520. if ($except && $file->getBasename(self::OLD_INSTALL_EXT) === $except) {
  5521. continue;
  5522. }
  5523. $file = (string) $file;
  5524. $io->writeError('<info>Removing: '.$file.'</info>');
  5525. $fs->remove($file);
  5526. }
  5527. }
  5528. protected function getLastBackupVersion($rollbackDir)
  5529. {
  5530. $finder = $this->getOldInstallationFinder($rollbackDir);
  5531. $finder->sortByName();
  5532. $files = iterator_to_array($finder);
  5533. if (count($files)) {
  5534. return basename(end($files), self::OLD_INSTALL_EXT);
  5535. }
  5536. return false;
  5537. }
  5538. protected function getOldInstallationFinder($rollbackDir)
  5539. {
  5540. $finder = Finder::create()
  5541. ->depth(0)
  5542. ->files()
  5543. ->name('*' . self::OLD_INSTALL_EXT)
  5544. ->in($rollbackDir);
  5545. return $finder;
  5546. }
  5547. protected function validatePhar($pharFile, &$error)
  5548. {
  5549. if (ini_get('phar.readonly')) {
  5550. return true;
  5551. }
  5552. try {
  5553. $phar = new \Phar($pharFile);
  5554. unset($phar);
  5555. $result = true;
  5556. } catch (\Exception $e) {
  5557. if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
  5558. throw $e;
  5559. }
  5560. $error = $e->getMessage();
  5561. $result = false;
  5562. }
  5563. return $result;
  5564. }
  5565. protected function isWindowsNonAdminUser(&$isCygwin)
  5566. {
  5567. $isCygwin = preg_match('/cygwin/i', php_uname());
  5568. if (!$isCygwin && !Platform::isWindows()) {
  5569. return false;
  5570. }
  5571. $command = sprintf('%sfltmc.exe filters', $isCygwin ? 'cmd.exe /c ' : '');
  5572. exec($command, $output, $exitCode);
  5573. return $exitCode !== 0;
  5574. }
  5575. protected function tryAsWindowsAdmin($localFilename, $newFilename, $isCygwin)
  5576. {
  5577. $io = $this->getIO();
  5578. $io->writeError('<error>Unable to write "'.$localFilename.'". Access is denied.</error>');
  5579. $helpMessage = 'Please run the self-update command as an Administrator.';
  5580. $question = 'Complete this operation with Administrator privileges [<comment>Y,n</comment>]? ';
  5581. if (!$io->askConfirmation($question, false)) {
  5582. $io->writeError('<warning>Operation cancelled. '.$helpMessage.'</warning>');
  5583. return false;
  5584. }
  5585. $tmpFile = tempnam(sys_get_temp_dir(), '');
  5586. $script = $tmpFile.'.vbs';
  5587. rename($tmpFile, $script);
  5588. $checksum = hash_file('sha256', $newFilename);
  5589. if ($isCygwin) {
  5590. $source = exec(sprintf("cygpath -w '%s'", $newFilename));
  5591. $destination = exec(sprintf("cygpath -w '%s'", $localFilename));
  5592. } else {
  5593. $source = str_replace('/', '\\', $newFilename);
  5594. $destination = str_replace('/', '\\', $localFilename);
  5595. }
  5596. $vbs = <<<EOT
  5597. Set UAC = CreateObject("Shell.Application")
  5598. UAC.ShellExecute "cmd.exe", "/c move /y ""$source"" ""$destination""", "", "runas", 0
  5599. Wscript.Sleep(300)
  5600. EOT;
  5601. file_put_contents($script, $vbs);
  5602. if ($isCygwin) {
  5603. chmod($script, 0755);
  5604. $cygscript = sprintf('"%s"', exec(sprintf("cygpath -w '%s'", $script)));
  5605. $command = sprintf("cmd.exe /c '%s'", $cygscript);
  5606. } else {
  5607. $command = sprintf('"%s"', $script);
  5608. }
  5609. exec($command);
  5610. @unlink($script);
  5611. if ($result = (hash_file('sha256', $localFilename) === $checksum)) {
  5612. $io->writeError('<info>Operation succeeded.</info>');
  5613. } else {
  5614. $io->writeError('<error>Operation failed (file not written). '.$helpMessage.'</error>');
  5615. };
  5616. return $result;
  5617. }
  5618. }
  5619. <?php
  5620. namespace Composer\Command;
  5621. use Composer\Composer;
  5622. use Composer\DependencyResolver\DefaultPolicy;
  5623. use Composer\DependencyResolver\Pool;
  5624. use Composer\Json\JsonFile;
  5625. use Composer\Package\BasePackage;
  5626. use Composer\Package\CompletePackageInterface;
  5627. use Composer\Package\PackageInterface;
  5628. use Composer\Package\Version\VersionParser;
  5629. use Composer\Package\Version\VersionSelector;
  5630. use Composer\Plugin\CommandEvent;
  5631. use Composer\Plugin\PluginEvents;
  5632. use Composer\Repository\ArrayRepository;
  5633. use Composer\Repository\ComposerRepository;
  5634. use Composer\Repository\CompositeRepository;
  5635. use Composer\Repository\PlatformRepository;
  5636. use Composer\Repository\RepositoryFactory;
  5637. use Composer\Repository\RepositoryInterface;
  5638. use Composer\Semver\Constraint\ConstraintInterface;
  5639. use Composer\Semver\Semver;
  5640. use Composer\Spdx\SpdxLicenses;
  5641. use Composer\Util\Platform;
  5642. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  5643. use Symfony\Component\Console\Input\InputArgument;
  5644. use Symfony\Component\Console\Input\InputInterface;
  5645. use Symfony\Component\Console\Input\InputOption;
  5646. use Symfony\Component\Console\Output\OutputInterface;
  5647. use Symfony\Component\Console\Terminal;
  5648. class ShowCommand extends BaseCommand
  5649. {
  5650. protected $versionParser;
  5651. protected $colors;
  5652. private $pool;
  5653. protected function configure()
  5654. {
  5655. $this
  5656. ->setName('show')
  5657. ->setAliases(array('info'))
  5658. ->setDescription('Shows information about packages.')
  5659. ->setDefinition(array(
  5660. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  5661. new InputArgument('version', InputArgument::OPTIONAL, 'Version or version constraint to inspect'),
  5662. new InputOption('all', null, InputOption::VALUE_NONE, 'List all packages'),
  5663. new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only (enabled by default, only present for BC).'),
  5664. new InputOption('platform', 'p', InputOption::VALUE_NONE, 'List platform packages only'),
  5665. new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available packages only'),
  5666. new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'),
  5667. new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'),
  5668. new InputOption('path', 'P', InputOption::VALUE_NONE, 'Show package paths'),
  5669. new InputOption('tree', 't', InputOption::VALUE_NONE, 'List the dependencies as a tree'),
  5670. new InputOption('latest', 'l', InputOption::VALUE_NONE, 'Show the latest version'),
  5671. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show the latest version but only for packages that are outdated'),
  5672. new InputOption('ignore', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore specified package(s). Use it with the --outdated option if you don\'t want to be informed about new versions of some packages.'),
  5673. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  5674. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  5675. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  5676. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  5677. ))
  5678. ->setHelp(
  5679. <<<EOT
  5680. The show command displays detailed information about a package, or
  5681. lists all packages available.
  5682. Read more at https://getcomposer.org/doc/03-cli.md#show
  5683. EOT
  5684. )
  5685. ;
  5686. }
  5687. protected function execute(InputInterface $input, OutputInterface $output)
  5688. {
  5689. $this->versionParser = new VersionParser;
  5690. if ($input->getOption('tree')) {
  5691. $this->initStyles($output);
  5692. }
  5693. $composer = $this->getComposer(false);
  5694. $io = $this->getIO();
  5695. if ($input->getOption('installed')) {
  5696. $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>');
  5697. }
  5698. if ($input->getOption('outdated')) {
  5699. $input->setOption('latest', true);
  5700. } elseif ($input->getOption('ignore')) {
  5701. $io->writeError('<warning>You are using the option "ignore" for action other than "outdated", it will be ignored.</warning>');
  5702. }
  5703. if ($input->getOption('direct') && ($input->getOption('all') || $input->getOption('available') || $input->getOption('platform'))) {
  5704. $io->writeError('The --direct (-D) option is not usable in combination with --all, --platform (-p) or --available (-a)');
  5705. return 1;
  5706. }
  5707. if ($input->getOption('tree') && ($input->getOption('all') || $input->getOption('available'))) {
  5708. $io->writeError('The --tree (-t) option is not usable in combination with --all or --available (-a)');
  5709. return 1;
  5710. }
  5711. if ($input->getOption('tree') && $input->getOption('latest')) {
  5712. $io->writeError('The --tree (-t) option is not usable in combination with --latest (-l)');
  5713. return 1;
  5714. }
  5715. if ($input->getOption('tree') && $input->getOption('path')) {
  5716. $io->writeError('The --tree (-t) option is not usable in combination with --path (-P)');
  5717. return 1;
  5718. }
  5719. $format = $input->getOption('format');
  5720. if (!in_array($format, array('text', 'json'))) {
  5721. $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  5722. return 1;
  5723. }
  5724. $platformOverrides = array();
  5725. if ($composer) {
  5726. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  5727. }
  5728. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  5729. $phpVersion = $platformRepo->findPackage('php', '*')->getVersion();
  5730. if ($input->getOption('self')) {
  5731. $package = $this->getComposer()->getPackage();
  5732. if ($input->getOption('name-only')) {
  5733. $io->write($package->getName());
  5734. return 0;
  5735. }
  5736. $repos = $installedRepo = new ArrayRepository(array($package));
  5737. } elseif ($input->getOption('platform')) {
  5738. $repos = $installedRepo = $platformRepo;
  5739. } elseif ($input->getOption('available')) {
  5740. $installedRepo = $platformRepo;
  5741. if ($composer) {
  5742. $repos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  5743. } else {
  5744. $defaultRepos = RepositoryFactory::defaultRepos($io);
  5745. $repos = new CompositeRepository($defaultRepos);
  5746. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  5747. }
  5748. } elseif ($input->getOption('all') && $composer) {
  5749. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  5750. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  5751. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  5752. } elseif ($input->getOption('all')) {
  5753. $defaultRepos = RepositoryFactory::defaultRepos($io);
  5754. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  5755. $installedRepo = $platformRepo;
  5756. $repos = new CompositeRepository(array_merge(array($installedRepo), $defaultRepos));
  5757. } else {
  5758. $repos = $installedRepo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
  5759. $rootPkg = $this->getComposer()->getPackage();
  5760. if (!$installedRepo->getPackages() && ($rootPkg->getRequires() || $rootPkg->getDevRequires())) {
  5761. $io->writeError('<warning>No dependencies installed. Try running composer install or update.</warning>');
  5762. }
  5763. }
  5764. if ($composer) {
  5765. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'show', $input, $output);
  5766. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5767. }
  5768. if ($input->getOption('latest') && null === $composer) {
  5769. $io->writeError('No composer.json found in the current directory, disabling "latest" option');
  5770. $input->setOption('latest', false);
  5771. }
  5772. $packageFilter = $input->getArgument('package');
  5773. if (($packageFilter && false === strpos($packageFilter, '*')) || !empty($package)) {
  5774. if (empty($package)) {
  5775. list($package, $versions) = $this->getPackage($installedRepo, $repos, $input->getArgument('package'), $input->getArgument('version'));
  5776. if (empty($package)) {
  5777. $options = $input->getOptions();
  5778. if (!isset($options['working-dir']) || !file_exists('composer.json')) {
  5779. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $input->getArgument('package')) && !$input->getOption('platform')) {
  5780. throw new \InvalidArgumentException('Package ' . $packageFilter . ' not found, try using --platform (-p) to show platform packages.');
  5781. }
  5782. throw new \InvalidArgumentException('Package ' . $packageFilter . ' not found');
  5783. }
  5784. $io->writeError('Package ' . $packageFilter . ' not found in ' . $options['working-dir'] . '/composer.json');
  5785. return 1;
  5786. }
  5787. } else {
  5788. $versions = array($package->getPrettyVersion() => $package->getVersion());
  5789. }
  5790. $exitCode = 0;
  5791. if ($input->getOption('tree')) {
  5792. $arrayTree = $this->generatePackageTree($package, $installedRepo, $repos);
  5793. if ('json' === $format) {
  5794. $io->write(JsonFile::encode(array('installed' => array($arrayTree))));
  5795. } else {
  5796. $this->displayPackageTree(array($arrayTree));
  5797. }
  5798. } else {
  5799. $latestPackage = null;
  5800. if ($input->getOption('latest')) {
  5801. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion);
  5802. }
  5803. if ($input->getOption('outdated') && $input->getOption('strict') && $latestPackage && $latestPackage->getFullPrettyVersion() !== $package->getFullPrettyVersion() && !$latestPackage->isAbandoned()) {
  5804. $exitCode = 1;
  5805. }
  5806. if ($input->getOption('path')) {
  5807. $io->write($package->getName(), false);
  5808. $io->write(' ' . strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n"));
  5809. return $exitCode;
  5810. }
  5811. if ('json' === $format) {
  5812. $this->printPackageInfoAsJson($package, $versions, $installedRepo, $latestPackage ?: null);
  5813. } else {
  5814. $this->printPackageInfo($package, $versions, $installedRepo, $latestPackage ?: null);
  5815. }
  5816. }
  5817. return $exitCode;
  5818. }
  5819. if ($input->getOption('tree')) {
  5820. $rootRequires = $this->getRootRequires();
  5821. $packages = $installedRepo->getPackages();
  5822. usort($packages, 'strcmp');
  5823. $arrayTree = array();
  5824. foreach ($packages as $package) {
  5825. if (in_array($package->getName(), $rootRequires, true)) {
  5826. $arrayTree[] = $this->generatePackageTree($package, $installedRepo, $repos);
  5827. }
  5828. }
  5829. if ('json' === $format) {
  5830. $io->write(JsonFile::encode(array('installed' => $arrayTree)));
  5831. } else {
  5832. $this->displayPackageTree($arrayTree);
  5833. }
  5834. return 0;
  5835. }
  5836. if ($repos instanceof CompositeRepository) {
  5837. $repos = $repos->getRepositories();
  5838. } elseif (!is_array($repos)) {
  5839. $repos = array($repos);
  5840. }
  5841. $packages = array();
  5842. if (null !== $packageFilter) {
  5843. $packageFilter = '{^'.str_replace('\\*', '.*?', preg_quote($packageFilter)).'$}i';
  5844. }
  5845. $packageListFilter = array();
  5846. if ($input->getOption('direct')) {
  5847. $packageListFilter = $this->getRootRequires();
  5848. }
  5849. if (class_exists('Symfony\Component\Console\Terminal')) {
  5850. $terminal = new Terminal();
  5851. $width = $terminal->getWidth();
  5852. } else {
  5853. list($width) = $this->getApplication()->getTerminalDimensions();
  5854. }
  5855. if (null === $width) {
  5856. $width = PHP_INT_MAX;
  5857. }
  5858. if (Platform::isWindows()) {
  5859. $width--;
  5860. } else {
  5861. $width = max(80, $width);
  5862. }
  5863. if ($input->getOption('path') && null === $composer) {
  5864. $io->writeError('No composer.json found in the current directory, disabling "path" option');
  5865. $input->setOption('path', false);
  5866. }
  5867. foreach ($repos as $repo) {
  5868. if ($repo === $platformRepo) {
  5869. $type = 'platform';
  5870. } elseif (
  5871. $repo === $installedRepo
  5872. || ($installedRepo instanceof CompositeRepository && in_array($repo, $installedRepo->getRepositories(), true))
  5873. ) {
  5874. $type = 'installed';
  5875. } else {
  5876. $type = 'available';
  5877. }
  5878. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  5879. foreach ($repo->getProviderNames() as $name) {
  5880. if (!$packageFilter || preg_match($packageFilter, $name)) {
  5881. $packages[$type][$name] = $name;
  5882. }
  5883. }
  5884. } else {
  5885. foreach ($repo->getPackages() as $package) {
  5886. if (!isset($packages[$type][$package->getName()])
  5887. || !is_object($packages[$type][$package->getName()])
  5888. || version_compare($packages[$type][$package->getName()]->getVersion(), $package->getVersion(), '<')
  5889. ) {
  5890. if (!$packageFilter || preg_match($packageFilter, $package->getName())) {
  5891. if (!$packageListFilter || in_array($package->getName(), $packageListFilter, true)) {
  5892. $packages[$type][$package->getName()] = $package;
  5893. }
  5894. }
  5895. }
  5896. }
  5897. }
  5898. }
  5899. $showAllTypes = $input->getOption('all');
  5900. $showLatest = $input->getOption('latest');
  5901. $showMinorOnly = $input->getOption('minor-only');
  5902. $ignoredPackages = array_map('strtolower', $input->getOption('ignore'));
  5903. $indent = $showAllTypes ? ' ' : '';
  5904. $latestPackages = array();
  5905. $exitCode = 0;
  5906. $viewData = array();
  5907. $viewMetaData = array();
  5908. foreach (array('platform' => true, 'available' => false, 'installed' => true) as $type => $showVersion) {
  5909. if (isset($packages[$type])) {
  5910. ksort($packages[$type]);
  5911. $nameLength = $versionLength = $latestLength = 0;
  5912. if ($showLatest && $showVersion) {
  5913. foreach ($packages[$type] as $package) {
  5914. if (is_object($package)) {
  5915. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion, $showMinorOnly);
  5916. if ($latestPackage === false) {
  5917. continue;
  5918. }
  5919. $latestPackages[$package->getPrettyName()] = $latestPackage;
  5920. }
  5921. }
  5922. }
  5923. $writePath = !$input->getOption('name-only') && $input->getOption('path');
  5924. $writeVersion = !$input->getOption('name-only') && !$input->getOption('path') && $showVersion;
  5925. $writeLatest = $writeVersion && $showLatest;
  5926. $writeDescription = !$input->getOption('name-only') && !$input->getOption('path');
  5927. $hasOutdatedPackages = false;
  5928. $viewData[$type] = array();
  5929. foreach ($packages[$type] as $package) {
  5930. $packageViewData = array();
  5931. if (is_object($package)) {
  5932. $latestPackage = null;
  5933. if ($showLatest && isset($latestPackages[$package->getPrettyName()])) {
  5934. $latestPackage = $latestPackages[$package->getPrettyName()];
  5935. }
  5936. $packageIsUpToDate = $latestPackage && $latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion() && !$latestPackage->isAbandoned();
  5937. $packageIsIgnored = \in_array($package->getPrettyName(), $ignoredPackages, true);
  5938. if ($input->getOption('outdated') && ($packageIsUpToDate || $packageIsIgnored)) {
  5939. continue;
  5940. } elseif ($input->getOption('outdated') || $input->getOption('strict')) {
  5941. $hasOutdatedPackages = true;
  5942. }
  5943. $packageViewData['name'] = $package->getPrettyName();
  5944. $nameLength = max($nameLength, strlen($package->getPrettyName()));
  5945. if ($writeVersion) {
  5946. $packageViewData['version'] = $package->getFullPrettyVersion();
  5947. $versionLength = max($versionLength, strlen($package->getFullPrettyVersion()));
  5948. }
  5949. if ($writeLatest && $latestPackage) {
  5950. $packageViewData['latest'] = $latestPackage->getFullPrettyVersion();
  5951. $packageViewData['latest-status'] = $this->getUpdateStatus($latestPackage, $package);
  5952. $latestLength = max($latestLength, strlen($latestPackage->getFullPrettyVersion()));
  5953. }
  5954. if ($writeDescription) {
  5955. $packageViewData['description'] = $package->getDescription();
  5956. }
  5957. if ($writePath) {
  5958. $packageViewData['path'] = strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n");
  5959. }
  5960. if ($latestPackage && $latestPackage->isAbandoned()) {
  5961. $replacement = is_string($latestPackage->getReplacementPackage())
  5962. ? 'Use ' . $latestPackage->getReplacementPackage() . ' instead'
  5963. : 'No replacement was suggested';
  5964. $packageWarning = sprintf(
  5965. 'Package %s is abandoned, you should avoid using it. %s.',
  5966. $package->getPrettyName(),
  5967. $replacement
  5968. );
  5969. $packageViewData['warning'] = $packageWarning;
  5970. }
  5971. } else {
  5972. $packageViewData['name'] = $package;
  5973. $nameLength = max($nameLength, strlen($package));
  5974. }
  5975. $viewData[$type][] = $packageViewData;
  5976. }
  5977. $viewMetaData[$type] = array(
  5978. 'nameLength' => $nameLength,
  5979. 'versionLength' => $versionLength,
  5980. 'latestLength' => $latestLength,
  5981. );
  5982. if ($input->getOption('strict') && $hasOutdatedPackages) {
  5983. $exitCode = 1;
  5984. break;
  5985. }
  5986. }
  5987. }
  5988. if ('json' === $format) {
  5989. $io->write(JsonFile::encode($viewData));
  5990. } else {
  5991. foreach ($viewData as $type => $packages) {
  5992. $nameLength = $viewMetaData[$type]['nameLength'];
  5993. $versionLength = $viewMetaData[$type]['versionLength'];
  5994. $latestLength = $viewMetaData[$type]['latestLength'];
  5995. $writeVersion = $nameLength + $versionLength + 3 <= $width;
  5996. $writeLatest = $nameLength + $versionLength + $latestLength + 3 <= $width;
  5997. $writeDescription = $nameLength + $versionLength + $latestLength + 24 <= $width;
  5998. if ($writeLatest && !$io->isDecorated()) {
  5999. $latestLength += 2;
  6000. }
  6001. if ($showAllTypes) {
  6002. if ('available' === $type) {
  6003. $io->write('<comment>' . $type . '</comment>:');
  6004. } else {
  6005. $io->write('<info>' . $type . '</info>:');
  6006. }
  6007. }
  6008. foreach ($packages as $package) {
  6009. $io->write($indent . str_pad($package['name'], $nameLength, ' '), false);
  6010. if (isset($package['version']) && $writeVersion) {
  6011. $io->write(' ' . str_pad($package['version'], $versionLength, ' '), false);
  6012. }
  6013. if (isset($package['latest']) && $writeLatest) {
  6014. $latestVersion = $package['latest'];
  6015. $updateStatus = $package['latest-status'];
  6016. $style = $this->updateStatusToVersionStyle($updateStatus);
  6017. if (!$io->isDecorated()) {
  6018. $latestVersion = str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('=', '!', '~'), $updateStatus) . ' ' . $latestVersion;
  6019. }
  6020. $io->write(' <' . $style . '>' . str_pad($latestVersion, $latestLength, ' ') . '</' . $style . '>', false);
  6021. }
  6022. if (isset($package['description']) && $writeDescription) {
  6023. $description = strtok($package['description'], "\r\n");
  6024. $remaining = $width - $nameLength - $versionLength - 4;
  6025. if ($writeLatest) {
  6026. $remaining -= $latestLength;
  6027. }
  6028. if (strlen($description) > $remaining) {
  6029. $description = substr($description, 0, $remaining - 3) . '...';
  6030. }
  6031. $io->write(' ' . $description, false);
  6032. }
  6033. if (isset($package['path'])) {
  6034. $io->write(' ' . $package['path'], false);
  6035. }
  6036. $io->write('');
  6037. if (isset($package['warning'])) {
  6038. $io->write('<warning>' . $package['warning'] . '</warning>');
  6039. }
  6040. }
  6041. if ($showAllTypes) {
  6042. $io->write('');
  6043. }
  6044. }
  6045. }
  6046. return $exitCode;
  6047. }
  6048. protected function getRootRequires()
  6049. {
  6050. $rootPackage = $this->getComposer()->getPackage();
  6051. return array_map(
  6052. 'strtolower',
  6053. array_keys(array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()))
  6054. );
  6055. }
  6056. protected function getVersionStyle(PackageInterface $latestPackage, PackageInterface $package)
  6057. {
  6058. return $this->updateStatusToVersionStyle($this->getUpdateStatus($latestPackage, $package));
  6059. }
  6060. protected function getPackage(RepositoryInterface $installedRepo, RepositoryInterface $repos, $name, $version = null)
  6061. {
  6062. $name = strtolower($name);
  6063. $constraint = is_string($version) ? $this->versionParser->parseConstraints($version) : $version;
  6064. $policy = new DefaultPolicy();
  6065. $pool = new Pool('dev');
  6066. $pool->addRepository($repos);
  6067. $matchedPackage = null;
  6068. $versions = array();
  6069. $matches = $pool->whatProvides($name, $constraint);
  6070. foreach ($matches as $index => $package) {
  6071. if ($package->getName() !== $name) {
  6072. unset($matches[$index]);
  6073. continue;
  6074. }
  6075. if (null === $version && $installedRepo->hasPackage($package)) {
  6076. $matchedPackage = $package;
  6077. }
  6078. $versions[$package->getPrettyVersion()] = $package->getVersion();
  6079. $matches[$index] = $package->getId();
  6080. }
  6081. if (!$matchedPackage && $matches && $preferred = $policy->selectPreferredPackages($pool, array(), $matches)) {
  6082. $matchedPackage = $pool->literalToPackage($preferred[0]);
  6083. }
  6084. return array($matchedPackage, $versions);
  6085. }
  6086. protected function printPackageInfo(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, PackageInterface $latestPackage = null)
  6087. {
  6088. $io = $this->getIO();
  6089. $this->printMeta($package, $versions, $installedRepo, $latestPackage ?: null);
  6090. $this->printLinks($package, 'requires');
  6091. $this->printLinks($package, 'devRequires', 'requires (dev)');
  6092. if ($package->getSuggests()) {
  6093. $io->write("\n<info>suggests</info>");
  6094. foreach ($package->getSuggests() as $suggested => $reason) {
  6095. $io->write($suggested . ' <comment>' . $reason . '</comment>');
  6096. }
  6097. }
  6098. $this->printLinks($package, 'provides');
  6099. $this->printLinks($package, 'conflicts');
  6100. $this->printLinks($package, 'replaces');
  6101. }
  6102. protected function printMeta(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, PackageInterface $latestPackage = null)
  6103. {
  6104. $io = $this->getIO();
  6105. $io->write('<info>name</info> : ' . $package->getPrettyName());
  6106. $io->write('<info>descrip.</info> : ' . $package->getDescription());
  6107. $io->write('<info>keywords</info> : ' . implode(', ', $package->getKeywords() ?: array()));
  6108. $this->printVersions($package, $versions, $installedRepo);
  6109. if ($latestPackage) {
  6110. $style = $this->getVersionStyle($latestPackage, $package);
  6111. $io->write('<info>latest</info> : <'.$style.'>' . $latestPackage->getPrettyVersion() . '</'.$style.'>');
  6112. } else {
  6113. $latestPackage = $package;
  6114. }
  6115. $io->write('<info>type</info> : ' . $package->getType());
  6116. $this->printLicenses($package);
  6117. $io->write('<info>homepage</info> : ' . $package->getHomepage());
  6118. $io->write('<info>source</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference()));
  6119. $io->write('<info>dist</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference()));
  6120. if ($installedRepo->hasPackage($package)) {
  6121. $io->write('<info>path</info> : ' . sprintf('%s', realpath($this->getComposer()->getInstallationManager()->getInstallPath($package))));
  6122. }
  6123. $io->write('<info>names</info> : ' . implode(', ', $package->getNames()));
  6124. if ($latestPackage->isAbandoned()) {
  6125. $replacement = ($latestPackage->getReplacementPackage() !== null)
  6126. ? ' The author suggests using the ' . $latestPackage->getReplacementPackage(). ' package instead.'
  6127. : null;
  6128. $io->writeError(
  6129. sprintf('<warning>Attention: This package is abandoned and no longer maintained.%s</warning>', $replacement)
  6130. );
  6131. }
  6132. if ($package->getSupport()) {
  6133. $io->write("\n<info>support</info>");
  6134. foreach ($package->getSupport() as $type => $value) {
  6135. $io->write('<comment>' . $type . '</comment> : '.$value);
  6136. }
  6137. }
  6138. if ($package->getAutoload()) {
  6139. $io->write("\n<info>autoload</info>");
  6140. foreach ($package->getAutoload() as $type => $autoloads) {
  6141. $io->write('<comment>' . $type . '</comment>');
  6142. if ($type === 'psr-0') {
  6143. foreach ($autoloads as $name => $path) {
  6144. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  6145. }
  6146. } elseif ($type === 'psr-4') {
  6147. foreach ($autoloads as $name => $path) {
  6148. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  6149. }
  6150. } elseif ($type === 'classmap') {
  6151. $io->write(implode(', ', $autoloads));
  6152. }
  6153. }
  6154. if ($package->getIncludePaths()) {
  6155. $io->write('<comment>include-path</comment>');
  6156. $io->write(implode(', ', $package->getIncludePaths()));
  6157. }
  6158. }
  6159. }
  6160. protected function printVersions(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo)
  6161. {
  6162. uasort($versions, 'version_compare');
  6163. $versions = array_keys(array_reverse($versions));
  6164. if ($installedRepo->hasPackage($package)) {
  6165. $installedVersion = $package->getPrettyVersion();
  6166. $key = array_search($installedVersion, $versions);
  6167. if (false !== $key) {
  6168. $versions[$key] = '<info>* ' . $installedVersion . '</info>';
  6169. }
  6170. }
  6171. $versions = implode(', ', $versions);
  6172. $this->getIO()->write('<info>versions</info> : ' . $versions);
  6173. }
  6174. protected function printLinks(CompletePackageInterface $package, $linkType, $title = null)
  6175. {
  6176. $title = $title ?: $linkType;
  6177. $io = $this->getIO();
  6178. if ($links = $package->{'get'.ucfirst($linkType)}()) {
  6179. $io->write("\n<info>" . $title . "</info>");
  6180. foreach ($links as $link) {
  6181. $io->write($link->getTarget() . ' <comment>' . $link->getPrettyConstraint() . '</comment>');
  6182. }
  6183. }
  6184. }
  6185. protected function printLicenses(CompletePackageInterface $package)
  6186. {
  6187. $spdxLicenses = new SpdxLicenses();
  6188. $licenses = $package->getLicense();
  6189. $io = $this->getIO();
  6190. foreach ($licenses as $licenseId) {
  6191. $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
  6192. if (!$license) {
  6193. $out = $licenseId;
  6194. } else {
  6195. if ($license[1] === true) {
  6196. $out = sprintf('%s (%s) (OSI approved) %s', $license[0], $licenseId, $license[2]);
  6197. } else {
  6198. $out = sprintf('%s (%s) %s', $license[0], $licenseId, $license[2]);
  6199. }
  6200. }
  6201. $io->write('<info>license</info> : ' . $out);
  6202. }
  6203. }
  6204. protected function printPackageInfoAsJson(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, PackageInterface $latestPackage = null)
  6205. {
  6206. $json = array(
  6207. 'name' => $package->getPrettyName(),
  6208. 'description' => $package->getDescription(),
  6209. 'keywords' => $package->getKeywords() ?: array(),
  6210. 'type' => $package->getType(),
  6211. 'homepage' => $package->getHomepage(),
  6212. 'names' => $package->getNames()
  6213. );
  6214. $json = $this->appendVersions($json, $versions);
  6215. $json = $this->appendLicenses($json, $package);
  6216. if ($latestPackage) {
  6217. $json['latest'] = $latestPackage->getPrettyVersion();
  6218. } else {
  6219. $latestPackage = $package;
  6220. }
  6221. if ($package->getSourceType()) {
  6222. $json['source'] = array(
  6223. 'type' => $package->getSourceType(),
  6224. 'url' => $package->getSourceUrl(),
  6225. 'reference' => $package->getSourceReference()
  6226. );
  6227. }
  6228. if ($package->getDistType()) {
  6229. $json['dist'] = array(
  6230. 'type' => $package->getDistType(),
  6231. 'url' => $package->getDistUrl(),
  6232. 'reference' => $package->getDistReference()
  6233. );
  6234. }
  6235. if ($installedRepo->hasPackage($package)) {
  6236. $json['path'] = realpath($this->getComposer()->getInstallationManager()->getInstallPath($package));
  6237. if ($json['path'] === false) {
  6238. unset($json['path']);
  6239. }
  6240. }
  6241. if ($latestPackage->isAbandoned()) {
  6242. $json['replacement'] = $latestPackage->getReplacementPackage();
  6243. }
  6244. if ($package->getSuggests()) {
  6245. $json['suggests'] = $package->getSuggests();
  6246. }
  6247. if ($package->getSupport()) {
  6248. $json['support'] = $package->getSupport();
  6249. }
  6250. $json = $this->appendAutoload($json, $package);
  6251. if ($package->getIncludePaths()) {
  6252. $json['include_path'] = $package->getIncludePaths();
  6253. }
  6254. $json = $this->appendLinks($json, $package);
  6255. $this->getIO()->write(JsonFile::encode($json));
  6256. }
  6257. private function appendVersions($json, array $versions)
  6258. {
  6259. uasort($versions, 'version_compare');
  6260. $versions = array_keys(array_reverse($versions));
  6261. $json['versions'] = $versions;
  6262. return $json;
  6263. }
  6264. private function appendLicenses($json, CompletePackageInterface $package)
  6265. {
  6266. if ($licenses = $package->getLicense()) {
  6267. $spdxLicenses = new SpdxLicenses();
  6268. $json['licenses'] = array_map(function ($licenseId) use ($spdxLicenses) {
  6269. $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
  6270. if (!$license) {
  6271. return $licenseId;
  6272. }
  6273. return array(
  6274. 'name' => $license[0],
  6275. 'osi' => $licenseId,
  6276. 'url' => $license[2]
  6277. );
  6278. }, $licenses);
  6279. }
  6280. return $json;
  6281. }
  6282. private function appendAutoload($json, CompletePackageInterface $package)
  6283. {
  6284. if ($package->getAutoload()) {
  6285. $autoload = array();
  6286. foreach ($package->getAutoload() as $type => $autoloads) {
  6287. if ($type === 'psr-0' || $type === 'psr-4') {
  6288. $psr = array();
  6289. foreach ($autoloads as $name => $path) {
  6290. if (!$path) {
  6291. $path = '.';
  6292. }
  6293. $psr[$name ?: '*'] = $path;
  6294. }
  6295. $autoload[$type] = $psr;
  6296. } elseif ($type === 'classmap') {
  6297. $autoload['classmap'] = $autoloads;
  6298. }
  6299. }
  6300. $json['autoload'] = $autoload;
  6301. }
  6302. return $json;
  6303. }
  6304. private function appendLinks($json, CompletePackageInterface $package)
  6305. {
  6306. foreach (array('requires', 'devRequires', 'provides', 'conflicts', 'replaces') as $linkType) {
  6307. $json = $this->appendLink($json, $package, $linkType);
  6308. }
  6309. return $json;
  6310. }
  6311. private function appendLink($json, CompletePackageInterface $package, $linkType)
  6312. {
  6313. $links = $package->{'get' . ucfirst($linkType)}();
  6314. if ($links) {
  6315. $json[$linkType] = array();
  6316. foreach ($links as $link) {
  6317. $json[$linkType][$link->getTarget()] = $link->getPrettyConstraint();
  6318. }
  6319. }
  6320. return $json;
  6321. }
  6322. protected function initStyles(OutputInterface $output)
  6323. {
  6324. $this->colors = array(
  6325. 'green',
  6326. 'yellow',
  6327. 'cyan',
  6328. 'magenta',
  6329. 'blue',
  6330. );
  6331. foreach ($this->colors as $color) {
  6332. $style = new OutputFormatterStyle($color);
  6333. $output->getFormatter()->setStyle($color, $style);
  6334. }
  6335. }
  6336. protected function displayPackageTree(array $arrayTree)
  6337. {
  6338. $io = $this->getIO();
  6339. foreach ($arrayTree as $package) {
  6340. $io->write(sprintf('<info>%s</info>', $package['name']), false);
  6341. $io->write(' ' . $package['version'], false);
  6342. $io->write(' ' . strtok($package['description'], "\r\n"));
  6343. if (isset($package['requires'])) {
  6344. $requires = $package['requires'];
  6345. $treeBar = '├';
  6346. $j = 0;
  6347. $total = count($requires);
  6348. foreach ($requires as $require) {
  6349. $requireName = $require['name'];
  6350. $j++;
  6351. if ($j === $total) {
  6352. $treeBar = 'â””';
  6353. }
  6354. $level = 1;
  6355. $color = $this->colors[$level];
  6356. $info = sprintf(
  6357. '%s──<%s>%s</%s> %s',
  6358. $treeBar,
  6359. $color,
  6360. $requireName,
  6361. $color,
  6362. $require['version']
  6363. );
  6364. $this->writeTreeLine($info);
  6365. $treeBar = str_replace('â””', ' ', $treeBar);
  6366. $packagesInTree = array($package['name'], $requireName);
  6367. $this->displayTree($require, $packagesInTree, $treeBar, $level + 1);
  6368. }
  6369. }
  6370. }
  6371. }
  6372. protected function generatePackageTree(
  6373. PackageInterface $package,
  6374. RepositoryInterface $installedRepo,
  6375. RepositoryInterface $distantRepos
  6376. ) {
  6377. $requires = $package->getRequires();
  6378. ksort($requires);
  6379. $children = array();
  6380. foreach ($requires as $requireName => $require) {
  6381. $packagesInTree = array($package->getName(), $requireName);
  6382. $treeChildDesc = array(
  6383. 'name' => $requireName,
  6384. 'version' => $require->getPrettyConstraint(),
  6385. );
  6386. $deepChildren = $this->addTree($requireName, $require, $installedRepo, $distantRepos, $packagesInTree);
  6387. if ($deepChildren) {
  6388. $treeChildDesc['requires'] = $deepChildren;
  6389. }
  6390. $children[] = $treeChildDesc;
  6391. }
  6392. $tree = array(
  6393. 'name' => $package->getPrettyName(),
  6394. 'version' => $package->getPrettyVersion(),
  6395. 'description' => $package->getDescription(),
  6396. );
  6397. if ($children) {
  6398. $tree['requires'] = $children;
  6399. }
  6400. return $tree;
  6401. }
  6402. protected function displayTree(
  6403. $package,
  6404. array $packagesInTree,
  6405. $previousTreeBar = '├',
  6406. $level = 1
  6407. ) {
  6408. $previousTreeBar = str_replace('├', '│', $previousTreeBar);
  6409. if (isset($package['requires'])) {
  6410. $requires = $package['requires'];
  6411. $treeBar = $previousTreeBar . ' ├';
  6412. $i = 0;
  6413. $total = count($requires);
  6414. foreach ($requires as $require) {
  6415. $currentTree = $packagesInTree;
  6416. $i++;
  6417. if ($i === $total) {
  6418. $treeBar = $previousTreeBar . ' â””';
  6419. }
  6420. $colorIdent = $level % count($this->colors);
  6421. $color = $this->colors[$colorIdent];
  6422. $circularWarn = in_array(
  6423. $require['name'],
  6424. $currentTree,
  6425. true
  6426. ) ? '(circular dependency aborted here)' : '';
  6427. $info = rtrim(sprintf(
  6428. '%s──<%s>%s</%s> %s %s',
  6429. $treeBar,
  6430. $color,
  6431. $require['name'],
  6432. $color,
  6433. $require['version'],
  6434. $circularWarn
  6435. ));
  6436. $this->writeTreeLine($info);
  6437. $treeBar = str_replace('â””', ' ', $treeBar);
  6438. $currentTree[] = $require['name'];
  6439. $this->displayTree($require, $currentTree, $treeBar, $level + 1);
  6440. }
  6441. }
  6442. }
  6443. protected function addTree(
  6444. $name,
  6445. $package,
  6446. RepositoryInterface $installedRepo,
  6447. RepositoryInterface $distantRepos,
  6448. array $packagesInTree
  6449. ) {
  6450. $children = array();
  6451. list($package, $versions) = $this->getPackage(
  6452. $installedRepo,
  6453. $distantRepos,
  6454. $name,
  6455. $package->getPrettyConstraint() === 'self.version' ? $package->getConstraint() : $package->getPrettyConstraint()
  6456. );
  6457. if (is_object($package)) {
  6458. $requires = $package->getRequires();
  6459. ksort($requires);
  6460. foreach ($requires as $requireName => $require) {
  6461. $currentTree = $packagesInTree;
  6462. $treeChildDesc = array(
  6463. 'name' => $requireName,
  6464. 'version' => $require->getPrettyConstraint(),
  6465. );
  6466. if (!in_array($requireName, $currentTree, true)) {
  6467. $currentTree[] = $requireName;
  6468. $deepChildren = $this->addTree($requireName, $require, $installedRepo, $distantRepos, $currentTree);
  6469. if ($deepChildren) {
  6470. $treeChildDesc['requires'] = $deepChildren;
  6471. }
  6472. }
  6473. $children[] = $treeChildDesc;
  6474. }
  6475. }
  6476. return $children;
  6477. }
  6478. private function updateStatusToVersionStyle($updateStatus)
  6479. {
  6480. return str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('info', 'highlight', 'comment'), $updateStatus);
  6481. }
  6482. private function getUpdateStatus(PackageInterface $latestPackage, PackageInterface $package)
  6483. {
  6484. if ($latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion()) {
  6485. return 'up-to-date';
  6486. }
  6487. $constraint = $package->getVersion();
  6488. if (0 !== strpos($constraint, 'dev-')) {
  6489. $constraint = '^'.$constraint;
  6490. }
  6491. if ($latestPackage->getVersion() && Semver::satisfies($latestPackage->getVersion(), $constraint)) {
  6492. return 'semver-safe-update';
  6493. }
  6494. return 'update-possible';
  6495. }
  6496. private function writeTreeLine($line)
  6497. {
  6498. $io = $this->getIO();
  6499. if (!$io->isDecorated()) {
  6500. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  6501. }
  6502. $io->write($line);
  6503. }
  6504. private function findLatestPackage(PackageInterface $package, Composer $composer, $phpVersion, $minorOnly = false)
  6505. {
  6506. $name = $package->getName();
  6507. $versionSelector = new VersionSelector($this->getPool($composer));
  6508. $stability = $composer->getPackage()->getMinimumStability();
  6509. $flags = $composer->getPackage()->getStabilityFlags();
  6510. if (isset($flags[$name])) {
  6511. $stability = array_search($flags[$name], BasePackage::$stabilities, true);
  6512. }
  6513. $bestStability = $stability;
  6514. if ($composer->getPackage()->getPreferStable()) {
  6515. $bestStability = $package->getStability();
  6516. }
  6517. $targetVersion = null;
  6518. if (0 === strpos($package->getVersion(), 'dev-')) {
  6519. $targetVersion = $package->getVersion();
  6520. }
  6521. if ($targetVersion === null && $minorOnly) {
  6522. $targetVersion = '^' . $package->getVersion();
  6523. }
  6524. return $versionSelector->findBestCandidate($name, $targetVersion, $phpVersion, $bestStability);
  6525. }
  6526. private function getPool(Composer $composer)
  6527. {
  6528. if (!$this->pool) {
  6529. $this->pool = new Pool($composer->getPackage()->getMinimumStability(), $composer->getPackage()->getStabilityFlags());
  6530. $this->pool->addRepository(new CompositeRepository($composer->getRepositoryManager()->getRepositories()));
  6531. }
  6532. return $this->pool;
  6533. }
  6534. }
  6535. <?php
  6536. namespace Composer\Command;
  6537. use Symfony\Component\Console\Input\InputInterface;
  6538. use Symfony\Component\Console\Input\InputOption;
  6539. use Symfony\Component\Console\Output\OutputInterface;
  6540. use Composer\Downloader\ChangeReportInterface;
  6541. use Composer\Downloader\DvcsDownloaderInterface;
  6542. use Composer\Downloader\VcsCapableDownloaderInterface;
  6543. use Composer\Package\Dumper\ArrayDumper;
  6544. use Composer\Package\Version\VersionGuesser;
  6545. use Composer\Package\Version\VersionParser;
  6546. use Composer\Plugin\CommandEvent;
  6547. use Composer\Plugin\PluginEvents;
  6548. use Composer\Script\ScriptEvents;
  6549. use Composer\Util\ProcessExecutor;
  6550. class StatusCommand extends BaseCommand
  6551. {
  6552. const EXIT_CODE_ERRORS = 1;
  6553. const EXIT_CODE_UNPUSHED_CHANGES = 2;
  6554. const EXIT_CODE_VERSION_CHANGES = 4;
  6555. protected function configure()
  6556. {
  6557. $this
  6558. ->setName('status')
  6559. ->setDescription('Shows a list of locally modified packages, for packages installed from source.')
  6560. ->setDefinition(array(
  6561. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Show modified files for each directory that contains changes.'),
  6562. ))
  6563. ->setHelp(
  6564. <<<EOT
  6565. The status command displays a list of dependencies that have
  6566. been modified locally.
  6567. Read more at https://getcomposer.org/doc/03-cli.md#status
  6568. EOT
  6569. )
  6570. ;
  6571. }
  6572. protected function execute(InputInterface $input, OutputInterface $output)
  6573. {
  6574. $composer = $this->getComposer();
  6575. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'status', $input, $output);
  6576. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6577. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_STATUS_CMD, true);
  6578. $exitCode = $this->doExecute($input, $output);
  6579. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_STATUS_CMD, true);
  6580. return $exitCode;
  6581. }
  6582. private function doExecute(InputInterface $input, OutputInterface $output)
  6583. {
  6584. $composer = $this->getComposer();
  6585. $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
  6586. $dm = $composer->getDownloadManager();
  6587. $im = $composer->getInstallationManager();
  6588. $errors = array();
  6589. $io = $this->getIO();
  6590. $unpushedChanges = array();
  6591. $vcsVersionChanges = array();
  6592. $parser = new VersionParser;
  6593. $guesser = new VersionGuesser($composer->getConfig(), new ProcessExecutor($io), $parser);
  6594. $dumper = new ArrayDumper;
  6595. foreach ($installedRepo->getCanonicalPackages() as $package) {
  6596. $downloader = $dm->getDownloaderForInstalledPackage($package);
  6597. $targetDir = $im->getInstallPath($package);
  6598. if ($downloader instanceof ChangeReportInterface) {
  6599. if (is_link($targetDir)) {
  6600. $errors[$targetDir] = $targetDir . ' is a symbolic link.';
  6601. }
  6602. if ($changes = $downloader->getLocalChanges($package, $targetDir)) {
  6603. $errors[$targetDir] = $changes;
  6604. }
  6605. }
  6606. if ($downloader instanceof VcsCapableDownloaderInterface) {
  6607. if ($currentRef = $downloader->getVcsReference($package, $targetDir)) {
  6608. switch ($package->getInstallationSource()) {
  6609. case 'source':
  6610. $previousRef = $package->getSourceReference();
  6611. break;
  6612. case 'dist':
  6613. $previousRef = $package->getDistReference();
  6614. break;
  6615. default:
  6616. $previousRef = null;
  6617. }
  6618. $currentVersion = $guesser->guessVersion($dumper->dump($package), $targetDir);
  6619. if ($previousRef && $currentVersion && $currentVersion['commit'] !== $previousRef) {
  6620. $vcsVersionChanges[$targetDir] = array(
  6621. 'previous' => array(
  6622. 'version' => $package->getPrettyVersion(),
  6623. 'ref' => $previousRef,
  6624. ),
  6625. 'current' => array(
  6626. 'version' => $currentVersion['pretty_version'],
  6627. 'ref' => $currentVersion['commit'],
  6628. ),
  6629. );
  6630. }
  6631. }
  6632. }
  6633. if ($downloader instanceof DvcsDownloaderInterface) {
  6634. if ($unpushed = $downloader->getUnpushedChanges($package, $targetDir)) {
  6635. $unpushedChanges[$targetDir] = $unpushed;
  6636. }
  6637. }
  6638. }
  6639. if (!$errors && !$unpushedChanges && !$vcsVersionChanges) {
  6640. $io->writeError('<info>No local changes</info>');
  6641. return 0;
  6642. }
  6643. if ($errors) {
  6644. $io->writeError('<error>You have changes in the following dependencies:</error>');
  6645. foreach ($errors as $path => $changes) {
  6646. if ($input->getOption('verbose')) {
  6647. $indentedChanges = implode("\n", array_map(function ($line) {
  6648. return ' ' . ltrim($line);
  6649. }, explode("\n", $changes)));
  6650. $io->write('<info>'.$path.'</info>:');
  6651. $io->write($indentedChanges);
  6652. } else {
  6653. $io->write($path);
  6654. }
  6655. }
  6656. }
  6657. if ($unpushedChanges) {
  6658. $io->writeError('<warning>You have unpushed changes on the current branch in the following dependencies:</warning>');
  6659. foreach ($unpushedChanges as $path => $changes) {
  6660. if ($input->getOption('verbose')) {
  6661. $indentedChanges = implode("\n", array_map(function ($line) {
  6662. return ' ' . ltrim($line);
  6663. }, explode("\n", $changes)));
  6664. $io->write('<info>'.$path.'</info>:');
  6665. $io->write($indentedChanges);
  6666. } else {
  6667. $io->write($path);
  6668. }
  6669. }
  6670. }
  6671. if ($vcsVersionChanges) {
  6672. $io->writeError('<warning>You have version variations in the following dependencies:</warning>');
  6673. foreach ($vcsVersionChanges as $path => $changes) {
  6674. if ($input->getOption('verbose')) {
  6675. $currentVersion = $changes['current']['version'] ?: $changes['current']['ref'];
  6676. $previousVersion = $changes['previous']['version'] ?: $changes['previous']['ref'];
  6677. if ($io->isVeryVerbose()) {
  6678. $currentVersion .= sprintf(' (%s)', $changes['current']['ref']);
  6679. $previousVersion .= sprintf(' (%s)', $changes['previous']['ref']);
  6680. }
  6681. $io->write('<info>'.$path.'</info>:');
  6682. $io->write(sprintf(' From <comment>%s</comment> to <comment>%s</comment>', $previousVersion, $currentVersion));
  6683. } else {
  6684. $io->write($path);
  6685. }
  6686. }
  6687. }
  6688. if (($errors || $unpushedChanges || $vcsVersionChanges) && !$input->getOption('verbose')) {
  6689. $io->writeError('Use --verbose (-v) to see a list of files');
  6690. }
  6691. return ($errors ? self::EXIT_CODE_ERRORS : 0) + ($unpushedChanges ? self::EXIT_CODE_UNPUSHED_CHANGES : 0) + ($vcsVersionChanges ? self::EXIT_CODE_VERSION_CHANGES : 0);
  6692. }
  6693. }
  6694. <?php
  6695. namespace Composer\Command;
  6696. use Composer\Repository\PlatformRepository;
  6697. use Symfony\Component\Console\Input\InputArgument;
  6698. use Symfony\Component\Console\Input\InputInterface;
  6699. use Symfony\Component\Console\Input\InputOption;
  6700. use Symfony\Component\Console\Output\OutputInterface;
  6701. class SuggestsCommand extends BaseCommand
  6702. {
  6703. protected function configure()
  6704. {
  6705. $this
  6706. ->setName('suggests')
  6707. ->setDescription('Shows package suggestions.')
  6708. ->setDefinition(array(
  6709. new InputOption('by-package', null, InputOption::VALUE_NONE, 'Groups output by suggesting package'),
  6710. new InputOption('by-suggestion', null, InputOption::VALUE_NONE, 'Groups output by suggested package'),
  6711. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Exclude suggestions from require-dev packages'),
  6712. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that you want to list suggestions from.'),
  6713. ))
  6714. ->setHelp(
  6715. <<<EOT
  6716. The <info>%command.name%</info> command shows a sorted list of suggested packages.
  6717. Enabling <info>-v</info> implies <info>--by-package --by-suggestion</info>, showing both lists.
  6718. Read more at https://getcomposer.org/doc/03-cli.md#suggests
  6719. EOT
  6720. )
  6721. ;
  6722. }
  6723. protected function execute(InputInterface $input, OutputInterface $output)
  6724. {
  6725. $lock = $this->getComposer()->getLocker()->getLockData();
  6726. if (empty($lock)) {
  6727. throw new \RuntimeException('Lockfile seems to be empty?');
  6728. }
  6729. $packages = $lock['packages'];
  6730. if (!$input->getOption('no-dev')) {
  6731. $packages += $lock['packages-dev'];
  6732. }
  6733. $filter = $input->getArgument('packages');
  6734. $installed = array();
  6735. foreach ($packages as $package) {
  6736. $installed[] = $package['name'];
  6737. if (!empty($package['provide'])) {
  6738. $installed = array_merge($installed, array_keys($package['provide']));
  6739. }
  6740. if (!empty($package['replace'])) {
  6741. $installed = array_merge($installed, array_keys($package['replace']));
  6742. }
  6743. }
  6744. $installed = array_flip($installed);
  6745. ksort($installed);
  6746. $platform = new PlatformRepository(array(), $this->getComposer()->getConfig()->get('platform') ?: array());
  6747. $suggesters = array();
  6748. $suggested = array();
  6749. foreach ($packages as $package) {
  6750. $packageName = $package['name'];
  6751. if ((!empty($filter) && !in_array($packageName, $filter)) || empty($package['suggest'])) {
  6752. continue;
  6753. }
  6754. foreach ($package['suggest'] as $suggestion => $reason) {
  6755. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $suggestion) && null !== $platform->findPackage($suggestion, '*')) {
  6756. continue;
  6757. }
  6758. if (!isset($installed[$suggestion])) {
  6759. $suggesters[$packageName][$suggestion] = $reason;
  6760. $suggested[$suggestion][$packageName] = $reason;
  6761. }
  6762. }
  6763. }
  6764. ksort($suggesters);
  6765. ksort($suggested);
  6766. $mode = 0;
  6767. $io = $this->getIO();
  6768. if ($input->getOption('by-package') || $io->isVerbose()) {
  6769. $mode |= 1;
  6770. }
  6771. if ($input->getOption('by-suggestion')) {
  6772. $mode |= 2;
  6773. }
  6774. if ($mode === 0) {
  6775. foreach (array_keys($suggested) as $suggestion) {
  6776. $io->write(sprintf('<info>%s</info>', $suggestion));
  6777. }
  6778. return 0;
  6779. }
  6780. if ($mode & 1) {
  6781. foreach ($suggesters as $suggester => $suggestions) {
  6782. $io->write(sprintf('<comment>%s</comment> suggests:', $suggester));
  6783. foreach ($suggestions as $suggestion => $reason) {
  6784. $io->write(sprintf(' - <info>%s</info>: %s', $suggestion, $reason ?: '*'));
  6785. }
  6786. $io->write('');
  6787. }
  6788. }
  6789. if ($mode & 2) {
  6790. if ($mode & 1) {
  6791. $io->write(str_repeat('-', 78));
  6792. }
  6793. foreach ($suggested as $suggestion => $suggesters) {
  6794. $io->write(sprintf('<comment>%s</comment> is suggested by:', $suggestion));
  6795. foreach ($suggesters as $suggester => $reason) {
  6796. $io->write(sprintf(' - <info>%s</info>: %s', $suggester, $reason ?: '*'));
  6797. }
  6798. $io->write('');
  6799. }
  6800. }
  6801. return 0;
  6802. }
  6803. }
  6804. <?php
  6805. namespace Composer\Command;
  6806. use Composer\Composer;
  6807. use Composer\Installer;
  6808. use Composer\IO\IOInterface;
  6809. use Composer\Plugin\CommandEvent;
  6810. use Composer\Plugin\PluginEvents;
  6811. use Symfony\Component\Console\Helper\Table;
  6812. use Symfony\Component\Console\Input\InputInterface;
  6813. use Symfony\Component\Console\Input\InputOption;
  6814. use Symfony\Component\Console\Input\InputArgument;
  6815. use Symfony\Component\Console\Output\OutputInterface;
  6816. use Symfony\Component\Console\Question\Question;
  6817. class UpdateCommand extends BaseCommand
  6818. {
  6819. protected function configure()
  6820. {
  6821. $this
  6822. ->setName('update')
  6823. ->setAliases(array('u', 'upgrade'))
  6824. ->setDescription('Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file.')
  6825. ->setDefinition(array(
  6826. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that should be updated, if not provided all packages are.'),
  6827. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  6828. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  6829. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  6830. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  6831. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  6832. new InputOption('lock', null, InputOption::VALUE_NONE, 'Only updates the lock file hash to suppress warning about the lock file being out of date.'),
  6833. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  6834. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  6835. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  6836. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  6837. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  6838. new InputOption('with-dependencies', null, InputOption::VALUE_NONE, 'Add also dependencies of allowed packages to the allow list, except those defined in root package.'),
  6839. new InputOption('with-all-dependencies', null, InputOption::VALUE_NONE, 'Add also all dependencies of allowed packages to the allow list, including those defined in root package.'),
  6840. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  6841. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump.'),
  6842. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  6843. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  6844. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  6845. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  6846. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  6847. new InputOption('interactive', 'i', InputOption::VALUE_NONE, 'Interactive interface with autocompletion to select the packages to update.'),
  6848. new InputOption('root-reqs', null, InputOption::VALUE_NONE, 'Restricts the update to your first degree dependencies.'),
  6849. ))
  6850. ->setHelp(
  6851. <<<EOT
  6852. The <info>update</info> command reads the composer.json file from the
  6853. current directory, processes it, and updates, removes or installs all the
  6854. dependencies.
  6855. <info>php composer.phar update</info>
  6856. To limit the update operation to a few packages, you can list the package(s)
  6857. you want to update as such:
  6858. <info>php composer.phar update vendor/package1 foo/mypackage [...]</info>
  6859. You may also use an asterisk (*) pattern to limit the update operation to package(s)
  6860. from a specific vendor:
  6861. <info>php composer.phar update vendor/package1 foo/* [...]</info>
  6862. To select packages names interactively with auto-completion use <info>-i</info>.
  6863. Read more at https://getcomposer.org/doc/03-cli.md#update-u
  6864. EOT
  6865. )
  6866. ;
  6867. }
  6868. protected function execute(InputInterface $input, OutputInterface $output)
  6869. {
  6870. $io = $this->getIO();
  6871. if ($input->getOption('no-custom-installers')) {
  6872. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  6873. $input->setOption('no-plugins', true);
  6874. }
  6875. if ($input->getOption('dev')) {
  6876. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  6877. }
  6878. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  6879. $packages = $input->getArgument('packages');
  6880. if ($input->getOption('interactive')) {
  6881. $packages = $this->getPackagesInteractively($io, $input, $output, $composer, $packages);
  6882. }
  6883. if ($input->getOption('root-reqs')) {
  6884. $require = array_keys($composer->getPackage()->getRequires());
  6885. if (!$input->getOption('no-dev')) {
  6886. $requireDev = array_keys($composer->getPackage()->getDevRequires());
  6887. $require = array_merge($require, $requireDev);
  6888. }
  6889. if (!empty($packages)) {
  6890. $packages = array_intersect($packages, $require);
  6891. } else {
  6892. $packages = $require;
  6893. }
  6894. }
  6895. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  6896. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'update', $input, $output);
  6897. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6898. $install = Installer::create($io, $composer);
  6899. $config = $composer->getConfig();
  6900. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  6901. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  6902. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  6903. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  6904. $install
  6905. ->setDryRun($input->getOption('dry-run'))
  6906. ->setVerbose($input->getOption('verbose'))
  6907. ->setPreferSource($preferSource)
  6908. ->setPreferDist($preferDist)
  6909. ->setDevMode(!$input->getOption('no-dev'))
  6910. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  6911. ->setRunScripts(!$input->getOption('no-scripts'))
  6912. ->setSkipSuggest($input->getOption('no-suggest'))
  6913. ->setOptimizeAutoloader($optimize)
  6914. ->setClassMapAuthoritative($authoritative)
  6915. ->setApcuAutoloader($apcu)
  6916. ->setUpdate(true)
  6917. ->setUpdateAllowList($input->getOption('lock') ? array('lock') : $packages)
  6918. ->setAllowListTransitiveDependencies($input->getOption('with-dependencies'))
  6919. ->setAllowListAllDependencies($input->getOption('with-all-dependencies'))
  6920. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  6921. ->setPreferStable($input->getOption('prefer-stable'))
  6922. ->setPreferLowest($input->getOption('prefer-lowest'))
  6923. ;
  6924. if ($input->getOption('no-plugins')) {
  6925. $install->disablePlugins();
  6926. }
  6927. return $install->run();
  6928. }
  6929. private function getPackagesInteractively(IOInterface $io, InputInterface $input, OutputInterface $output, Composer $composer, array $packages)
  6930. {
  6931. if (!$input->isInteractive()) {
  6932. throw new \InvalidArgumentException('--interactive cannot be used in non-interactive terminals.');
  6933. }
  6934. $requires = array_merge(
  6935. $composer->getPackage()->getRequires(),
  6936. $composer->getPackage()->getDevRequires()
  6937. );
  6938. $autocompleterValues = array();
  6939. foreach ($requires as $require) {
  6940. $target = $require->getTarget();
  6941. $autocompleterValues[strtolower($target)] = $target;
  6942. }
  6943. $installedPackages = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  6944. foreach ($installedPackages as $package) {
  6945. $autocompleterValues[$package->getName()] = $package->getPrettyName();
  6946. }
  6947. $helper = $this->getHelper('question');
  6948. $question = new Question('<comment>Enter package name: </comment>', null);
  6949. $io->writeError('<info>Press enter without value to end submission</info>');
  6950. do {
  6951. $autocompleterValues = array_diff($autocompleterValues, $packages);
  6952. $question->setAutocompleterValues($autocompleterValues);
  6953. $addedPackage = $helper->ask($input, $output, $question);
  6954. if (!is_string($addedPackage) || empty($addedPackage)) {
  6955. break;
  6956. }
  6957. $addedPackage = strtolower($addedPackage);
  6958. if (!in_array($addedPackage, $packages)) {
  6959. $packages[] = $addedPackage;
  6960. }
  6961. } while (true);
  6962. $packages = array_filter($packages);
  6963. if (!$packages) {
  6964. throw new \InvalidArgumentException('You must enter minimum one package.');
  6965. }
  6966. $table = new Table($output);
  6967. $table->setHeaders(array('Selected packages'));
  6968. foreach ($packages as $package) {
  6969. $table->addRow(array($package));
  6970. }
  6971. $table->render();
  6972. if ($io->askConfirmation(sprintf(
  6973. 'Would you like to continue and update the above package%s [<comment>yes</comment>]? ',
  6974. 1 === count($packages) ? '' : 's'
  6975. ), true)) {
  6976. return $packages;
  6977. }
  6978. throw new \RuntimeException('Installation aborted.');
  6979. }
  6980. }
  6981. <?php
  6982. namespace Composer\Command;
  6983. use Composer\Factory;
  6984. use Composer\Package\Loader\ValidatingArrayLoader;
  6985. use Composer\Plugin\CommandEvent;
  6986. use Composer\Plugin\PluginEvents;
  6987. use Composer\Util\ConfigValidator;
  6988. use Symfony\Component\Console\Input\InputArgument;
  6989. use Symfony\Component\Console\Input\InputInterface;
  6990. use Symfony\Component\Console\Input\InputOption;
  6991. use Symfony\Component\Console\Output\OutputInterface;
  6992. class ValidateCommand extends BaseCommand
  6993. {
  6994. protected function configure()
  6995. {
  6996. $this
  6997. ->setName('validate')
  6998. ->setDescription('Validates a composer.json and composer.lock.')
  6999. ->setDefinition(array(
  7000. new InputOption('no-check-all', null, InputOption::VALUE_NONE, 'Do not validate requires for overly strict/loose constraints'),
  7001. new InputOption('no-check-lock', null, InputOption::VALUE_NONE, 'Do not check if lock file is up to date'),
  7002. new InputOption('no-check-publish', null, InputOption::VALUE_NONE, 'Do not check for publish errors'),
  7003. new InputOption('with-dependencies', 'A', InputOption::VALUE_NONE, 'Also validate the composer.json of all installed dependencies'),
  7004. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code for warnings as well as errors'),
  7005. new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file'),
  7006. ))
  7007. ->setHelp(
  7008. <<<EOT
  7009. The validate command validates a given composer.json and composer.lock
  7010. Exit codes in case of errors are:
  7011. 1 validation warning(s), only when --strict is given
  7012. 2 validation error(s)
  7013. 3 file unreadable or missing
  7014. Read more at https://getcomposer.org/doc/03-cli.md#validate
  7015. EOT
  7016. );
  7017. }
  7018. protected function execute(InputInterface $input, OutputInterface $output)
  7019. {
  7020. $file = $input->getArgument('file') ?: Factory::getComposerFile();
  7021. $io = $this->getIO();
  7022. if (!file_exists($file)) {
  7023. $io->writeError('<error>' . $file . ' not found.</error>');
  7024. return 3;
  7025. }
  7026. if (!is_readable($file)) {
  7027. $io->writeError('<error>' . $file . ' is not readable.</error>');
  7028. return 3;
  7029. }
  7030. $validator = new ConfigValidator($io);
  7031. $checkAll = $input->getOption('no-check-all') ? 0 : ValidatingArrayLoader::CHECK_ALL;
  7032. $checkPublish = !$input->getOption('no-check-publish');
  7033. $checkLock = !$input->getOption('no-check-lock');
  7034. $isStrict = $input->getOption('strict');
  7035. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  7036. $lockErrors = array();
  7037. $composer = Factory::create($io, $file, $input->hasParameterOption('--no-plugins'));
  7038. $locker = $composer->getLocker();
  7039. if ($locker->isLocked() && !$locker->isFresh()) {
  7040. $lockErrors[] = 'The lock file is not up to date with the latest changes in composer.json, it is recommended that you run `composer update` or `composer update <package name>`.';
  7041. }
  7042. $this->outputResult($io, $file, $errors, $warnings, $checkPublish, $publishErrors, $checkLock, $lockErrors, true);
  7043. $exitCode = $errors ? 2 : ($isStrict && $warnings ? 1 : 0);
  7044. if ($input->getOption('with-dependencies')) {
  7045. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  7046. foreach ($localRepo->getPackages() as $package) {
  7047. $path = $composer->getInstallationManager()->getInstallPath($package);
  7048. $file = $path . '/composer.json';
  7049. if (is_dir($path) && file_exists($file)) {
  7050. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  7051. $this->outputResult($io, $package->getPrettyName(), $errors, $warnings, $checkPublish, $publishErrors);
  7052. $depCode = $errors ? 2 : ($isStrict && $warnings ? 1 : 0);
  7053. $exitCode = max($depCode, $exitCode);
  7054. }
  7055. }
  7056. }
  7057. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'validate', $input, $output);
  7058. $eventCode = $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  7059. $exitCode = max($eventCode, $exitCode);
  7060. return $exitCode;
  7061. }
  7062. private function outputResult($io, $name, &$errors, &$warnings, $checkPublish = false, $publishErrors = array(), $checkLock = false, $lockErrors = array(), $printSchemaUrl = false)
  7063. {
  7064. $doPrintSchemaUrl = false;
  7065. if ($errors) {
  7066. $io->writeError('<error>' . $name . ' is invalid, the following errors/warnings were found:</error>');
  7067. } elseif ($publishErrors) {
  7068. $io->writeError('<info>' . $name . ' is valid for simple usage with composer but has</info>');
  7069. $io->writeError('<info>strict errors that make it unable to be published as a package:</info>');
  7070. $doPrintSchemaUrl = $printSchemaUrl;
  7071. } elseif ($warnings) {
  7072. $io->writeError('<info>' . $name . ' is valid, but with a few warnings</info>');
  7073. $doPrintSchemaUrl = $printSchemaUrl;
  7074. } else {
  7075. $io->write('<info>' . $name . ' is valid</info>');
  7076. }
  7077. if ($doPrintSchemaUrl) {
  7078. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  7079. }
  7080. $extraWarnings = array();
  7081. if ($checkPublish) {
  7082. $errors = array_merge($errors, $publishErrors);
  7083. } else {
  7084. $extraWarnings = array_merge($extraWarnings, $publishErrors);
  7085. }
  7086. if ($checkLock) {
  7087. $errors = array_merge($errors, $lockErrors);
  7088. } else {
  7089. $extraWarnings = array_merge($extraWarnings, $lockErrors);
  7090. }
  7091. $messages = array(
  7092. 'error' => $errors,
  7093. 'warning' => array_merge($warnings, $extraWarnings),
  7094. );
  7095. foreach ($messages as $style => $msgs) {
  7096. foreach ($msgs as $msg) {
  7097. $io->writeError('<' . $style . '>' . $msg . '</' . $style . '>');
  7098. }
  7099. }
  7100. }
  7101. }
  7102. <?php
  7103. namespace Composer;
  7104. use Composer\Package\RootPackageInterface;
  7105. use Composer\Package\Locker;
  7106. use Composer\Repository\RepositoryManager;
  7107. use Composer\Installer\InstallationManager;
  7108. use Composer\Plugin\PluginManager;
  7109. use Composer\Downloader\DownloadManager;
  7110. use Composer\EventDispatcher\EventDispatcher;
  7111. use Composer\Autoload\AutoloadGenerator;
  7112. use Composer\Package\Archiver\ArchiveManager;
  7113. class Composer
  7114. {
  7115. const VERSION = '1.10.9';
  7116. const BRANCH_ALIAS_VERSION = '';
  7117. const RELEASE_DATE = '2020-07-16 12:57:00';
  7118. const SOURCE_VERSION = '';
  7119. const RUNTIME_API_VERSION = '1.0.0';
  7120. public static function getVersion()
  7121. {
  7122. if (self::VERSION === '@package_version'.'@') {
  7123. return self::SOURCE_VERSION;
  7124. }
  7125. if (self::BRANCH_ALIAS_VERSION !== '' && preg_match('{^[a-f0-9]{40}$}', self::VERSION)) {
  7126. return self::BRANCH_ALIAS_VERSION.'+'.self::VERSION;
  7127. }
  7128. return self::VERSION;
  7129. }
  7130. private $package;
  7131. private $locker;
  7132. private $repositoryManager;
  7133. private $downloadManager;
  7134. private $installationManager;
  7135. private $pluginManager;
  7136. private $config;
  7137. private $eventDispatcher;
  7138. private $autoloadGenerator;
  7139. private $archiveManager;
  7140. public function setPackage(RootPackageInterface $package)
  7141. {
  7142. $this->package = $package;
  7143. }
  7144. public function getPackage()
  7145. {
  7146. return $this->package;
  7147. }
  7148. public function setConfig(Config $config)
  7149. {
  7150. $this->config = $config;
  7151. }
  7152. public function getConfig()
  7153. {
  7154. return $this->config;
  7155. }
  7156. public function setLocker(Locker $locker)
  7157. {
  7158. $this->locker = $locker;
  7159. }
  7160. public function getLocker()
  7161. {
  7162. return $this->locker;
  7163. }
  7164. public function setRepositoryManager(RepositoryManager $manager)
  7165. {
  7166. $this->repositoryManager = $manager;
  7167. }
  7168. public function getRepositoryManager()
  7169. {
  7170. return $this->repositoryManager;
  7171. }
  7172. public function setDownloadManager(DownloadManager $manager)
  7173. {
  7174. $this->downloadManager = $manager;
  7175. }
  7176. public function getDownloadManager()
  7177. {
  7178. return $this->downloadManager;
  7179. }
  7180. public function setArchiveManager(ArchiveManager $manager)
  7181. {
  7182. $this->archiveManager = $manager;
  7183. }
  7184. public function getArchiveManager()
  7185. {
  7186. return $this->archiveManager;
  7187. }
  7188. public function setInstallationManager(InstallationManager $manager)
  7189. {
  7190. $this->installationManager = $manager;
  7191. }
  7192. public function getInstallationManager()
  7193. {
  7194. return $this->installationManager;
  7195. }
  7196. public function setPluginManager(PluginManager $manager)
  7197. {
  7198. $this->pluginManager = $manager;
  7199. }
  7200. public function getPluginManager()
  7201. {
  7202. return $this->pluginManager;
  7203. }
  7204. public function setEventDispatcher(EventDispatcher $eventDispatcher)
  7205. {
  7206. $this->eventDispatcher = $eventDispatcher;
  7207. }
  7208. public function getEventDispatcher()
  7209. {
  7210. return $this->eventDispatcher;
  7211. }
  7212. public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator)
  7213. {
  7214. $this->autoloadGenerator = $autoloadGenerator;
  7215. }
  7216. public function getAutoloadGenerator()
  7217. {
  7218. return $this->autoloadGenerator;
  7219. }
  7220. }
  7221. <?php
  7222. namespace Composer;
  7223. use Composer\Config\ConfigSourceInterface;
  7224. use Composer\Downloader\TransportException;
  7225. use Composer\IO\IOInterface;
  7226. use Composer\Util\Platform;
  7227. use Composer\Util\ProcessExecutor;
  7228. class Config
  7229. {
  7230. const RELATIVE_PATHS = 1;
  7231. public static $defaultConfig = array(
  7232. 'process-timeout' => 300,
  7233. 'use-include-path' => false,
  7234. 'preferred-install' => 'auto',
  7235. 'notify-on-install' => true,
  7236. 'github-protocols' => array('https', 'ssh', 'git'),
  7237. 'vendor-dir' => 'vendor',
  7238. 'bin-dir' => '{$vendor-dir}/bin',
  7239. 'cache-dir' => '{$home}/cache',
  7240. 'data-dir' => '{$home}',
  7241. 'cache-files-dir' => '{$cache-dir}/files',
  7242. 'cache-repo-dir' => '{$cache-dir}/repo',
  7243. 'cache-vcs-dir' => '{$cache-dir}/vcs',
  7244. 'cache-ttl' => 15552000,
  7245. 'cache-files-ttl' => null,
  7246. 'cache-files-maxsize' => '300MiB',
  7247. 'bin-compat' => 'auto',
  7248. 'discard-changes' => false,
  7249. 'autoloader-suffix' => null,
  7250. 'sort-packages' => false,
  7251. 'optimize-autoloader' => false,
  7252. 'classmap-authoritative' => false,
  7253. 'apcu-autoloader' => false,
  7254. 'prepend-autoloader' => true,
  7255. 'github-domains' => array('github.com'),
  7256. 'bitbucket-expose-hostname' => true,
  7257. 'disable-tls' => false,
  7258. 'secure-http' => true,
  7259. 'cafile' => null,
  7260. 'capath' => null,
  7261. 'github-expose-hostname' => true,
  7262. 'gitlab-domains' => array('gitlab.com'),
  7263. 'store-auths' => 'prompt',
  7264. 'platform' => array(),
  7265. 'archive-format' => 'tar',
  7266. 'archive-dir' => '.',
  7267. 'htaccess-protect' => true,
  7268. 'use-github-api' => true,
  7269. 'lock' => true,
  7270. );
  7271. public static $defaultRepositories = array(
  7272. 'packagist.org' => array(
  7273. 'type' => 'composer',
  7274. 'url' => 'https?://repo.packagist.org',
  7275. 'allow_ssl_downgrade' => true,
  7276. ),
  7277. );
  7278. private $config;
  7279. private $baseDir;
  7280. private $repositories;
  7281. private $configSource;
  7282. private $authConfigSource;
  7283. private $useEnvironment;
  7284. private $warnedHosts = array();
  7285. public function __construct($useEnvironment = true, $baseDir = null)
  7286. {
  7287. $this->config = static::$defaultConfig;
  7288. $this->repositories = static::$defaultRepositories;
  7289. $this->useEnvironment = (bool) $useEnvironment;
  7290. $this->baseDir = $baseDir;
  7291. }
  7292. public function setConfigSource(ConfigSourceInterface $source)
  7293. {
  7294. $this->configSource = $source;
  7295. }
  7296. public function getConfigSource()
  7297. {
  7298. return $this->configSource;
  7299. }
  7300. public function setAuthConfigSource(ConfigSourceInterface $source)
  7301. {
  7302. $this->authConfigSource = $source;
  7303. }
  7304. public function getAuthConfigSource()
  7305. {
  7306. return $this->authConfigSource;
  7307. }
  7308. public function merge($config)
  7309. {
  7310. if (!empty($config['config']) && is_array($config['config'])) {
  7311. foreach ($config['config'] as $key => $val) {
  7312. if (in_array($key, array('bitbucket-oauth', 'github-oauth', 'gitlab-oauth', 'gitlab-token', 'http-basic', 'bearer')) && isset($this->config[$key])) {
  7313. $this->config[$key] = array_merge($this->config[$key], $val);
  7314. } elseif ('preferred-install' === $key && isset($this->config[$key])) {
  7315. if (is_array($val) || is_array($this->config[$key])) {
  7316. if (is_string($val)) {
  7317. $val = array('*' => $val);
  7318. }
  7319. if (is_string($this->config[$key])) {
  7320. $this->config[$key] = array('*' => $this->config[$key]);
  7321. }
  7322. $this->config[$key] = array_merge($this->config[$key], $val);
  7323. if (isset($this->config[$key]['*'])) {
  7324. $wildcard = $this->config[$key]['*'];
  7325. unset($this->config[$key]['*']);
  7326. $this->config[$key]['*'] = $wildcard;
  7327. }
  7328. } else {
  7329. $this->config[$key] = $val;
  7330. }
  7331. } else {
  7332. $this->config[$key] = $val;
  7333. }
  7334. }
  7335. }
  7336. if (!empty($config['repositories']) && is_array($config['repositories'])) {
  7337. $this->repositories = array_reverse($this->repositories, true);
  7338. $newRepos = array_reverse($config['repositories'], true);
  7339. foreach ($newRepos as $name => $repository) {
  7340. if (false === $repository) {
  7341. $this->disableRepoByName($name);
  7342. continue;
  7343. }
  7344. if (is_array($repository) && 1 === count($repository) && false === current($repository)) {
  7345. $this->disableRepoByName(key($repository));
  7346. continue;
  7347. }
  7348. if (is_int($name)) {
  7349. $this->repositories[] = $repository;
  7350. } else {
  7351. if ($name === 'packagist') {
  7352. $this->repositories[$name . '.org'] = $repository;
  7353. } else {
  7354. $this->repositories[$name] = $repository;
  7355. }
  7356. }
  7357. }
  7358. $this->repositories = array_reverse($this->repositories, true);
  7359. }
  7360. }
  7361. public function getRepositories()
  7362. {
  7363. return $this->repositories;
  7364. }
  7365. public function get($key, $flags = 0)
  7366. {
  7367. switch ($key) {
  7368. case 'vendor-dir':
  7369. case 'bin-dir':
  7370. case 'process-timeout':
  7371. case 'data-dir':
  7372. case 'cache-dir':
  7373. case 'cache-files-dir':
  7374. case 'cache-repo-dir':
  7375. case 'cache-vcs-dir':
  7376. case 'cafile':
  7377. case 'capath':
  7378. $env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
  7379. $val = $this->getComposerEnv($env);
  7380. $val = rtrim((string) $this->process(false !== $val ? $val : $this->config[$key], $flags), '/\\');
  7381. $val = Platform::expandPath($val);
  7382. if (substr($key, -4) !== '-dir') {
  7383. return $val;
  7384. }
  7385. return (($flags & self::RELATIVE_PATHS) == self::RELATIVE_PATHS) ? $val : $this->realpath($val);
  7386. case 'htaccess-protect':
  7387. $value = $this->getComposerEnv('COMPOSER_HTACCESS_PROTECT');
  7388. if (false === $value) {
  7389. $value = $this->config[$key];
  7390. }
  7391. return $value !== 'false' && (bool) $value;
  7392. case 'cache-ttl':
  7393. return (int) $this->config[$key];
  7394. case 'cache-files-maxsize':
  7395. if (!preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $this->config[$key], $matches)) {
  7396. throw new \RuntimeException(
  7397. "Could not parse the value of 'cache-files-maxsize': {$this->config[$key]}"
  7398. );
  7399. }
  7400. $size = $matches[1];
  7401. if (isset($matches[2])) {
  7402. switch (strtolower($matches[2])) {
  7403. case 'g':
  7404. $size *= 1024;
  7405. case 'm':
  7406. $size *= 1024;
  7407. case 'k':
  7408. $size *= 1024;
  7409. break;
  7410. }
  7411. }
  7412. return $size;
  7413. case 'cache-files-ttl':
  7414. if (isset($this->config[$key])) {
  7415. return (int) $this->config[$key];
  7416. }
  7417. return (int) $this->config['cache-ttl'];
  7418. case 'home':
  7419. $val = preg_replace('#^(\$HOME|~)(/|$)#', rtrim(getenv('HOME') ?: getenv('USERPROFILE'), '/\\') . '/', $this->config[$key]);
  7420. return rtrim($this->process($val, $flags), '/\\');
  7421. case 'bin-compat':
  7422. $value = $this->getComposerEnv('COMPOSER_BIN_COMPAT') ?: $this->config[$key];
  7423. if (!in_array($value, array('auto', 'full'))) {
  7424. throw new \RuntimeException(
  7425. "Invalid value for 'bin-compat': {$value}. Expected auto, full"
  7426. );
  7427. }
  7428. return $value;
  7429. case 'discard-changes':
  7430. if ($env = $this->getComposerEnv('COMPOSER_DISCARD_CHANGES')) {
  7431. if (!in_array($env, array('stash', 'true', 'false', '1', '0'), true)) {
  7432. throw new \RuntimeException(
  7433. "Invalid value for COMPOSER_DISCARD_CHANGES: {$env}. Expected 1, 0, true, false or stash"
  7434. );
  7435. }
  7436. if ('stash' === $env) {
  7437. return 'stash';
  7438. }
  7439. return $env !== 'false' && (bool) $env;
  7440. }
  7441. if (!in_array($this->config[$key], array(true, false, 'stash'), true)) {
  7442. throw new \RuntimeException(
  7443. "Invalid value for 'discard-changes': {$this->config[$key]}. Expected true, false or stash"
  7444. );
  7445. }
  7446. return $this->config[$key];
  7447. case 'github-protocols':
  7448. $protos = $this->config['github-protocols'];
  7449. if ($this->config['secure-http'] && false !== ($index = array_search('git', $protos))) {
  7450. unset($protos[$index]);
  7451. }
  7452. if (reset($protos) === 'http') {
  7453. throw new \RuntimeException('The http protocol for github is not available anymore, update your config\'s github-protocols to use "https", "git" or "ssh"');
  7454. }
  7455. return $protos;
  7456. case 'disable-tls':
  7457. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  7458. case 'secure-http':
  7459. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  7460. case 'use-github-api':
  7461. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  7462. case 'lock':
  7463. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  7464. default:
  7465. if (!isset($this->config[$key])) {
  7466. return null;
  7467. }
  7468. return $this->process($this->config[$key], $flags);
  7469. }
  7470. }
  7471. public function all($flags = 0)
  7472. {
  7473. $all = array(
  7474. 'repositories' => $this->getRepositories(),
  7475. );
  7476. foreach (array_keys($this->config) as $key) {
  7477. $all['config'][$key] = $this->get($key, $flags);
  7478. }
  7479. return $all;
  7480. }
  7481. public function raw()
  7482. {
  7483. return array(
  7484. 'repositories' => $this->getRepositories(),
  7485. 'config' => $this->config,
  7486. );
  7487. }
  7488. public function has($key)
  7489. {
  7490. return array_key_exists($key, $this->config);
  7491. }
  7492. private function process($value, $flags)
  7493. {
  7494. $config = $this;
  7495. if (!is_string($value)) {
  7496. return $value;
  7497. }
  7498. return preg_replace_callback('#\{\$(.+)\}#', function ($match) use ($config, $flags) {
  7499. return $config->get($match[1], $flags);
  7500. }, $value);
  7501. }
  7502. private function realpath($path)
  7503. {
  7504. if (preg_match('{^(?:/|[a-z]:|[a-z0-9.]+://)}i', $path)) {
  7505. return $path;
  7506. }
  7507. return $this->baseDir . '/' . $path;
  7508. }
  7509. private function getComposerEnv($var)
  7510. {
  7511. if ($this->useEnvironment) {
  7512. return getenv($var);
  7513. }
  7514. return false;
  7515. }
  7516. private function disableRepoByName($name)
  7517. {
  7518. if (isset($this->repositories[$name])) {
  7519. unset($this->repositories[$name]);
  7520. } elseif ($name === 'packagist') {
  7521. unset($this->repositories['packagist.org']);
  7522. }
  7523. }
  7524. public function prohibitUrlByConfig($url, IOInterface $io = null)
  7525. {
  7526. if (false === filter_var($url, FILTER_VALIDATE_URL)) {
  7527. return;
  7528. }
  7529. $scheme = parse_url($url, PHP_URL_SCHEME);
  7530. if (in_array($scheme, array('http', 'git', 'ftp', 'svn'))) {
  7531. if ($this->get('secure-http')) {
  7532. throw new TransportException("Your configuration does not allow connections to $url. See https://getcomposer.org/doc/06-config.md#secure-http for details.");
  7533. } elseif ($io) {
  7534. $host = parse_url($url, PHP_URL_HOST);
  7535. if (!isset($this->warnedHosts[$host])) {
  7536. $io->writeError("<warning>Warning: Accessing $host over $scheme which is an insecure protocol.</warning>");
  7537. }
  7538. $this->warnedHosts[$host] = true;
  7539. }
  7540. }
  7541. }
  7542. public static function disableProcessTimeout()
  7543. {
  7544. ProcessExecutor::setTimeout(0);
  7545. }
  7546. }
  7547. <?php
  7548. namespace Composer\Config;
  7549. interface ConfigSourceInterface
  7550. {
  7551. public function addRepository($name, $config);
  7552. public function removeRepository($name);
  7553. public function addConfigSetting($name, $value);
  7554. public function removeConfigSetting($name);
  7555. public function addProperty($name, $value);
  7556. public function removeProperty($name);
  7557. public function addLink($type, $name, $value);
  7558. public function removeLink($type, $name);
  7559. public function getName();
  7560. }
  7561. <?php
  7562. namespace Composer\Config;
  7563. use Composer\Json\JsonFile;
  7564. use Composer\Json\JsonManipulator;
  7565. use Composer\Util\Silencer;
  7566. class JsonConfigSource implements ConfigSourceInterface
  7567. {
  7568. private $file;
  7569. private $authConfig;
  7570. public function __construct(JsonFile $file, $authConfig = false)
  7571. {
  7572. $this->file = $file;
  7573. $this->authConfig = $authConfig;
  7574. }
  7575. public function getName()
  7576. {
  7577. return $this->file->getPath();
  7578. }
  7579. public function addRepository($name, $config)
  7580. {
  7581. $this->manipulateJson('addRepository', $name, $config, function (&$config, $repo, $repoConfig) {
  7582. if (isset($config['repositories'])) {
  7583. foreach ($config['repositories'] as $index => $val) {
  7584. if ($index === $repo) {
  7585. continue;
  7586. }
  7587. if (is_numeric($index) && ($val === array('packagist' => false) || $val === array('packagist.org' => false))) {
  7588. unset($config['repositories'][$index]);
  7589. $config['repositories']['packagist.org'] = false;
  7590. break;
  7591. }
  7592. }
  7593. }
  7594. $config['repositories'][$repo] = $repoConfig;
  7595. });
  7596. }
  7597. public function removeRepository($name)
  7598. {
  7599. $this->manipulateJson('removeRepository', $name, function (&$config, $repo) {
  7600. unset($config['repositories'][$repo]);
  7601. });
  7602. }
  7603. public function addConfigSetting($name, $value)
  7604. {
  7605. $authConfig = $this->authConfig;
  7606. $this->manipulateJson('addConfigSetting', $name, $value, function (&$config, $key, $val) use ($authConfig) {
  7607. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|bearer|http-basic|platform)\.}', $key)) {
  7608. list($key, $host) = explode('.', $key, 2);
  7609. if ($authConfig) {
  7610. $config[$key][$host] = $val;
  7611. } else {
  7612. $config['config'][$key][$host] = $val;
  7613. }
  7614. } else {
  7615. $config['config'][$key] = $val;
  7616. }
  7617. });
  7618. }
  7619. public function removeConfigSetting($name)
  7620. {
  7621. $authConfig = $this->authConfig;
  7622. $this->manipulateJson('removeConfigSetting', $name, function (&$config, $key) use ($authConfig) {
  7623. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|bearer|http-basic|platform)\.}', $key)) {
  7624. list($key, $host) = explode('.', $key, 2);
  7625. if ($authConfig) {
  7626. unset($config[$key][$host]);
  7627. } else {
  7628. unset($config['config'][$key][$host]);
  7629. }
  7630. } else {
  7631. unset($config['config'][$key]);
  7632. }
  7633. });
  7634. }
  7635. public function addProperty($name, $value)
  7636. {
  7637. $this->manipulateJson('addProperty', $name, $value, function (&$config, $key, $val) {
  7638. if (substr($key, 0, 6) === 'extra.' || substr($key, 0, 8) === 'scripts.') {
  7639. $bits = explode('.', $key);
  7640. $last = array_pop($bits);
  7641. $arr = &$config[reset($bits)];
  7642. foreach ($bits as $bit) {
  7643. if (!isset($arr[$bit])) {
  7644. $arr[$bit] = array();
  7645. }
  7646. $arr = &$arr[$bit];
  7647. }
  7648. $arr[$last] = $val;
  7649. } else {
  7650. $config[$key] = $val;
  7651. }
  7652. });
  7653. }
  7654. public function removeProperty($name)
  7655. {
  7656. $authConfig = $this->authConfig;
  7657. $this->manipulateJson('removeProperty', $name, function (&$config, $key) {
  7658. if (substr($key, 0, 6) === 'extra.' || substr($key, 0, 8) === 'scripts.') {
  7659. $bits = explode('.', $key);
  7660. $last = array_pop($bits);
  7661. $arr = &$config[reset($bits)];
  7662. foreach ($bits as $bit) {
  7663. if (!isset($arr[$bit])) {
  7664. return;
  7665. }
  7666. $arr = &$arr[$bit];
  7667. }
  7668. unset($arr[$last]);
  7669. } else {
  7670. unset($config[$key]);
  7671. }
  7672. });
  7673. }
  7674. public function addLink($type, $name, $value)
  7675. {
  7676. $this->manipulateJson('addLink', $type, $name, $value, function (&$config, $type, $name, $value) {
  7677. $config[$type][$name] = $value;
  7678. });
  7679. }
  7680. public function removeLink($type, $name)
  7681. {
  7682. $this->manipulateJson('removeSubNode', $type, $name, function (&$config, $type, $name) {
  7683. unset($config[$type][$name]);
  7684. if (0 === count($config[$type])) {
  7685. unset($config[$type]);
  7686. }
  7687. });
  7688. }
  7689. protected function manipulateJson($method, $args, $fallback)
  7690. {
  7691. $args = func_get_args();
  7692. array_shift($args);
  7693. $fallback = array_pop($args);
  7694. if ($this->file->exists()) {
  7695. if (!is_writable($this->file->getPath())) {
  7696. throw new \RuntimeException(sprintf('The file "%s" is not writable.', $this->file->getPath()));
  7697. }
  7698. if (!is_readable($this->file->getPath())) {
  7699. throw new \RuntimeException(sprintf('The file "%s" is not readable.', $this->file->getPath()));
  7700. }
  7701. $contents = file_get_contents($this->file->getPath());
  7702. } elseif ($this->authConfig) {
  7703. $contents = "{\n}\n";
  7704. } else {
  7705. $contents = "{\n \"config\": {\n }\n}\n";
  7706. }
  7707. $manipulator = new JsonManipulator($contents);
  7708. $newFile = !$this->file->exists();
  7709. if ($this->authConfig && $method === 'addConfigSetting') {
  7710. $method = 'addSubNode';
  7711. list($mainNode, $name) = explode('.', $args[0], 2);
  7712. $args = array($mainNode, $name, $args[1]);
  7713. } elseif ($this->authConfig && $method === 'removeConfigSetting') {
  7714. $method = 'removeSubNode';
  7715. list($mainNode, $name) = explode('.', $args[0], 2);
  7716. $args = array($mainNode, $name);
  7717. }
  7718. if (call_user_func_array(array($manipulator, $method), $args)) {
  7719. file_put_contents($this->file->getPath(), $manipulator->getContents());
  7720. } else {
  7721. $config = $this->file->read();
  7722. $this->arrayUnshiftRef($args, $config);
  7723. call_user_func_array($fallback, $args);
  7724. foreach (array('require', 'require-dev', 'conflict', 'provide', 'replace', 'suggest', 'config', 'autoload', 'autoload-dev') as $linkType) {
  7725. if (isset($config[$linkType]) && $config[$linkType] === array()) {
  7726. $config[$linkType] = new \stdClass;
  7727. }
  7728. }
  7729. $this->file->write($config);
  7730. }
  7731. if ($newFile) {
  7732. Silencer::call('chmod', $this->file->getPath(), 0600);
  7733. }
  7734. }
  7735. private function arrayUnshiftRef(&$array, &$value)
  7736. {
  7737. $return = array_unshift($array, '');
  7738. $array[0] = &$value;
  7739. return $return;
  7740. }
  7741. }
  7742. <?php
  7743. namespace Composer\Console;
  7744. use Composer\IO\NullIO;
  7745. use Composer\Util\Platform;
  7746. use Composer\Util\Silencer;
  7747. use Symfony\Component\Console\Application as BaseApplication;
  7748. use Symfony\Component\Console\Exception\CommandNotFoundException;
  7749. use Symfony\Component\Console\Helper\HelperSet;
  7750. use Symfony\Component\Console\Helper\QuestionHelper;
  7751. use Symfony\Component\Console\Input\InputInterface;
  7752. use Symfony\Component\Console\Input\InputOption;
  7753. use Symfony\Component\Console\Output\OutputInterface;
  7754. use Composer\Command;
  7755. use Composer\Composer;
  7756. use Composer\Factory;
  7757. use Composer\IO\IOInterface;
  7758. use Composer\IO\ConsoleIO;
  7759. use Composer\Json\JsonValidationException;
  7760. use Composer\Util\ErrorHandler;
  7761. use Composer\EventDispatcher\ScriptExecutionException;
  7762. use Composer\Exception\NoSslException;
  7763. class Application extends BaseApplication
  7764. {
  7765. protected $composer;
  7766. protected $io;
  7767. private static $logo = ' ______
  7768. / ____/___ ____ ___ ____ ____ ________ _____
  7769. / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
  7770. / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
  7771. \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
  7772. /_/
  7773. ';
  7774. private $hasPluginCommands = false;
  7775. private $disablePluginsByDefault = false;
  7776. private $initialWorkingDirectory = '';
  7777. public function __construct()
  7778. {
  7779. static $shutdownRegistered = false;
  7780. if (function_exists('ini_set') && extension_loaded('xdebug')) {
  7781. ini_set('xdebug.show_exception_trace', false);
  7782. ini_set('xdebug.scream', false);
  7783. }
  7784. if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
  7785. date_default_timezone_set(Silencer::call('date_default_timezone_get'));
  7786. }
  7787. if (!$shutdownRegistered) {
  7788. $shutdownRegistered = true;
  7789. register_shutdown_function(function () {
  7790. $lastError = error_get_last();
  7791. if ($lastError && $lastError['message'] &&
  7792. (strpos($lastError['message'], 'Allowed memory') !== false ||
  7793. strpos($lastError['message'], 'exceeded memory') !== false )) {
  7794. echo "\n". 'Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.';
  7795. }
  7796. });
  7797. }
  7798. $this->io = new NullIO();
  7799. $this->initialWorkingDirectory = getcwd();
  7800. parent::__construct('Composer', Composer::getVersion());
  7801. }
  7802. public function run(InputInterface $input = null, OutputInterface $output = null)
  7803. {
  7804. if (null === $output) {
  7805. $output = Factory::createOutput();
  7806. }
  7807. return parent::run($input, $output);
  7808. }
  7809. public function doRun(InputInterface $input, OutputInterface $output)
  7810. {
  7811. $this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins');
  7812. if (getenv('COMPOSER_NO_INTERACTION')) {
  7813. $input->setInteractive(false);
  7814. }
  7815. $io = $this->io = new ConsoleIO($input, $output, new HelperSet(array(
  7816. new QuestionHelper(),
  7817. )));
  7818. ErrorHandler::register($io);
  7819. if ($input->hasParameterOption('--no-cache')) {
  7820. $io->writeError('Disabling cache usage', true, IOInterface::DEBUG);
  7821. $_SERVER['COMPOSER_CACHE_DIR'] = Platform::isWindows() ? 'nul' : '/dev/null';
  7822. putenv('COMPOSER_CACHE_DIR='.$_SERVER['COMPOSER_CACHE_DIR']);
  7823. }
  7824. if ($newWorkDir = $this->getNewWorkingDir($input)) {
  7825. $oldWorkingDir = getcwd();
  7826. chdir($newWorkDir);
  7827. $this->initialWorkingDirectory = $newWorkDir;
  7828. $io->writeError('Changed CWD to ' . getcwd(), true, IOInterface::DEBUG);
  7829. }
  7830. $commandName = '';
  7831. if ($name = $this->getCommandName($input)) {
  7832. try {
  7833. $commandName = $this->find($name)->getName();
  7834. } catch (CommandNotFoundException $e) {
  7835. $commandName = false;
  7836. } catch (\InvalidArgumentException $e) {
  7837. }
  7838. }
  7839. if ($io->isInteractive() && !$newWorkDir && !in_array($commandName, array('', 'list', 'init', 'about', 'help', 'diagnose', 'self-update', 'global', 'create-project', 'outdated'), true) && !file_exists(Factory::getComposerFile())) {
  7840. $dir = dirname(getcwd());
  7841. $home = realpath(getenv('HOME') ?: getenv('USERPROFILE') ?: '/');
  7842. while (dirname($dir) !== $dir && $dir !== $home) {
  7843. if (file_exists($dir.'/'.Factory::getComposerFile())) {
  7844. 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)) {
  7845. $oldWorkingDir = getcwd();
  7846. chdir($dir);
  7847. }
  7848. break;
  7849. }
  7850. $dir = dirname($dir);
  7851. }
  7852. }
  7853. if (!$this->disablePluginsByDefault && !$this->hasPluginCommands && 'global' !== $commandName) {
  7854. try {
  7855. foreach ($this->getPluginCommands() as $command) {
  7856. if ($this->has($command->getName())) {
  7857. $io->writeError('<warning>Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped</warning>');
  7858. } else {
  7859. $this->add($command);
  7860. }
  7861. }
  7862. } catch (NoSslException $e) {
  7863. }
  7864. $this->hasPluginCommands = true;
  7865. }
  7866. $isProxyCommand = false;
  7867. if ($name = $this->getCommandName($input)) {
  7868. try {
  7869. $command = $this->find($name);
  7870. $commandName = $command->getName();
  7871. $isProxyCommand = ($command instanceof Command\BaseCommand && $command->isProxyCommand());
  7872. } catch (\InvalidArgumentException $e) {
  7873. }
  7874. }
  7875. if (!$isProxyCommand) {
  7876. $io->writeError(sprintf(
  7877. 'Running %s (%s) with %s on %s',
  7878. Composer::getVersion(),
  7879. Composer::RELEASE_DATE,
  7880. defined('HHVM_VERSION') ? 'HHVM '.HHVM_VERSION : 'PHP '.PHP_VERSION,
  7881. function_exists('php_uname') ? php_uname('s') . ' / ' . php_uname('r') : 'Unknown OS'
  7882. ), true, IOInterface::DEBUG);
  7883. if (PHP_VERSION_ID < 50302) {
  7884. $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>');
  7885. }
  7886. if (extension_loaded('xdebug') && !getenv('COMPOSER_DISABLE_XDEBUG_WARN')) {
  7887. $io->writeError('<warning>You are running composer with Xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug</warning>');
  7888. }
  7889. if (defined('COMPOSER_DEV_WARNING_TIME') && $commandName !== 'self-update' && $commandName !== 'selfupdate' && time() > COMPOSER_DEV_WARNING_TIME) {
  7890. $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']));
  7891. }
  7892. if (
  7893. !Platform::isWindows()
  7894. && function_exists('exec')
  7895. && !getenv('COMPOSER_ALLOW_SUPERUSER')
  7896. && (ini_get('open_basedir') || !file_exists('/.dockerenv'))
  7897. ) {
  7898. if (function_exists('posix_getuid') && posix_getuid() === 0) {
  7899. if ($commandName !== 'self-update' && $commandName !== 'selfupdate') {
  7900. $io->writeError('<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>');
  7901. }
  7902. if ($uid = (int) getenv('SUDO_UID')) {
  7903. Silencer::call('exec', "sudo -u \\#{$uid} sudo -K > /dev/null 2>&1");
  7904. }
  7905. }
  7906. Silencer::call('exec', 'sudo -K > /dev/null 2>&1');
  7907. }
  7908. Silencer::call(function () use ($io) {
  7909. $tempfile = sys_get_temp_dir() . '/temp-' . md5(microtime());
  7910. if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) == __FILE__) && unlink($tempfile) && !file_exists($tempfile))) {
  7911. $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()));
  7912. }
  7913. });
  7914. $file = Factory::getComposerFile();
  7915. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  7916. if (isset($composer['scripts']) && is_array($composer['scripts'])) {
  7917. foreach ($composer['scripts'] as $script => $dummy) {
  7918. if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  7919. if ($this->has($script)) {
  7920. $io->writeError('<warning>A script named '.$script.' would override a Composer command and has been skipped</warning>');
  7921. } else {
  7922. $description = null;
  7923. if (isset($composer['scripts-descriptions'][$script])) {
  7924. $description = $composer['scripts-descriptions'][$script];
  7925. }
  7926. $this->add(new Command\ScriptAliasCommand($script, $description));
  7927. }
  7928. }
  7929. }
  7930. }
  7931. }
  7932. }
  7933. try {
  7934. if ($input->hasParameterOption('--profile')) {
  7935. $startTime = microtime(true);
  7936. $this->io->enableDebugging($startTime);
  7937. }
  7938. $result = parent::doRun($input, $output);
  7939. if (isset($oldWorkingDir)) {
  7940. chdir($oldWorkingDir);
  7941. }
  7942. if (isset($startTime)) {
  7943. $io->writeError('<info>Memory usage: '.round(memory_get_usage() / 1024 / 1024, 2).'MiB (peak: '.round(memory_get_peak_usage() / 1024 / 1024, 2).'MiB), time: '.round(microtime(true) - $startTime, 2).'s');
  7944. }
  7945. restore_error_handler();
  7946. return $result;
  7947. } catch (ScriptExecutionException $e) {
  7948. return $e->getCode();
  7949. } catch (\Exception $e) {
  7950. $this->hintCommonErrors($e);
  7951. restore_error_handler();
  7952. throw $e;
  7953. }
  7954. }
  7955. private function getNewWorkingDir(InputInterface $input)
  7956. {
  7957. $workingDir = $input->getParameterOption(array('--working-dir', '-d'));
  7958. if (false !== $workingDir && !is_dir($workingDir)) {
  7959. throw new \RuntimeException('Invalid working directory specified, '.$workingDir.' does not exist.');
  7960. }
  7961. return $workingDir;
  7962. }
  7963. private function hintCommonErrors($exception)
  7964. {
  7965. $io = $this->getIO();
  7966. Silencer::suppress();
  7967. try {
  7968. $composer = $this->getComposer(false, true);
  7969. if ($composer) {
  7970. $config = $composer->getConfig();
  7971. $minSpaceFree = 1024 * 1024;
  7972. if ((($df = disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  7973. || (($df = disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  7974. || (($df = disk_free_space($dir = sys_get_temp_dir())) !== false && $df < $minSpaceFree)
  7975. ) {
  7976. $io->writeError('<error>The disk hosting '.$dir.' is full, this may be the cause of the following exception</error>', true, IOInterface::QUIET);
  7977. }
  7978. }
  7979. } catch (\Exception $e) {
  7980. }
  7981. Silencer::restore();
  7982. if (Platform::isWindows() && false !== strpos($exception->getMessage(), 'The system cannot find the path specified')) {
  7983. $io->writeError('<error>The following exception may be caused by a stale entry in your cmd.exe AutoRun</error>', true, IOInterface::QUIET);
  7984. $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);
  7985. }
  7986. if (false !== strpos($exception->getMessage(), 'fork failed - Cannot allocate memory')) {
  7987. $io->writeError('<error>The following exception is caused by a lack of memory or swap, or not having swap configured</error>', true, IOInterface::QUIET);
  7988. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details</error>', true, IOInterface::QUIET);
  7989. }
  7990. }
  7991. public function getComposer($required = true, $disablePlugins = null)
  7992. {
  7993. if (null === $disablePlugins) {
  7994. $disablePlugins = $this->disablePluginsByDefault;
  7995. }
  7996. if (null === $this->composer) {
  7997. try {
  7998. $this->composer = Factory::create($this->io, null, $disablePlugins);
  7999. } catch (\InvalidArgumentException $e) {
  8000. if ($required) {
  8001. $this->io->writeError($e->getMessage());
  8002. exit(1);
  8003. }
  8004. } catch (JsonValidationException $e) {
  8005. $errors = ' - ' . implode(PHP_EOL . ' - ', $e->getErrors());
  8006. $message = $e->getMessage() . ':' . PHP_EOL . $errors;
  8007. throw new JsonValidationException($message);
  8008. }
  8009. }
  8010. return $this->composer;
  8011. }
  8012. public function resetComposer()
  8013. {
  8014. $this->composer = null;
  8015. if ($this->getIO() && method_exists($this->getIO(), 'resetAuthentications')) {
  8016. $this->getIO()->resetAuthentications();
  8017. }
  8018. }
  8019. public function getIO()
  8020. {
  8021. return $this->io;
  8022. }
  8023. public function getHelp()
  8024. {
  8025. return self::$logo . parent::getHelp();
  8026. }
  8027. protected function getDefaultCommands()
  8028. {
  8029. $commands = array_merge(parent::getDefaultCommands(), array(
  8030. new Command\AboutCommand(),
  8031. new Command\ConfigCommand(),
  8032. new Command\DependsCommand(),
  8033. new Command\ProhibitsCommand(),
  8034. new Command\InitCommand(),
  8035. new Command\InstallCommand(),
  8036. new Command\CreateProjectCommand(),
  8037. new Command\UpdateCommand(),
  8038. new Command\SearchCommand(),
  8039. new Command\ValidateCommand(),
  8040. new Command\ShowCommand(),
  8041. new Command\SuggestsCommand(),
  8042. new Command\RequireCommand(),
  8043. new Command\DumpAutoloadCommand(),
  8044. new Command\StatusCommand(),
  8045. new Command\ArchiveCommand(),
  8046. new Command\DiagnoseCommand(),
  8047. new Command\RunScriptCommand(),
  8048. new Command\LicensesCommand(),
  8049. new Command\GlobalCommand(),
  8050. new Command\ClearCacheCommand(),
  8051. new Command\RemoveCommand(),
  8052. new Command\HomeCommand(),
  8053. new Command\ExecCommand(),
  8054. new Command\OutdatedCommand(),
  8055. new Command\CheckPlatformReqsCommand(),
  8056. new Command\FundCommand(),
  8057. ));
  8058. if ('phar:' === substr(__FILE__, 0, 5)) {
  8059. $commands[] = new Command\SelfUpdateCommand();
  8060. }
  8061. return $commands;
  8062. }
  8063. public function getLongVersion()
  8064. {
  8065. if (Composer::BRANCH_ALIAS_VERSION && Composer::BRANCH_ALIAS_VERSION !== '@package_branch_alias_version'.'@') {
  8066. return sprintf(
  8067. '<info>%s</info> version <comment>%s (%s)</comment> %s',
  8068. $this->getName(),
  8069. Composer::BRANCH_ALIAS_VERSION,
  8070. $this->getVersion(),
  8071. Composer::RELEASE_DATE
  8072. );
  8073. }
  8074. return parent::getLongVersion() . ' ' . Composer::RELEASE_DATE;
  8075. }
  8076. protected function getDefaultInputDefinition()
  8077. {
  8078. $definition = parent::getDefaultInputDefinition();
  8079. $definition->addOption(new InputOption('--profile', null, InputOption::VALUE_NONE, 'Display timing and memory usage information'));
  8080. $definition->addOption(new InputOption('--no-plugins', null, InputOption::VALUE_NONE, 'Whether to disable plugins.'));
  8081. $definition->addOption(new InputOption('--working-dir', '-d', InputOption::VALUE_REQUIRED, 'If specified, use the given directory as working directory.'));
  8082. $definition->addOption(new InputOption('--no-cache', null, InputOption::VALUE_NONE, 'Prevent use of the cache'));
  8083. return $definition;
  8084. }
  8085. private function getPluginCommands()
  8086. {
  8087. $commands = array();
  8088. $composer = $this->getComposer(false, false);
  8089. if (null === $composer) {
  8090. $composer = Factory::createGlobal($this->io, false);
  8091. }
  8092. if (null !== $composer) {
  8093. $pm = $composer->getPluginManager();
  8094. foreach ($pm->getPluginCapabilities('Composer\Plugin\Capability\CommandProvider', array('composer' => $composer, 'io' => $this->io)) as $capability) {
  8095. $newCommands = $capability->getCommands();
  8096. if (!is_array($newCommands)) {
  8097. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' failed to return an array from getCommands');
  8098. }
  8099. foreach ($newCommands as $command) {
  8100. if (!$command instanceof Command\BaseCommand) {
  8101. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' returned an invalid value, we expected an array of Composer\Command\BaseCommand objects');
  8102. }
  8103. }
  8104. $commands = array_merge($commands, $newCommands);
  8105. }
  8106. }
  8107. return $commands;
  8108. }
  8109. public function getInitialWorkingDirectory()
  8110. {
  8111. return $this->initialWorkingDirectory;
  8112. }
  8113. }
  8114. <?php
  8115. namespace Composer\Console;
  8116. use Symfony\Component\Console\Formatter\OutputFormatter;
  8117. class HtmlOutputFormatter extends OutputFormatter
  8118. {
  8119. private static $availableForegroundColors = array(
  8120. 30 => 'black',
  8121. 31 => 'red',
  8122. 32 => 'green',
  8123. 33 => 'yellow',
  8124. 34 => 'blue',
  8125. 35 => 'magenta',
  8126. 36 => 'cyan',
  8127. 37 => 'white',
  8128. );
  8129. private static $availableBackgroundColors = array(
  8130. 40 => 'black',
  8131. 41 => 'red',
  8132. 42 => 'green',
  8133. 43 => 'yellow',
  8134. 44 => 'blue',
  8135. 45 => 'magenta',
  8136. 46 => 'cyan',
  8137. 47 => 'white',
  8138. );
  8139. private static $availableOptions = array(
  8140. 1 => 'bold',
  8141. 4 => 'underscore',
  8142. );
  8143. public function __construct(array $styles = array())
  8144. {
  8145. parent::__construct(true, $styles);
  8146. }
  8147. public function format($message)
  8148. {
  8149. $formatted = parent::format($message);
  8150. $clearEscapeCodes = '(?:39|49|0|22|24|25|27|28)';
  8151. return preg_replace_callback("{\033\[([0-9;]+)m(.*?)\033\[(?:".$clearEscapeCodes.";)*?".$clearEscapeCodes."m}s", array($this, 'formatHtml'), $formatted);
  8152. }
  8153. private function formatHtml($matches)
  8154. {
  8155. $out = '<span style="';
  8156. foreach (explode(';', $matches[1]) as $code) {
  8157. if (isset(self::$availableForegroundColors[$code])) {
  8158. $out .= 'color:'.self::$availableForegroundColors[$code].';';
  8159. } elseif (isset(self::$availableBackgroundColors[$code])) {
  8160. $out .= 'background-color:'.self::$availableBackgroundColors[$code].';';
  8161. } elseif (isset(self::$availableOptions[$code])) {
  8162. switch (self::$availableOptions[$code]) {
  8163. case 'bold':
  8164. $out .= 'font-weight:bold;';
  8165. break;
  8166. case 'underscore':
  8167. $out .= 'text-decoration:underline;';
  8168. break;
  8169. }
  8170. }
  8171. }
  8172. return $out.'">'.$matches[2].'</span>';
  8173. }
  8174. }
  8175. <?php
  8176. namespace Composer\DependencyResolver;
  8177. class Decisions implements \Iterator, \Countable
  8178. {
  8179. const DECISION_LITERAL = 0;
  8180. const DECISION_REASON = 1;
  8181. protected $pool;
  8182. protected $decisionMap;
  8183. protected $decisionQueue = array();
  8184. public function __construct($pool)
  8185. {
  8186. $this->pool = $pool;
  8187. $this->decisionMap = array();
  8188. }
  8189. public function decide($literal, $level, $why)
  8190. {
  8191. $this->addDecision($literal, $level);
  8192. $this->decisionQueue[] = array(
  8193. self::DECISION_LITERAL => $literal,
  8194. self::DECISION_REASON => $why,
  8195. );
  8196. }
  8197. public function satisfy($literal)
  8198. {
  8199. $packageId = abs($literal);
  8200. return (
  8201. $literal > 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 ||
  8202. $literal < 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0
  8203. );
  8204. }
  8205. public function conflict($literal)
  8206. {
  8207. $packageId = abs($literal);
  8208. return (
  8209. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 && $literal < 0) ||
  8210. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0 && $literal > 0)
  8211. );
  8212. }
  8213. public function decided($literalOrPackageId)
  8214. {
  8215. return !empty($this->decisionMap[abs($literalOrPackageId)]);
  8216. }
  8217. public function undecided($literalOrPackageId)
  8218. {
  8219. return empty($this->decisionMap[abs($literalOrPackageId)]);
  8220. }
  8221. public function decidedInstall($literalOrPackageId)
  8222. {
  8223. $packageId = abs($literalOrPackageId);
  8224. return isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0;
  8225. }
  8226. public function decisionLevel($literalOrPackageId)
  8227. {
  8228. $packageId = abs($literalOrPackageId);
  8229. if (isset($this->decisionMap[$packageId])) {
  8230. return abs($this->decisionMap[$packageId]);
  8231. }
  8232. return 0;
  8233. }
  8234. public function decisionRule($literalOrPackageId)
  8235. {
  8236. $packageId = abs($literalOrPackageId);
  8237. foreach ($this->decisionQueue as $i => $decision) {
  8238. if ($packageId === abs($decision[self::DECISION_LITERAL])) {
  8239. return $decision[self::DECISION_REASON];
  8240. }
  8241. }
  8242. return null;
  8243. }
  8244. public function atOffset($queueOffset)
  8245. {
  8246. return $this->decisionQueue[$queueOffset];
  8247. }
  8248. public function validOffset($queueOffset)
  8249. {
  8250. return $queueOffset >= 0 && $queueOffset < count($this->decisionQueue);
  8251. }
  8252. public function lastReason()
  8253. {
  8254. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_REASON];
  8255. }
  8256. public function lastLiteral()
  8257. {
  8258. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_LITERAL];
  8259. }
  8260. public function reset()
  8261. {
  8262. while ($decision = array_pop($this->decisionQueue)) {
  8263. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  8264. }
  8265. }
  8266. public function resetToOffset($offset)
  8267. {
  8268. while (count($this->decisionQueue) > $offset + 1) {
  8269. $decision = array_pop($this->decisionQueue);
  8270. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  8271. }
  8272. }
  8273. public function revertLast()
  8274. {
  8275. $this->decisionMap[abs($this->lastLiteral())] = 0;
  8276. array_pop($this->decisionQueue);
  8277. }
  8278. public function count()
  8279. {
  8280. return count($this->decisionQueue);
  8281. }
  8282. public function rewind()
  8283. {
  8284. end($this->decisionQueue);
  8285. }
  8286. public function current()
  8287. {
  8288. return current($this->decisionQueue);
  8289. }
  8290. public function key()
  8291. {
  8292. return key($this->decisionQueue);
  8293. }
  8294. public function next()
  8295. {
  8296. return prev($this->decisionQueue);
  8297. }
  8298. public function valid()
  8299. {
  8300. return false !== current($this->decisionQueue);
  8301. }
  8302. public function isEmpty()
  8303. {
  8304. return count($this->decisionQueue) === 0;
  8305. }
  8306. protected function addDecision($literal, $level)
  8307. {
  8308. $packageId = abs($literal);
  8309. $previousDecision = isset($this->decisionMap[$packageId]) ? $this->decisionMap[$packageId] : null;
  8310. if ($previousDecision != 0) {
  8311. $literalString = $this->pool->literalToPrettyString($literal, array());
  8312. $package = $this->pool->literalToPackage($literal);
  8313. throw new SolverBugException(
  8314. "Trying to decide $literalString on level $level, even though $package was previously decided as ".(int) $previousDecision."."
  8315. );
  8316. }
  8317. if ($literal > 0) {
  8318. $this->decisionMap[$packageId] = $level;
  8319. } else {
  8320. $this->decisionMap[$packageId] = -$level;
  8321. }
  8322. }
  8323. public function __toString()
  8324. {
  8325. $decisionMap = $this->decisionMap;
  8326. ksort($decisionMap);
  8327. $str = '[';
  8328. foreach ($decisionMap as $packageId => $level) {
  8329. $str .= $packageId.':'.$level.',';
  8330. }
  8331. $str .= ']';
  8332. return $str;
  8333. }
  8334. }
  8335. <?php
  8336. namespace Composer\DependencyResolver;
  8337. use Composer\Package\PackageInterface;
  8338. use Composer\Package\AliasPackage;
  8339. use Composer\Package\BasePackage;
  8340. use Composer\Semver\Constraint\Constraint;
  8341. class DefaultPolicy implements PolicyInterface
  8342. {
  8343. private $preferStable;
  8344. private $preferLowest;
  8345. public function __construct($preferStable = false, $preferLowest = false)
  8346. {
  8347. $this->preferStable = $preferStable;
  8348. $this->preferLowest = $preferLowest;
  8349. }
  8350. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator)
  8351. {
  8352. if ($this->preferStable && ($stabA = $a->getStability()) !== ($stabB = $b->getStability())) {
  8353. return BasePackage::$stabilities[$stabA] < BasePackage::$stabilities[$stabB];
  8354. }
  8355. $constraint = new Constraint($operator, $b->getVersion());
  8356. $version = new Constraint('==', $a->getVersion());
  8357. return $constraint->matchSpecific($version, true);
  8358. }
  8359. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package, $mustMatchName = false)
  8360. {
  8361. $packages = array();
  8362. foreach ($pool->whatProvides($package->getName(), null, $mustMatchName) as $candidate) {
  8363. if ($candidate !== $package) {
  8364. $packages[] = $candidate;
  8365. }
  8366. }
  8367. return $packages;
  8368. }
  8369. public function getPriority(Pool $pool, PackageInterface $package)
  8370. {
  8371. return $pool->getPriority($package->getRepository());
  8372. }
  8373. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null)
  8374. {
  8375. $packages = $this->groupLiteralsByNamePreferInstalled($pool, $installedMap, $literals);
  8376. foreach ($packages as &$literals) {
  8377. $policy = $this;
  8378. usort($literals, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  8379. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage, true);
  8380. });
  8381. }
  8382. foreach ($packages as &$literals) {
  8383. $literals = $this->pruneToHighestPriorityOrInstalled($pool, $installedMap, $literals);
  8384. $literals = $this->pruneToBestVersion($pool, $literals);
  8385. $literals = $this->pruneRemoteAliases($pool, $literals);
  8386. }
  8387. $selected = call_user_func_array('array_merge', $packages);
  8388. usort($selected, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  8389. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage);
  8390. });
  8391. return $selected;
  8392. }
  8393. protected function groupLiteralsByNamePreferInstalled(Pool $pool, array $installedMap, $literals)
  8394. {
  8395. $packages = array();
  8396. foreach ($literals as $literal) {
  8397. $packageName = $pool->literalToPackage($literal)->getName();
  8398. if (!isset($packages[$packageName])) {
  8399. $packages[$packageName] = array();
  8400. }
  8401. if (isset($installedMap[abs($literal)])) {
  8402. array_unshift($packages[$packageName], $literal);
  8403. } else {
  8404. $packages[$packageName][] = $literal;
  8405. }
  8406. }
  8407. return $packages;
  8408. }
  8409. public function compareByPriorityPreferInstalled(Pool $pool, array $installedMap, PackageInterface $a, PackageInterface $b, $requiredPackage = null, $ignoreReplace = false)
  8410. {
  8411. if ($a->getRepository() === $b->getRepository()) {
  8412. if ($a->getName() === $b->getName()) {
  8413. $aAliased = $a instanceof AliasPackage;
  8414. $bAliased = $b instanceof AliasPackage;
  8415. if ($aAliased && !$bAliased) {
  8416. return -1;
  8417. }
  8418. if (!$aAliased && $bAliased) {
  8419. return 1;
  8420. }
  8421. }
  8422. if (!$ignoreReplace) {
  8423. if ($this->replaces($a, $b)) {
  8424. return 1;
  8425. }
  8426. if ($this->replaces($b, $a)) {
  8427. return -1;
  8428. }
  8429. if ($requiredPackage && false !== ($pos = strpos($requiredPackage, '/'))) {
  8430. $requiredVendor = substr($requiredPackage, 0, $pos);
  8431. $aIsSameVendor = substr($a->getName(), 0, $pos) === $requiredVendor;
  8432. $bIsSameVendor = substr($b->getName(), 0, $pos) === $requiredVendor;
  8433. if ($bIsSameVendor !== $aIsSameVendor) {
  8434. return $aIsSameVendor ? -1 : 1;
  8435. }
  8436. }
  8437. }
  8438. if ($a->id === $b->id) {
  8439. return 0;
  8440. }
  8441. return ($a->id < $b->id) ? -1 : 1;
  8442. }
  8443. if (isset($installedMap[$a->id])) {
  8444. return -1;
  8445. }
  8446. if (isset($installedMap[$b->id])) {
  8447. return 1;
  8448. }
  8449. return ($this->getPriority($pool, $a) > $this->getPriority($pool, $b)) ? -1 : 1;
  8450. }
  8451. protected function replaces(PackageInterface $source, PackageInterface $target)
  8452. {
  8453. foreach ($source->getReplaces() as $link) {
  8454. if ($link->getTarget() === $target->getName()
  8455. ) {
  8456. return true;
  8457. }
  8458. }
  8459. return false;
  8460. }
  8461. protected function pruneToBestVersion(Pool $pool, $literals)
  8462. {
  8463. $operator = $this->preferLowest ? '<' : '>';
  8464. $bestLiterals = array($literals[0]);
  8465. $bestPackage = $pool->literalToPackage($literals[0]);
  8466. foreach ($literals as $i => $literal) {
  8467. if (0 === $i) {
  8468. continue;
  8469. }
  8470. $package = $pool->literalToPackage($literal);
  8471. if ($this->versionCompare($package, $bestPackage, $operator)) {
  8472. $bestPackage = $package;
  8473. $bestLiterals = array($literal);
  8474. } elseif ($this->versionCompare($package, $bestPackage, '==')) {
  8475. $bestLiterals[] = $literal;
  8476. }
  8477. }
  8478. return $bestLiterals;
  8479. }
  8480. protected function pruneToHighestPriorityOrInstalled(Pool $pool, array $installedMap, array $literals)
  8481. {
  8482. $selected = array();
  8483. $priority = null;
  8484. foreach ($literals as $literal) {
  8485. $package = $pool->literalToPackage($literal);
  8486. if (isset($installedMap[$package->id])) {
  8487. $selected[] = $literal;
  8488. continue;
  8489. }
  8490. if (null === $priority) {
  8491. $priority = $this->getPriority($pool, $package);
  8492. }
  8493. if ($this->getPriority($pool, $package) != $priority) {
  8494. break;
  8495. }
  8496. $selected[] = $literal;
  8497. }
  8498. return $selected;
  8499. }
  8500. protected function pruneRemoteAliases(Pool $pool, array $literals)
  8501. {
  8502. $hasLocalAlias = false;
  8503. foreach ($literals as $literal) {
  8504. $package = $pool->literalToPackage($literal);
  8505. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  8506. $hasLocalAlias = true;
  8507. break;
  8508. }
  8509. }
  8510. if (!$hasLocalAlias) {
  8511. return $literals;
  8512. }
  8513. $selected = array();
  8514. foreach ($literals as $literal) {
  8515. $package = $pool->literalToPackage($literal);
  8516. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  8517. $selected[] = $literal;
  8518. }
  8519. }
  8520. return $selected;
  8521. }
  8522. }
  8523. <?php
  8524. namespace Composer\DependencyResolver;
  8525. use Composer\Package\PackageInterface;
  8526. use Composer\Package\Link;
  8527. class GenericRule extends Rule
  8528. {
  8529. protected $literals;
  8530. public function __construct(array $literals, $reason, $reasonData, $job = null)
  8531. {
  8532. parent::__construct($reason, $reasonData, $job);
  8533. sort($literals);
  8534. $this->literals = $literals;
  8535. }
  8536. public function getLiterals()
  8537. {
  8538. return $this->literals;
  8539. }
  8540. public function getHash()
  8541. {
  8542. $data = unpack('ihash', md5(implode(',', $this->literals), true));
  8543. return $data['hash'];
  8544. }
  8545. public function equals(Rule $rule)
  8546. {
  8547. return $this->literals === $rule->getLiterals();
  8548. }
  8549. public function isAssertion()
  8550. {
  8551. return 1 === count($this->literals);
  8552. }
  8553. public function __toString()
  8554. {
  8555. $result = $this->isDisabled() ? 'disabled(' : '(';
  8556. foreach ($this->literals as $i => $literal) {
  8557. if ($i != 0) {
  8558. $result .= '|';
  8559. }
  8560. $result .= $literal;
  8561. }
  8562. $result .= ')';
  8563. return $result;
  8564. }
  8565. }
  8566. <?php
  8567. namespace Composer\DependencyResolver\Operation;
  8568. use Composer\Package\PackageInterface;
  8569. class InstallOperation extends SolverOperation
  8570. {
  8571. protected $package;
  8572. public function __construct(PackageInterface $package, $reason = null)
  8573. {
  8574. parent::__construct($reason);
  8575. $this->package = $package;
  8576. }
  8577. public function getPackage()
  8578. {
  8579. return $this->package;
  8580. }
  8581. public function getJobType()
  8582. {
  8583. return 'install';
  8584. }
  8585. public function __toString()
  8586. {
  8587. return 'Installing '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  8588. }
  8589. }
  8590. <?php
  8591. namespace Composer\DependencyResolver\Operation;
  8592. use Composer\Package\AliasPackage;
  8593. use Composer\Package\PackageInterface;
  8594. class MarkAliasInstalledOperation extends SolverOperation
  8595. {
  8596. protected $package;
  8597. public function __construct(AliasPackage $package, $reason = null)
  8598. {
  8599. parent::__construct($reason);
  8600. $this->package = $package;
  8601. }
  8602. public function getPackage()
  8603. {
  8604. return $this->package;
  8605. }
  8606. public function getJobType()
  8607. {
  8608. return 'markAliasInstalled';
  8609. }
  8610. public function __toString()
  8611. {
  8612. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as installed, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  8613. }
  8614. }
  8615. <?php
  8616. namespace Composer\DependencyResolver\Operation;
  8617. use Composer\Package\AliasPackage;
  8618. use Composer\Package\PackageInterface;
  8619. class MarkAliasUninstalledOperation extends SolverOperation
  8620. {
  8621. protected $package;
  8622. public function __construct(AliasPackage $package, $reason = null)
  8623. {
  8624. parent::__construct($reason);
  8625. $this->package = $package;
  8626. }
  8627. public function getPackage()
  8628. {
  8629. return $this->package;
  8630. }
  8631. public function getJobType()
  8632. {
  8633. return 'markAliasUninstalled';
  8634. }
  8635. public function __toString()
  8636. {
  8637. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as uninstalled, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  8638. }
  8639. }
  8640. <?php
  8641. namespace Composer\DependencyResolver\Operation;
  8642. interface OperationInterface
  8643. {
  8644. public function getJobType();
  8645. public function getReason();
  8646. public function __toString();
  8647. }
  8648. <?php
  8649. namespace Composer\DependencyResolver\Operation;
  8650. use Composer\Package\PackageInterface;
  8651. abstract class SolverOperation implements OperationInterface
  8652. {
  8653. protected $reason;
  8654. public function __construct($reason = null)
  8655. {
  8656. $this->reason = $reason;
  8657. }
  8658. public function getReason()
  8659. {
  8660. return $this->reason;
  8661. }
  8662. protected function formatVersion(PackageInterface $package)
  8663. {
  8664. return $package->getFullPrettyVersion();
  8665. }
  8666. }
  8667. <?php
  8668. namespace Composer\DependencyResolver\Operation;
  8669. use Composer\Package\PackageInterface;
  8670. class UninstallOperation extends SolverOperation
  8671. {
  8672. protected $package;
  8673. public function __construct(PackageInterface $package, $reason = null)
  8674. {
  8675. parent::__construct($reason);
  8676. $this->package = $package;
  8677. }
  8678. public function getPackage()
  8679. {
  8680. return $this->package;
  8681. }
  8682. public function getJobType()
  8683. {
  8684. return 'uninstall';
  8685. }
  8686. public function __toString()
  8687. {
  8688. return 'Uninstalling '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  8689. }
  8690. }
  8691. <?php
  8692. namespace Composer\DependencyResolver\Operation;
  8693. use Composer\Package\PackageInterface;
  8694. use Composer\Package\Version\VersionParser;
  8695. class UpdateOperation extends SolverOperation
  8696. {
  8697. protected $initialPackage;
  8698. protected $targetPackage;
  8699. public function __construct(PackageInterface $initial, PackageInterface $target, $reason = null)
  8700. {
  8701. parent::__construct($reason);
  8702. $this->initialPackage = $initial;
  8703. $this->targetPackage = $target;
  8704. }
  8705. public function getInitialPackage()
  8706. {
  8707. return $this->initialPackage;
  8708. }
  8709. public function getTargetPackage()
  8710. {
  8711. return $this->targetPackage;
  8712. }
  8713. public function getJobType()
  8714. {
  8715. return 'update';
  8716. }
  8717. public function __toString()
  8718. {
  8719. $actionName = VersionParser::isUpgrade($this->initialPackage->getVersion(), $this->targetPackage->getVersion()) ? 'Updating' : 'Downgrading';
  8720. return $actionName.' '.$this->initialPackage->getPrettyName().' ('.$this->formatVersion($this->initialPackage).') to '.
  8721. $this->targetPackage->getPrettyName(). ' ('.$this->formatVersion($this->targetPackage).')';
  8722. }
  8723. }
  8724. <?php
  8725. namespace Composer\DependencyResolver;
  8726. use Composer\Package\PackageInterface;
  8727. interface PolicyInterface
  8728. {
  8729. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator);
  8730. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package);
  8731. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null);
  8732. }
  8733. <?php
  8734. namespace Composer\DependencyResolver;
  8735. use Composer\Package\BasePackage;
  8736. use Composer\Package\AliasPackage;
  8737. use Composer\Package\Version\VersionParser;
  8738. use Composer\Semver\Constraint\ConstraintInterface;
  8739. use Composer\Semver\Constraint\Constraint;
  8740. use Composer\Semver\Constraint\EmptyConstraint;
  8741. use Composer\Repository\RepositoryInterface;
  8742. use Composer\Repository\CompositeRepository;
  8743. use Composer\Repository\ComposerRepository;
  8744. use Composer\Repository\InstalledRepositoryInterface;
  8745. use Composer\Repository\PlatformRepository;
  8746. use Composer\Package\PackageInterface;
  8747. class Pool implements \Countable
  8748. {
  8749. const MATCH_NAME = -1;
  8750. const MATCH_NONE = 0;
  8751. const MATCH = 1;
  8752. const MATCH_PROVIDE = 2;
  8753. const MATCH_REPLACE = 3;
  8754. const MATCH_FILTERED = 4;
  8755. protected $repositories = array();
  8756. protected $providerRepos = array();
  8757. protected $packages = array();
  8758. protected $packageByName = array();
  8759. protected $packageByExactName = array();
  8760. protected $acceptableStabilities;
  8761. protected $stabilityFlags;
  8762. protected $versionParser;
  8763. protected $providerCache = array();
  8764. protected $filterRequires;
  8765. protected $whitelist = null;
  8766. protected $id = 1;
  8767. public function __construct($minimumStability = 'stable', array $stabilityFlags = array(), array $filterRequires = array())
  8768. {
  8769. $this->versionParser = new VersionParser;
  8770. $this->acceptableStabilities = array();
  8771. foreach (BasePackage::$stabilities as $stability => $value) {
  8772. if ($value <= BasePackage::$stabilities[$minimumStability]) {
  8773. $this->acceptableStabilities[$stability] = $value;
  8774. }
  8775. }
  8776. $this->stabilityFlags = $stabilityFlags;
  8777. $this->filterRequires = $filterRequires;
  8778. foreach ($filterRequires as $name => $constraint) {
  8779. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  8780. unset($this->filterRequires[$name]);
  8781. }
  8782. }
  8783. }
  8784. public function setAllowList($allowList)
  8785. {
  8786. $this->setWhitelist($allowList);
  8787. }
  8788. public function setWhitelist($whitelist)
  8789. {
  8790. $this->whitelist = $whitelist;
  8791. $this->providerCache = array();
  8792. }
  8793. public function addRepository(RepositoryInterface $repo, $rootAliases = array())
  8794. {
  8795. if ($repo instanceof CompositeRepository) {
  8796. $repos = $repo->getRepositories();
  8797. } else {
  8798. $repos = array($repo);
  8799. }
  8800. foreach ($repos as $repo) {
  8801. $this->repositories[] = $repo;
  8802. $exempt = $repo instanceof PlatformRepository || $repo instanceof InstalledRepositoryInterface;
  8803. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  8804. $this->providerRepos[] = $repo;
  8805. $repo->setRootAliases($rootAliases);
  8806. $repo->resetPackageIds();
  8807. } else {
  8808. foreach ($repo->getPackages() as $package) {
  8809. $names = $package->getNames();
  8810. $stability = $package->getStability();
  8811. if ($exempt || $this->isPackageAcceptable($names, $stability)) {
  8812. $package->setId($this->id++);
  8813. $this->packages[] = $package;
  8814. $this->packageByExactName[$package->getName()][$package->id] = $package;
  8815. foreach ($names as $provided) {
  8816. $this->packageByName[$provided][] = $package;
  8817. }
  8818. $name = $package->getName();
  8819. if (isset($rootAliases[$name][$package->getVersion()])) {
  8820. $alias = $rootAliases[$name][$package->getVersion()];
  8821. if ($package instanceof AliasPackage) {
  8822. $package = $package->getAliasOf();
  8823. }
  8824. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  8825. $aliasPackage->setRootPackageAlias(true);
  8826. $aliasPackage->setId($this->id++);
  8827. $package->getRepository()->addPackage($aliasPackage);
  8828. $this->packages[] = $aliasPackage;
  8829. $this->packageByExactName[$aliasPackage->getName()][$aliasPackage->id] = $aliasPackage;
  8830. foreach ($aliasPackage->getNames() as $name) {
  8831. $this->packageByName[$name][] = $aliasPackage;
  8832. }
  8833. }
  8834. }
  8835. }
  8836. }
  8837. }
  8838. }
  8839. public function getPriority(RepositoryInterface $repo)
  8840. {
  8841. $priority = array_search($repo, $this->repositories, true);
  8842. if (false === $priority) {
  8843. throw new \RuntimeException("Could not determine repository priority. The repository was not registered in the pool.");
  8844. }
  8845. return -$priority;
  8846. }
  8847. public function packageById($id)
  8848. {
  8849. return $this->packages[$id - 1];
  8850. }
  8851. public function count()
  8852. {
  8853. return count($this->packages);
  8854. }
  8855. public function whatProvides($name, ConstraintInterface $constraint = null, $mustMatchName = false, $bypassFilters = false)
  8856. {
  8857. if ($bypassFilters) {
  8858. return $this->computeWhatProvides($name, $constraint, $mustMatchName, true);
  8859. }
  8860. $key = ((int) $mustMatchName).$constraint;
  8861. if (isset($this->providerCache[$name][$key])) {
  8862. return $this->providerCache[$name][$key];
  8863. }
  8864. return $this->providerCache[$name][$key] = $this->computeWhatProvides($name, $constraint, $mustMatchName, $bypassFilters);
  8865. }
  8866. private function computeWhatProvides($name, $constraint, $mustMatchName = false, $bypassFilters = false)
  8867. {
  8868. $candidates = array();
  8869. foreach ($this->providerRepos as $repo) {
  8870. foreach ($repo->whatProvides($this, $name, $bypassFilters) as $candidate) {
  8871. $candidates[] = $candidate;
  8872. if ($candidate->id < 1) {
  8873. $candidate->setId($this->id++);
  8874. $this->packages[$this->id - 2] = $candidate;
  8875. }
  8876. }
  8877. }
  8878. if ($mustMatchName) {
  8879. $candidates = array_filter($candidates, function ($candidate) use ($name) {
  8880. return $candidate->getName() == $name;
  8881. });
  8882. if (isset($this->packageByExactName[$name])) {
  8883. $candidates = array_merge($candidates, $this->packageByExactName[$name]);
  8884. }
  8885. } elseif (isset($this->packageByName[$name])) {
  8886. $candidates = array_merge($candidates, $this->packageByName[$name]);
  8887. }
  8888. $matches = $provideMatches = array();
  8889. $nameMatch = false;
  8890. foreach ($candidates as $candidate) {
  8891. $aliasOfCandidate = null;
  8892. if ($candidate instanceof AliasPackage) {
  8893. $aliasOfCandidate = $candidate->getAliasOf();
  8894. }
  8895. if ($this->whitelist !== null && !$bypassFilters && (
  8896. (!($candidate instanceof AliasPackage) && !isset($this->whitelist[$candidate->id])) ||
  8897. ($candidate instanceof AliasPackage && !isset($this->whitelist[$aliasOfCandidate->id]))
  8898. )) {
  8899. continue;
  8900. }
  8901. switch ($this->match($candidate, $name, $constraint, $bypassFilters)) {
  8902. case self::MATCH_NONE:
  8903. break;
  8904. case self::MATCH_NAME:
  8905. $nameMatch = true;
  8906. break;
  8907. case self::MATCH:
  8908. $nameMatch = true;
  8909. $matches[] = $candidate;
  8910. break;
  8911. case self::MATCH_PROVIDE:
  8912. $provideMatches[] = $candidate;
  8913. break;
  8914. case self::MATCH_REPLACE:
  8915. $matches[] = $candidate;
  8916. break;
  8917. case self::MATCH_FILTERED:
  8918. break;
  8919. default:
  8920. throw new \UnexpectedValueException('Unexpected match type');
  8921. }
  8922. }
  8923. if ($nameMatch) {
  8924. return $matches;
  8925. }
  8926. return array_merge($matches, $provideMatches);
  8927. }
  8928. public function literalToPackage($literal)
  8929. {
  8930. $packageId = abs($literal);
  8931. return $this->packageById($packageId);
  8932. }
  8933. public function literalToPrettyString($literal, $installedMap)
  8934. {
  8935. $package = $this->literalToPackage($literal);
  8936. if (isset($installedMap[$package->id])) {
  8937. $prefix = ($literal > 0 ? 'keep' : 'remove');
  8938. } else {
  8939. $prefix = ($literal > 0 ? 'install' : 'don\'t install');
  8940. }
  8941. return $prefix.' '.$package->getPrettyString();
  8942. }
  8943. public function isPackageAcceptable($name, $stability)
  8944. {
  8945. foreach ((array) $name as $n) {
  8946. if (!isset($this->stabilityFlags[$n]) && isset($this->acceptableStabilities[$stability])) {
  8947. return true;
  8948. }
  8949. if (isset($this->stabilityFlags[$n]) && BasePackage::$stabilities[$stability] <= $this->stabilityFlags[$n]) {
  8950. return true;
  8951. }
  8952. }
  8953. return false;
  8954. }
  8955. public function match($candidate, $name, ConstraintInterface $constraint = null, $bypassFilters)
  8956. {
  8957. $candidateName = $candidate->getName();
  8958. $candidateVersion = $candidate->getVersion();
  8959. $isDev = $candidate->getStability() === 'dev';
  8960. $isAlias = $candidate instanceof AliasPackage;
  8961. if (!$bypassFilters && !$isDev && !$isAlias && isset($this->filterRequires[$name])) {
  8962. $requireFilter = $this->filterRequires[$name];
  8963. } else {
  8964. $requireFilter = new EmptyConstraint;
  8965. }
  8966. if ($candidateName === $name) {
  8967. $pkgConstraint = new Constraint('==', $candidateVersion);
  8968. if ($constraint === null || $constraint->matches($pkgConstraint)) {
  8969. return $requireFilter->matches($pkgConstraint) ? self::MATCH : self::MATCH_FILTERED;
  8970. }
  8971. return self::MATCH_NAME;
  8972. }
  8973. $provides = $candidate->getProvides();
  8974. $replaces = $candidate->getReplaces();
  8975. if (isset($replaces[0]) || isset($provides[0])) {
  8976. foreach ($provides as $link) {
  8977. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  8978. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  8979. }
  8980. }
  8981. foreach ($replaces as $link) {
  8982. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  8983. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  8984. }
  8985. }
  8986. return self::MATCH_NONE;
  8987. }
  8988. if (isset($provides[$name]) && ($constraint === null || $constraint->matches($provides[$name]->getConstraint()))) {
  8989. return $requireFilter->matches($provides[$name]->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  8990. }
  8991. if (isset($replaces[$name]) && ($constraint === null || $constraint->matches($replaces[$name]->getConstraint()))) {
  8992. return $requireFilter->matches($replaces[$name]->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  8993. }
  8994. return self::MATCH_NONE;
  8995. }
  8996. }
  8997. <?php
  8998. namespace Composer\DependencyResolver;
  8999. use Composer\Package\CompletePackageInterface;
  9000. class Problem
  9001. {
  9002. protected $reasonSeen;
  9003. protected $reasons = array();
  9004. protected $section = 0;
  9005. protected $pool;
  9006. public function __construct(Pool $pool)
  9007. {
  9008. $this->pool = $pool;
  9009. }
  9010. public function addRule(Rule $rule)
  9011. {
  9012. $this->addReason(spl_object_hash($rule), array(
  9013. 'rule' => $rule,
  9014. 'job' => $rule->getJob(),
  9015. ));
  9016. }
  9017. public function getReasons()
  9018. {
  9019. return $this->reasons;
  9020. }
  9021. public function getPrettyString(array $installedMap = array())
  9022. {
  9023. $reasons = call_user_func_array('array_merge', array_reverse($this->reasons));
  9024. if (count($reasons) === 1) {
  9025. reset($reasons);
  9026. $reason = current($reasons);
  9027. $job = $reason['job'];
  9028. $packageName = $job['packageName'];
  9029. $constraint = $job['constraint'];
  9030. if (isset($constraint)) {
  9031. $packages = $this->pool->whatProvides($packageName, $constraint);
  9032. } else {
  9033. $packages = array();
  9034. }
  9035. if ($job && $job['cmd'] === 'install' && empty($packages)) {
  9036. if ($packageName === 'php' || $packageName === 'php-64bit' || $packageName === 'hhvm') {
  9037. $version = phpversion();
  9038. $available = $this->pool->whatProvides($packageName);
  9039. if (count($available)) {
  9040. $firstAvailable = reset($available);
  9041. $version = $firstAvailable->getPrettyVersion();
  9042. $extra = $firstAvailable->getExtra();
  9043. if ($firstAvailable instanceof CompletePackageInterface && isset($extra['config.platform']) && $extra['config.platform'] === true) {
  9044. $version .= '; ' . $firstAvailable->getDescription();
  9045. }
  9046. }
  9047. $msg = "\n - This package requires ".$packageName.$this->constraintToText($constraint).' but ';
  9048. if (defined('HHVM_VERSION') || (count($available) && $packageName === 'hhvm')) {
  9049. return $msg . 'your HHVM version does not satisfy that requirement.';
  9050. }
  9051. if ($packageName === 'hhvm') {
  9052. return $msg . 'you are running this with PHP and not HHVM.';
  9053. }
  9054. return $msg . 'your PHP version ('. $version .') does not satisfy that requirement.';
  9055. }
  9056. if (0 === stripos($packageName, 'ext-')) {
  9057. if (false !== strpos($packageName, ' ')) {
  9058. return "\n - The requested PHP extension ".$packageName.' should be required as '.str_replace(' ', '-', $packageName).'.';
  9059. }
  9060. $ext = substr($packageName, 4);
  9061. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  9062. return "\n - The requested PHP extension ".$packageName.$this->constraintToText($constraint).' '.$error.'. Install or enable PHP\'s '.$ext.' extension.';
  9063. }
  9064. if (0 === stripos($packageName, 'lib-')) {
  9065. if (strtolower($packageName) === 'lib-icu') {
  9066. $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.';
  9067. return "\n - The requested linked library ".$packageName.$this->constraintToText($constraint).' '.$error;
  9068. }
  9069. return "\n - The requested linked library ".$packageName.$this->constraintToText($constraint).' has the wrong version installed or is missing from your system, make sure to load the extension providing it.';
  9070. }
  9071. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $packageName)) {
  9072. $illegalChars = preg_replace('{[A-Za-z0-9_./-]+}', '', $packageName);
  9073. return "\n - The requested package ".$packageName.' could not be found, it looks like its name is invalid, "'.$illegalChars.'" is not allowed in package names.';
  9074. }
  9075. if ($providers = $this->pool->whatProvides($packageName, $constraint, true, true)) {
  9076. return "\n - The requested package ".$packageName.$this->constraintToText($constraint).' is satisfiable by '.$this->getPackageList($providers).' but these conflict with your requirements or minimum-stability.';
  9077. }
  9078. if ($providers = $this->pool->whatProvides($packageName, null, true, true)) {
  9079. return "\n - The requested package ".$packageName.$this->constraintToText($constraint).' exists as '.$this->getPackageList($providers).' but these are rejected by your constraint.';
  9080. }
  9081. return "\n - The requested package ".$packageName.' could not be found in any version, there may be a typo in the package name.';
  9082. }
  9083. }
  9084. $messages = array();
  9085. foreach ($reasons as $reason) {
  9086. $rule = $reason['rule'];
  9087. $job = $reason['job'];
  9088. if ($job) {
  9089. $messages[] = $this->jobToText($job);
  9090. } elseif ($rule) {
  9091. if ($rule instanceof Rule) {
  9092. $messages[] = $rule->getPrettyString($this->pool, $installedMap);
  9093. }
  9094. }
  9095. }
  9096. return "\n - ".implode("\n - ", $messages);
  9097. }
  9098. protected function addReason($id, $reason)
  9099. {
  9100. if (!isset($this->reasonSeen[$id])) {
  9101. $this->reasonSeen[$id] = true;
  9102. $this->reasons[$this->section][] = $reason;
  9103. }
  9104. }
  9105. public function nextSection()
  9106. {
  9107. $this->section++;
  9108. }
  9109. protected function jobToText($job)
  9110. {
  9111. $packageName = $job['packageName'];
  9112. $constraint = $job['constraint'];
  9113. switch ($job['cmd']) {
  9114. case 'install':
  9115. $packages = $this->pool->whatProvides($packageName, $constraint);
  9116. if (!$packages) {
  9117. return 'No package found to satisfy install request for '.$packageName.$this->constraintToText($constraint);
  9118. }
  9119. return 'Installation request for '.$packageName.$this->constraintToText($constraint).' -> satisfiable by '.$this->getPackageList($packages).'.';
  9120. case 'update':
  9121. return 'Update request for '.$packageName.$this->constraintToText($constraint).'.';
  9122. case 'remove':
  9123. return 'Removal request for '.$packageName.$this->constraintToText($constraint).'';
  9124. }
  9125. if (isset($constraint)) {
  9126. $packages = $this->pool->whatProvides($packageName, $constraint);
  9127. } else {
  9128. $packages = array();
  9129. }
  9130. return 'Job(cmd='.$job['cmd'].', target='.$packageName.', packages=['.$this->getPackageList($packages).'])';
  9131. }
  9132. protected function getPackageList($packages)
  9133. {
  9134. $prepared = array();
  9135. foreach ($packages as $package) {
  9136. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  9137. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  9138. }
  9139. foreach ($prepared as $name => $package) {
  9140. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  9141. }
  9142. return implode(', ', $prepared);
  9143. }
  9144. protected function constraintToText($constraint)
  9145. {
  9146. return $constraint ? ' '.$constraint->getPrettyString() : '';
  9147. }
  9148. }
  9149. <?php
  9150. namespace Composer\DependencyResolver;
  9151. use Composer\Semver\Constraint\ConstraintInterface;
  9152. class Request
  9153. {
  9154. protected $jobs;
  9155. public function __construct()
  9156. {
  9157. $this->jobs = array();
  9158. }
  9159. public function install($packageName, ConstraintInterface $constraint = null)
  9160. {
  9161. $this->addJob($packageName, 'install', $constraint);
  9162. }
  9163. public function update($packageName, ConstraintInterface $constraint = null)
  9164. {
  9165. $this->addJob($packageName, 'update', $constraint);
  9166. }
  9167. public function remove($packageName, ConstraintInterface $constraint = null)
  9168. {
  9169. $this->addJob($packageName, 'remove', $constraint);
  9170. }
  9171. public function fix($packageName, ConstraintInterface $constraint = null)
  9172. {
  9173. $this->addJob($packageName, 'install', $constraint, true);
  9174. }
  9175. protected function addJob($packageName, $cmd, ConstraintInterface $constraint = null, $fixed = false)
  9176. {
  9177. $packageName = strtolower($packageName);
  9178. $this->jobs[] = array(
  9179. 'cmd' => $cmd,
  9180. 'packageName' => $packageName,
  9181. 'constraint' => $constraint,
  9182. 'fixed' => $fixed,
  9183. );
  9184. }
  9185. public function updateAll()
  9186. {
  9187. $this->jobs[] = array('cmd' => 'update-all');
  9188. }
  9189. public function getJobs()
  9190. {
  9191. return $this->jobs;
  9192. }
  9193. }
  9194. <?php
  9195. namespace Composer\DependencyResolver;
  9196. use Composer\Package\CompletePackage;
  9197. use Composer\Package\Link;
  9198. use Composer\Package\PackageInterface;
  9199. abstract class Rule
  9200. {
  9201. const RULE_INTERNAL_ALLOW_UPDATE = 1;
  9202. const RULE_JOB_INSTALL = 2;
  9203. const RULE_JOB_REMOVE = 3;
  9204. const RULE_PACKAGE_CONFLICT = 6;
  9205. const RULE_PACKAGE_REQUIRES = 7;
  9206. const RULE_PACKAGE_OBSOLETES = 8;
  9207. const RULE_INSTALLED_PACKAGE_OBSOLETES = 9;
  9208. const RULE_PACKAGE_SAME_NAME = 10;
  9209. const RULE_PACKAGE_IMPLICIT_OBSOLETES = 11;
  9210. const RULE_LEARNED = 12;
  9211. const RULE_PACKAGE_ALIAS = 13;
  9212. const BITFIELD_TYPE = 0;
  9213. const BITFIELD_REASON = 8;
  9214. const BITFIELD_DISABLED = 16;
  9215. protected $bitfield;
  9216. protected $job;
  9217. protected $reasonData;
  9218. public function __construct($reason, $reasonData, $job = null)
  9219. {
  9220. $this->reasonData = $reasonData;
  9221. if ($job) {
  9222. $this->job = $job;
  9223. }
  9224. $this->bitfield = (0 << self::BITFIELD_DISABLED) |
  9225. ($reason << self::BITFIELD_REASON) |
  9226. (255 << self::BITFIELD_TYPE);
  9227. }
  9228. abstract public function getLiterals();
  9229. abstract public function getHash();
  9230. public function getJob()
  9231. {
  9232. return $this->job;
  9233. }
  9234. abstract public function equals(Rule $rule);
  9235. public function getReason()
  9236. {
  9237. return ($this->bitfield & (255 << self::BITFIELD_REASON)) >> self::BITFIELD_REASON;
  9238. }
  9239. public function getReasonData()
  9240. {
  9241. return $this->reasonData;
  9242. }
  9243. public function getRequiredPackage()
  9244. {
  9245. if ($this->getReason() === self::RULE_JOB_INSTALL) {
  9246. return $this->reasonData;
  9247. }
  9248. if ($this->getReason() === self::RULE_PACKAGE_REQUIRES) {
  9249. return $this->reasonData->getTarget();
  9250. }
  9251. }
  9252. public function setType($type)
  9253. {
  9254. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_TYPE)) | ((255 & $type) << self::BITFIELD_TYPE);
  9255. }
  9256. public function getType()
  9257. {
  9258. return ($this->bitfield & (255 << self::BITFIELD_TYPE)) >> self::BITFIELD_TYPE;
  9259. }
  9260. public function disable()
  9261. {
  9262. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_DISABLED)) | (1 << self::BITFIELD_DISABLED);
  9263. }
  9264. public function enable()
  9265. {
  9266. $this->bitfield &= ~(255 << self::BITFIELD_DISABLED);
  9267. }
  9268. public function isDisabled()
  9269. {
  9270. return (bool) (($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  9271. }
  9272. public function isEnabled()
  9273. {
  9274. return !(($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  9275. }
  9276. abstract public function isAssertion();
  9277. public function getPrettyString(Pool $pool, array $installedMap = array())
  9278. {
  9279. $literals = $this->getLiterals();
  9280. $ruleText = '';
  9281. foreach ($literals as $i => $literal) {
  9282. if ($i != 0) {
  9283. $ruleText .= '|';
  9284. }
  9285. $ruleText .= $pool->literalToPrettyString($literal, $installedMap);
  9286. }
  9287. switch ($this->getReason()) {
  9288. case self::RULE_INTERNAL_ALLOW_UPDATE:
  9289. return $ruleText;
  9290. case self::RULE_JOB_INSTALL:
  9291. return "Install command rule ($ruleText)";
  9292. case self::RULE_JOB_REMOVE:
  9293. return "Remove command rule ($ruleText)";
  9294. case self::RULE_PACKAGE_CONFLICT:
  9295. $package1 = $pool->literalToPackage($literals[0]);
  9296. $package2 = $pool->literalToPackage($literals[1]);
  9297. return $package1->getPrettyString().' conflicts with '.$this->formatPackagesUnique($pool, array($package2)).'.';
  9298. case self::RULE_PACKAGE_REQUIRES:
  9299. $sourceLiteral = array_shift($literals);
  9300. $sourcePackage = $pool->literalToPackage($sourceLiteral);
  9301. $requires = array();
  9302. foreach ($literals as $literal) {
  9303. $requires[] = $pool->literalToPackage($literal);
  9304. }
  9305. $text = $this->reasonData->getPrettyString($sourcePackage);
  9306. if ($requires) {
  9307. $text .= ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $requires) . '.';
  9308. } else {
  9309. $targetName = $this->reasonData->getTarget();
  9310. if ($targetName === 'php' || $targetName === 'php-64bit' || $targetName === 'hhvm') {
  9311. if (defined('HHVM_VERSION')) {
  9312. return $text . ' -> your HHVM version does not satisfy that requirement.';
  9313. }
  9314. $packages = $pool->whatProvides($targetName);
  9315. $package = count($packages) ? current($packages) : phpversion();
  9316. if ($targetName === 'hhvm') {
  9317. if ($package instanceof CompletePackage) {
  9318. return $text . ' -> your HHVM version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  9319. } else {
  9320. return $text . ' -> you are running this with PHP and not HHVM.';
  9321. }
  9322. }
  9323. if (!($package instanceof CompletePackage)) {
  9324. return $text . ' -> your PHP version ('.phpversion().') does not satisfy that requirement.';
  9325. }
  9326. $extra = $package->getExtra();
  9327. if (!empty($extra['config.platform'])) {
  9328. $text .= ' -> your PHP version ('.phpversion().') overridden by "config.platform.php" version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  9329. } else {
  9330. $text .= ' -> your PHP version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  9331. }
  9332. return $text;
  9333. }
  9334. if (0 === strpos($targetName, 'ext-')) {
  9335. $ext = substr($targetName, 4);
  9336. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  9337. return $text . ' -> the requested PHP extension '.$ext.' '.$error.'.';
  9338. }
  9339. if (0 === strpos($targetName, 'lib-')) {
  9340. $lib = substr($targetName, 4);
  9341. 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.';
  9342. }
  9343. if ($providers = $pool->whatProvides($targetName, $this->reasonData->getConstraint(), true, true)) {
  9344. return $text . ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $providers) .' but these conflict with your requirements or minimum-stability.';
  9345. }
  9346. return $text . ' -> no matching package found.';
  9347. }
  9348. return $text;
  9349. case self::RULE_PACKAGE_OBSOLETES:
  9350. return $ruleText;
  9351. case self::RULE_INSTALLED_PACKAGE_OBSOLETES:
  9352. return $ruleText;
  9353. case self::RULE_PACKAGE_SAME_NAME:
  9354. return 'Can only install one of: ' . $this->formatPackagesUnique($pool, $literals) . '.';
  9355. case self::RULE_PACKAGE_IMPLICIT_OBSOLETES:
  9356. return $ruleText;
  9357. case self::RULE_LEARNED:
  9358. return 'Conclusion: '.$ruleText;
  9359. case self::RULE_PACKAGE_ALIAS:
  9360. return $ruleText;
  9361. default:
  9362. return '('.$ruleText.')';
  9363. }
  9364. }
  9365. protected function formatPackagesUnique($pool, array $packages)
  9366. {
  9367. $prepared = array();
  9368. foreach ($packages as $package) {
  9369. if (!is_object($package)) {
  9370. $package = $pool->literalToPackage($package);
  9371. }
  9372. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  9373. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  9374. }
  9375. foreach ($prepared as $name => $package) {
  9376. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  9377. }
  9378. return implode(', ', $prepared);
  9379. }
  9380. }
  9381. <?php
  9382. namespace Composer\DependencyResolver;
  9383. use Composer\Package\PackageInterface;
  9384. use Composer\Package\Link;
  9385. class Rule2Literals extends Rule
  9386. {
  9387. protected $literal1;
  9388. protected $literal2;
  9389. public function __construct($literal1, $literal2, $reason, $reasonData, $job = null)
  9390. {
  9391. parent::__construct($reason, $reasonData, $job);
  9392. if ($literal1 < $literal2) {
  9393. $this->literal1 = $literal1;
  9394. $this->literal2 = $literal2;
  9395. } else {
  9396. $this->literal1 = $literal2;
  9397. $this->literal2 = $literal1;
  9398. }
  9399. }
  9400. public function getLiterals()
  9401. {
  9402. return array($this->literal1, $this->literal2);
  9403. }
  9404. public function getHash()
  9405. {
  9406. return $this->literal1.','.$this->literal2;
  9407. }
  9408. public function equals(Rule $rule)
  9409. {
  9410. if ($rule instanceof self) {
  9411. if ($this->literal1 !== $rule->literal1) {
  9412. return false;
  9413. }
  9414. if ($this->literal2 !== $rule->literal2) {
  9415. return false;
  9416. }
  9417. return true;
  9418. }
  9419. $literals = $rule->getLiterals();
  9420. if (2 != count($literals)) {
  9421. return false;
  9422. }
  9423. if ($this->literal1 !== $literals[0]) {
  9424. return false;
  9425. }
  9426. if ($this->literal2 !== $literals[1]) {
  9427. return false;
  9428. }
  9429. return true;
  9430. }
  9431. public function isAssertion()
  9432. {
  9433. return false;
  9434. }
  9435. public function __toString()
  9436. {
  9437. $result = $this->isDisabled() ? 'disabled(' : '(';
  9438. $result .= $this->literal1 . '|' . $this->literal2 . ')';
  9439. return $result;
  9440. }
  9441. }
  9442. <?php
  9443. namespace Composer\DependencyResolver;
  9444. class RuleSet implements \IteratorAggregate, \Countable
  9445. {
  9446. const TYPE_PACKAGE = 0;
  9447. const TYPE_JOB = 1;
  9448. const TYPE_LEARNED = 4;
  9449. public $ruleById;
  9450. protected static $types = array(
  9451. 255 => 'UNKNOWN',
  9452. self::TYPE_PACKAGE => 'PACKAGE',
  9453. self::TYPE_JOB => 'JOB',
  9454. self::TYPE_LEARNED => 'LEARNED',
  9455. );
  9456. protected $rules;
  9457. protected $nextRuleId;
  9458. protected $rulesByHash;
  9459. public function __construct()
  9460. {
  9461. $this->nextRuleId = 0;
  9462. foreach ($this->getTypes() as $type) {
  9463. $this->rules[$type] = array();
  9464. }
  9465. $this->rulesByHash = array();
  9466. }
  9467. public function add(Rule $rule, $type)
  9468. {
  9469. if (!isset(self::$types[$type])) {
  9470. throw new \OutOfBoundsException('Unknown rule type: ' . $type);
  9471. }
  9472. $hash = $rule->getHash();
  9473. if (isset($this->rulesByHash[$hash])) {
  9474. $potentialDuplicates = $this->rulesByHash[$hash];
  9475. if (is_array($potentialDuplicates)) {
  9476. foreach ($potentialDuplicates as $potentialDuplicate) {
  9477. if ($rule->equals($potentialDuplicate)) {
  9478. return;
  9479. }
  9480. }
  9481. } else {
  9482. if ($rule->equals($potentialDuplicates)) {
  9483. return;
  9484. }
  9485. }
  9486. }
  9487. if (!isset($this->rules[$type])) {
  9488. $this->rules[$type] = array();
  9489. }
  9490. $this->rules[$type][] = $rule;
  9491. $this->ruleById[$this->nextRuleId] = $rule;
  9492. $rule->setType($type);
  9493. $this->nextRuleId++;
  9494. if (!isset($this->rulesByHash[$hash])) {
  9495. $this->rulesByHash[$hash] = $rule;
  9496. } elseif (is_array($this->rulesByHash[$hash])) {
  9497. $this->rulesByHash[$hash][] = $rule;
  9498. } else {
  9499. $originalRule = $this->rulesByHash[$hash];
  9500. $this->rulesByHash[$hash] = array($originalRule, $rule);
  9501. }
  9502. }
  9503. public function count()
  9504. {
  9505. return $this->nextRuleId;
  9506. }
  9507. public function ruleById($id)
  9508. {
  9509. return $this->ruleById[$id];
  9510. }
  9511. public function getRules()
  9512. {
  9513. return $this->rules;
  9514. }
  9515. public function getIterator()
  9516. {
  9517. return new RuleSetIterator($this->getRules());
  9518. }
  9519. public function getIteratorFor($types)
  9520. {
  9521. if (!is_array($types)) {
  9522. $types = array($types);
  9523. }
  9524. $allRules = $this->getRules();
  9525. $rules = array();
  9526. foreach ($types as $type) {
  9527. $rules[$type] = $allRules[$type];
  9528. }
  9529. return new RuleSetIterator($rules);
  9530. }
  9531. public function getIteratorWithout($types)
  9532. {
  9533. if (!is_array($types)) {
  9534. $types = array($types);
  9535. }
  9536. $rules = $this->getRules();
  9537. foreach ($types as $type) {
  9538. unset($rules[$type]);
  9539. }
  9540. return new RuleSetIterator($rules);
  9541. }
  9542. public function getTypes()
  9543. {
  9544. $types = self::$types;
  9545. unset($types[255]);
  9546. return array_keys($types);
  9547. }
  9548. public function getPrettyString(Pool $pool = null)
  9549. {
  9550. $string = "\n";
  9551. foreach ($this->rules as $type => $rules) {
  9552. $string .= str_pad(self::$types[$type], 8, ' ') . ": ";
  9553. foreach ($rules as $rule) {
  9554. $string .= ($pool ? $rule->getPrettyString($pool) : $rule)."\n";
  9555. }
  9556. $string .= "\n\n";
  9557. }
  9558. return $string;
  9559. }
  9560. public function __toString()
  9561. {
  9562. return $this->getPrettyString(null);
  9563. }
  9564. }
  9565. <?php
  9566. namespace Composer\DependencyResolver;
  9567. use Composer\Package\PackageInterface;
  9568. use Composer\Package\AliasPackage;
  9569. use Composer\Repository\PlatformRepository;
  9570. class RuleSetGenerator
  9571. {
  9572. protected $policy;
  9573. protected $pool;
  9574. protected $rules;
  9575. protected $jobs;
  9576. protected $installedMap;
  9577. protected $allowListedMap;
  9578. protected $addedMap;
  9579. protected $conflictAddedMap;
  9580. protected $addedPackages;
  9581. protected $addedPackagesByNames;
  9582. public function __construct(PolicyInterface $policy, Pool $pool)
  9583. {
  9584. $this->policy = $policy;
  9585. $this->pool = $pool;
  9586. }
  9587. protected function createRequireRule(PackageInterface $package, array $providers, $reason, $reasonData = null)
  9588. {
  9589. $literals = array(-$package->id);
  9590. foreach ($providers as $provider) {
  9591. if ($provider === $package) {
  9592. return null;
  9593. }
  9594. $literals[] = $provider->id;
  9595. }
  9596. return new GenericRule($literals, $reason, $reasonData);
  9597. }
  9598. protected function createInstallOneOfRule(array $packages, $reason, $job)
  9599. {
  9600. $literals = array();
  9601. foreach ($packages as $package) {
  9602. $literals[] = $package->id;
  9603. }
  9604. return new GenericRule($literals, $reason, $job['packageName'], $job);
  9605. }
  9606. protected function createRemoveRule(PackageInterface $package, $reason, $job)
  9607. {
  9608. return new GenericRule(array(-$package->id), $reason, $job['packageName'], $job);
  9609. }
  9610. protected function createRule2Literals(PackageInterface $issuer, PackageInterface $provider, $reason, $reasonData = null)
  9611. {
  9612. if ($issuer === $provider) {
  9613. return null;
  9614. }
  9615. return new Rule2Literals(-$issuer->id, -$provider->id, $reason, $reasonData);
  9616. }
  9617. private function addRule($type, Rule $newRule = null)
  9618. {
  9619. if (!$newRule) {
  9620. return;
  9621. }
  9622. $this->rules->add($newRule, $type);
  9623. }
  9624. protected function allowListFromPackage(PackageInterface $package)
  9625. {
  9626. $this->whitelistFromPackage($package);
  9627. }
  9628. protected function whitelistFromPackage(PackageInterface $package)
  9629. {
  9630. $workQueue = new \SplQueue;
  9631. $workQueue->enqueue($package);
  9632. while (!$workQueue->isEmpty()) {
  9633. $package = $workQueue->dequeue();
  9634. if (isset($this->allowListedMap[$package->id])) {
  9635. continue;
  9636. }
  9637. $this->allowListedMap[$package->id] = true;
  9638. foreach ($package->getRequires() as $link) {
  9639. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint(), true);
  9640. foreach ($possibleRequires as $require) {
  9641. $workQueue->enqueue($require);
  9642. }
  9643. }
  9644. $obsoleteProviders = $this->pool->whatProvides($package->getName(), null, true);
  9645. foreach ($obsoleteProviders as $provider) {
  9646. if ($provider === $package) {
  9647. continue;
  9648. }
  9649. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  9650. $workQueue->enqueue($provider);
  9651. }
  9652. }
  9653. }
  9654. }
  9655. protected function addRulesForPackage(PackageInterface $package, $ignorePlatformReqs)
  9656. {
  9657. $workQueue = new \SplQueue;
  9658. $workQueue->enqueue($package);
  9659. while (!$workQueue->isEmpty()) {
  9660. $package = $workQueue->dequeue();
  9661. if (isset($this->addedMap[$package->id])) {
  9662. continue;
  9663. }
  9664. $this->addedMap[$package->id] = true;
  9665. $this->addedPackages[] = $package;
  9666. foreach ($package->getNames() as $name) {
  9667. $this->addedPackagesByNames[$name][] = $package;
  9668. }
  9669. foreach ($package->getRequires() as $link) {
  9670. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  9671. continue;
  9672. }
  9673. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  9674. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, $possibleRequires, Rule::RULE_PACKAGE_REQUIRES, $link));
  9675. foreach ($possibleRequires as $require) {
  9676. $workQueue->enqueue($require);
  9677. }
  9678. }
  9679. $packageName = $package->getName();
  9680. $obsoleteProviders = $this->pool->whatProvides($packageName, null);
  9681. foreach ($obsoleteProviders as $provider) {
  9682. if ($provider === $package) {
  9683. continue;
  9684. }
  9685. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  9686. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, array($provider), Rule::RULE_PACKAGE_ALIAS, $package));
  9687. } elseif (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  9688. $reason = ($packageName == $provider->getName()) ? Rule::RULE_PACKAGE_SAME_NAME : Rule::RULE_PACKAGE_IMPLICIT_OBSOLETES;
  9689. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $provider, $reason, $package));
  9690. }
  9691. }
  9692. }
  9693. }
  9694. protected function addConflictRules($ignorePlatformReqs = false)
  9695. {
  9696. foreach ($this->addedPackages as $package) {
  9697. foreach ($package->getConflicts() as $link) {
  9698. if (!isset($this->addedPackagesByNames[$link->getTarget()])) {
  9699. continue;
  9700. }
  9701. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  9702. continue;
  9703. }
  9704. foreach ($this->addedPackagesByNames[$link->getTarget()] as $possibleConflict) {
  9705. $conflictMatch = $this->pool->match($possibleConflict, $link->getTarget(), $link->getConstraint(), true);
  9706. if ($conflictMatch === Pool::MATCH || $conflictMatch === Pool::MATCH_REPLACE) {
  9707. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $possibleConflict, Rule::RULE_PACKAGE_CONFLICT, $link));
  9708. }
  9709. }
  9710. }
  9711. $isInstalled = isset($this->installedMap[$package->id]);
  9712. foreach ($package->getReplaces() as $link) {
  9713. if (!isset($this->addedPackagesByNames[$link->getTarget()])) {
  9714. continue;
  9715. }
  9716. foreach ($this->addedPackagesByNames[$link->getTarget()] as $provider) {
  9717. if ($provider === $package) {
  9718. continue;
  9719. }
  9720. if (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  9721. $reason = $isInstalled ? Rule::RULE_INSTALLED_PACKAGE_OBSOLETES : Rule::RULE_PACKAGE_OBSOLETES;
  9722. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $provider, $reason, $link));
  9723. }
  9724. }
  9725. }
  9726. }
  9727. }
  9728. protected function obsoleteImpossibleForAlias($package, $provider)
  9729. {
  9730. $packageIsAlias = $package instanceof AliasPackage;
  9731. $providerIsAlias = $provider instanceof AliasPackage;
  9732. $impossible = (
  9733. ($packageIsAlias && $package->getAliasOf() === $provider) ||
  9734. ($providerIsAlias && $provider->getAliasOf() === $package) ||
  9735. ($packageIsAlias && $providerIsAlias && $provider->getAliasOf() === $package->getAliasOf())
  9736. );
  9737. return $impossible;
  9738. }
  9739. protected function allowListFromJobs()
  9740. {
  9741. $this->whitelistFromJobs();
  9742. }
  9743. protected function whitelistFromJobs()
  9744. {
  9745. foreach ($this->jobs as $job) {
  9746. switch ($job['cmd']) {
  9747. case 'install':
  9748. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint'], true);
  9749. foreach ($packages as $package) {
  9750. $this->allowListFromPackage($package);
  9751. }
  9752. break;
  9753. }
  9754. }
  9755. }
  9756. protected function addRulesForJobs($ignorePlatformReqs)
  9757. {
  9758. foreach ($this->jobs as $job) {
  9759. switch ($job['cmd']) {
  9760. case 'install':
  9761. if (!$job['fixed'] && $ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  9762. break;
  9763. }
  9764. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  9765. if ($packages) {
  9766. foreach ($packages as $package) {
  9767. if (!isset($this->installedMap[$package->id])) {
  9768. $this->addRulesForPackage($package, $ignorePlatformReqs);
  9769. }
  9770. }
  9771. $rule = $this->createInstallOneOfRule($packages, Rule::RULE_JOB_INSTALL, $job);
  9772. $this->addRule(RuleSet::TYPE_JOB, $rule);
  9773. }
  9774. break;
  9775. case 'remove':
  9776. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  9777. foreach ($packages as $package) {
  9778. $rule = $this->createRemoveRule($package, Rule::RULE_JOB_REMOVE, $job);
  9779. $this->addRule(RuleSet::TYPE_JOB, $rule);
  9780. }
  9781. break;
  9782. }
  9783. }
  9784. }
  9785. public function getRulesFor($jobs, $installedMap, $ignorePlatformReqs = false)
  9786. {
  9787. $this->jobs = $jobs;
  9788. $this->rules = new RuleSet;
  9789. $this->installedMap = $installedMap;
  9790. $this->allowListedMap = array();
  9791. foreach ($this->installedMap as $package) {
  9792. $this->allowListFromPackage($package);
  9793. }
  9794. $this->allowListFromJobs();
  9795. $this->pool->setAllowList($this->allowListedMap);
  9796. $this->addedMap = array();
  9797. $this->conflictAddedMap = array();
  9798. $this->addedPackages = array();
  9799. $this->addedPackagesByNames = array();
  9800. foreach ($this->installedMap as $package) {
  9801. $this->addRulesForPackage($package, $ignorePlatformReqs);
  9802. }
  9803. $this->addRulesForJobs($ignorePlatformReqs);
  9804. $this->addConflictRules($ignorePlatformReqs);
  9805. $this->addedPackages = $this->addedPackagesByNames = null;
  9806. return $this->rules;
  9807. }
  9808. }
  9809. <?php
  9810. namespace Composer\DependencyResolver;
  9811. class RuleSetIterator implements \Iterator
  9812. {
  9813. protected $rules;
  9814. protected $types;
  9815. protected $currentOffset;
  9816. protected $currentType;
  9817. protected $currentTypeOffset;
  9818. public function __construct(array $rules)
  9819. {
  9820. $this->rules = $rules;
  9821. $this->types = array_keys($rules);
  9822. sort($this->types);
  9823. $this->rewind();
  9824. }
  9825. public function current()
  9826. {
  9827. return $this->rules[$this->currentType][$this->currentOffset];
  9828. }
  9829. public function key()
  9830. {
  9831. return $this->currentType;
  9832. }
  9833. public function next()
  9834. {
  9835. $this->currentOffset++;
  9836. if (!isset($this->rules[$this->currentType])) {
  9837. return;
  9838. }
  9839. if ($this->currentOffset >= count($this->rules[$this->currentType])) {
  9840. $this->currentOffset = 0;
  9841. do {
  9842. $this->currentTypeOffset++;
  9843. if (!isset($this->types[$this->currentTypeOffset])) {
  9844. $this->currentType = -1;
  9845. break;
  9846. }
  9847. $this->currentType = $this->types[$this->currentTypeOffset];
  9848. } while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
  9849. }
  9850. }
  9851. public function rewind()
  9852. {
  9853. $this->currentOffset = 0;
  9854. $this->currentTypeOffset = -1;
  9855. $this->currentType = -1;
  9856. do {
  9857. $this->currentTypeOffset++;
  9858. if (!isset($this->types[$this->currentTypeOffset])) {
  9859. $this->currentType = -1;
  9860. break;
  9861. }
  9862. $this->currentType = $this->types[$this->currentTypeOffset];
  9863. } while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
  9864. }
  9865. public function valid()
  9866. {
  9867. return isset($this->rules[$this->currentType])
  9868. && isset($this->rules[$this->currentType][$this->currentOffset]);
  9869. }
  9870. }
  9871. <?php
  9872. namespace Composer\DependencyResolver;
  9873. class RuleWatchChain extends \SplDoublyLinkedList
  9874. {
  9875. protected $offset = 0;
  9876. public function seek($offset)
  9877. {
  9878. $this->rewind();
  9879. for ($i = 0; $i < $offset; $i++, $this->next());
  9880. }
  9881. public function remove()
  9882. {
  9883. $offset = $this->key();
  9884. $this->offsetUnset($offset);
  9885. $this->seek($offset);
  9886. }
  9887. }
  9888. <?php
  9889. namespace Composer\DependencyResolver;
  9890. class RuleWatchGraph
  9891. {
  9892. protected $watchChains = array();
  9893. public function insert(RuleWatchNode $node)
  9894. {
  9895. if ($node->getRule()->isAssertion()) {
  9896. return;
  9897. }
  9898. foreach (array($node->watch1, $node->watch2) as $literal) {
  9899. if (!isset($this->watchChains[$literal])) {
  9900. $this->watchChains[$literal] = new RuleWatchChain;
  9901. }
  9902. $this->watchChains[$literal]->unshift($node);
  9903. }
  9904. }
  9905. public function propagateLiteral($decidedLiteral, $level, $decisions)
  9906. {
  9907. $literal = -$decidedLiteral;
  9908. if (!isset($this->watchChains[$literal])) {
  9909. return null;
  9910. }
  9911. $chain = $this->watchChains[$literal];
  9912. $chain->rewind();
  9913. while ($chain->valid()) {
  9914. $node = $chain->current();
  9915. $otherWatch = $node->getOtherWatch($literal);
  9916. if (!$node->getRule()->isDisabled() && !$decisions->satisfy($otherWatch)) {
  9917. $ruleLiterals = $node->getRule()->getLiterals();
  9918. $alternativeLiterals = array_filter($ruleLiterals, function ($ruleLiteral) use ($literal, $otherWatch, $decisions) {
  9919. return $literal !== $ruleLiteral &&
  9920. $otherWatch !== $ruleLiteral &&
  9921. !$decisions->conflict($ruleLiteral);
  9922. });
  9923. if ($alternativeLiterals) {
  9924. reset($alternativeLiterals);
  9925. $this->moveWatch($literal, current($alternativeLiterals), $node);
  9926. continue;
  9927. }
  9928. if ($decisions->conflict($otherWatch)) {
  9929. return $node->getRule();
  9930. }
  9931. $decisions->decide($otherWatch, $level, $node->getRule());
  9932. }
  9933. $chain->next();
  9934. }
  9935. return null;
  9936. }
  9937. protected function moveWatch($fromLiteral, $toLiteral, $node)
  9938. {
  9939. if (!isset($this->watchChains[$toLiteral])) {
  9940. $this->watchChains[$toLiteral] = new RuleWatchChain;
  9941. }
  9942. $node->moveWatch($fromLiteral, $toLiteral);
  9943. $this->watchChains[$fromLiteral]->remove();
  9944. $this->watchChains[$toLiteral]->unshift($node);
  9945. }
  9946. }
  9947. <?php
  9948. namespace Composer\DependencyResolver;
  9949. class RuleWatchNode
  9950. {
  9951. public $watch1;
  9952. public $watch2;
  9953. protected $rule;
  9954. public function __construct($rule)
  9955. {
  9956. $this->rule = $rule;
  9957. $literals = $rule->getLiterals();
  9958. $literalCount = count($literals);
  9959. $this->watch1 = $literalCount > 0 ? $literals[0] : 0;
  9960. $this->watch2 = $literalCount > 1 ? $literals[1] : 0;
  9961. }
  9962. public function watch2OnHighest(Decisions $decisions)
  9963. {
  9964. $literals = $this->rule->getLiterals();
  9965. if (count($literals) < 3) {
  9966. return;
  9967. }
  9968. $watchLevel = 0;
  9969. foreach ($literals as $literal) {
  9970. $level = $decisions->decisionLevel($literal);
  9971. if ($level > $watchLevel) {
  9972. $this->watch2 = $literal;
  9973. $watchLevel = $level;
  9974. }
  9975. }
  9976. }
  9977. public function getRule()
  9978. {
  9979. return $this->rule;
  9980. }
  9981. public function getOtherWatch($literal)
  9982. {
  9983. if ($this->watch1 == $literal) {
  9984. return $this->watch2;
  9985. }
  9986. return $this->watch1;
  9987. }
  9988. public function moveWatch($from, $to)
  9989. {
  9990. if ($this->watch1 == $from) {
  9991. $this->watch1 = $to;
  9992. } else {
  9993. $this->watch2 = $to;
  9994. }
  9995. }
  9996. }
  9997. <?php
  9998. namespace Composer\DependencyResolver;
  9999. use Composer\IO\IOInterface;
  10000. use Composer\Repository\RepositoryInterface;
  10001. use Composer\Repository\PlatformRepository;
  10002. class Solver
  10003. {
  10004. const BRANCH_LITERALS = 0;
  10005. const BRANCH_LEVEL = 1;
  10006. protected $policy;
  10007. protected $pool;
  10008. protected $installed;
  10009. protected $rules;
  10010. protected $ruleSetGenerator;
  10011. protected $jobs;
  10012. protected $updateMap = array();
  10013. protected $watchGraph;
  10014. protected $decisions;
  10015. protected $installedMap;
  10016. protected $propagateIndex;
  10017. protected $branches = array();
  10018. protected $problems = array();
  10019. protected $learnedPool = array();
  10020. protected $learnedWhy = array();
  10021. public $testFlagLearnedPositiveLiteral = false;
  10022. protected $io;
  10023. public function __construct(PolicyInterface $policy, Pool $pool, RepositoryInterface $installed, IOInterface $io)
  10024. {
  10025. $this->io = $io;
  10026. $this->policy = $policy;
  10027. $this->pool = $pool;
  10028. $this->installed = $installed;
  10029. $this->ruleSetGenerator = new RuleSetGenerator($policy, $pool);
  10030. }
  10031. public function getRuleSetSize()
  10032. {
  10033. return count($this->rules);
  10034. }
  10035. private function makeAssertionRuleDecisions()
  10036. {
  10037. $decisionStart = count($this->decisions) - 1;
  10038. $rulesCount = count($this->rules);
  10039. for ($ruleIndex = 0; $ruleIndex < $rulesCount; $ruleIndex++) {
  10040. $rule = $this->rules->ruleById[$ruleIndex];
  10041. if (!$rule->isAssertion() || $rule->isDisabled()) {
  10042. continue;
  10043. }
  10044. $literals = $rule->getLiterals();
  10045. $literal = $literals[0];
  10046. if (!$this->decisions->decided($literal)) {
  10047. $this->decisions->decide($literal, 1, $rule);
  10048. continue;
  10049. }
  10050. if ($this->decisions->satisfy($literal)) {
  10051. continue;
  10052. }
  10053. if (RuleSet::TYPE_LEARNED === $rule->getType()) {
  10054. $rule->disable();
  10055. continue;
  10056. }
  10057. $conflict = $this->decisions->decisionRule($literal);
  10058. if ($conflict && RuleSet::TYPE_PACKAGE === $conflict->getType()) {
  10059. $problem = new Problem($this->pool);
  10060. $problem->addRule($rule);
  10061. $problem->addRule($conflict);
  10062. $this->disableProblem($rule);
  10063. $this->problems[] = $problem;
  10064. continue;
  10065. }
  10066. $problem = new Problem($this->pool);
  10067. $problem->addRule($rule);
  10068. $problem->addRule($conflict);
  10069. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_JOB) as $assertRule) {
  10070. if ($assertRule->isDisabled() || !$assertRule->isAssertion()) {
  10071. continue;
  10072. }
  10073. $assertRuleLiterals = $assertRule->getLiterals();
  10074. $assertRuleLiteral = $assertRuleLiterals[0];
  10075. if (abs($literal) !== abs($assertRuleLiteral)) {
  10076. continue;
  10077. }
  10078. $problem->addRule($assertRule);
  10079. $this->disableProblem($assertRule);
  10080. }
  10081. $this->problems[] = $problem;
  10082. $this->decisions->resetToOffset($decisionStart);
  10083. $ruleIndex = -1;
  10084. }
  10085. }
  10086. protected function setupInstalledMap()
  10087. {
  10088. $this->installedMap = array();
  10089. foreach ($this->installed->getPackages() as $package) {
  10090. $this->installedMap[$package->id] = $package;
  10091. }
  10092. }
  10093. protected function checkForRootRequireProblems($ignorePlatformReqs)
  10094. {
  10095. foreach ($this->jobs as $job) {
  10096. switch ($job['cmd']) {
  10097. case 'update':
  10098. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  10099. foreach ($packages as $package) {
  10100. if (isset($this->installedMap[$package->id])) {
  10101. $this->updateMap[$package->id] = true;
  10102. }
  10103. }
  10104. break;
  10105. case 'update-all':
  10106. foreach ($this->installedMap as $package) {
  10107. $this->updateMap[$package->id] = true;
  10108. }
  10109. break;
  10110. case 'install':
  10111. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  10112. break;
  10113. }
  10114. if (!$this->pool->whatProvides($job['packageName'], $job['constraint'])) {
  10115. $problem = new Problem($this->pool);
  10116. $problem->addRule(new GenericRule(array(), null, null, $job));
  10117. $this->problems[] = $problem;
  10118. }
  10119. break;
  10120. }
  10121. }
  10122. }
  10123. public function solve(Request $request, $ignorePlatformReqs = false)
  10124. {
  10125. $this->jobs = $request->getJobs();
  10126. $this->setupInstalledMap();
  10127. $this->rules = $this->ruleSetGenerator->getRulesFor($this->jobs, $this->installedMap, $ignorePlatformReqs);
  10128. $this->checkForRootRequireProblems($ignorePlatformReqs);
  10129. $this->decisions = new Decisions($this->pool);
  10130. $this->watchGraph = new RuleWatchGraph;
  10131. foreach ($this->rules as $rule) {
  10132. $this->watchGraph->insert(new RuleWatchNode($rule));
  10133. }
  10134. $this->makeAssertionRuleDecisions();
  10135. $this->io->writeError('Resolving dependencies through SAT', true, IOInterface::DEBUG);
  10136. $before = microtime(true);
  10137. $this->runSat(true);
  10138. $this->io->writeError('', true, IOInterface::DEBUG);
  10139. $this->io->writeError(sprintf('Dependency resolution completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERBOSE);
  10140. foreach ($this->installedMap as $packageId => $void) {
  10141. if ($this->decisions->undecided($packageId)) {
  10142. $this->decisions->decide(-$packageId, 1, null);
  10143. }
  10144. }
  10145. if ($this->problems) {
  10146. throw new SolverProblemsException($this->problems, $this->installedMap);
  10147. }
  10148. $transaction = new Transaction($this->policy, $this->pool, $this->installedMap, $this->decisions);
  10149. return $transaction->getOperations();
  10150. }
  10151. protected function propagate($level)
  10152. {
  10153. while ($this->decisions->validOffset($this->propagateIndex)) {
  10154. $decision = $this->decisions->atOffset($this->propagateIndex);
  10155. $conflict = $this->watchGraph->propagateLiteral(
  10156. $decision[Decisions::DECISION_LITERAL],
  10157. $level,
  10158. $this->decisions
  10159. );
  10160. $this->propagateIndex++;
  10161. if ($conflict) {
  10162. return $conflict;
  10163. }
  10164. }
  10165. return null;
  10166. }
  10167. private function revert($level)
  10168. {
  10169. while (!$this->decisions->isEmpty()) {
  10170. $literal = $this->decisions->lastLiteral();
  10171. if ($this->decisions->undecided($literal)) {
  10172. break;
  10173. }
  10174. $decisionLevel = $this->decisions->decisionLevel($literal);
  10175. if ($decisionLevel <= $level) {
  10176. break;
  10177. }
  10178. $this->decisions->revertLast();
  10179. $this->propagateIndex = count($this->decisions);
  10180. }
  10181. while (!empty($this->branches) && $this->branches[count($this->branches) - 1][self::BRANCH_LEVEL] >= $level) {
  10182. array_pop($this->branches);
  10183. }
  10184. }
  10185. private function setPropagateLearn($level, $literal, $disableRules, Rule $rule)
  10186. {
  10187. $level++;
  10188. $this->decisions->decide($literal, $level, $rule);
  10189. while (true) {
  10190. $rule = $this->propagate($level);
  10191. if (!$rule) {
  10192. break;
  10193. }
  10194. if ($level == 1) {
  10195. return $this->analyzeUnsolvable($rule, $disableRules);
  10196. }
  10197. list($learnLiteral, $newLevel, $newRule, $why) = $this->analyze($level, $rule);
  10198. if ($newLevel <= 0 || $newLevel >= $level) {
  10199. throw new SolverBugException(
  10200. "Trying to revert to invalid level ".(int) $newLevel." from level ".(int) $level."."
  10201. );
  10202. } elseif (!$newRule) {
  10203. throw new SolverBugException(
  10204. "No rule was learned from analyzing $rule at level $level."
  10205. );
  10206. }
  10207. $level = $newLevel;
  10208. $this->revert($level);
  10209. $this->rules->add($newRule, RuleSet::TYPE_LEARNED);
  10210. $this->learnedWhy[spl_object_hash($newRule)] = $why;
  10211. $ruleNode = new RuleWatchNode($newRule);
  10212. $ruleNode->watch2OnHighest($this->decisions);
  10213. $this->watchGraph->insert($ruleNode);
  10214. $this->decisions->decide($learnLiteral, $level, $newRule);
  10215. }
  10216. return $level;
  10217. }
  10218. private function selectAndInstall($level, array $decisionQueue, $disableRules, Rule $rule)
  10219. {
  10220. $literals = $this->policy->selectPreferredPackages($this->pool, $this->installedMap, $decisionQueue, $rule->getRequiredPackage());
  10221. $selectedLiteral = array_shift($literals);
  10222. if (count($literals)) {
  10223. $this->branches[] = array($literals, $level);
  10224. }
  10225. return $this->setPropagateLearn($level, $selectedLiteral, $disableRules, $rule);
  10226. }
  10227. protected function analyze($level, Rule $rule)
  10228. {
  10229. $analyzedRule = $rule;
  10230. $ruleLevel = 1;
  10231. $num = 0;
  10232. $l1num = 0;
  10233. $seen = array();
  10234. $learnedLiterals = array(null);
  10235. $decisionId = count($this->decisions);
  10236. $this->learnedPool[] = array();
  10237. while (true) {
  10238. $this->learnedPool[count($this->learnedPool) - 1][] = $rule;
  10239. foreach ($rule->getLiterals() as $literal) {
  10240. if ($this->decisions->satisfy($literal)) {
  10241. continue;
  10242. }
  10243. if (isset($seen[abs($literal)])) {
  10244. continue;
  10245. }
  10246. $seen[abs($literal)] = true;
  10247. $l = $this->decisions->decisionLevel($literal);
  10248. if (1 === $l) {
  10249. $l1num++;
  10250. } elseif ($level === $l) {
  10251. $num++;
  10252. } else {
  10253. $learnedLiterals[] = $literal;
  10254. if ($l > $ruleLevel) {
  10255. $ruleLevel = $l;
  10256. }
  10257. }
  10258. }
  10259. $l1retry = true;
  10260. while ($l1retry) {
  10261. $l1retry = false;
  10262. if (!$num && !--$l1num) {
  10263. break 2;
  10264. }
  10265. while (true) {
  10266. if ($decisionId <= 0) {
  10267. throw new SolverBugException(
  10268. "Reached invalid decision id $decisionId while looking through $rule for a literal present in the analyzed rule $analyzedRule."
  10269. );
  10270. }
  10271. $decisionId--;
  10272. $decision = $this->decisions->atOffset($decisionId);
  10273. $literal = $decision[Decisions::DECISION_LITERAL];
  10274. if (isset($seen[abs($literal)])) {
  10275. break;
  10276. }
  10277. }
  10278. unset($seen[abs($literal)]);
  10279. if ($num && 0 === --$num) {
  10280. if ($literal < 0) {
  10281. $this->testFlagLearnedPositiveLiteral = true;
  10282. }
  10283. $learnedLiterals[0] = -$literal;
  10284. if (!$l1num) {
  10285. break 2;
  10286. }
  10287. foreach ($learnedLiterals as $i => $learnedLiteral) {
  10288. if ($i !== 0) {
  10289. unset($seen[abs($learnedLiteral)]);
  10290. }
  10291. }
  10292. $l1num++;
  10293. $l1retry = true;
  10294. }
  10295. }
  10296. $decision = $this->decisions->atOffset($decisionId);
  10297. $rule = $decision[Decisions::DECISION_REASON];
  10298. }
  10299. $why = count($this->learnedPool) - 1;
  10300. if (!$learnedLiterals[0]) {
  10301. throw new SolverBugException(
  10302. "Did not find a learnable literal in analyzed rule $analyzedRule."
  10303. );
  10304. }
  10305. $newRule = new GenericRule($learnedLiterals, Rule::RULE_LEARNED, $why);
  10306. return array($learnedLiterals[0], $ruleLevel, $newRule, $why);
  10307. }
  10308. private function analyzeUnsolvableRule(Problem $problem, Rule $conflictRule)
  10309. {
  10310. if ($conflictRule->getType() == RuleSet::TYPE_LEARNED) {
  10311. $why = spl_object_hash($conflictRule);
  10312. $learnedWhy = $this->learnedWhy[$why];
  10313. $problemRules = $this->learnedPool[$learnedWhy];
  10314. foreach ($problemRules as $problemRule) {
  10315. $this->analyzeUnsolvableRule($problem, $problemRule);
  10316. }
  10317. return;
  10318. }
  10319. if ($conflictRule->getType() == RuleSet::TYPE_PACKAGE) {
  10320. return;
  10321. }
  10322. $problem->nextSection();
  10323. $problem->addRule($conflictRule);
  10324. }
  10325. private function analyzeUnsolvable(Rule $conflictRule, $disableRules)
  10326. {
  10327. $problem = new Problem($this->pool);
  10328. $problem->addRule($conflictRule);
  10329. $this->analyzeUnsolvableRule($problem, $conflictRule);
  10330. $this->problems[] = $problem;
  10331. $seen = array();
  10332. $literals = $conflictRule->getLiterals();
  10333. foreach ($literals as $literal) {
  10334. if ($this->decisions->satisfy($literal)) {
  10335. continue;
  10336. }
  10337. $seen[abs($literal)] = true;
  10338. }
  10339. foreach ($this->decisions as $decision) {
  10340. $literal = $decision[Decisions::DECISION_LITERAL];
  10341. if (!isset($seen[abs($literal)])) {
  10342. continue;
  10343. }
  10344. $why = $decision[Decisions::DECISION_REASON];
  10345. $problem->addRule($why);
  10346. $this->analyzeUnsolvableRule($problem, $why);
  10347. $literals = $why->getLiterals();
  10348. foreach ($literals as $literal) {
  10349. if ($this->decisions->satisfy($literal)) {
  10350. continue;
  10351. }
  10352. $seen[abs($literal)] = true;
  10353. }
  10354. }
  10355. if ($disableRules) {
  10356. foreach ($this->problems[count($this->problems) - 1] as $reason) {
  10357. $this->disableProblem($reason['rule']);
  10358. }
  10359. $this->resetSolver();
  10360. return 1;
  10361. }
  10362. return 0;
  10363. }
  10364. private function disableProblem(Rule $why)
  10365. {
  10366. $job = $why->getJob();
  10367. if (!$job) {
  10368. $why->disable();
  10369. return;
  10370. }
  10371. foreach ($this->rules as $rule) {
  10372. if ($job === $rule->getJob()) {
  10373. $rule->disable();
  10374. }
  10375. }
  10376. }
  10377. private function resetSolver()
  10378. {
  10379. $this->decisions->reset();
  10380. $this->propagateIndex = 0;
  10381. $this->branches = array();
  10382. $this->enableDisableLearnedRules();
  10383. $this->makeAssertionRuleDecisions();
  10384. }
  10385. private function enableDisableLearnedRules()
  10386. {
  10387. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_LEARNED) as $rule) {
  10388. $why = $this->learnedWhy[spl_object_hash($rule)];
  10389. $problemRules = $this->learnedPool[$why];
  10390. $foundDisabled = false;
  10391. foreach ($problemRules as $problemRule) {
  10392. if ($problemRule->isDisabled()) {
  10393. $foundDisabled = true;
  10394. break;
  10395. }
  10396. }
  10397. if ($foundDisabled && $rule->isEnabled()) {
  10398. $rule->disable();
  10399. } elseif (!$foundDisabled && $rule->isDisabled()) {
  10400. $rule->enable();
  10401. }
  10402. }
  10403. }
  10404. private function runSat($disableRules = true)
  10405. {
  10406. $this->propagateIndex = 0;
  10407. $decisionQueue = array();
  10408. $disableRules = array();
  10409. $level = 1;
  10410. $systemLevel = $level + 1;
  10411. while (true) {
  10412. if (1 === $level) {
  10413. $conflictRule = $this->propagate($level);
  10414. if (null !== $conflictRule) {
  10415. if ($this->analyzeUnsolvable($conflictRule, $disableRules)) {
  10416. continue;
  10417. }
  10418. return;
  10419. }
  10420. }
  10421. if ($level < $systemLevel) {
  10422. $iterator = $this->rules->getIteratorFor(RuleSet::TYPE_JOB);
  10423. foreach ($iterator as $rule) {
  10424. if ($rule->isEnabled()) {
  10425. $decisionQueue = array();
  10426. $noneSatisfied = true;
  10427. foreach ($rule->getLiterals() as $literal) {
  10428. if ($this->decisions->satisfy($literal)) {
  10429. $noneSatisfied = false;
  10430. break;
  10431. }
  10432. if ($literal > 0 && $this->decisions->undecided($literal)) {
  10433. $decisionQueue[] = $literal;
  10434. }
  10435. }
  10436. if ($noneSatisfied && count($decisionQueue)) {
  10437. if (count($this->installed) != count($this->updateMap)) {
  10438. $prunedQueue = array();
  10439. foreach ($decisionQueue as $literal) {
  10440. if (isset($this->installedMap[abs($literal)])) {
  10441. $prunedQueue[] = $literal;
  10442. if (isset($this->updateMap[abs($literal)])) {
  10443. $prunedQueue = $decisionQueue;
  10444. break;
  10445. }
  10446. }
  10447. }
  10448. $decisionQueue = $prunedQueue;
  10449. }
  10450. }
  10451. if ($noneSatisfied && count($decisionQueue)) {
  10452. $oLevel = $level;
  10453. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  10454. if (0 === $level) {
  10455. return;
  10456. }
  10457. if ($level <= $oLevel) {
  10458. break;
  10459. }
  10460. }
  10461. }
  10462. }
  10463. $systemLevel = $level + 1;
  10464. $iterator->next();
  10465. if ($iterator->valid()) {
  10466. continue;
  10467. }
  10468. }
  10469. if ($level < $systemLevel) {
  10470. $systemLevel = $level;
  10471. }
  10472. $rulesCount = count($this->rules);
  10473. $pass = 1;
  10474. $this->io->writeError('Looking at all rules.', true, IOInterface::DEBUG);
  10475. for ($i = 0, $n = 0; $n < $rulesCount; $i++, $n++) {
  10476. if ($i == $rulesCount) {
  10477. if (1 === $pass) {
  10478. $this->io->writeError("Something's changed, looking at all rules again (pass #$pass)", false, IOInterface::DEBUG);
  10479. } else {
  10480. $this->io->overwriteError("Something's changed, looking at all rules again (pass #$pass)", false, null, IOInterface::DEBUG);
  10481. }
  10482. $i = 0;
  10483. $pass++;
  10484. }
  10485. $rule = $this->rules->ruleById[$i];
  10486. $literals = $rule->getLiterals();
  10487. if ($rule->isDisabled()) {
  10488. continue;
  10489. }
  10490. $decisionQueue = array();
  10491. foreach ($literals as $literal) {
  10492. if ($literal <= 0) {
  10493. if (!$this->decisions->decidedInstall($literal)) {
  10494. continue 2;
  10495. }
  10496. } else {
  10497. if ($this->decisions->decidedInstall($literal)) {
  10498. continue 2;
  10499. }
  10500. if ($this->decisions->undecided($literal)) {
  10501. $decisionQueue[] = $literal;
  10502. }
  10503. }
  10504. }
  10505. if (count($decisionQueue) < 2) {
  10506. continue;
  10507. }
  10508. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  10509. if (0 === $level) {
  10510. return;
  10511. }
  10512. $rulesCount = count($this->rules);
  10513. $n = -1;
  10514. }
  10515. if ($level < $systemLevel) {
  10516. continue;
  10517. }
  10518. if (count($this->branches)) {
  10519. $lastLiteral = null;
  10520. $lastLevel = null;
  10521. $lastBranchIndex = 0;
  10522. $lastBranchOffset = 0;
  10523. for ($i = count($this->branches) - 1; $i >= 0; $i--) {
  10524. list($literals, $l) = $this->branches[$i];
  10525. foreach ($literals as $offset => $literal) {
  10526. if ($literal && $literal > 0 && $this->decisions->decisionLevel($literal) > $l + 1) {
  10527. $lastLiteral = $literal;
  10528. $lastBranchIndex = $i;
  10529. $lastBranchOffset = $offset;
  10530. $lastLevel = $l;
  10531. }
  10532. }
  10533. }
  10534. if ($lastLiteral) {
  10535. unset($this->branches[$lastBranchIndex][self::BRANCH_LITERALS][$lastBranchOffset]);
  10536. $level = $lastLevel;
  10537. $this->revert($level);
  10538. $why = $this->decisions->lastReason();
  10539. $level = $this->setPropagateLearn($level, $lastLiteral, $disableRules, $why);
  10540. if ($level == 0) {
  10541. return;
  10542. }
  10543. continue;
  10544. }
  10545. }
  10546. break;
  10547. }
  10548. }
  10549. }
  10550. <?php
  10551. namespace Composer\DependencyResolver;
  10552. class SolverBugException extends \RuntimeException
  10553. {
  10554. public function __construct($message)
  10555. {
  10556. parent::__construct(
  10557. $message."\nThis exception was most likely caused by a bug in Composer.\n".
  10558. "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"
  10559. );
  10560. }
  10561. }
  10562. <?php
  10563. namespace Composer\DependencyResolver;
  10564. use Composer\Util\IniHelper;
  10565. class SolverProblemsException extends \RuntimeException
  10566. {
  10567. protected $problems;
  10568. protected $installedMap;
  10569. public function __construct(array $problems, array $installedMap)
  10570. {
  10571. $this->problems = $problems;
  10572. $this->installedMap = $installedMap;
  10573. parent::__construct($this->createMessage(), 2);
  10574. }
  10575. protected function createMessage()
  10576. {
  10577. $text = "\n";
  10578. $hasExtensionProblems = false;
  10579. foreach ($this->problems as $i => $problem) {
  10580. $text .= " Problem ".($i + 1).$problem->getPrettyString($this->installedMap)."\n";
  10581. if (!$hasExtensionProblems && $this->hasExtensionProblems($problem->getReasons())) {
  10582. $hasExtensionProblems = true;
  10583. }
  10584. }
  10585. if (strpos($text, 'could not be found') || strpos($text, 'no matching package found')) {
  10586. $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.";
  10587. }
  10588. if ($hasExtensionProblems) {
  10589. $text .= $this->createExtensionHint();
  10590. }
  10591. return $text;
  10592. }
  10593. public function getProblems()
  10594. {
  10595. return $this->problems;
  10596. }
  10597. private function createExtensionHint()
  10598. {
  10599. $paths = IniHelper::getAll();
  10600. if (count($paths) === 1 && empty($paths[0])) {
  10601. return '';
  10602. }
  10603. $text = "\n To enable extensions, verify that they are enabled in your .ini files:\n - ";
  10604. $text .= implode("\n - ", $paths);
  10605. $text .= "\n You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.";
  10606. return $text;
  10607. }
  10608. private function hasExtensionProblems(array $reasonSets)
  10609. {
  10610. foreach ($reasonSets as $reasonSet) {
  10611. foreach ($reasonSet as $reason) {
  10612. if (isset($reason["rule"]) && 0 === strpos($reason["rule"]->getRequiredPackage(), 'ext-')) {
  10613. return true;
  10614. }
  10615. }
  10616. }
  10617. return false;
  10618. }
  10619. }
  10620. <?php
  10621. namespace Composer\DependencyResolver;
  10622. use Composer\Package\AliasPackage;
  10623. class Transaction
  10624. {
  10625. protected $policy;
  10626. protected $pool;
  10627. protected $installedMap;
  10628. protected $decisions;
  10629. protected $transaction;
  10630. public function __construct($policy, $pool, $installedMap, $decisions)
  10631. {
  10632. $this->policy = $policy;
  10633. $this->pool = $pool;
  10634. $this->installedMap = $installedMap;
  10635. $this->decisions = $decisions;
  10636. $this->transaction = array();
  10637. }
  10638. public function getOperations()
  10639. {
  10640. $installMeansUpdateMap = $this->findUpdates();
  10641. $updateMap = array();
  10642. $installMap = array();
  10643. $uninstallMap = array();
  10644. foreach ($this->decisions as $i => $decision) {
  10645. $literal = $decision[Decisions::DECISION_LITERAL];
  10646. $reason = $decision[Decisions::DECISION_REASON];
  10647. $package = $this->pool->literalToPackage($literal);
  10648. if (($literal > 0) == isset($this->installedMap[$package->id])) {
  10649. continue;
  10650. }
  10651. if ($literal > 0) {
  10652. if (isset($installMeansUpdateMap[abs($literal)]) && !$package instanceof AliasPackage) {
  10653. $source = $installMeansUpdateMap[abs($literal)];
  10654. $updateMap[$package->id] = array(
  10655. 'package' => $package,
  10656. 'source' => $source,
  10657. 'reason' => $reason,
  10658. );
  10659. unset($installMeansUpdateMap[abs($literal)]);
  10660. $ignoreRemove[$source->id] = true;
  10661. } else {
  10662. $installMap[$package->id] = array(
  10663. 'package' => $package,
  10664. 'reason' => $reason,
  10665. );
  10666. }
  10667. }
  10668. }
  10669. foreach ($this->decisions as $i => $decision) {
  10670. $literal = $decision[Decisions::DECISION_LITERAL];
  10671. $reason = $decision[Decisions::DECISION_REASON];
  10672. $package = $this->pool->literalToPackage($literal);
  10673. if ($literal <= 0 &&
  10674. isset($this->installedMap[$package->id]) &&
  10675. !isset($ignoreRemove[$package->id])) {
  10676. $uninstallMap[$package->id] = array(
  10677. 'package' => $package,
  10678. 'reason' => $reason,
  10679. );
  10680. }
  10681. }
  10682. $this->transactionFromMaps($installMap, $updateMap, $uninstallMap);
  10683. return $this->transaction;
  10684. }
  10685. protected function transactionFromMaps($installMap, $updateMap, $uninstallMap)
  10686. {
  10687. $queue = array_map(
  10688. function ($operation) {
  10689. return $operation['package'];
  10690. },
  10691. $this->findRootPackages($installMap, $updateMap)
  10692. );
  10693. $visited = array();
  10694. while (!empty($queue)) {
  10695. $package = array_pop($queue);
  10696. $packageId = $package->id;
  10697. if (!isset($visited[$packageId])) {
  10698. $queue[] = $package;
  10699. if ($package instanceof AliasPackage) {
  10700. $queue[] = $package->getAliasOf();
  10701. } else {
  10702. foreach ($package->getRequires() as $link) {
  10703. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  10704. foreach ($possibleRequires as $require) {
  10705. $queue[] = $require;
  10706. }
  10707. }
  10708. }
  10709. $visited[$package->id] = true;
  10710. } else {
  10711. if (isset($installMap[$packageId])) {
  10712. $this->install(
  10713. $installMap[$packageId]['package'],
  10714. $installMap[$packageId]['reason']
  10715. );
  10716. unset($installMap[$packageId]);
  10717. }
  10718. if (isset($updateMap[$packageId])) {
  10719. $this->update(
  10720. $updateMap[$packageId]['source'],
  10721. $updateMap[$packageId]['package'],
  10722. $updateMap[$packageId]['reason']
  10723. );
  10724. unset($updateMap[$packageId]);
  10725. }
  10726. }
  10727. }
  10728. foreach ($uninstallMap as $uninstall) {
  10729. $this->uninstall($uninstall['package'], $uninstall['reason']);
  10730. }
  10731. }
  10732. protected function findRootPackages($installMap, $updateMap)
  10733. {
  10734. $packages = $installMap + $updateMap;
  10735. $roots = $packages;
  10736. foreach ($packages as $packageId => $operation) {
  10737. $package = $operation['package'];
  10738. if (!isset($roots[$packageId])) {
  10739. continue;
  10740. }
  10741. foreach ($package->getRequires() as $link) {
  10742. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  10743. foreach ($possibleRequires as $require) {
  10744. if ($require !== $package) {
  10745. unset($roots[$require->id]);
  10746. }
  10747. }
  10748. }
  10749. }
  10750. return $roots;
  10751. }
  10752. protected function findUpdates()
  10753. {
  10754. $installMeansUpdateMap = array();
  10755. foreach ($this->decisions as $i => $decision) {
  10756. $literal = $decision[Decisions::DECISION_LITERAL];
  10757. $package = $this->pool->literalToPackage($literal);
  10758. if ($package instanceof AliasPackage) {
  10759. continue;
  10760. }
  10761. if ($literal <= 0 && isset($this->installedMap[$package->id])) {
  10762. $updates = $this->policy->findUpdatePackages($this->pool, $this->installedMap, $package);
  10763. $literals = array($package->id);
  10764. foreach ($updates as $update) {
  10765. $literals[] = $update->id;
  10766. }
  10767. foreach ($literals as $updateLiteral) {
  10768. if ($updateLiteral !== $literal) {
  10769. $installMeansUpdateMap[abs($updateLiteral)] = $package;
  10770. }
  10771. }
  10772. }
  10773. }
  10774. return $installMeansUpdateMap;
  10775. }
  10776. protected function install($package, $reason)
  10777. {
  10778. if ($package instanceof AliasPackage) {
  10779. return $this->markAliasInstalled($package, $reason);
  10780. }
  10781. $this->transaction[] = new Operation\InstallOperation($package, $reason);
  10782. }
  10783. protected function update($from, $to, $reason)
  10784. {
  10785. $this->transaction[] = new Operation\UpdateOperation($from, $to, $reason);
  10786. }
  10787. protected function uninstall($package, $reason)
  10788. {
  10789. if ($package instanceof AliasPackage) {
  10790. return $this->markAliasUninstalled($package, $reason);
  10791. }
  10792. $this->transaction[] = new Operation\UninstallOperation($package, $reason);
  10793. }
  10794. protected function markAliasInstalled($package, $reason)
  10795. {
  10796. $this->transaction[] = new Operation\MarkAliasInstalledOperation($package, $reason);
  10797. }
  10798. protected function markAliasUninstalled($package, $reason)
  10799. {
  10800. $this->transaction[] = new Operation\MarkAliasUninstalledOperation($package, $reason);
  10801. }
  10802. }
  10803. <?php
  10804. namespace Composer\Downloader;
  10805. use Composer\Package\PackageInterface;
  10806. use Symfony\Component\Finder\Finder;
  10807. use Composer\IO\IOInterface;
  10808. abstract class ArchiveDownloader extends FileDownloader
  10809. {
  10810. public function download(PackageInterface $package, $path, $output = true)
  10811. {
  10812. $temporaryDir = $this->config->get('vendor-dir').'/composer/'.substr(md5(uniqid('', true)), 0, 8);
  10813. $retries = 3;
  10814. while ($retries--) {
  10815. $fileName = parent::download($package, $path, $output);
  10816. if ($output) {
  10817. $this->io->writeError(' Extracting archive', false, IOInterface::VERBOSE);
  10818. }
  10819. try {
  10820. $this->filesystem->ensureDirectoryExists($temporaryDir);
  10821. try {
  10822. $this->extract($fileName, $temporaryDir);
  10823. } catch (\Exception $e) {
  10824. parent::clearLastCacheWrite($package);
  10825. throw $e;
  10826. }
  10827. $this->filesystem->unlink($fileName);
  10828. $contentDir = $this->getFolderContent($temporaryDir);
  10829. if (1 === count($contentDir) && is_dir(reset($contentDir))) {
  10830. $contentDir = $this->getFolderContent((string) reset($contentDir));
  10831. }
  10832. foreach ($contentDir as $file) {
  10833. $file = (string) $file;
  10834. $this->filesystem->rename($file, $path . '/' . basename($file));
  10835. }
  10836. $this->filesystem->removeDirectory($temporaryDir);
  10837. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir').'/composer/')) {
  10838. $this->filesystem->removeDirectory($this->config->get('vendor-dir').'/composer/');
  10839. }
  10840. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir'))) {
  10841. $this->filesystem->removeDirectory($this->config->get('vendor-dir'));
  10842. }
  10843. } catch (\Exception $e) {
  10844. $this->filesystem->removeDirectory($path);
  10845. $this->filesystem->removeDirectory($temporaryDir);
  10846. if ($retries && $e instanceof \UnexpectedValueException && class_exists('ZipArchive') && $e->getCode() === \ZipArchive::ER_NOZIP) {
  10847. $this->io->writeError('');
  10848. if ($this->io->isDebug()) {
  10849. $this->io->writeError(' Invalid zip file ('.$e->getMessage().'), retrying...');
  10850. } else {
  10851. $this->io->writeError(' Invalid zip file, retrying...');
  10852. }
  10853. usleep(500000);
  10854. continue;
  10855. }
  10856. throw $e;
  10857. }
  10858. break;
  10859. }
  10860. }
  10861. protected function getFileName(PackageInterface $package, $path)
  10862. {
  10863. return rtrim($path.'/'.md5($path.spl_object_hash($package)).'.'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_EXTENSION), '.');
  10864. }
  10865. abstract protected function extract($file, $path);
  10866. private function getFolderContent($dir)
  10867. {
  10868. $finder = Finder::create()
  10869. ->ignoreVCS(false)
  10870. ->ignoreDotFiles(false)
  10871. ->notName('.DS_Store')
  10872. ->depth(0)
  10873. ->in($dir);
  10874. return iterator_to_array($finder);
  10875. }
  10876. }
  10877. <?php
  10878. namespace Composer\Downloader;
  10879. use Composer\Package\PackageInterface;
  10880. interface ChangeReportInterface
  10881. {
  10882. public function getLocalChanges(PackageInterface $package, $path);
  10883. }
  10884. <?php
  10885. namespace Composer\Downloader;
  10886. use Composer\Package\PackageInterface;
  10887. use Composer\IO\IOInterface;
  10888. use Composer\Util\Filesystem;
  10889. class DownloadManager
  10890. {
  10891. private $io;
  10892. private $preferDist = false;
  10893. private $preferSource = false;
  10894. private $packagePreferences = array();
  10895. private $filesystem;
  10896. private $downloaders = array();
  10897. public function __construct(IOInterface $io, $preferSource = false, Filesystem $filesystem = null)
  10898. {
  10899. $this->io = $io;
  10900. $this->preferSource = $preferSource;
  10901. $this->filesystem = $filesystem ?: new Filesystem();
  10902. }
  10903. public function setPreferSource($preferSource)
  10904. {
  10905. $this->preferSource = $preferSource;
  10906. return $this;
  10907. }
  10908. public function setPreferDist($preferDist)
  10909. {
  10910. $this->preferDist = $preferDist;
  10911. return $this;
  10912. }
  10913. public function setPreferences(array $preferences)
  10914. {
  10915. $this->packagePreferences = $preferences;
  10916. return $this;
  10917. }
  10918. public function setOutputProgress($outputProgress)
  10919. {
  10920. foreach ($this->downloaders as $downloader) {
  10921. $downloader->setOutputProgress($outputProgress);
  10922. }
  10923. return $this;
  10924. }
  10925. public function setDownloader($type, DownloaderInterface $downloader)
  10926. {
  10927. $type = strtolower($type);
  10928. $this->downloaders[$type] = $downloader;
  10929. return $this;
  10930. }
  10931. public function getDownloader($type)
  10932. {
  10933. $type = strtolower($type);
  10934. if (!isset($this->downloaders[$type])) {
  10935. throw new \InvalidArgumentException(sprintf('Unknown downloader type: %s. Available types: %s.', $type, implode(', ', array_keys($this->downloaders))));
  10936. }
  10937. return $this->downloaders[$type];
  10938. }
  10939. public function getDownloaderForInstalledPackage(PackageInterface $package)
  10940. {
  10941. $installationSource = $package->getInstallationSource();
  10942. if ('metapackage' === $package->getType()) {
  10943. return;
  10944. }
  10945. if ('dist' === $installationSource) {
  10946. $downloader = $this->getDownloader($package->getDistType());
  10947. } elseif ('source' === $installationSource) {
  10948. $downloader = $this->getDownloader($package->getSourceType());
  10949. } else {
  10950. throw new \InvalidArgumentException(
  10951. 'Package '.$package.' seems not been installed properly'
  10952. );
  10953. }
  10954. if ($installationSource !== $downloader->getInstallationSource()) {
  10955. throw new \LogicException(sprintf(
  10956. 'Downloader "%s" is a %s type downloader and can not be used to download %s for package %s',
  10957. get_class($downloader),
  10958. $downloader->getInstallationSource(),
  10959. $installationSource,
  10960. $package
  10961. ));
  10962. }
  10963. return $downloader;
  10964. }
  10965. public function download(PackageInterface $package, $targetDir, $preferSource = null)
  10966. {
  10967. $preferSource = null !== $preferSource ? $preferSource : $this->preferSource;
  10968. $sourceType = $package->getSourceType();
  10969. $distType = $package->getDistType();
  10970. $sources = array();
  10971. if ($sourceType) {
  10972. $sources[] = 'source';
  10973. }
  10974. if ($distType) {
  10975. $sources[] = 'dist';
  10976. }
  10977. if (empty($sources)) {
  10978. throw new \InvalidArgumentException('Package '.$package.' must have a source or dist specified');
  10979. }
  10980. if (!$preferSource && ($this->preferDist || 'dist' === $this->resolvePackageInstallPreference($package))) {
  10981. $sources = array_reverse($sources);
  10982. }
  10983. $this->filesystem->ensureDirectoryExists($targetDir);
  10984. foreach ($sources as $i => $source) {
  10985. if (isset($e)) {
  10986. $this->io->writeError(' <warning>Now trying to download from ' . $source . '</warning>');
  10987. }
  10988. $package->setInstallationSource($source);
  10989. try {
  10990. $downloader = $this->getDownloaderForInstalledPackage($package);
  10991. if ($downloader) {
  10992. $downloader->download($package, $targetDir);
  10993. }
  10994. break;
  10995. } catch (\RuntimeException $e) {
  10996. if ($i === count($sources) - 1) {
  10997. throw $e;
  10998. }
  10999. $this->io->writeError(
  11000. ' <warning>Failed to download '.
  11001. $package->getPrettyName().
  11002. ' from ' . $source . ': '.
  11003. $e->getMessage().'</warning>'
  11004. );
  11005. }
  11006. }
  11007. }
  11008. public function update(PackageInterface $initial, PackageInterface $target, $targetDir)
  11009. {
  11010. $downloader = $this->getDownloaderForInstalledPackage($initial);
  11011. if (!$downloader) {
  11012. return;
  11013. }
  11014. $installationSource = $initial->getInstallationSource();
  11015. if ('dist' === $installationSource) {
  11016. $initialType = $initial->getDistType();
  11017. $targetType = $target->getDistType();
  11018. } else {
  11019. $initialType = $initial->getSourceType();
  11020. $targetType = $target->getSourceType();
  11021. }
  11022. if ($target->isDev() && 'dist' === $installationSource) {
  11023. $downloader->remove($initial, $targetDir);
  11024. $this->download($target, $targetDir);
  11025. return;
  11026. }
  11027. if ($initialType === $targetType) {
  11028. $target->setInstallationSource($installationSource);
  11029. try {
  11030. $downloader->update($initial, $target, $targetDir);
  11031. return;
  11032. } catch (\RuntimeException $e) {
  11033. if (!$this->io->isInteractive()) {
  11034. throw $e;
  11035. }
  11036. $this->io->writeError('<error> Update failed ('.$e->getMessage().')</error>');
  11037. if (!$this->io->askConfirmation(' Would you like to try reinstalling the package instead [<comment>yes</comment>]? ', true)) {
  11038. throw $e;
  11039. }
  11040. }
  11041. }
  11042. $downloader->remove($initial, $targetDir);
  11043. $this->download($target, $targetDir, 'source' === $installationSource);
  11044. }
  11045. public function remove(PackageInterface $package, $targetDir)
  11046. {
  11047. $downloader = $this->getDownloaderForInstalledPackage($package);
  11048. if ($downloader) {
  11049. $downloader->remove($package, $targetDir);
  11050. }
  11051. }
  11052. protected function resolvePackageInstallPreference(PackageInterface $package)
  11053. {
  11054. foreach ($this->packagePreferences as $pattern => $preference) {
  11055. $pattern = '{^'.str_replace('\\*', '.*', preg_quote($pattern)).'$}i';
  11056. if (preg_match($pattern, $package->getName())) {
  11057. if ('dist' === $preference || (!$package->isDev() && 'auto' === $preference)) {
  11058. return 'dist';
  11059. }
  11060. return 'source';
  11061. }
  11062. }
  11063. return $package->isDev() ? 'source' : 'dist';
  11064. }
  11065. }
  11066. <?php
  11067. namespace Composer\Downloader;
  11068. use Composer\Package\PackageInterface;
  11069. interface DownloaderInterface
  11070. {
  11071. public function getInstallationSource();
  11072. public function download(PackageInterface $package, $path);
  11073. public function update(PackageInterface $initial, PackageInterface $target, $path);
  11074. public function remove(PackageInterface $package, $path);
  11075. public function setOutputProgress($outputProgress);
  11076. }
  11077. <?php
  11078. namespace Composer\Downloader;
  11079. use Composer\Package\PackageInterface;
  11080. interface DvcsDownloaderInterface
  11081. {
  11082. public function getUnpushedChanges(PackageInterface $package, $path);
  11083. }
  11084. <?php
  11085. namespace Composer\Downloader;
  11086. use Composer\Config;
  11087. use Composer\Cache;
  11088. use Composer\Factory;
  11089. use Composer\IO\IOInterface;
  11090. use Composer\IO\NullIO;
  11091. use Composer\Package\Comparer\Comparer;
  11092. use Composer\Package\PackageInterface;
  11093. use Composer\Package\Version\VersionParser;
  11094. use Composer\Plugin\PluginEvents;
  11095. use Composer\Plugin\PreFileDownloadEvent;
  11096. use Composer\EventDispatcher\EventDispatcher;
  11097. use Composer\Util\Filesystem;
  11098. use Composer\Util\RemoteFilesystem;
  11099. use Composer\Util\Url as UrlUtil;
  11100. class FileDownloader implements DownloaderInterface, ChangeReportInterface
  11101. {
  11102. protected $io;
  11103. protected $config;
  11104. protected $rfs;
  11105. protected $filesystem;
  11106. protected $cache;
  11107. protected $outputProgress = true;
  11108. private $lastCacheWrites = array();
  11109. private $eventDispatcher;
  11110. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, RemoteFilesystem $rfs = null, Filesystem $filesystem = null)
  11111. {
  11112. $this->io = $io;
  11113. $this->config = $config;
  11114. $this->eventDispatcher = $eventDispatcher;
  11115. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  11116. $this->filesystem = $filesystem ?: new Filesystem();
  11117. $this->cache = $cache;
  11118. if ($this->cache && $this->cache->gcIsNecessary()) {
  11119. $this->cache->gc($config->get('cache-files-ttl'), $config->get('cache-files-maxsize'));
  11120. }
  11121. }
  11122. public function getInstallationSource()
  11123. {
  11124. return 'dist';
  11125. }
  11126. public function download(PackageInterface $package, $path, $output = true)
  11127. {
  11128. if (!$package->getDistUrl()) {
  11129. throw new \InvalidArgumentException('The given package is missing url information');
  11130. }
  11131. if ($output) {
  11132. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  11133. }
  11134. $urls = $package->getDistUrls();
  11135. while ($url = array_shift($urls)) {
  11136. try {
  11137. $fileName = $this->doDownload($package, $path, $url);
  11138. break;
  11139. } catch (\Exception $e) {
  11140. if ($this->io->isDebug()) {
  11141. $this->io->writeError('');
  11142. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getCode().': '.$e->getMessage());
  11143. } elseif (count($urls)) {
  11144. $this->io->writeError('');
  11145. $this->io->writeError(' Failed, trying the next URL ('.$e->getCode().': '.$e->getMessage().')', false);
  11146. }
  11147. if (!count($urls)) {
  11148. throw $e;
  11149. }
  11150. }
  11151. }
  11152. if ($output) {
  11153. $this->io->writeError('');
  11154. }
  11155. return $fileName;
  11156. }
  11157. protected function doDownload(PackageInterface $package, $path, $url)
  11158. {
  11159. $this->filesystem->emptyDirectory($path);
  11160. $fileName = $this->getFileName($package, $path);
  11161. $processedUrl = $this->processUrl($package, $url);
  11162. $origin = RemoteFilesystem::getOrigin($processedUrl);
  11163. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $processedUrl);
  11164. if ($this->eventDispatcher) {
  11165. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  11166. }
  11167. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  11168. try {
  11169. $checksum = $package->getDistSha1Checksum();
  11170. $cacheKey = $this->getCacheKey($package, $processedUrl);
  11171. if ($this->cache && (!$checksum || $checksum === $this->cache->sha1($cacheKey)) && $this->cache->copyTo($cacheKey, $fileName)) {
  11172. $this->io->writeError('Loading from cache', false);
  11173. } else {
  11174. if (!$this->outputProgress) {
  11175. $this->io->writeError('Downloading', false);
  11176. }
  11177. $retries = 3;
  11178. while ($retries--) {
  11179. try {
  11180. $rfs->copy($origin, $processedUrl, $fileName, $this->outputProgress, $package->getTransportOptions());
  11181. break;
  11182. } catch (TransportException $e) {
  11183. if ((0 !== $e->getCode() && !in_array($e->getCode(), array(500, 502, 503, 504))) || !$retries) {
  11184. throw $e;
  11185. }
  11186. $this->io->writeError('');
  11187. $this->io->writeError(' Download failed, retrying...', true, IOInterface::VERBOSE);
  11188. usleep(500000);
  11189. }
  11190. }
  11191. if (!$this->outputProgress) {
  11192. $this->io->writeError(' (<comment>100%</comment>)', false);
  11193. }
  11194. if ($this->cache) {
  11195. $this->lastCacheWrites[$package->getName()] = $cacheKey;
  11196. $this->cache->copyFrom($cacheKey, $fileName);
  11197. }
  11198. }
  11199. if (!file_exists($fileName)) {
  11200. throw new \UnexpectedValueException($url.' could not be saved to '.$fileName.', make sure the'
  11201. .' directory is writable and you have internet connectivity');
  11202. }
  11203. if ($checksum && hash_file('sha1', $fileName) !== $checksum) {
  11204. throw new \UnexpectedValueException('The checksum verification of the file failed (downloaded from '.$url.')');
  11205. }
  11206. } catch (\Exception $e) {
  11207. $this->filesystem->removeDirectory($path);
  11208. $this->clearLastCacheWrite($package);
  11209. throw $e;
  11210. }
  11211. return $fileName;
  11212. }
  11213. public function setOutputProgress($outputProgress)
  11214. {
  11215. $this->outputProgress = $outputProgress;
  11216. return $this;
  11217. }
  11218. protected function clearLastCacheWrite(PackageInterface $package)
  11219. {
  11220. if ($this->cache && isset($this->lastCacheWrites[$package->getName()])) {
  11221. $this->cache->remove($this->lastCacheWrites[$package->getName()]);
  11222. unset($this->lastCacheWrites[$package->getName()]);
  11223. }
  11224. }
  11225. public function update(PackageInterface $initial, PackageInterface $target, $path)
  11226. {
  11227. $name = $target->getName();
  11228. $from = $initial->getFullPrettyVersion();
  11229. $to = $target->getFullPrettyVersion();
  11230. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  11231. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  11232. $this->remove($initial, $path, false);
  11233. $this->download($target, $path, false);
  11234. $this->io->writeError('');
  11235. }
  11236. public function remove(PackageInterface $package, $path, $output = true)
  11237. {
  11238. if ($output) {
  11239. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  11240. }
  11241. if (!$this->filesystem->removeDirectory($path)) {
  11242. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  11243. }
  11244. }
  11245. protected function getFileName(PackageInterface $package, $path)
  11246. {
  11247. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  11248. }
  11249. protected function processUrl(PackageInterface $package, $url)
  11250. {
  11251. if (!extension_loaded('openssl') && 0 === strpos($url, 'https:')) {
  11252. throw new \RuntimeException('You must enable the openssl extension to download files via https');
  11253. }
  11254. if ($package->getDistReference()) {
  11255. $url = UrlUtil::updateDistReference($this->config, $url, $package->getDistReference());
  11256. }
  11257. return $url;
  11258. }
  11259. private function getCacheKey(PackageInterface $package, $processedUrl)
  11260. {
  11261. $cacheKey = sha1($processedUrl);
  11262. return $package->getName().'/'.$cacheKey.'.'.$package->getDistType();
  11263. }
  11264. public function getLocalChanges(PackageInterface $package, $targetDir)
  11265. {
  11266. $prevIO = $this->io;
  11267. $prevProgress = $this->outputProgress;
  11268. $this->io = new NullIO;
  11269. $this->io->loadConfiguration($this->config);
  11270. $this->outputProgress = false;
  11271. $e = null;
  11272. try {
  11273. $this->download($package, $targetDir.'_compare', false);
  11274. $comparer = new Comparer();
  11275. $comparer->setSource($targetDir.'_compare');
  11276. $comparer->setUpdate($targetDir);
  11277. $comparer->doCompare();
  11278. $output = $comparer->getChanged(true, true);
  11279. $this->filesystem->removeDirectory($targetDir.'_compare');
  11280. } catch (\Exception $e) {
  11281. }
  11282. $this->io = $prevIO;
  11283. $this->outputProgress = $prevProgress;
  11284. if ($e) {
  11285. throw $e;
  11286. }
  11287. return trim($output);
  11288. }
  11289. }
  11290. <?php
  11291. namespace Composer\Downloader;
  11292. class FilesystemException extends \Exception
  11293. {
  11294. public function __construct($message = '', $code = 0, \Exception $previous = null)
  11295. {
  11296. parent::__construct("Filesystem exception: \n".$message, $code, $previous);
  11297. }
  11298. }
  11299. <?php
  11300. namespace Composer\Downloader;
  11301. use Composer\Package\PackageInterface;
  11302. use Composer\Util\ProcessExecutor;
  11303. class FossilDownloader extends VcsDownloader
  11304. {
  11305. public function doDownload(PackageInterface $package, $path, $url)
  11306. {
  11307. $this->config->prohibitUrlByConfig($url, $this->io);
  11308. $url = ProcessExecutor::escape($url);
  11309. $ref = ProcessExecutor::escape($package->getSourceReference());
  11310. $repoFile = $path . '.fossil';
  11311. $this->io->writeError("Cloning ".$package->getSourceReference());
  11312. $command = sprintf('fossil clone %s %s', $url, ProcessExecutor::escape($repoFile));
  11313. if (0 !== $this->process->execute($command, $ignoredOutput)) {
  11314. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11315. }
  11316. $command = sprintf('fossil open %s --nested', ProcessExecutor::escape($repoFile));
  11317. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  11318. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11319. }
  11320. $command = sprintf('fossil update %s', $ref);
  11321. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  11322. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11323. }
  11324. }
  11325. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11326. {
  11327. $this->config->prohibitUrlByConfig($url, $this->io);
  11328. $url = ProcessExecutor::escape($url);
  11329. $ref = ProcessExecutor::escape($target->getSourceReference());
  11330. $this->io->writeError(" Updating to ".$target->getSourceReference());
  11331. if (!$this->hasMetadataRepository($path)) {
  11332. throw new \RuntimeException('The .fslckout file is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  11333. }
  11334. $command = sprintf('fossil pull && fossil up %s', $ref);
  11335. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  11336. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11337. }
  11338. }
  11339. public function getLocalChanges(PackageInterface $package, $path)
  11340. {
  11341. if (!$this->hasMetadataRepository($path)) {
  11342. return null;
  11343. }
  11344. $this->process->execute('fossil changes', $output, realpath($path));
  11345. return trim($output) ?: null;
  11346. }
  11347. protected function getCommitLogs($fromReference, $toReference, $path)
  11348. {
  11349. $command = sprintf('fossil timeline -t ci -W 0 -n 0 before %s', ProcessExecutor::escape($toReference));
  11350. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  11351. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11352. }
  11353. $log = '';
  11354. $match = '/\d\d:\d\d:\d\d\s+\[' . $toReference . '\]/';
  11355. foreach ($this->process->splitLines($output) as $line) {
  11356. if (preg_match($match, $line)) {
  11357. break;
  11358. }
  11359. $log .= $line;
  11360. }
  11361. return $log;
  11362. }
  11363. protected function hasMetadataRepository($path)
  11364. {
  11365. return is_file($path . '/.fslckout') || is_file($path . '/_FOSSIL_');
  11366. }
  11367. }
  11368. <?php
  11369. namespace Composer\Downloader;
  11370. use Composer\Config;
  11371. use Composer\IO\IOInterface;
  11372. use Composer\Package\PackageInterface;
  11373. use Composer\Util\Filesystem;
  11374. use Composer\Util\Git as GitUtil;
  11375. use Composer\Util\Platform;
  11376. use Composer\Util\ProcessExecutor;
  11377. use Composer\Cache;
  11378. class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
  11379. {
  11380. private $hasStashedChanges = false;
  11381. private $hasDiscardedChanges = false;
  11382. private $gitUtil;
  11383. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  11384. {
  11385. parent::__construct($io, $config, $process, $fs);
  11386. $this->gitUtil = new GitUtil($this->io, $this->config, $this->process, $this->filesystem);
  11387. }
  11388. public function doDownload(PackageInterface $package, $path, $url)
  11389. {
  11390. GitUtil::cleanEnv();
  11391. $path = $this->normalizePath($path);
  11392. $cachePath = $this->config->get('cache-vcs-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $url).'/';
  11393. $ref = $package->getSourceReference();
  11394. $flag = Platform::isWindows() ? '/D ' : '';
  11395. $gitVersion = GitUtil::getVersion($this->process);
  11396. $msg = "Cloning ".$this->getShortHash($ref);
  11397. $command = 'git clone --no-checkout %url% %path% && cd '.$flag.'%path% && git remote add composer %url% && git fetch composer && git remote set-url origin %sanitizedUrl% && git remote set-url composer %sanitizedUrl%';
  11398. if ($gitVersion && version_compare($gitVersion, '2.3.0-rc0', '>=') && Cache::isUsable($cachePath)) {
  11399. $this->io->writeError('', true, IOInterface::DEBUG);
  11400. $this->io->writeError(sprintf(' Cloning to cache at %s', ProcessExecutor::escape($cachePath)), true, IOInterface::DEBUG);
  11401. try {
  11402. if (!$this->gitUtil->fetchRefOrSyncMirror($url, $cachePath, $ref)) {
  11403. $this->io->writeError('<error>Failed to update '.$url.' in cache, package installation for '.$package->getPrettyName().' might fail.</error>');
  11404. }
  11405. if (is_dir($cachePath)) {
  11406. $command =
  11407. 'git clone --no-checkout %cachePath% %path% --dissociate --reference %cachePath% '
  11408. . '&& cd '.$flag.'%path% '
  11409. . '&& git remote set-url origin %sanitizedUrl% && git remote add composer %sanitizedUrl%';
  11410. $msg = "Cloning ".$this->getShortHash($ref).' from cache';
  11411. }
  11412. } catch (\RuntimeException $e) {
  11413. if (0 === strpos(get_class($e), 'PHPUnit')) {
  11414. throw $e;
  11415. }
  11416. }
  11417. }
  11418. $this->io->writeError($msg);
  11419. $commandCallable = function ($url) use ($path, $command, $cachePath) {
  11420. return str_replace(
  11421. array('%url%', '%path%', '%cachePath%', '%sanitizedUrl%'),
  11422. array(
  11423. ProcessExecutor::escape($url),
  11424. ProcessExecutor::escape($path),
  11425. ProcessExecutor::escape($cachePath),
  11426. ProcessExecutor::escape(preg_replace('{://([^@]+?):(.+?)@}', '://', $url)),
  11427. ),
  11428. $command
  11429. );
  11430. };
  11431. $this->gitUtil->runCommand($commandCallable, $url, $path, true);
  11432. if ($url !== $package->getSourceUrl()) {
  11433. $this->updateOriginUrl($path, $package->getSourceUrl());
  11434. } else {
  11435. $this->setPushUrl($path, $url);
  11436. }
  11437. if ($newRef = $this->updateToCommit($path, $ref, $package->getPrettyVersion(), $package->getReleaseDate())) {
  11438. if ($package->getDistReference() === $package->getSourceReference()) {
  11439. $package->setDistReference($newRef);
  11440. }
  11441. $package->setSourceReference($newRef);
  11442. }
  11443. }
  11444. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11445. {
  11446. GitUtil::cleanEnv();
  11447. if (!$this->hasMetadataRepository($path)) {
  11448. throw new \RuntimeException('The .git directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  11449. }
  11450. $updateOriginUrl = false;
  11451. if (
  11452. 0 === $this->process->execute('git remote -v', $output, $path)
  11453. && preg_match('{^origin\s+(?P<url>\S+)}m', $output, $originMatch)
  11454. && preg_match('{^composer\s+(?P<url>\S+)}m', $output, $composerMatch)
  11455. ) {
  11456. if ($originMatch['url'] === $composerMatch['url'] && $composerMatch['url'] !== $target->getSourceUrl()) {
  11457. $updateOriginUrl = true;
  11458. }
  11459. }
  11460. $ref = $target->getSourceReference();
  11461. $this->io->writeError(" Checking out ".$this->getShortHash($ref));
  11462. $command = '(git remote set-url composer %s && git rev-parse --quiet --verify %s || (git fetch composer && git fetch --tags composer)) && git remote set-url composer %s';
  11463. $commandCallable = function ($url) use ($command, $ref) {
  11464. return sprintf(
  11465. $command,
  11466. ProcessExecutor::escape($url),
  11467. ProcessExecutor::escape($ref.'^{commit}'),
  11468. ProcessExecutor::escape(preg_replace('{://([^@]+?):(.+?)@}', '://', $url))
  11469. );
  11470. };
  11471. $this->gitUtil->runCommand($commandCallable, $url, $path);
  11472. if ($newRef = $this->updateToCommit($path, $ref, $target->getPrettyVersion(), $target->getReleaseDate())) {
  11473. if ($target->getDistReference() === $target->getSourceReference()) {
  11474. $target->setDistReference($newRef);
  11475. }
  11476. $target->setSourceReference($newRef);
  11477. }
  11478. if ($updateOriginUrl) {
  11479. $this->updateOriginUrl($path, $target->getSourceUrl());
  11480. }
  11481. }
  11482. public function getLocalChanges(PackageInterface $package, $path)
  11483. {
  11484. GitUtil::cleanEnv();
  11485. if (!$this->hasMetadataRepository($path)) {
  11486. return;
  11487. }
  11488. $command = 'git status --porcelain --untracked-files=no';
  11489. if (0 !== $this->process->execute($command, $output, $path)) {
  11490. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11491. }
  11492. return trim($output) ?: null;
  11493. }
  11494. public function getUnpushedChanges(PackageInterface $package, $path)
  11495. {
  11496. GitUtil::cleanEnv();
  11497. $path = $this->normalizePath($path);
  11498. if (!$this->hasMetadataRepository($path)) {
  11499. return;
  11500. }
  11501. $command = 'git show-ref --head -d';
  11502. if (0 !== $this->process->execute($command, $output, $path)) {
  11503. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11504. }
  11505. $refs = trim($output);
  11506. if (!preg_match('{^([a-f0-9]+) HEAD$}mi', $refs, $match)) {
  11507. return;
  11508. }
  11509. $headRef = $match[1];
  11510. if (!preg_match_all('{^'.$headRef.' refs/heads/(.+)$}mi', $refs, $matches)) {
  11511. return;
  11512. }
  11513. $branch = $matches[1][0];
  11514. $unpushedChanges = null;
  11515. for ($i = 0; $i <= 1; $i++) {
  11516. foreach ($matches[1] as $candidate) {
  11517. if (preg_match('{^[a-f0-9]+ refs/remotes/((?:composer|origin)/'.preg_quote($candidate).')$}mi', $refs, $match)) {
  11518. $branch = $candidate;
  11519. $remoteBranch = $match[1];
  11520. break;
  11521. }
  11522. }
  11523. if (!isset($remoteBranch)) {
  11524. $unpushedChanges = 'Branch ' . $branch . ' could not be found on the origin remote and appears to be unpushed';
  11525. } else {
  11526. $command = sprintf('git diff --name-status %s...%s --', $remoteBranch, $branch);
  11527. if (0 !== $this->process->execute($command, $output, $path)) {
  11528. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11529. }
  11530. $unpushedChanges = trim($output) ?: null;
  11531. }
  11532. if ($unpushedChanges && $i === 0) {
  11533. $this->process->execute('git fetch composer && git fetch origin', $output, $path);
  11534. }
  11535. if (!$unpushedChanges) {
  11536. break;
  11537. }
  11538. }
  11539. return $unpushedChanges;
  11540. }
  11541. protected function cleanChanges(PackageInterface $package, $path, $update)
  11542. {
  11543. GitUtil::cleanEnv();
  11544. $path = $this->normalizePath($path);
  11545. $unpushed = $this->getUnpushedChanges($package, $path);
  11546. if ($unpushed && ($this->io->isInteractive() || $this->config->get('discard-changes') !== true)) {
  11547. throw new \RuntimeException('Source directory ' . $path . ' has unpushed changes on the current branch: '."\n".$unpushed);
  11548. }
  11549. if (!$changes = $this->getLocalChanges($package, $path)) {
  11550. return;
  11551. }
  11552. if (!$this->io->isInteractive()) {
  11553. $discardChanges = $this->config->get('discard-changes');
  11554. if (true === $discardChanges) {
  11555. return $this->discardChanges($path);
  11556. }
  11557. if ('stash' === $discardChanges) {
  11558. if (!$update) {
  11559. return parent::cleanChanges($package, $path, $update);
  11560. }
  11561. return $this->stashChanges($path);
  11562. }
  11563. return parent::cleanChanges($package, $path, $update);
  11564. }
  11565. $changes = array_map(function ($elem) {
  11566. return ' '.$elem;
  11567. }, preg_split('{\s*\r?\n\s*}', $changes));
  11568. $this->io->writeError(' <error>The package has modified files:</error>');
  11569. $this->io->writeError(array_slice($changes, 0, 10));
  11570. if (count($changes) > 10) {
  11571. $this->io->writeError(' <info>' . (count($changes) - 10) . ' more files modified, choose "v" to view the full list</info>');
  11572. }
  11573. while (true) {
  11574. switch ($this->io->ask(' <info>Discard changes [y,n,v,d,'.($update ? 's,' : '').'?]?</info> ', '?')) {
  11575. case 'y':
  11576. $this->discardChanges($path);
  11577. break 2;
  11578. case 's':
  11579. if (!$update) {
  11580. goto help;
  11581. }
  11582. $this->stashChanges($path);
  11583. break 2;
  11584. case 'n':
  11585. throw new \RuntimeException('Update aborted');
  11586. case 'v':
  11587. $this->io->writeError($changes);
  11588. break;
  11589. case 'd':
  11590. $this->viewDiff($path);
  11591. break;
  11592. case '?':
  11593. default:
  11594. help:
  11595. $this->io->writeError(array(
  11596. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  11597. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  11598. ' v - view modified files',
  11599. ' d - view local modifications (diff)',
  11600. ));
  11601. if ($update) {
  11602. $this->io->writeError(' s - stash changes and try to reapply them after the update');
  11603. }
  11604. $this->io->writeError(' ? - print help');
  11605. break;
  11606. }
  11607. }
  11608. }
  11609. protected function reapplyChanges($path)
  11610. {
  11611. $path = $this->normalizePath($path);
  11612. if ($this->hasStashedChanges) {
  11613. $this->hasStashedChanges = false;
  11614. $this->io->writeError(' <info>Re-applying stashed changes</info>');
  11615. if (0 !== $this->process->execute('git stash pop', $output, $path)) {
  11616. throw new \RuntimeException("Failed to apply stashed changes:\n\n".$this->process->getErrorOutput());
  11617. }
  11618. }
  11619. $this->hasDiscardedChanges = false;
  11620. }
  11621. protected function updateToCommit($path, $reference, $branch, $date)
  11622. {
  11623. $force = $this->hasDiscardedChanges || $this->hasStashedChanges ? '-f ' : '';
  11624. $template = 'git checkout '.$force.'%s -- && git reset --hard %1$s --';
  11625. $branch = preg_replace('{(?:^dev-|(?:\.x)?-dev$)}i', '', $branch);
  11626. $branches = null;
  11627. if (0 === $this->process->execute('git branch -r', $output, $path)) {
  11628. $branches = $output;
  11629. }
  11630. $gitRef = $reference;
  11631. if (!preg_match('{^[a-f0-9]{40}$}', $reference)
  11632. && $branches
  11633. && preg_match('{^\s+composer/'.preg_quote($reference).'$}m', $branches)
  11634. ) {
  11635. $command = sprintf('git checkout '.$force.'-B %s %s -- && git reset --hard %2$s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$reference));
  11636. if (0 === $this->process->execute($command, $output, $path)) {
  11637. return;
  11638. }
  11639. }
  11640. if (preg_match('{^[a-f0-9]{40}$}', $reference)) {
  11641. if (!preg_match('{^\s+composer/'.preg_quote($branch).'$}m', $branches) && preg_match('{^\s+composer/v'.preg_quote($branch).'$}m', $branches)) {
  11642. $branch = 'v' . $branch;
  11643. }
  11644. $command = sprintf('git checkout %s --', ProcessExecutor::escape($branch));
  11645. $fallbackCommand = sprintf('git checkout '.$force.'-B %s %s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$branch));
  11646. if (0 === $this->process->execute($command, $output, $path)
  11647. || 0 === $this->process->execute($fallbackCommand, $output, $path)
  11648. ) {
  11649. $command = sprintf('git reset --hard %s --', ProcessExecutor::escape($reference));
  11650. if (0 === $this->process->execute($command, $output, $path)) {
  11651. return;
  11652. }
  11653. }
  11654. }
  11655. $command = sprintf($template, ProcessExecutor::escape($gitRef));
  11656. if (0 === $this->process->execute($command, $output, $path)) {
  11657. return;
  11658. }
  11659. if (false !== strpos($this->process->getErrorOutput(), $reference)) {
  11660. $this->io->writeError(' <warning>'.$reference.' is gone (history was rewritten?)</warning>');
  11661. }
  11662. throw new \RuntimeException(GitUtil::sanitizeUrl('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()));
  11663. }
  11664. protected function updateOriginUrl($path, $url)
  11665. {
  11666. $this->process->execute(sprintf('git remote set-url origin %s', ProcessExecutor::escape($url)), $output, $path);
  11667. $this->setPushUrl($path, $url);
  11668. }
  11669. protected function setPushUrl($path, $url)
  11670. {
  11671. if (preg_match('{^(?:https?|git)://'.GitUtil::getGitHubDomainsRegex($this->config).'/([^/]+)/([^/]+?)(?:\.git)?$}', $url, $match)) {
  11672. $protocols = $this->config->get('github-protocols');
  11673. $pushUrl = 'git@'.$match[1].':'.$match[2].'/'.$match[3].'.git';
  11674. if (!in_array('ssh', $protocols, true)) {
  11675. $pushUrl = 'https://' . $match[1] . '/'.$match[2].'/'.$match[3].'.git';
  11676. }
  11677. $cmd = sprintf('git remote set-url --push origin %s', ProcessExecutor::escape($pushUrl));
  11678. $this->process->execute($cmd, $ignoredOutput, $path);
  11679. }
  11680. }
  11681. protected function getCommitLogs($fromReference, $toReference, $path)
  11682. {
  11683. $path = $this->normalizePath($path);
  11684. $command = sprintf('git log %s..%s --pretty=format:"%%h - %%an: %%s"'.GitUtil::getNoShowSignatureFlag($this->process), ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
  11685. if (0 !== $this->process->execute($command, $output, $path)) {
  11686. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11687. }
  11688. return $output;
  11689. }
  11690. protected function discardChanges($path)
  11691. {
  11692. $path = $this->normalizePath($path);
  11693. if (0 !== $this->process->execute('git clean -df && git reset --hard', $output, $path)) {
  11694. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  11695. }
  11696. $this->hasDiscardedChanges = true;
  11697. }
  11698. protected function stashChanges($path)
  11699. {
  11700. $path = $this->normalizePath($path);
  11701. if (0 !== $this->process->execute('git stash --include-untracked', $output, $path)) {
  11702. throw new \RuntimeException("Could not stash changes\n\n:".$this->process->getErrorOutput());
  11703. }
  11704. $this->hasStashedChanges = true;
  11705. }
  11706. protected function viewDiff($path)
  11707. {
  11708. $path = $this->normalizePath($path);
  11709. if (0 !== $this->process->execute('git diff HEAD', $output, $path)) {
  11710. throw new \RuntimeException("Could not view diff\n\n:".$this->process->getErrorOutput());
  11711. }
  11712. $this->io->writeError($output);
  11713. }
  11714. protected function normalizePath($path)
  11715. {
  11716. if (Platform::isWindows() && strlen($path) > 0) {
  11717. $basePath = $path;
  11718. $removed = array();
  11719. while (!is_dir($basePath) && $basePath !== '\\') {
  11720. array_unshift($removed, basename($basePath));
  11721. $basePath = dirname($basePath);
  11722. }
  11723. if ($basePath === '\\') {
  11724. return $path;
  11725. }
  11726. $path = rtrim(realpath($basePath) . '/' . implode('/', $removed), '/');
  11727. }
  11728. return $path;
  11729. }
  11730. protected function hasMetadataRepository($path)
  11731. {
  11732. $path = $this->normalizePath($path);
  11733. return is_dir($path.'/.git');
  11734. }
  11735. protected function getShortHash($reference)
  11736. {
  11737. if (!$this->io->isVerbose() && preg_match('{^[0-9a-f]{40}$}', $reference)) {
  11738. return substr($reference, 0, 10);
  11739. }
  11740. return $reference;
  11741. }
  11742. }
  11743. <?php
  11744. namespace Composer\Downloader;
  11745. use Composer\Config;
  11746. use Composer\Cache;
  11747. use Composer\EventDispatcher\EventDispatcher;
  11748. use Composer\Package\PackageInterface;
  11749. use Composer\Util\Platform;
  11750. use Composer\Util\ProcessExecutor;
  11751. use Composer\Util\RemoteFilesystem;
  11752. use Composer\IO\IOInterface;
  11753. class GzipDownloader extends ArchiveDownloader
  11754. {
  11755. protected $process;
  11756. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11757. {
  11758. $this->process = $process ?: new ProcessExecutor($io);
  11759. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11760. }
  11761. protected function extract($file, $path)
  11762. {
  11763. $targetFilepath = $path . DIRECTORY_SEPARATOR . basename(substr($file, 0, -3));
  11764. if (!Platform::isWindows()) {
  11765. $command = 'gzip -cd ' . ProcessExecutor::escape($file) . ' > ' . ProcessExecutor::escape($targetFilepath);
  11766. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11767. return;
  11768. }
  11769. if (extension_loaded('zlib')) {
  11770. $this->extractUsingExt($file, $targetFilepath);
  11771. return;
  11772. }
  11773. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  11774. throw new \RuntimeException($processError);
  11775. }
  11776. $this->extractUsingExt($file, $targetFilepath);
  11777. }
  11778. protected function getFileName(PackageInterface $package, $path)
  11779. {
  11780. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  11781. }
  11782. private function extractUsingExt($file, $targetFilepath)
  11783. {
  11784. $archiveFile = gzopen($file, 'rb');
  11785. $targetFile = fopen($targetFilepath, 'wb');
  11786. while ($string = gzread($archiveFile, 4096)) {
  11787. fwrite($targetFile, $string, Platform::strlen($string));
  11788. }
  11789. gzclose($archiveFile);
  11790. fclose($targetFile);
  11791. }
  11792. }
  11793. <?php
  11794. namespace Composer\Downloader;
  11795. use Composer\Package\PackageInterface;
  11796. use Composer\Util\ProcessExecutor;
  11797. use Composer\Util\Hg as HgUtils;
  11798. class HgDownloader extends VcsDownloader
  11799. {
  11800. public function doDownload(PackageInterface $package, $path, $url)
  11801. {
  11802. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  11803. $cloneCommand = function ($url) use ($path) {
  11804. return sprintf('hg clone %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($path));
  11805. };
  11806. $hgUtils->runCommand($cloneCommand, $url, $path);
  11807. $ref = ProcessExecutor::escape($package->getSourceReference());
  11808. $command = sprintf('hg up %s', $ref);
  11809. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  11810. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11811. }
  11812. }
  11813. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11814. {
  11815. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  11816. $ref = $target->getSourceReference();
  11817. $this->io->writeError(" Updating to ".$target->getSourceReference());
  11818. if (!$this->hasMetadataRepository($path)) {
  11819. throw new \RuntimeException('The .hg directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  11820. }
  11821. $command = function ($url) use ($ref) {
  11822. return sprintf('hg pull %s && hg up %s', ProcessExecutor::escape($url), ProcessExecutor::escape($ref));
  11823. };
  11824. $hgUtils->runCommand($command, $url, $path);
  11825. }
  11826. public function getLocalChanges(PackageInterface $package, $path)
  11827. {
  11828. if (!is_dir($path.'/.hg')) {
  11829. return null;
  11830. }
  11831. $this->process->execute('hg st', $output, realpath($path));
  11832. return trim($output) ?: null;
  11833. }
  11834. protected function getCommitLogs($fromReference, $toReference, $path)
  11835. {
  11836. $command = sprintf('hg log -r %s:%s --style compact', ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
  11837. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  11838. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11839. }
  11840. return $output;
  11841. }
  11842. protected function hasMetadataRepository($path)
  11843. {
  11844. return is_dir($path . '/.hg');
  11845. }
  11846. }
  11847. <?php
  11848. namespace Composer\Downloader;
  11849. use Composer\Package\Archiver\ArchivableFilesFinder;
  11850. use Composer\Package\Dumper\ArrayDumper;
  11851. use Composer\Package\PackageInterface;
  11852. use Composer\Package\Version\VersionGuesser;
  11853. use Composer\Package\Version\VersionParser;
  11854. use Composer\Util\Platform;
  11855. use Composer\Util\ProcessExecutor;
  11856. use Composer\Util\Filesystem as ComposerFilesystem;
  11857. use Symfony\Component\Filesystem\Exception\IOException;
  11858. use Symfony\Component\Filesystem\Filesystem;
  11859. class PathDownloader extends FileDownloader implements VcsCapableDownloaderInterface
  11860. {
  11861. const STRATEGY_SYMLINK = 10;
  11862. const STRATEGY_MIRROR = 20;
  11863. public function download(PackageInterface $package, $path, $output = true)
  11864. {
  11865. $url = $package->getDistUrl();
  11866. $realUrl = realpath($url);
  11867. if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
  11868. throw new \RuntimeException(sprintf(
  11869. 'Source path "%s" is not found for package %s',
  11870. $url,
  11871. $package->getName()
  11872. ));
  11873. }
  11874. if (realpath($path) === $realUrl) {
  11875. if ($output) {
  11876. $this->io->writeError(sprintf(
  11877. ' - Installing <info>%s</info> (<comment>%s</comment>): Source already present',
  11878. $package->getName(),
  11879. $package->getFullPrettyVersion()
  11880. ));
  11881. }
  11882. return;
  11883. }
  11884. if (strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) {
  11885. throw new \RuntimeException(sprintf(
  11886. 'Package %s cannot install to "%s" inside its source at "%s"',
  11887. $package->getName(),
  11888. realpath($path),
  11889. $realUrl
  11890. ));
  11891. }
  11892. $transportOptions = $package->getTransportOptions() + array('symlink' => null, 'relative' => true);
  11893. $currentStrategy = self::STRATEGY_SYMLINK;
  11894. $allowedStrategies = array(self::STRATEGY_SYMLINK, self::STRATEGY_MIRROR);
  11895. $mirrorPathRepos = getenv('COMPOSER_MIRROR_PATH_REPOS');
  11896. if ($mirrorPathRepos) {
  11897. $currentStrategy = self::STRATEGY_MIRROR;
  11898. }
  11899. if (true === $transportOptions['symlink']) {
  11900. $currentStrategy = self::STRATEGY_SYMLINK;
  11901. $allowedStrategies = array(self::STRATEGY_SYMLINK);
  11902. } elseif (false === $transportOptions['symlink']) {
  11903. $currentStrategy = self::STRATEGY_MIRROR;
  11904. $allowedStrategies = array(self::STRATEGY_MIRROR);
  11905. }
  11906. if (Platform::isWindows() && self::STRATEGY_SYMLINK === $currentStrategy && !$this->safeJunctions()) {
  11907. $currentStrategy = self::STRATEGY_MIRROR;
  11908. $allowedStrategies = array(self::STRATEGY_MIRROR);
  11909. }
  11910. $fileSystem = new Filesystem();
  11911. $this->filesystem->removeDirectory($path);
  11912. if ($output) {
  11913. $this->io->writeError(sprintf(
  11914. ' - Installing <info>%s</info> (<comment>%s</comment>): ',
  11915. $package->getName(),
  11916. $package->getFullPrettyVersion()
  11917. ), false);
  11918. }
  11919. $isFallback = false;
  11920. if (self::STRATEGY_SYMLINK == $currentStrategy) {
  11921. try {
  11922. if (Platform::isWindows()) {
  11923. $this->io->writeError(sprintf('Junctioning from %s', $url), false);
  11924. $this->filesystem->junction($realUrl, $path);
  11925. } else {
  11926. $absolutePath = $path;
  11927. if (!$this->filesystem->isAbsolutePath($absolutePath)) {
  11928. $absolutePath = getcwd() . DIRECTORY_SEPARATOR . $path;
  11929. }
  11930. $shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl);
  11931. $path = rtrim($path, "/");
  11932. $this->io->writeError(sprintf('Symlinking from %s', $url), false);
  11933. if ($transportOptions['relative']) {
  11934. $fileSystem->symlink($shortestPath, $path);
  11935. } else {
  11936. $fileSystem->symlink($realUrl, $path);
  11937. }
  11938. }
  11939. } catch (IOException $e) {
  11940. if (in_array(self::STRATEGY_MIRROR, $allowedStrategies)) {
  11941. $this->io->writeError('');
  11942. $this->io->writeError(' <error>Symlink failed, fallback to use mirroring!</error>');
  11943. $currentStrategy = self::STRATEGY_MIRROR;
  11944. $isFallback = true;
  11945. } else {
  11946. throw new \RuntimeException(sprintf('Symlink from "%s" to "%s" failed!', $realUrl, $path));
  11947. }
  11948. }
  11949. }
  11950. if (self::STRATEGY_MIRROR == $currentStrategy) {
  11951. $fs = new ComposerFilesystem();
  11952. $realUrl = $fs->normalizePath($realUrl);
  11953. $this->io->writeError(sprintf('%sMirroring from %s', $isFallback ? ' ' : '', $url), false);
  11954. $iterator = new ArchivableFilesFinder($realUrl, array());
  11955. $fileSystem->mirror($realUrl, $path, $iterator);
  11956. }
  11957. $this->io->writeError('');
  11958. }
  11959. public function remove(PackageInterface $package, $path, $output = true)
  11960. {
  11961. $realUrl = realpath($package->getDistUrl());
  11962. if (realpath($path) === $realUrl) {
  11963. if ($output) {
  11964. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>), source is still present in $path");
  11965. }
  11966. return;
  11967. }
  11968. if (Platform::isWindows() && $this->filesystem->isJunction($path)) {
  11969. if ($output) {
  11970. $this->io->writeError(" - Removing junction for <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  11971. }
  11972. if (!$this->filesystem->removeJunction($path)) {
  11973. $this->io->writeError(" <warning>Could not remove junction at " . $path . " - is another process locking it?</warning>");
  11974. throw new \RuntimeException('Could not reliably remove junction for package ' . $package->getName());
  11975. }
  11976. } else {
  11977. parent::remove($package, $path, $output);
  11978. }
  11979. }
  11980. public function getVcsReference(PackageInterface $package, $path)
  11981. {
  11982. $parser = new VersionParser;
  11983. $guesser = new VersionGuesser($this->config, new ProcessExecutor($this->io), $parser);
  11984. $dumper = new ArrayDumper;
  11985. $packageConfig = $dumper->dump($package);
  11986. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  11987. return $packageVersion['commit'];
  11988. }
  11989. }
  11990. private function safeJunctions()
  11991. {
  11992. return function_exists('proc_open') &&
  11993. (PHP_WINDOWS_VERSION_MAJOR > 6 ||
  11994. (PHP_WINDOWS_VERSION_MAJOR === 6 && PHP_WINDOWS_VERSION_MINOR >= 1));
  11995. }
  11996. }
  11997. <?php
  11998. namespace Composer\Downloader;
  11999. use Composer\Util\Filesystem;
  12000. class PearPackageExtractor
  12001. {
  12002. private static $rolesWithoutPackageNamePrefix = array('php', 'script', 'www');
  12003. private $filesystem;
  12004. private $file;
  12005. public function __construct($file)
  12006. {
  12007. if (!is_file($file)) {
  12008. throw new \UnexpectedValueException('PEAR package file is not found at '.$file);
  12009. }
  12010. $this->filesystem = new Filesystem();
  12011. $this->file = $file;
  12012. }
  12013. public function extractTo($target, array $roles = array('php' => '/', 'script' => '/bin'), $vars = array())
  12014. {
  12015. $extractionPath = $target.'/tarball';
  12016. try {
  12017. $archive = new \PharData($this->file);
  12018. $archive->extractTo($extractionPath, null, true);
  12019. if (!is_file($this->combine($extractionPath, '/package.xml'))) {
  12020. throw new \RuntimeException('Invalid PEAR package. It must contain package.xml file.');
  12021. }
  12022. $fileCopyActions = $this->buildCopyActions($extractionPath, $roles, $vars);
  12023. $this->copyFiles($fileCopyActions, $extractionPath, $target, $roles, $vars);
  12024. $this->filesystem->removeDirectory($extractionPath);
  12025. } catch (\Exception $exception) {
  12026. throw new \UnexpectedValueException(sprintf('Failed to extract PEAR package %s to %s. Reason: %s', $this->file, $target, $exception->getMessage()), 0, $exception);
  12027. }
  12028. }
  12029. private function copyFiles($files, $source, $target, $roles, $vars)
  12030. {
  12031. foreach ($files as $file) {
  12032. $from = $this->combine($source, $file['from']);
  12033. $to = $this->combine($target, $roles[$file['role']]);
  12034. $to = $this->combine($to, $file['to']);
  12035. $tasks = $file['tasks'];
  12036. $this->copyFile($from, $to, $tasks, $vars);
  12037. }
  12038. }
  12039. private function copyFile($from, $to, $tasks, $vars)
  12040. {
  12041. if (!is_file($from)) {
  12042. throw new \RuntimeException('Invalid PEAR package. package.xml defines file that is not located inside tarball.');
  12043. }
  12044. $this->filesystem->ensureDirectoryExists(dirname($to));
  12045. if (0 == count($tasks)) {
  12046. $copied = copy($from, $to);
  12047. } else {
  12048. $content = file_get_contents($from);
  12049. $replacements = array();
  12050. foreach ($tasks as $task) {
  12051. $pattern = $task['from'];
  12052. $varName = $task['to'];
  12053. if (isset($vars[$varName])) {
  12054. if ($varName === 'php_bin' && false === strpos($to, '.bat')) {
  12055. $replacements[$pattern] = preg_replace('{\.bat$}', '', $vars[$varName]);
  12056. } else {
  12057. $replacements[$pattern] = $vars[$varName];
  12058. }
  12059. }
  12060. }
  12061. $content = strtr($content, $replacements);
  12062. $copied = file_put_contents($to, $content);
  12063. }
  12064. if (false === $copied) {
  12065. throw new \RuntimeException(sprintf('Failed to copy %s to %s', $from, $to));
  12066. }
  12067. }
  12068. private function buildCopyActions($source, array $roles, $vars)
  12069. {
  12070. $package = simplexml_load_string(file_get_contents($this->combine($source, 'package.xml')));
  12071. if (false === $package) {
  12072. throw new \RuntimeException('Package definition file is not valid.');
  12073. }
  12074. $packageSchemaVersion = $package['version'];
  12075. if ('1.0' == $packageSchemaVersion) {
  12076. $children = $package->release->filelist->children();
  12077. $packageName = (string) $package->name;
  12078. $packageVersion = (string) $package->release->version;
  12079. $sourceDir = $packageName . '-' . $packageVersion;
  12080. $result = $this->buildSourceList10($children, $roles, $sourceDir, '', null, $packageName);
  12081. } elseif ('2.0' == $packageSchemaVersion || '2.1' == $packageSchemaVersion) {
  12082. $children = $package->contents->children();
  12083. $packageName = (string) $package->name;
  12084. $packageVersion = (string) $package->version->release;
  12085. $sourceDir = $packageName . '-' . $packageVersion;
  12086. $result = $this->buildSourceList20($children, $roles, $sourceDir, '', null, $packageName);
  12087. $namespaces = $package->getNamespaces();
  12088. $package->registerXPathNamespace('ns', $namespaces['']);
  12089. $releaseNodes = $package->xpath('ns:phprelease');
  12090. $this->applyRelease($result, $releaseNodes, $vars);
  12091. } else {
  12092. throw new \RuntimeException('Unsupported schema version of package definition file.');
  12093. }
  12094. return $result;
  12095. }
  12096. private function applyRelease(&$actions, $releaseNodes, $vars)
  12097. {
  12098. foreach ($releaseNodes as $releaseNode) {
  12099. $requiredOs = $releaseNode->installconditions && $releaseNode->installconditions->os && $releaseNode->installconditions->os->name ? (string) $releaseNode->installconditions->os->name : '';
  12100. if ($requiredOs && $vars['os'] != $requiredOs) {
  12101. continue;
  12102. }
  12103. if ($releaseNode->filelist) {
  12104. foreach ($releaseNode->filelist->children() as $action) {
  12105. if ('install' == $action->getName()) {
  12106. $name = (string) $action['name'];
  12107. $as = (string) $action['as'];
  12108. if (isset($actions[$name])) {
  12109. $actions[$name]['to'] = $as;
  12110. }
  12111. } elseif ('ignore' == $action->getName()) {
  12112. $name = (string) $action['name'];
  12113. unset($actions[$name]);
  12114. } else {
  12115. }
  12116. }
  12117. }
  12118. break;
  12119. }
  12120. }
  12121. private function buildSourceList10($children, $targetRoles, $source, $target, $role, $packageName)
  12122. {
  12123. $result = array();
  12124. foreach ($children as $child) {
  12125. if ($child->getName() == 'dir') {
  12126. $dirSource = $this->combine($source, (string) $child['name']);
  12127. $dirTarget = $child['baseinstalldir'] ?: $target;
  12128. $dirRole = $child['role'] ?: $role;
  12129. $dirFiles = $this->buildSourceList10($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  12130. $result = array_merge($result, $dirFiles);
  12131. } elseif ($child->getName() == 'file') {
  12132. $fileRole = (string) $child['role'] ?: $role;
  12133. if (isset($targetRoles[$fileRole])) {
  12134. $fileName = (string) ($child['name'] ?: $child[0]);
  12135. $fileSource = $this->combine($source, $fileName);
  12136. $fileTarget = $this->combine((string) $child['baseinstalldir'] ?: $target, $fileName);
  12137. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  12138. $fileTarget = $packageName . '/' . $fileTarget;
  12139. }
  12140. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => array());
  12141. }
  12142. }
  12143. }
  12144. return $result;
  12145. }
  12146. private function buildSourceList20($children, $targetRoles, $source, $target, $role, $packageName)
  12147. {
  12148. $result = array();
  12149. foreach ($children as $child) {
  12150. if ('dir' == $child->getName()) {
  12151. $dirSource = $this->combine($source, $child['name']);
  12152. $dirTarget = $child['baseinstalldir'] ?: $target;
  12153. $dirRole = $child['role'] ?: $role;
  12154. $dirFiles = $this->buildSourceList20($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  12155. $result = array_merge($result, $dirFiles);
  12156. } elseif ('file' == $child->getName()) {
  12157. $fileRole = (string) $child['role'] ?: $role;
  12158. if (isset($targetRoles[$fileRole])) {
  12159. $fileSource = $this->combine($source, (string) $child['name']);
  12160. $fileTarget = $this->combine((string) ($child['baseinstalldir'] ?: $target), (string) $child['name']);
  12161. $fileTasks = array();
  12162. foreach ($child->children('http://pear.php.net/dtd/tasks-1.0') as $taskNode) {
  12163. if ('replace' == $taskNode->getName()) {
  12164. $fileTasks[] = array('from' => (string) $taskNode->attributes()->from, 'to' => (string) $taskNode->attributes()->to);
  12165. }
  12166. }
  12167. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  12168. $fileTarget = $packageName . '/' . $fileTarget;
  12169. }
  12170. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => $fileTasks);
  12171. }
  12172. }
  12173. }
  12174. return $result;
  12175. }
  12176. private function combine($left, $right)
  12177. {
  12178. return rtrim($left, '/') . '/' . ltrim($right, '/');
  12179. }
  12180. }
  12181. <?php
  12182. namespace Composer\Downloader;
  12183. use Composer\Package\PackageInterface;
  12184. use Composer\Repository\VcsRepository;
  12185. use Composer\Util\Perforce;
  12186. class PerforceDownloader extends VcsDownloader
  12187. {
  12188. protected $perforce;
  12189. public function doDownload(PackageInterface $package, $path, $url)
  12190. {
  12191. $ref = $package->getSourceReference();
  12192. $label = $this->getLabelFromSourceReference($ref);
  12193. $this->io->writeError('Cloning ' . $ref);
  12194. $this->initPerforce($package, $path, $url);
  12195. $this->perforce->setStream($ref);
  12196. $this->perforce->p4Login();
  12197. $this->perforce->writeP4ClientSpec();
  12198. $this->perforce->connectClient();
  12199. $this->perforce->syncCodeBase($label);
  12200. $this->perforce->cleanupClientSpec();
  12201. }
  12202. private function getLabelFromSourceReference($ref)
  12203. {
  12204. $pos = strpos($ref, '@');
  12205. if (false !== $pos) {
  12206. return substr($ref, $pos + 1);
  12207. }
  12208. return null;
  12209. }
  12210. public function initPerforce(PackageInterface $package, $path, $url)
  12211. {
  12212. if (!empty($this->perforce)) {
  12213. $this->perforce->initializePath($path);
  12214. return;
  12215. }
  12216. $repository = $package->getRepository();
  12217. $repoConfig = null;
  12218. if ($repository instanceof VcsRepository) {
  12219. $repoConfig = $this->getRepoConfig($repository);
  12220. }
  12221. $this->perforce = Perforce::create($repoConfig, $url, $path, $this->process, $this->io);
  12222. }
  12223. private function getRepoConfig(VcsRepository $repository)
  12224. {
  12225. return $repository->getRepoConfig();
  12226. }
  12227. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  12228. {
  12229. $this->doDownload($target, $path, $url);
  12230. }
  12231. public function getLocalChanges(PackageInterface $package, $path)
  12232. {
  12233. $this->io->writeError('Perforce driver does not check for local changes before overriding', true);
  12234. }
  12235. protected function getCommitLogs($fromReference, $toReference, $path)
  12236. {
  12237. return $this->perforce->getCommitLogs($fromReference, $toReference);
  12238. }
  12239. public function setPerforce($perforce)
  12240. {
  12241. $this->perforce = $perforce;
  12242. }
  12243. protected function hasMetadataRepository($path)
  12244. {
  12245. return true;
  12246. }
  12247. }
  12248. <?php
  12249. namespace Composer\Downloader;
  12250. class PharDownloader extends ArchiveDownloader
  12251. {
  12252. protected function extract($file, $path)
  12253. {
  12254. $archive = new \Phar($file);
  12255. $archive->extractTo($path, null, true);
  12256. }
  12257. }
  12258. <?php
  12259. namespace Composer\Downloader;
  12260. use Composer\Config;
  12261. use Composer\Cache;
  12262. use Composer\EventDispatcher\EventDispatcher;
  12263. use Composer\Util\IniHelper;
  12264. use Composer\Util\Platform;
  12265. use Composer\Util\ProcessExecutor;
  12266. use Composer\Util\RemoteFilesystem;
  12267. use Composer\IO\IOInterface;
  12268. use RarArchive;
  12269. class RarDownloader extends ArchiveDownloader
  12270. {
  12271. protected $process;
  12272. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  12273. {
  12274. $this->process = $process ?: new ProcessExecutor($io);
  12275. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  12276. }
  12277. protected function extract($file, $path)
  12278. {
  12279. $processError = null;
  12280. if (!Platform::isWindows()) {
  12281. $command = 'unrar x ' . ProcessExecutor::escape($file) . ' ' . ProcessExecutor::escape($path) . ' >/dev/null && chmod -R u+w ' . ProcessExecutor::escape($path);
  12282. if (0 === $this->process->execute($command, $ignoredOutput)) {
  12283. return;
  12284. }
  12285. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  12286. }
  12287. if (!class_exists('RarArchive')) {
  12288. $iniMessage = IniHelper::getMessage();
  12289. $error = "Could not decompress the archive, enable the PHP rar extension or install unrar.\n"
  12290. . $iniMessage . "\n" . $processError;
  12291. if (!Platform::isWindows()) {
  12292. $error = "Could not decompress the archive, enable the PHP rar extension.\n" . $iniMessage;
  12293. }
  12294. throw new \RuntimeException($error);
  12295. }
  12296. $rarArchive = RarArchive::open($file);
  12297. if (false === $rarArchive) {
  12298. throw new \UnexpectedValueException('Could not open RAR archive: ' . $file);
  12299. }
  12300. $entries = $rarArchive->getEntries();
  12301. if (false === $entries) {
  12302. throw new \RuntimeException('Could not retrieve RAR archive entries');
  12303. }
  12304. foreach ($entries as $entry) {
  12305. if (false === $entry->extract($path)) {
  12306. throw new \RuntimeException('Could not extract entry');
  12307. }
  12308. }
  12309. $rarArchive->close();
  12310. }
  12311. }
  12312. <?php
  12313. namespace Composer\Downloader;
  12314. use Composer\Package\PackageInterface;
  12315. use Composer\Util\Svn as SvnUtil;
  12316. use Composer\Repository\VcsRepository;
  12317. use Composer\Util\ProcessExecutor;
  12318. class SvnDownloader extends VcsDownloader
  12319. {
  12320. protected $cacheCredentials = true;
  12321. public function doDownload(PackageInterface $package, $path, $url)
  12322. {
  12323. SvnUtil::cleanEnv();
  12324. $ref = $package->getSourceReference();
  12325. $repo = $package->getRepository();
  12326. if ($repo instanceof VcsRepository) {
  12327. $repoConfig = $repo->getRepoConfig();
  12328. if (array_key_exists('svn-cache-credentials', $repoConfig)) {
  12329. $this->cacheCredentials = (bool) $repoConfig['svn-cache-credentials'];
  12330. }
  12331. }
  12332. $this->io->writeError(" Checking out ".$package->getSourceReference());
  12333. $this->execute($url, "svn co", sprintf("%s/%s", $url, $ref), null, $path);
  12334. }
  12335. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  12336. {
  12337. SvnUtil::cleanEnv();
  12338. $ref = $target->getSourceReference();
  12339. if (!$this->hasMetadataRepository($path)) {
  12340. throw new \RuntimeException('The .svn directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  12341. }
  12342. $util = new SvnUtil($url, $this->io, $this->config);
  12343. $flags = "";
  12344. if (version_compare($util->binaryVersion(), '1.7.0', '>=')) {
  12345. $flags .= ' --ignore-ancestry';
  12346. }
  12347. $this->io->writeError(" Checking out " . $ref);
  12348. $this->execute($url, "svn switch" . $flags, sprintf("%s/%s", $url, $ref), $path);
  12349. }
  12350. public function getLocalChanges(PackageInterface $package, $path)
  12351. {
  12352. if (!$this->hasMetadataRepository($path)) {
  12353. return null;
  12354. }
  12355. $this->process->execute('svn status --ignore-externals', $output, $path);
  12356. return preg_match('{^ *[^X ] +}m', $output) ? $output : null;
  12357. }
  12358. protected function execute($baseUrl, $command, $url, $cwd = null, $path = null)
  12359. {
  12360. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  12361. $util->setCacheCredentials($this->cacheCredentials);
  12362. try {
  12363. return $util->execute($command, $url, $cwd, $path, $this->io->isVerbose());
  12364. } catch (\RuntimeException $e) {
  12365. throw new \RuntimeException(
  12366. 'Package could not be downloaded, '.$e->getMessage()
  12367. );
  12368. }
  12369. }
  12370. protected function cleanChanges(PackageInterface $package, $path, $update)
  12371. {
  12372. if (!$changes = $this->getLocalChanges($package, $path)) {
  12373. return;
  12374. }
  12375. if (!$this->io->isInteractive()) {
  12376. if (true === $this->config->get('discard-changes')) {
  12377. return $this->discardChanges($path);
  12378. }
  12379. return parent::cleanChanges($package, $path, $update);
  12380. }
  12381. $changes = array_map(function ($elem) {
  12382. return ' '.$elem;
  12383. }, preg_split('{\s*\r?\n\s*}', $changes));
  12384. $countChanges = count($changes);
  12385. $this->io->writeError(sprintf(' <error>The package has modified file%s:</error>', $countChanges === 1 ? '' : 's'));
  12386. $this->io->writeError(array_slice($changes, 0, 10));
  12387. if ($countChanges > 10) {
  12388. $remainingChanges = $countChanges - 10;
  12389. $this->io->writeError(
  12390. sprintf(
  12391. ' <info>'.$remainingChanges.' more file%s modified, choose "v" to view the full list</info>',
  12392. $remainingChanges === 1 ? '' : 's'
  12393. )
  12394. );
  12395. }
  12396. while (true) {
  12397. switch ($this->io->ask(' <info>Discard changes [y,n,v,?]?</info> ', '?')) {
  12398. case 'y':
  12399. $this->discardChanges($path);
  12400. break 2;
  12401. case 'n':
  12402. throw new \RuntimeException('Update aborted');
  12403. case 'v':
  12404. $this->io->writeError($changes);
  12405. break;
  12406. case '?':
  12407. default:
  12408. $this->io->writeError(array(
  12409. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  12410. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  12411. ' v - view modified files',
  12412. ' ? - print help',
  12413. ));
  12414. break;
  12415. }
  12416. }
  12417. }
  12418. protected function getCommitLogs($fromReference, $toReference, $path)
  12419. {
  12420. if (preg_match('{.*@(\d+)$}', $fromReference) && preg_match('{.*@(\d+)$}', $toReference)) {
  12421. $command = sprintf('svn info --non-interactive --xml %s', ProcessExecutor::escape($path));
  12422. if (0 !== $this->process->execute($command, $output, $path)) {
  12423. throw new \RuntimeException(
  12424. 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()
  12425. );
  12426. }
  12427. $urlPattern = '#<url>(.*)</url>#';
  12428. if (preg_match($urlPattern, $output, $matches)) {
  12429. $baseUrl = $matches[1];
  12430. } else {
  12431. throw new \RuntimeException(
  12432. 'Unable to determine svn url for path '. $path
  12433. );
  12434. }
  12435. $fromRevision = preg_replace('{.*@(\d+)$}', '$1', $fromReference);
  12436. $toRevision = preg_replace('{.*@(\d+)$}', '$1', $toReference);
  12437. $command = sprintf('svn log -r%s:%s --incremental', ProcessExecutor::escape($fromRevision), ProcessExecutor::escape($toRevision));
  12438. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  12439. $util->setCacheCredentials($this->cacheCredentials);
  12440. try {
  12441. return $util->executeLocal($command, $path, null, $this->io->isVerbose());
  12442. } catch (\RuntimeException $e) {
  12443. throw new \RuntimeException(
  12444. 'Failed to execute ' . $command . "\n\n".$e->getMessage()
  12445. );
  12446. }
  12447. }
  12448. return "Could not retrieve changes between $fromReference and $toReference due to missing revision information";
  12449. }
  12450. protected function discardChanges($path)
  12451. {
  12452. if (0 !== $this->process->execute('svn revert -R .', $output, $path)) {
  12453. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  12454. }
  12455. }
  12456. protected function hasMetadataRepository($path)
  12457. {
  12458. return is_dir($path.'/.svn');
  12459. }
  12460. }
  12461. <?php
  12462. namespace Composer\Downloader;
  12463. class TarDownloader extends ArchiveDownloader
  12464. {
  12465. protected function extract($file, $path)
  12466. {
  12467. $archive = new \PharData($file);
  12468. $archive->extractTo($path, null, true);
  12469. }
  12470. }
  12471. <?php
  12472. namespace Composer\Downloader;
  12473. class TransportException extends \RuntimeException
  12474. {
  12475. protected $headers;
  12476. protected $response;
  12477. protected $statusCode;
  12478. public function setHeaders($headers)
  12479. {
  12480. $this->headers = $headers;
  12481. }
  12482. public function getHeaders()
  12483. {
  12484. return $this->headers;
  12485. }
  12486. public function setResponse($response)
  12487. {
  12488. $this->response = $response;
  12489. }
  12490. public function getResponse()
  12491. {
  12492. return $this->response;
  12493. }
  12494. public function setStatusCode($statusCode)
  12495. {
  12496. $this->statusCode = $statusCode;
  12497. }
  12498. public function getStatusCode()
  12499. {
  12500. return $this->statusCode;
  12501. }
  12502. }
  12503. <?php
  12504. namespace Composer\Downloader;
  12505. use Composer\Package\PackageInterface;
  12506. interface VcsCapableDownloaderInterface
  12507. {
  12508. public function getVcsReference(PackageInterface $package, $path);
  12509. }
  12510. <?php
  12511. namespace Composer\Downloader;
  12512. use Composer\Config;
  12513. use Composer\Package\Dumper\ArrayDumper;
  12514. use Composer\Package\PackageInterface;
  12515. use Composer\Package\Version\VersionGuesser;
  12516. use Composer\Package\Version\VersionParser;
  12517. use Composer\Util\ProcessExecutor;
  12518. use Composer\IO\IOInterface;
  12519. use Composer\Util\Filesystem;
  12520. abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterface, VcsCapableDownloaderInterface
  12521. {
  12522. protected $io;
  12523. protected $config;
  12524. protected $process;
  12525. protected $filesystem;
  12526. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  12527. {
  12528. $this->io = $io;
  12529. $this->config = $config;
  12530. $this->process = $process ?: new ProcessExecutor($io);
  12531. $this->filesystem = $fs ?: new Filesystem($this->process);
  12532. }
  12533. public function getInstallationSource()
  12534. {
  12535. return 'source';
  12536. }
  12537. public function download(PackageInterface $package, $path)
  12538. {
  12539. if (!$package->getSourceReference()) {
  12540. throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
  12541. }
  12542. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  12543. $this->filesystem->emptyDirectory($path);
  12544. $urls = $package->getSourceUrls();
  12545. while ($url = array_shift($urls)) {
  12546. try {
  12547. if (Filesystem::isLocalPath($url)) {
  12548. $needle = 'file://';
  12549. $isFileProtocol = false;
  12550. if (0 === strpos($url, $needle)) {
  12551. $url = substr($url, strlen($needle));
  12552. $isFileProtocol = true;
  12553. }
  12554. if (false !== strpos($url, '%')) {
  12555. $url = rawurldecode($url);
  12556. }
  12557. $url = realpath($url);
  12558. if ($isFileProtocol) {
  12559. $url = $needle . $url;
  12560. }
  12561. }
  12562. $this->doDownload($package, $path, $url);
  12563. break;
  12564. } catch (\Exception $e) {
  12565. if ($e instanceof \PHPUnit_Framework_Exception) {
  12566. throw $e;
  12567. }
  12568. if ($this->io->isDebug()) {
  12569. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getMessage());
  12570. } elseif (count($urls)) {
  12571. $this->io->writeError(' Failed, trying the next URL');
  12572. }
  12573. if (!count($urls)) {
  12574. throw $e;
  12575. }
  12576. }
  12577. }
  12578. }
  12579. public function update(PackageInterface $initial, PackageInterface $target, $path)
  12580. {
  12581. if (!$target->getSourceReference()) {
  12582. throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information');
  12583. }
  12584. $name = $target->getName();
  12585. if ($initial->getPrettyVersion() == $target->getPrettyVersion()) {
  12586. if ($target->getSourceType() === 'svn') {
  12587. $from = $initial->getSourceReference();
  12588. $to = $target->getSourceReference();
  12589. } else {
  12590. $from = substr($initial->getSourceReference(), 0, 7);
  12591. $to = substr($target->getSourceReference(), 0, 7);
  12592. }
  12593. $name .= ' '.$initial->getPrettyVersion();
  12594. } else {
  12595. $from = $initial->getFullPrettyVersion();
  12596. $to = $target->getFullPrettyVersion();
  12597. }
  12598. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  12599. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  12600. $this->cleanChanges($initial, $path, true);
  12601. $urls = $target->getSourceUrls();
  12602. $exception = null;
  12603. while ($url = array_shift($urls)) {
  12604. try {
  12605. if (Filesystem::isLocalPath($url)) {
  12606. $url = realpath($url);
  12607. }
  12608. $this->doUpdate($initial, $target, $path, $url);
  12609. $exception = null;
  12610. break;
  12611. } catch (\Exception $exception) {
  12612. if ($exception instanceof \PHPUnit_Framework_Exception) {
  12613. throw $exception;
  12614. }
  12615. if ($this->io->isDebug()) {
  12616. $this->io->writeError('Failed: ['.get_class($exception).'] '.$exception->getMessage());
  12617. } elseif (count($urls)) {
  12618. $this->io->writeError(' Failed, trying the next URL');
  12619. }
  12620. }
  12621. }
  12622. $this->reapplyChanges($path);
  12623. if (!$exception && $this->io->isVerbose() && $this->hasMetadataRepository($path)) {
  12624. $message = 'Pulling in changes:';
  12625. $logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
  12626. if (!trim($logs)) {
  12627. $message = 'Rolling back changes:';
  12628. $logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
  12629. }
  12630. if (trim($logs)) {
  12631. $logs = implode("\n", array_map(function ($line) {
  12632. return ' ' . $line;
  12633. }, explode("\n", $logs)));
  12634. $logs = str_replace('<', '\<', $logs);
  12635. $this->io->writeError(' '.$message);
  12636. $this->io->writeError($logs);
  12637. }
  12638. }
  12639. if (!$urls && $exception) {
  12640. throw $exception;
  12641. }
  12642. }
  12643. public function remove(PackageInterface $package, $path)
  12644. {
  12645. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
  12646. $this->cleanChanges($package, $path, false);
  12647. if (!$this->filesystem->removeDirectory($path)) {
  12648. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  12649. }
  12650. }
  12651. public function setOutputProgress($outputProgress)
  12652. {
  12653. return $this;
  12654. }
  12655. public function getVcsReference(PackageInterface $package, $path)
  12656. {
  12657. $parser = new VersionParser;
  12658. $guesser = new VersionGuesser($this->config, $this->process, $parser);
  12659. $dumper = new ArrayDumper;
  12660. $packageConfig = $dumper->dump($package);
  12661. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  12662. return $packageVersion['commit'];
  12663. }
  12664. }
  12665. protected function cleanChanges(PackageInterface $package, $path, $update)
  12666. {
  12667. if (null !== $this->getLocalChanges($package, $path)) {
  12668. throw new \RuntimeException('Source directory ' . $path . ' has uncommitted changes.');
  12669. }
  12670. }
  12671. protected function reapplyChanges($path)
  12672. {
  12673. }
  12674. abstract protected function doDownload(PackageInterface $package, $path, $url);
  12675. abstract protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url);
  12676. abstract protected function getCommitLogs($fromReference, $toReference, $path);
  12677. abstract protected function hasMetadataRepository($path);
  12678. }
  12679. <?php
  12680. namespace Composer\Downloader;
  12681. use Composer\Config;
  12682. use Composer\Cache;
  12683. use Composer\EventDispatcher\EventDispatcher;
  12684. use Composer\Package\PackageInterface;
  12685. use Composer\Util\ProcessExecutor;
  12686. use Composer\Util\RemoteFilesystem;
  12687. use Composer\IO\IOInterface;
  12688. class XzDownloader extends ArchiveDownloader
  12689. {
  12690. protected $process;
  12691. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  12692. {
  12693. $this->process = $process ?: new ProcessExecutor($io);
  12694. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  12695. }
  12696. protected function extract($file, $path)
  12697. {
  12698. $command = 'tar -xJf ' . ProcessExecutor::escape($file) . ' -C ' . ProcessExecutor::escape($path);
  12699. if (0 === $this->process->execute($command, $ignoredOutput)) {
  12700. return;
  12701. }
  12702. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  12703. throw new \RuntimeException($processError);
  12704. }
  12705. protected function getFileName(PackageInterface $package, $path)
  12706. {
  12707. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  12708. }
  12709. }
  12710. <?php
  12711. namespace Composer\Downloader;
  12712. use Composer\Config;
  12713. use Composer\Cache;
  12714. use Composer\EventDispatcher\EventDispatcher;
  12715. use Composer\Package\PackageInterface;
  12716. use Composer\Util\IniHelper;
  12717. use Composer\Util\Platform;
  12718. use Composer\Util\ProcessExecutor;
  12719. use Composer\Util\RemoteFilesystem;
  12720. use Composer\IO\IOInterface;
  12721. use Symfony\Component\Process\ExecutableFinder;
  12722. use ZipArchive;
  12723. class ZipDownloader extends ArchiveDownloader
  12724. {
  12725. protected static $hasSystemUnzip;
  12726. private static $hasZipArchive;
  12727. private static $isWindows;
  12728. protected $process;
  12729. private $zipArchiveObject;
  12730. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  12731. {
  12732. $this->process = $process ?: new ProcessExecutor($io);
  12733. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  12734. }
  12735. public function download(PackageInterface $package, $path, $output = true)
  12736. {
  12737. if (null === self::$hasSystemUnzip) {
  12738. $finder = new ExecutableFinder;
  12739. self::$hasSystemUnzip = (bool) $finder->find('unzip');
  12740. }
  12741. if (null === self::$hasZipArchive) {
  12742. self::$hasZipArchive = class_exists('ZipArchive');
  12743. }
  12744. if (!self::$hasZipArchive && !self::$hasSystemUnzip) {
  12745. $iniMessage = IniHelper::getMessage();
  12746. $error = "The zip extension and unzip command are both missing, skipping.\n" . $iniMessage;
  12747. throw new \RuntimeException($error);
  12748. }
  12749. if (null === self::$isWindows) {
  12750. self::$isWindows = Platform::isWindows();
  12751. if (!self::$isWindows && !self::$hasSystemUnzip) {
  12752. $this->io->writeError("<warning>As there is no 'unzip' command installed zip files are being unpacked using the PHP zip extension.</warning>");
  12753. $this->io->writeError("<warning>This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost.</warning>");
  12754. $this->io->writeError("<warning>Installing 'unzip' may remediate them.</warning>");
  12755. }
  12756. }
  12757. return parent::download($package, $path, $output);
  12758. }
  12759. protected function extractWithSystemUnzip($file, $path, $isLastChance)
  12760. {
  12761. if (!self::$hasZipArchive) {
  12762. $isLastChance = true;
  12763. }
  12764. if (!self::$hasSystemUnzip && !$isLastChance) {
  12765. return $this->extractWithZipArchive($file, $path, true);
  12766. }
  12767. $processError = null;
  12768. $overwrite = $isLastChance ? '-o' : '';
  12769. $command = 'unzip -qq '.$overwrite.' '.ProcessExecutor::escape($file).' -d '.ProcessExecutor::escape($path);
  12770. try {
  12771. if (0 === $exitCode = $this->process->execute($command, $ignoredOutput)) {
  12772. return true;
  12773. }
  12774. $processError = new \RuntimeException('Failed to execute ('.$exitCode.') '.$command."\n\n".$this->process->getErrorOutput());
  12775. } catch (\Exception $e) {
  12776. $processError = $e;
  12777. }
  12778. if ($isLastChance) {
  12779. throw $processError;
  12780. }
  12781. $this->io->writeError(' '.$processError->getMessage());
  12782. $this->io->writeError(' The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)');
  12783. $this->io->writeError(' Unzip with unzip command failed, falling back to ZipArchive class');
  12784. return $this->extractWithZipArchive($file, $path, true);
  12785. }
  12786. protected function extractWithZipArchive($file, $path, $isLastChance)
  12787. {
  12788. if (!self::$hasSystemUnzip) {
  12789. $isLastChance = true;
  12790. }
  12791. if (!self::$hasZipArchive && !$isLastChance) {
  12792. return $this->extractWithSystemUnzip($file, $path, true);
  12793. }
  12794. $processError = null;
  12795. $zipArchive = $this->zipArchiveObject ?: new ZipArchive();
  12796. try {
  12797. if (true === ($retval = $zipArchive->open($file))) {
  12798. $extractResult = $zipArchive->extractTo($path);
  12799. if (true === $extractResult) {
  12800. $zipArchive->close();
  12801. return true;
  12802. }
  12803. $processError = new \RuntimeException(rtrim("There was an error extracting the ZIP file, it is either corrupted or using an invalid format.\n"));
  12804. } else {
  12805. $processError = new \UnexpectedValueException(rtrim($this->getErrorMessage($retval, $file)."\n"), $retval);
  12806. }
  12807. } catch (\ErrorException $e) {
  12808. $processError = new \RuntimeException('The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems): '.$e->getMessage(), 0, $e);
  12809. } catch (\Exception $e) {
  12810. $processError = $e;
  12811. }
  12812. if ($isLastChance) {
  12813. throw $processError;
  12814. }
  12815. $this->io->writeError(' '.$processError->getMessage());
  12816. $this->io->writeError(' Unzip with ZipArchive class failed, falling back to unzip command');
  12817. return $this->extractWithSystemUnzip($file, $path, true);
  12818. }
  12819. public function extract($file, $path)
  12820. {
  12821. if (self::$isWindows) {
  12822. $this->extractWithZipArchive($file, $path, false);
  12823. } else {
  12824. $this->extractWithSystemUnzip($file, $path, false);
  12825. }
  12826. }
  12827. protected function getErrorMessage($retval, $file)
  12828. {
  12829. switch ($retval) {
  12830. case ZipArchive::ER_EXISTS:
  12831. return sprintf("File '%s' already exists.", $file);
  12832. case ZipArchive::ER_INCONS:
  12833. return sprintf("Zip archive '%s' is inconsistent.", $file);
  12834. case ZipArchive::ER_INVAL:
  12835. return sprintf("Invalid argument (%s)", $file);
  12836. case ZipArchive::ER_MEMORY:
  12837. return sprintf("Malloc failure (%s)", $file);
  12838. case ZipArchive::ER_NOENT:
  12839. return sprintf("No such zip file: '%s'", $file);
  12840. case ZipArchive::ER_NOZIP:
  12841. return sprintf("'%s' is not a zip archive.", $file);
  12842. case ZipArchive::ER_OPEN:
  12843. return sprintf("Can't open zip file: %s", $file);
  12844. case ZipArchive::ER_READ:
  12845. return sprintf("Zip read error (%s)", $file);
  12846. case ZipArchive::ER_SEEK:
  12847. return sprintf("Zip seek error (%s)", $file);
  12848. default:
  12849. return sprintf("'%s' is not a valid zip archive, got error code: %s", $file, $retval);
  12850. }
  12851. }
  12852. }
  12853. <?php
  12854. namespace Composer\EventDispatcher;
  12855. class Event
  12856. {
  12857. protected $name;
  12858. protected $args;
  12859. protected $flags;
  12860. private $propagationStopped = false;
  12861. public function __construct($name, array $args = array(), array $flags = array())
  12862. {
  12863. $this->name = $name;
  12864. $this->args = $args;
  12865. $this->flags = $flags;
  12866. }
  12867. public function getName()
  12868. {
  12869. return $this->name;
  12870. }
  12871. public function getArguments()
  12872. {
  12873. return $this->args;
  12874. }
  12875. public function getFlags()
  12876. {
  12877. return $this->flags;
  12878. }
  12879. public function isPropagationStopped()
  12880. {
  12881. return $this->propagationStopped;
  12882. }
  12883. public function stopPropagation()
  12884. {
  12885. $this->propagationStopped = true;
  12886. }
  12887. }
  12888. <?php
  12889. namespace Composer\EventDispatcher;
  12890. use Composer\DependencyResolver\PolicyInterface;
  12891. use Composer\DependencyResolver\Pool;
  12892. use Composer\DependencyResolver\Request;
  12893. use Composer\Installer\InstallerEvent;
  12894. use Composer\IO\IOInterface;
  12895. use Composer\Composer;
  12896. use Composer\DependencyResolver\Operation\OperationInterface;
  12897. use Composer\Repository\CompositeRepository;
  12898. use Composer\Script;
  12899. use Composer\Installer\PackageEvent;
  12900. use Composer\Installer\BinaryInstaller;
  12901. use Composer\Util\ProcessExecutor;
  12902. use Composer\Script\Event as ScriptEvent;
  12903. use Symfony\Component\Process\PhpExecutableFinder;
  12904. class EventDispatcher
  12905. {
  12906. protected $composer;
  12907. protected $io;
  12908. protected $loader;
  12909. protected $process;
  12910. protected $listeners;
  12911. private $eventStack;
  12912. public function __construct(Composer $composer, IOInterface $io, ProcessExecutor $process = null)
  12913. {
  12914. $this->composer = $composer;
  12915. $this->io = $io;
  12916. $this->process = $process ?: new ProcessExecutor($io);
  12917. $this->eventStack = array();
  12918. }
  12919. public function dispatch($eventName, Event $event = null)
  12920. {
  12921. if (null === $event) {
  12922. $event = new Event($eventName);
  12923. }
  12924. return $this->doDispatch($event);
  12925. }
  12926. public function dispatchScript($eventName, $devMode = false, $additionalArgs = array(), $flags = array())
  12927. {
  12928. return $this->doDispatch(new Script\Event($eventName, $this->composer, $this->io, $devMode, $additionalArgs, $flags));
  12929. }
  12930. public function dispatchPackageEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  12931. {
  12932. return $this->doDispatch(new PackageEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations, $operation));
  12933. }
  12934. public function dispatchInstallerEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  12935. {
  12936. return $this->doDispatch(new InstallerEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations));
  12937. }
  12938. protected function doDispatch(Event $event)
  12939. {
  12940. $listeners = $this->getListeners($event);
  12941. $this->pushEvent($event);
  12942. $return = 0;
  12943. foreach ($listeners as $callable) {
  12944. $this->ensureBinDirIsInPath();
  12945. if (!is_string($callable)) {
  12946. if (!is_callable($callable)) {
  12947. $className = is_object($callable[0]) ? get_class($callable[0]) : $callable[0];
  12948. throw new \RuntimeException('Subscriber '.$className.'::'.$callable[1].' for event '.$event->getName().' is not callable, make sure the function is defined and public');
  12949. }
  12950. $event = $this->checkListenerExpectedEvent($callable, $event);
  12951. $return = false === call_user_func($callable, $event) ? 1 : 0;
  12952. } elseif ($this->isComposerScript($callable)) {
  12953. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $callable), true, IOInterface::VERBOSE);
  12954. $script = explode(' ', substr($callable, 1));
  12955. $scriptName = $script[0];
  12956. unset($script[0]);
  12957. $args = array_merge($script, $event->getArguments());
  12958. $flags = $event->getFlags();
  12959. if (substr($callable, 0, 10) === '@composer ') {
  12960. $exec = $this->getPhpExecCommand() . ' ' . ProcessExecutor::escape(getenv('COMPOSER_BINARY')) . substr($callable, 9);
  12961. if (0 !== ($exitCode = $this->process->execute($exec))) {
  12962. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12963. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  12964. }
  12965. } else {
  12966. if (!$this->getListeners(new Event($scriptName))) {
  12967. $this->io->writeError(sprintf('<warning>You made a reference to a non-existent script %s</warning>', $callable), true, IOInterface::QUIET);
  12968. }
  12969. try {
  12970. $scriptEvent = new Script\Event($scriptName, $event->getComposer(), $event->getIO(), $event->isDevMode(), $args, $flags);
  12971. $scriptEvent->setOriginatingEvent($event);
  12972. $return = $this->dispatch($scriptName, $scriptEvent);
  12973. } catch (ScriptExecutionException $e) {
  12974. $this->io->writeError(sprintf('<error>Script %s was called via %s</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12975. throw $e;
  12976. }
  12977. }
  12978. } elseif ($this->isPhpScript($callable)) {
  12979. $className = substr($callable, 0, strpos($callable, '::'));
  12980. $methodName = substr($callable, strpos($callable, '::') + 2);
  12981. if (!class_exists($className)) {
  12982. $this->io->writeError('<warning>Class '.$className.' is not autoloadable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  12983. continue;
  12984. }
  12985. if (!is_callable($callable)) {
  12986. $this->io->writeError('<warning>Method '.$callable.' is not callable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  12987. continue;
  12988. }
  12989. try {
  12990. $return = false === $this->executeEventPhpScript($className, $methodName, $event) ? 1 : 0;
  12991. } catch (\Exception $e) {
  12992. $message = "Script %s handling the %s event terminated with an exception";
  12993. $this->io->writeError('<error>'.sprintf($message, $callable, $event->getName()).'</error>', true, IOInterface::QUIET);
  12994. throw $e;
  12995. }
  12996. } else {
  12997. $args = implode(' ', array_map(array('Composer\Util\ProcessExecutor', 'escape'), $event->getArguments()));
  12998. $exec = $callable . ($args === '' ? '' : ' '.$args);
  12999. if ($this->io->isVerbose()) {
  13000. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $exec));
  13001. } else {
  13002. $this->io->writeError(sprintf('> %s', $exec));
  13003. }
  13004. $possibleLocalBinaries = $this->composer->getPackage()->getBinaries();
  13005. if ($possibleLocalBinaries) {
  13006. foreach ($possibleLocalBinaries as $localExec) {
  13007. if (preg_match('{\b'.preg_quote($callable).'$}', $localExec)) {
  13008. $caller = BinaryInstaller::determineBinaryCaller($localExec);
  13009. $exec = preg_replace('{^'.preg_quote($callable).'}', $caller . ' ' . $localExec, $exec);
  13010. break;
  13011. }
  13012. }
  13013. }
  13014. if (substr($exec, 0, 8) === '@putenv ') {
  13015. putenv(substr($exec, 8));
  13016. continue;
  13017. } elseif (substr($exec, 0, 5) === '@php ') {
  13018. $exec = $this->getPhpExecCommand() . ' ' . substr($exec, 5);
  13019. } else {
  13020. $finder = new PhpExecutableFinder();
  13021. $phpPath = $finder->find(false);
  13022. if ($phpPath) {
  13023. $_SERVER['PHP_BINARY'] = $phpPath;
  13024. putenv('PHP_BINARY=' . $_SERVER['PHP_BINARY']);
  13025. }
  13026. }
  13027. if (substr($exec, 0, 9) === 'composer ') {
  13028. $exec = $this->getPhpExecCommand() . ' ' . ProcessExecutor::escape(getenv('COMPOSER_BINARY')) . substr($exec, 8);
  13029. }
  13030. if (0 !== ($exitCode = $this->process->execute($exec))) {
  13031. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  13032. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  13033. }
  13034. }
  13035. if ($event->isPropagationStopped()) {
  13036. break;
  13037. }
  13038. }
  13039. $this->popEvent();
  13040. return $return;
  13041. }
  13042. protected function getPhpExecCommand()
  13043. {
  13044. $finder = new PhpExecutableFinder();
  13045. $phpPath = $finder->find(false);
  13046. if (!$phpPath) {
  13047. throw new \RuntimeException('Failed to locate PHP binary to execute '.$phpPath);
  13048. }
  13049. $phpArgs = $finder->findArguments();
  13050. $phpArgs = $phpArgs ? ' ' . implode(' ', $phpArgs) : '';
  13051. $allowUrlFOpenFlag = ' -d allow_url_fopen=' . ProcessExecutor::escape(ini_get('allow_url_fopen'));
  13052. $disableFunctionsFlag = ' -d disable_functions=' . ProcessExecutor::escape(ini_get('disable_functions'));
  13053. $memoryLimitFlag = ' -d memory_limit=' . ProcessExecutor::escape(ini_get('memory_limit'));
  13054. return ProcessExecutor::escape($phpPath) . $phpArgs . $allowUrlFOpenFlag . $disableFunctionsFlag . $memoryLimitFlag;
  13055. }
  13056. protected function executeEventPhpScript($className, $methodName, Event $event)
  13057. {
  13058. $event = $this->checkListenerExpectedEvent(array($className, $methodName), $event);
  13059. if ($this->io->isVerbose()) {
  13060. $this->io->writeError(sprintf('> %s: %s::%s', $event->getName(), $className, $methodName));
  13061. } else {
  13062. $this->io->writeError(sprintf('> %s::%s', $className, $methodName));
  13063. }
  13064. return $className::$methodName($event);
  13065. }
  13066. protected function checkListenerExpectedEvent($target, Event $event)
  13067. {
  13068. if (in_array($event->getName(), array(
  13069. 'init',
  13070. 'command',
  13071. 'pre-file-download',
  13072. ), true)) {
  13073. return $event;
  13074. }
  13075. try {
  13076. $reflected = new \ReflectionParameter($target, 0);
  13077. } catch (\Exception $e) {
  13078. return $event;
  13079. }
  13080. $expected = null;
  13081. $isClass = false;
  13082. if (\PHP_VERSION_ID >= 70000) {
  13083. $reflectionType = $reflected->getType();
  13084. if ($reflectionType) {
  13085. $expected = $reflectionType instanceof \ReflectionNamedType ? $reflectionType->getName() : (string)$reflectionType;
  13086. $isClass = !$reflectionType->isBuiltin();
  13087. }
  13088. } else {
  13089. $expected = $reflected->getClass() ? $reflected->getClass()->getName() : null;
  13090. $isClass = null !== $expected;
  13091. }
  13092. if (!$isClass) {
  13093. return $event;
  13094. }
  13095. if (!$event instanceof $expected && $expected === 'Composer\Script\CommandEvent') {
  13096. 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);
  13097. $event = new \Composer\Script\CommandEvent(
  13098. $event->getName(),
  13099. $event->getComposer(),
  13100. $event->getIO(),
  13101. $event->isDevMode(),
  13102. $event->getArguments()
  13103. );
  13104. }
  13105. if (!$event instanceof $expected && $expected === 'Composer\Script\PackageEvent') {
  13106. 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);
  13107. $event = new \Composer\Script\PackageEvent(
  13108. $event->getName(),
  13109. $event->getComposer(),
  13110. $event->getIO(),
  13111. $event->isDevMode(),
  13112. $event->getPolicy(),
  13113. $event->getPool(),
  13114. $event->getInstalledRepo(),
  13115. $event->getRequest(),
  13116. $event->getOperations(),
  13117. $event->getOperation()
  13118. );
  13119. }
  13120. if (!$event instanceof $expected && $expected === 'Composer\Script\Event') {
  13121. 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);
  13122. $event = new \Composer\Script\Event(
  13123. $event->getName(),
  13124. $event->getComposer(),
  13125. $event->getIO(),
  13126. $event->isDevMode(),
  13127. $event->getArguments(),
  13128. $event->getFlags()
  13129. );
  13130. }
  13131. return $event;
  13132. }
  13133. private function serializeCallback($cb)
  13134. {
  13135. if (is_array($cb) && count($cb) === 2) {
  13136. if (is_object($cb[0])) {
  13137. $cb[0] = get_class($cb[0]);
  13138. }
  13139. if (is_string($cb[0]) && is_string($cb[1])) {
  13140. $cb = implode('::', $cb);
  13141. }
  13142. }
  13143. if (is_string($cb)) {
  13144. return $cb;
  13145. }
  13146. return var_export($cb, true);
  13147. }
  13148. public function addListener($eventName, $listener, $priority = 0)
  13149. {
  13150. $this->listeners[$eventName][$priority][] = $listener;
  13151. }
  13152. public function addSubscriber(EventSubscriberInterface $subscriber)
  13153. {
  13154. foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
  13155. if (is_string($params)) {
  13156. $this->addListener($eventName, array($subscriber, $params));
  13157. } elseif (is_string($params[0])) {
  13158. $this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0);
  13159. } else {
  13160. foreach ($params as $listener) {
  13161. $this->addListener($eventName, array($subscriber, $listener[0]), isset($listener[1]) ? $listener[1] : 0);
  13162. }
  13163. }
  13164. }
  13165. }
  13166. protected function getListeners(Event $event)
  13167. {
  13168. $scriptListeners = $this->getScriptListeners($event);
  13169. if (!isset($this->listeners[$event->getName()][0])) {
  13170. $this->listeners[$event->getName()][0] = array();
  13171. }
  13172. krsort($this->listeners[$event->getName()]);
  13173. $listeners = $this->listeners;
  13174. $listeners[$event->getName()][0] = array_merge($listeners[$event->getName()][0], $scriptListeners);
  13175. return call_user_func_array('array_merge', $listeners[$event->getName()]);
  13176. }
  13177. public function hasEventListeners(Event $event)
  13178. {
  13179. $listeners = $this->getListeners($event);
  13180. return count($listeners) > 0;
  13181. }
  13182. protected function getScriptListeners(Event $event)
  13183. {
  13184. $package = $this->composer->getPackage();
  13185. $scripts = $package->getScripts();
  13186. if (empty($scripts[$event->getName()])) {
  13187. return array();
  13188. }
  13189. if ($this->loader) {
  13190. $this->loader->unregister();
  13191. }
  13192. $generator = $this->composer->getAutoloadGenerator();
  13193. if ($event instanceof ScriptEvent) {
  13194. $generator->setDevMode($event->isDevMode());
  13195. }
  13196. $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
  13197. $packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
  13198. $map = $generator->parseAutoloads($packageMap, $package);
  13199. $this->loader = $generator->createLoader($map);
  13200. $this->loader->register();
  13201. return $scripts[$event->getName()];
  13202. }
  13203. protected function isPhpScript($callable)
  13204. {
  13205. return false === strpos($callable, ' ') && false !== strpos($callable, '::');
  13206. }
  13207. protected function isComposerScript($callable)
  13208. {
  13209. return '@' === substr($callable, 0, 1) && '@php ' !== substr($callable, 0, 5) && '@putenv ' !== substr($callable, 0, 8);
  13210. }
  13211. protected function pushEvent(Event $event)
  13212. {
  13213. $eventName = $event->getName();
  13214. if (in_array($eventName, $this->eventStack)) {
  13215. throw new \RuntimeException(sprintf("Circular call to script handler '%s' detected", $eventName));
  13216. }
  13217. return array_push($this->eventStack, $eventName);
  13218. }
  13219. protected function popEvent()
  13220. {
  13221. return array_pop($this->eventStack);
  13222. }
  13223. private function ensureBinDirIsInPath()
  13224. {
  13225. $pathStr = 'PATH';
  13226. if (!isset($_SERVER[$pathStr]) && isset($_SERVER['Path'])) {
  13227. $pathStr = 'Path';
  13228. }
  13229. $binDir = $this->composer->getConfig()->get('bin-dir');
  13230. if (is_dir($binDir)) {
  13231. $binDir = realpath($binDir);
  13232. if (isset($_SERVER[$pathStr]) && !preg_match('{(^|'.PATH_SEPARATOR.')'.preg_quote($binDir).'($|'.PATH_SEPARATOR.')}', $_SERVER[$pathStr])) {
  13233. $_SERVER[$pathStr] = $binDir.PATH_SEPARATOR.getenv($pathStr);
  13234. putenv($pathStr.'='.$_SERVER[$pathStr]);
  13235. }
  13236. }
  13237. }
  13238. }
  13239. <?php
  13240. namespace Composer\EventDispatcher;
  13241. interface EventSubscriberInterface
  13242. {
  13243. public static function getSubscribedEvents();
  13244. }
  13245. <?php
  13246. namespace Composer\EventDispatcher;
  13247. class ScriptExecutionException extends \RuntimeException
  13248. {
  13249. }
  13250. <?php
  13251. namespace Composer\Exception;
  13252. class NoSslException extends \RuntimeException
  13253. {
  13254. }
  13255. <?php
  13256. namespace Composer;
  13257. use Composer\Config\JsonConfigSource;
  13258. use Composer\Json\JsonFile;
  13259. use Composer\IO\IOInterface;
  13260. use Composer\Package\Archiver;
  13261. use Composer\Package\Version\VersionGuesser;
  13262. use Composer\Repository\RepositoryManager;
  13263. use Composer\Repository\RepositoryFactory;
  13264. use Composer\Repository\WritableRepositoryInterface;
  13265. use Composer\Util\Filesystem;
  13266. use Composer\Util\Platform;
  13267. use Composer\Util\ProcessExecutor;
  13268. use Composer\Util\RemoteFilesystem;
  13269. use Composer\Util\Silencer;
  13270. use Composer\Plugin\PluginEvents;
  13271. use Composer\EventDispatcher\Event;
  13272. use Seld\JsonLint\DuplicateKeyException;
  13273. use Symfony\Component\Console\Formatter\OutputFormatter;
  13274. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  13275. use Symfony\Component\Console\Output\ConsoleOutput;
  13276. use Composer\EventDispatcher\EventDispatcher;
  13277. use Composer\Autoload\AutoloadGenerator;
  13278. use Composer\Package\Version\VersionParser;
  13279. use Composer\Downloader\TransportException;
  13280. use Seld\JsonLint\JsonParser;
  13281. class Factory
  13282. {
  13283. protected static function getHomeDir()
  13284. {
  13285. $home = getenv('COMPOSER_HOME');
  13286. if ($home) {
  13287. return $home;
  13288. }
  13289. if (Platform::isWindows()) {
  13290. if (!getenv('APPDATA')) {
  13291. throw new \RuntimeException('The APPDATA or COMPOSER_HOME environment variable must be set for composer to run correctly');
  13292. }
  13293. return rtrim(strtr(getenv('APPDATA'), '\\', '/'), '/') . '/Composer';
  13294. }
  13295. $userDir = self::getUserDir();
  13296. if (is_dir($userDir . '/.composer')) {
  13297. return $userDir . '/.composer';
  13298. }
  13299. if (self::useXdg()) {
  13300. $xdgConfig = getenv('XDG_CONFIG_HOME') ?: $userDir . '/.config';
  13301. return $xdgConfig . '/composer';
  13302. }
  13303. return $userDir . '/.composer';
  13304. }
  13305. protected static function getCacheDir($home)
  13306. {
  13307. $cacheDir = getenv('COMPOSER_CACHE_DIR');
  13308. if ($cacheDir) {
  13309. return $cacheDir;
  13310. }
  13311. $homeEnv = getenv('COMPOSER_HOME');
  13312. if ($homeEnv) {
  13313. return $homeEnv . '/cache';
  13314. }
  13315. if (Platform::isWindows()) {
  13316. if ($cacheDir = getenv('LOCALAPPDATA')) {
  13317. $cacheDir .= '/Composer';
  13318. } else {
  13319. $cacheDir = $home . '/cache';
  13320. }
  13321. return rtrim(strtr($cacheDir, '\\', '/'), '/');
  13322. }
  13323. $userDir = self::getUserDir();
  13324. if ($home === $userDir . '/.composer' && is_dir($home . '/cache')) {
  13325. return $home . '/cache';
  13326. }
  13327. if (self::useXdg()) {
  13328. $xdgCache = getenv('XDG_CACHE_HOME') ?: $userDir . '/.cache';
  13329. return $xdgCache . '/composer';
  13330. }
  13331. return $home . '/cache';
  13332. }
  13333. protected static function getDataDir($home)
  13334. {
  13335. $homeEnv = getenv('COMPOSER_HOME');
  13336. if ($homeEnv) {
  13337. return $homeEnv;
  13338. }
  13339. if (Platform::isWindows()) {
  13340. return strtr($home, '\\', '/');
  13341. }
  13342. $userDir = self::getUserDir();
  13343. if ($home !== $userDir . '/.composer' && self::useXdg()) {
  13344. $xdgData = getenv('XDG_DATA_HOME') ?: $userDir . '/.local/share';
  13345. return $xdgData . '/composer';
  13346. }
  13347. return $home;
  13348. }
  13349. public static function createConfig(IOInterface $io = null, $cwd = null)
  13350. {
  13351. $cwd = $cwd ?: getcwd();
  13352. $config = new Config(true, $cwd);
  13353. $home = self::getHomeDir();
  13354. $config->merge(array('config' => array(
  13355. 'home' => $home,
  13356. 'cache-dir' => self::getCacheDir($home),
  13357. 'data-dir' => self::getDataDir($home),
  13358. )));
  13359. $file = new JsonFile($config->get('home').'/config.json');
  13360. if ($file->exists()) {
  13361. if ($io && $io->isDebug()) {
  13362. $io->writeError('Loading config file ' . $file->getPath());
  13363. }
  13364. $config->merge($file->read());
  13365. }
  13366. $config->setConfigSource(new JsonConfigSource($file));
  13367. $htaccessProtect = (bool) $config->get('htaccess-protect');
  13368. if ($htaccessProtect) {
  13369. $dirs = array($config->get('home'), $config->get('cache-dir'), $config->get('data-dir'));
  13370. foreach ($dirs as $dir) {
  13371. if (!file_exists($dir . '/.htaccess')) {
  13372. if (!is_dir($dir)) {
  13373. Silencer::call('mkdir', $dir, 0777, true);
  13374. }
  13375. Silencer::call('file_put_contents', $dir . '/.htaccess', 'Deny from all');
  13376. }
  13377. }
  13378. }
  13379. $file = new JsonFile($config->get('home').'/auth.json');
  13380. if ($file->exists()) {
  13381. if ($io && $io->isDebug()) {
  13382. $io->writeError('Loading config file ' . $file->getPath());
  13383. }
  13384. $config->merge(array('config' => $file->read()));
  13385. }
  13386. $config->setAuthConfigSource(new JsonConfigSource($file, true));
  13387. if ($composerAuthEnv = getenv('COMPOSER_AUTH')) {
  13388. $authData = json_decode($composerAuthEnv, true);
  13389. if (null === $authData) {
  13390. throw new \UnexpectedValueException('COMPOSER_AUTH environment variable is malformed, should be a valid JSON object');
  13391. }
  13392. if ($io && $io->isDebug()) {
  13393. $io->writeError('Loading auth config from COMPOSER_AUTH');
  13394. }
  13395. $config->merge(array('config' => $authData));
  13396. }
  13397. return $config;
  13398. }
  13399. public static function getComposerFile()
  13400. {
  13401. return trim(getenv('COMPOSER')) ?: './composer.json';
  13402. }
  13403. public static function createAdditionalStyles()
  13404. {
  13405. return array(
  13406. 'highlight' => new OutputFormatterStyle('red'),
  13407. 'warning' => new OutputFormatterStyle('black', 'yellow'),
  13408. );
  13409. }
  13410. public static function createOutput()
  13411. {
  13412. $styles = self::createAdditionalStyles();
  13413. $formatter = new OutputFormatter(false, $styles);
  13414. return new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter);
  13415. }
  13416. public static function createDefaultRepositories(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  13417. {
  13418. return RepositoryFactory::defaultRepos($io, $config, $rm);
  13419. }
  13420. public function createComposer(IOInterface $io, $localConfig = null, $disablePlugins = false, $cwd = null, $fullLoad = true)
  13421. {
  13422. $cwd = $cwd ?: getcwd();
  13423. if (null === $localConfig) {
  13424. $localConfig = static::getComposerFile();
  13425. }
  13426. if (is_string($localConfig)) {
  13427. $composerFile = $localConfig;
  13428. $file = new JsonFile($localConfig, null, $io);
  13429. if (!$file->exists()) {
  13430. if ($localConfig === './composer.json' || $localConfig === 'composer.json') {
  13431. $message = 'Composer could not find a composer.json file in '.$cwd;
  13432. } else {
  13433. $message = 'Composer could not find the config file: '.$localConfig;
  13434. }
  13435. $instructions = 'To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section';
  13436. throw new \InvalidArgumentException($message.PHP_EOL.$instructions);
  13437. }
  13438. $file->validateSchema(JsonFile::LAX_SCHEMA);
  13439. $jsonParser = new JsonParser;
  13440. try {
  13441. $jsonParser->parse(file_get_contents($localConfig), JsonParser::DETECT_KEY_CONFLICTS);
  13442. } catch (DuplicateKeyException $e) {
  13443. $details = $e->getDetails();
  13444. $io->writeError('<warning>Key '.$details['key'].' is a duplicate in '.$localConfig.' at line '.$details['line'].'</warning>');
  13445. }
  13446. $localConfig = $file->read();
  13447. }
  13448. $config = static::createConfig($io, $cwd);
  13449. $config->merge($localConfig);
  13450. if (isset($composerFile)) {
  13451. $io->writeError('Loading config file ' . $composerFile, true, IOInterface::DEBUG);
  13452. $config->setConfigSource(new JsonConfigSource(new JsonFile(realpath($composerFile), null, $io)));
  13453. $localAuthFile = new JsonFile(dirname(realpath($composerFile)) . '/auth.json', null, $io);
  13454. if ($localAuthFile->exists()) {
  13455. $io->writeError('Loading config file ' . $localAuthFile->getPath(), true, IOInterface::DEBUG);
  13456. $config->merge(array('config' => $localAuthFile->read()));
  13457. $config->setAuthConfigSource(new JsonConfigSource($localAuthFile, true));
  13458. }
  13459. }
  13460. $vendorDir = $config->get('vendor-dir');
  13461. $composer = new Composer();
  13462. $composer->setConfig($config);
  13463. if ($fullLoad) {
  13464. $io->loadConfiguration($config);
  13465. }
  13466. $rfs = self::createRemoteFilesystem($io, $config);
  13467. $dispatcher = new EventDispatcher($composer, $io);
  13468. $composer->setEventDispatcher($dispatcher);
  13469. $rm = RepositoryFactory::manager($io, $config, $dispatcher, $rfs);
  13470. $composer->setRepositoryManager($rm);
  13471. $this->addLocalRepository($io, $rm, $vendorDir);
  13472. if (!$fullLoad && !isset($localConfig['version'])) {
  13473. $localConfig['version'] = '1.0.0';
  13474. }
  13475. $parser = new VersionParser;
  13476. $guesser = new VersionGuesser($config, new ProcessExecutor($io), $parser);
  13477. $loader = new Package\Loader\RootPackageLoader($rm, $config, $parser, $guesser, $io);
  13478. $package = $loader->load($localConfig, 'Composer\Package\RootPackage', $cwd);
  13479. $composer->setPackage($package);
  13480. $im = $this->createInstallationManager();
  13481. $composer->setInstallationManager($im);
  13482. if ($fullLoad) {
  13483. $dm = $this->createDownloadManager($io, $config, $dispatcher, $rfs);
  13484. $composer->setDownloadManager($dm);
  13485. $generator = new AutoloadGenerator($dispatcher, $io);
  13486. $composer->setAutoloadGenerator($generator);
  13487. $am = $this->createArchiveManager($config, $dm);
  13488. $composer->setArchiveManager($am);
  13489. }
  13490. $this->createDefaultInstallers($im, $composer, $io);
  13491. if ($fullLoad) {
  13492. $globalComposer = null;
  13493. if (realpath($config->get('home')) !== $cwd) {
  13494. $globalComposer = $this->createGlobalComposer($io, $config, $disablePlugins);
  13495. }
  13496. $pm = $this->createPluginManager($io, $composer, $globalComposer, $disablePlugins);
  13497. $composer->setPluginManager($pm);
  13498. $pm->loadInstalledPlugins();
  13499. }
  13500. if ($fullLoad && isset($composerFile)) {
  13501. $lockFile = "json" === pathinfo($composerFile, PATHINFO_EXTENSION)
  13502. ? substr($composerFile, 0, -4).'lock'
  13503. : $composerFile . '.lock';
  13504. $locker = new Package\Locker($io, new JsonFile($lockFile, null, $io), $rm, $im, file_get_contents($composerFile));
  13505. $composer->setLocker($locker);
  13506. }
  13507. if ($fullLoad) {
  13508. $initEvent = new Event(PluginEvents::INIT);
  13509. $composer->getEventDispatcher()->dispatch($initEvent->getName(), $initEvent);
  13510. if ($rm->getLocalRepository()) {
  13511. $this->purgePackages($rm->getLocalRepository(), $im);
  13512. }
  13513. }
  13514. return $composer;
  13515. }
  13516. public static function createGlobal(IOInterface $io, $disablePlugins = false)
  13517. {
  13518. $factory = new static();
  13519. return $factory->createGlobalComposer($io, static::createConfig($io), $disablePlugins, true);
  13520. }
  13521. protected function addLocalRepository(IOInterface $io, RepositoryManager $rm, $vendorDir)
  13522. {
  13523. $rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed.json', null, $io)));
  13524. }
  13525. protected function createGlobalComposer(IOInterface $io, Config $config, $disablePlugins, $fullLoad = false)
  13526. {
  13527. $composer = null;
  13528. try {
  13529. $composer = $this->createComposer($io, $config->get('home') . '/composer.json', $disablePlugins, $config->get('home'), $fullLoad);
  13530. } catch (\Exception $e) {
  13531. $io->writeError('Failed to initialize global composer: '.$e->getMessage(), true, IOInterface::DEBUG);
  13532. }
  13533. return $composer;
  13534. }
  13535. public function createDownloadManager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  13536. {
  13537. $cache = null;
  13538. if ($config->get('cache-files-ttl') > 0) {
  13539. $cache = new Cache($io, $config->get('cache-files-dir'), 'a-z0-9_./');
  13540. }
  13541. $dm = new Downloader\DownloadManager($io);
  13542. switch ($preferred = $config->get('preferred-install')) {
  13543. case 'dist':
  13544. $dm->setPreferDist(true);
  13545. break;
  13546. case 'source':
  13547. $dm->setPreferSource(true);
  13548. break;
  13549. case 'auto':
  13550. default:
  13551. break;
  13552. }
  13553. if (is_array($preferred)) {
  13554. $dm->setPreferences($preferred);
  13555. }
  13556. $executor = new ProcessExecutor($io);
  13557. $fs = new Filesystem($executor);
  13558. $dm->setDownloader('git', new Downloader\GitDownloader($io, $config, $executor, $fs));
  13559. $dm->setDownloader('svn', new Downloader\SvnDownloader($io, $config, $executor, $fs));
  13560. $dm->setDownloader('fossil', new Downloader\FossilDownloader($io, $config, $executor, $fs));
  13561. $dm->setDownloader('hg', new Downloader\HgDownloader($io, $config, $executor, $fs));
  13562. $dm->setDownloader('perforce', new Downloader\PerforceDownloader($io, $config));
  13563. $dm->setDownloader('zip', new Downloader\ZipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  13564. $dm->setDownloader('rar', new Downloader\RarDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  13565. $dm->setDownloader('tar', new Downloader\TarDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  13566. $dm->setDownloader('gzip', new Downloader\GzipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  13567. $dm->setDownloader('xz', new Downloader\XzDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  13568. $dm->setDownloader('phar', new Downloader\PharDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  13569. $dm->setDownloader('file', new Downloader\FileDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  13570. $dm->setDownloader('path', new Downloader\PathDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  13571. return $dm;
  13572. }
  13573. public function createArchiveManager(Config $config, Downloader\DownloadManager $dm = null)
  13574. {
  13575. if (null === $dm) {
  13576. $io = new IO\NullIO();
  13577. $io->loadConfiguration($config);
  13578. $dm = $this->createDownloadManager($io, $config);
  13579. }
  13580. $am = new Archiver\ArchiveManager($dm);
  13581. $am->addArchiver(new Archiver\ZipArchiver);
  13582. $am->addArchiver(new Archiver\PharArchiver);
  13583. return $am;
  13584. }
  13585. protected function createPluginManager(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  13586. {
  13587. return new Plugin\PluginManager($io, $composer, $globalComposer, $disablePlugins);
  13588. }
  13589. protected function createInstallationManager()
  13590. {
  13591. return new Installer\InstallationManager();
  13592. }
  13593. protected function createDefaultInstallers(Installer\InstallationManager $im, Composer $composer, IOInterface $io)
  13594. {
  13595. $im->addInstaller(new Installer\LibraryInstaller($io, $composer, null));
  13596. $im->addInstaller(new Installer\PearInstaller($io, $composer, 'pear-library'));
  13597. $im->addInstaller(new Installer\PluginInstaller($io, $composer));
  13598. $im->addInstaller(new Installer\MetapackageInstaller($io));
  13599. }
  13600. protected function purgePackages(WritableRepositoryInterface $repo, Installer\InstallationManager $im)
  13601. {
  13602. foreach ($repo->getPackages() as $package) {
  13603. if (!$im->isPackageInstalled($repo, $package)) {
  13604. $repo->removePackage($package);
  13605. }
  13606. }
  13607. }
  13608. public static function create(IOInterface $io, $config = null, $disablePlugins = false)
  13609. {
  13610. $factory = new static();
  13611. return $factory->createComposer($io, $config, $disablePlugins);
  13612. }
  13613. public static function createRemoteFilesystem(IOInterface $io, Config $config = null, $options = array())
  13614. {
  13615. static $warned = false;
  13616. $disableTls = false;
  13617. if ($config && $config->get('disable-tls') === true) {
  13618. if (!$warned) {
  13619. $io->writeError('<warning>You are running Composer with SSL/TLS protection disabled.</warning>');
  13620. }
  13621. $warned = true;
  13622. $disableTls = true;
  13623. } elseif (!extension_loaded('openssl')) {
  13624. throw new Exception\NoSslException('The openssl extension is required for SSL/TLS protection but is not available. '
  13625. . '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.');
  13626. }
  13627. $remoteFilesystemOptions = array();
  13628. if ($disableTls === false) {
  13629. if ($config && $config->get('cafile')) {
  13630. $remoteFilesystemOptions['ssl']['cafile'] = $config->get('cafile');
  13631. }
  13632. if ($config && $config->get('capath')) {
  13633. $remoteFilesystemOptions['ssl']['capath'] = $config->get('capath');
  13634. }
  13635. $remoteFilesystemOptions = array_replace_recursive($remoteFilesystemOptions, $options);
  13636. }
  13637. try {
  13638. $remoteFilesystem = new RemoteFilesystem($io, $config, $remoteFilesystemOptions, $disableTls);
  13639. } catch (TransportException $e) {
  13640. if (false !== strpos($e->getMessage(), 'cafile')) {
  13641. $io->write('<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>');
  13642. $io->write('<error>A valid CA certificate file is required for SSL/TLS protection.</error>');
  13643. if (PHP_VERSION_ID < 50600) {
  13644. $io->write('<error>It is recommended you upgrade to PHP 5.6+ which can detect your system CA file automatically.</error>');
  13645. }
  13646. $io->write('<error>You can disable this error, at your own risk, by setting the \'disable-tls\' option to true.</error>');
  13647. }
  13648. throw $e;
  13649. }
  13650. return $remoteFilesystem;
  13651. }
  13652. private static function useXdg()
  13653. {
  13654. foreach (array_keys($_SERVER) as $key) {
  13655. if (substr($key, 0, 4) === 'XDG_') {
  13656. return true;
  13657. }
  13658. }
  13659. return false;
  13660. }
  13661. private static function getUserDir()
  13662. {
  13663. $home = getenv('HOME');
  13664. if (!$home) {
  13665. throw new \RuntimeException('The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly');
  13666. }
  13667. return rtrim(strtr($home, '\\', '/'), '/');
  13668. }
  13669. }
  13670. <?php
  13671. namespace Composer\IO;
  13672. use Composer\Config;
  13673. use Composer\Util\ProcessExecutor;
  13674. use Psr\Log\LoggerInterface;
  13675. use Psr\Log\LogLevel;
  13676. abstract class BaseIO implements IOInterface, LoggerInterface
  13677. {
  13678. protected $authentications = array();
  13679. public function getAuthentications()
  13680. {
  13681. return $this->authentications;
  13682. }
  13683. public function resetAuthentications()
  13684. {
  13685. $this->authentications = array();
  13686. }
  13687. public function hasAuthentication($repositoryName)
  13688. {
  13689. return isset($this->authentications[$repositoryName]);
  13690. }
  13691. public function getAuthentication($repositoryName)
  13692. {
  13693. if (isset($this->authentications[$repositoryName])) {
  13694. return $this->authentications[$repositoryName];
  13695. }
  13696. return array('username' => null, 'password' => null);
  13697. }
  13698. public function setAuthentication($repositoryName, $username, $password = null)
  13699. {
  13700. $this->authentications[$repositoryName] = array('username' => $username, 'password' => $password);
  13701. }
  13702. public function writeRaw($messages, $newline = true, $verbosity = self::NORMAL)
  13703. {
  13704. $this->write($messages, $newline, $verbosity);
  13705. }
  13706. public function writeErrorRaw($messages, $newline = true, $verbosity = self::NORMAL)
  13707. {
  13708. $this->writeError($messages, $newline, $verbosity);
  13709. }
  13710. protected function checkAndSetAuthentication($repositoryName, $username, $password = null)
  13711. {
  13712. if ($this->hasAuthentication($repositoryName)) {
  13713. $auth = $this->getAuthentication($repositoryName);
  13714. if ($auth['username'] === $username && $auth['password'] === $password) {
  13715. return;
  13716. }
  13717. $this->writeError(
  13718. sprintf(
  13719. "<warning>Warning: You should avoid overwriting already defined auth settings for %s.</warning>",
  13720. $repositoryName
  13721. )
  13722. );
  13723. }
  13724. $this->setAuthentication($repositoryName, $username, $password);
  13725. }
  13726. public function loadConfiguration(Config $config)
  13727. {
  13728. $bitbucketOauth = $config->get('bitbucket-oauth') ?: array();
  13729. $githubOauth = $config->get('github-oauth') ?: array();
  13730. $gitlabOauth = $config->get('gitlab-oauth') ?: array();
  13731. $gitlabToken = $config->get('gitlab-token') ?: array();
  13732. $httpBasic = $config->get('http-basic') ?: array();
  13733. $bearerToken = $config->get('bearer') ?: array();
  13734. foreach ($bitbucketOauth as $domain => $cred) {
  13735. $this->checkAndSetAuthentication($domain, $cred['consumer-key'], $cred['consumer-secret']);
  13736. }
  13737. foreach ($githubOauth as $domain => $token) {
  13738. if (!preg_match('{^[.a-z0-9]+$}', $token)) {
  13739. throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
  13740. }
  13741. $this->checkAndSetAuthentication($domain, $token, 'x-oauth-basic');
  13742. }
  13743. foreach ($gitlabOauth as $domain => $token) {
  13744. $this->checkAndSetAuthentication($domain, $token, 'oauth2');
  13745. }
  13746. foreach ($gitlabToken as $domain => $token) {
  13747. $this->checkAndSetAuthentication($domain, $token, 'private-token');
  13748. }
  13749. foreach ($httpBasic as $domain => $cred) {
  13750. $this->checkAndSetAuthentication($domain, $cred['username'], $cred['password']);
  13751. }
  13752. foreach ($bearerToken as $domain => $token) {
  13753. $this->checkAndSetAuthentication($domain, $token, 'bearer');
  13754. }
  13755. ProcessExecutor::setTimeout((int) $config->get('process-timeout'));
  13756. }
  13757. public function emergency($message, array $context = array())
  13758. {
  13759. return $this->log(LogLevel::EMERGENCY, $message, $context);
  13760. }
  13761. public function alert($message, array $context = array())
  13762. {
  13763. return $this->log(LogLevel::ALERT, $message, $context);
  13764. }
  13765. public function critical($message, array $context = array())
  13766. {
  13767. return $this->log(LogLevel::CRITICAL, $message, $context);
  13768. }
  13769. public function error($message, array $context = array())
  13770. {
  13771. return $this->log(LogLevel::ERROR, $message, $context);
  13772. }
  13773. public function warning($message, array $context = array())
  13774. {
  13775. return $this->log(LogLevel::WARNING, $message, $context);
  13776. }
  13777. public function notice($message, array $context = array())
  13778. {
  13779. return $this->log(LogLevel::NOTICE, $message, $context);
  13780. }
  13781. public function info($message, array $context = array())
  13782. {
  13783. return $this->log(LogLevel::INFO, $message, $context);
  13784. }
  13785. public function debug($message, array $context = array())
  13786. {
  13787. return $this->log(LogLevel::DEBUG, $message, $context);
  13788. }
  13789. public function log($level, $message, array $context = array())
  13790. {
  13791. if (in_array($level, array(LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR))) {
  13792. $this->writeError('<error>'.$message.'</error>', true, self::NORMAL);
  13793. } elseif ($level === LogLevel::WARNING) {
  13794. $this->writeError('<warning>'.$message.'</warning>', true, self::NORMAL);
  13795. } elseif ($level === LogLevel::NOTICE) {
  13796. $this->writeError('<info>'.$message.'</info>', true, self::VERBOSE);
  13797. } elseif ($level === LogLevel::INFO) {
  13798. $this->writeError('<info>'.$message.'</info>', true, self::VERY_VERBOSE);
  13799. } else {
  13800. $this->writeError($message, true, self::DEBUG);
  13801. }
  13802. }
  13803. }
  13804. <?php
  13805. namespace Composer\IO;
  13806. use Symfony\Component\Console\Helper\QuestionHelper;
  13807. use Symfony\Component\Console\Output\StreamOutput;
  13808. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  13809. use Symfony\Component\Console\Input\StreamableInputInterface;
  13810. use Symfony\Component\Console\Input\StringInput;
  13811. use Symfony\Component\Console\Helper\HelperSet;
  13812. class BufferIO extends ConsoleIO
  13813. {
  13814. public function __construct($input = '', $verbosity = StreamOutput::VERBOSITY_NORMAL, OutputFormatterInterface $formatter = null)
  13815. {
  13816. $input = new StringInput($input);
  13817. $input->setInteractive(false);
  13818. $output = new StreamOutput(fopen('php://memory', 'rw'), $verbosity, $formatter ? $formatter->isDecorated() : false, $formatter);
  13819. parent::__construct($input, $output, new HelperSet(array(
  13820. new QuestionHelper(),
  13821. )));
  13822. }
  13823. public function getOutput()
  13824. {
  13825. fseek($this->output->getStream(), 0);
  13826. $output = stream_get_contents($this->output->getStream());
  13827. $output = preg_replace_callback("{(?<=^|\n|\x08)(.+?)(\x08+)}", function ($matches) {
  13828. $pre = strip_tags($matches[1]);
  13829. if (strlen($pre) === strlen($matches[2])) {
  13830. return '';
  13831. }
  13832. return rtrim($matches[1])."\n";
  13833. }, $output);
  13834. return $output;
  13835. }
  13836. public function setUserInputs(array $inputs)
  13837. {
  13838. if (!$this->input instanceof StreamableInputInterface) {
  13839. throw new \RuntimeException('Setting the user inputs requires at least the version 3.2 of the symfony/console component.');
  13840. }
  13841. $this->input->setStream($this->createStream($inputs));
  13842. $this->input->setInteractive(true);
  13843. }
  13844. private function createStream(array $inputs)
  13845. {
  13846. $stream = fopen('php://memory', 'r+', false);
  13847. foreach ($inputs as $input) {
  13848. fwrite($stream, $input.PHP_EOL);
  13849. }
  13850. rewind($stream);
  13851. return $stream;
  13852. }
  13853. }
  13854. <?php
  13855. namespace Composer\IO;
  13856. use Composer\Question\StrictConfirmationQuestion;
  13857. use Symfony\Component\Console\Helper\HelperSet;
  13858. use Symfony\Component\Console\Input\InputInterface;
  13859. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  13860. use Symfony\Component\Console\Output\OutputInterface;
  13861. use Symfony\Component\Console\Question\ChoiceQuestion;
  13862. use Symfony\Component\Console\Question\Question;
  13863. class ConsoleIO extends BaseIO
  13864. {
  13865. protected $input;
  13866. protected $output;
  13867. protected $helperSet;
  13868. protected $lastMessage;
  13869. protected $lastMessageErr;
  13870. private $startTime;
  13871. private $verbosityMap;
  13872. public function __construct(InputInterface $input, OutputInterface $output, HelperSet $helperSet)
  13873. {
  13874. $this->input = $input;
  13875. $this->output = $output;
  13876. $this->helperSet = $helperSet;
  13877. $this->verbosityMap = array(
  13878. self::QUIET => OutputInterface::VERBOSITY_QUIET,
  13879. self::NORMAL => OutputInterface::VERBOSITY_NORMAL,
  13880. self::VERBOSE => OutputInterface::VERBOSITY_VERBOSE,
  13881. self::VERY_VERBOSE => OutputInterface::VERBOSITY_VERY_VERBOSE,
  13882. self::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  13883. );
  13884. }
  13885. public function enableDebugging($startTime)
  13886. {
  13887. $this->startTime = $startTime;
  13888. }
  13889. public function isInteractive()
  13890. {
  13891. return $this->input->isInteractive();
  13892. }
  13893. public function isDecorated()
  13894. {
  13895. return $this->output->isDecorated();
  13896. }
  13897. public function isVerbose()
  13898. {
  13899. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE;
  13900. }
  13901. public function isVeryVerbose()
  13902. {
  13903. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE;
  13904. }
  13905. public function isDebug()
  13906. {
  13907. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG;
  13908. }
  13909. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  13910. {
  13911. $this->doWrite($messages, $newline, false, $verbosity);
  13912. }
  13913. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  13914. {
  13915. $this->doWrite($messages, $newline, true, $verbosity);
  13916. }
  13917. public function writeRaw($messages, $newline = true, $verbosity = self::NORMAL)
  13918. {
  13919. $this->doWrite($messages, $newline, false, $verbosity, true);
  13920. }
  13921. public function writeErrorRaw($messages, $newline = true, $verbosity = self::NORMAL)
  13922. {
  13923. $this->doWrite($messages, $newline, true, $verbosity, true);
  13924. }
  13925. private function doWrite($messages, $newline, $stderr, $verbosity, $raw = false)
  13926. {
  13927. $sfVerbosity = $this->verbosityMap[$verbosity];
  13928. if ($sfVerbosity > $this->output->getVerbosity()) {
  13929. return;
  13930. }
  13931. if (OutputInterface::VERBOSITY_QUIET === 0) {
  13932. $sfVerbosity = OutputInterface::OUTPUT_NORMAL;
  13933. }
  13934. if ($raw) {
  13935. if ($sfVerbosity === OutputInterface::OUTPUT_NORMAL) {
  13936. $sfVerbosity = OutputInterface::OUTPUT_RAW;
  13937. } else {
  13938. $sfVerbosity |= OutputInterface::OUTPUT_RAW;
  13939. }
  13940. }
  13941. if (null !== $this->startTime) {
  13942. $memoryUsage = memory_get_usage() / 1024 / 1024;
  13943. $timeSpent = microtime(true) - $this->startTime;
  13944. $messages = array_map(function ($message) use ($memoryUsage, $timeSpent) {
  13945. return sprintf('[%.1fMiB/%.2fs] %s', $memoryUsage, $timeSpent, $message);
  13946. }, (array) $messages);
  13947. }
  13948. if (true === $stderr && $this->output instanceof ConsoleOutputInterface) {
  13949. $this->output->getErrorOutput()->write($messages, $newline, $sfVerbosity);
  13950. $this->lastMessageErr = implode($newline ? "\n" : '', (array) $messages);
  13951. return;
  13952. }
  13953. $this->output->write($messages, $newline, $sfVerbosity);
  13954. $this->lastMessage = implode($newline ? "\n" : '', (array) $messages);
  13955. }
  13956. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  13957. {
  13958. $this->doOverwrite($messages, $newline, $size, false, $verbosity);
  13959. }
  13960. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  13961. {
  13962. $this->doOverwrite($messages, $newline, $size, true, $verbosity);
  13963. }
  13964. private function doOverwrite($messages, $newline, $size, $stderr, $verbosity)
  13965. {
  13966. $messages = implode($newline ? "\n" : '', (array) $messages);
  13967. if (!isset($size)) {
  13968. $size = strlen(strip_tags($stderr ? $this->lastMessageErr : $this->lastMessage));
  13969. }
  13970. $this->doWrite(str_repeat("\x08", $size), false, $stderr, $verbosity);
  13971. $this->doWrite($messages, false, $stderr, $verbosity);
  13972. $fill = $size - strlen(strip_tags($messages));
  13973. if ($fill > 0) {
  13974. $this->doWrite(str_repeat(' ', $fill), false, $stderr, $verbosity);
  13975. $this->doWrite(str_repeat("\x08", $fill), false, $stderr, $verbosity);
  13976. }
  13977. if ($newline) {
  13978. $this->doWrite('', true, $stderr, $verbosity);
  13979. }
  13980. if ($stderr) {
  13981. $this->lastMessageErr = $messages;
  13982. } else {
  13983. $this->lastMessage = $messages;
  13984. }
  13985. }
  13986. public function ask($question, $default = null)
  13987. {
  13988. $helper = $this->helperSet->get('question');
  13989. $question = new Question($question, $default);
  13990. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13991. }
  13992. public function askConfirmation($question, $default = true)
  13993. {
  13994. $helper = $this->helperSet->get('question');
  13995. $question = new StrictConfirmationQuestion($question, $default);
  13996. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13997. }
  13998. public function askAndValidate($question, $validator, $attempts = null, $default = null)
  13999. {
  14000. $helper = $this->helperSet->get('question');
  14001. $question = new Question($question, $default);
  14002. $question->setValidator($validator);
  14003. $question->setMaxAttempts($attempts);
  14004. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  14005. }
  14006. public function askAndHideAnswer($question)
  14007. {
  14008. $helper = $this->helperSet->get('question');
  14009. $question = new Question($question);
  14010. $question->setHidden(true);
  14011. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  14012. }
  14013. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  14014. {
  14015. $helper = $this->helperSet->get('question');
  14016. $question = new ChoiceQuestion($question, $choices, $default);
  14017. $question->setMaxAttempts($attempts ?: null);
  14018. $question->setErrorMessage($errorMessage);
  14019. $question->setMultiselect($multiselect);
  14020. $result = $helper->ask($this->input, $this->getErrorOutput(), $question);
  14021. if (!is_array($result)) {
  14022. return (string) array_search($result, $choices, true);
  14023. }
  14024. $results = array();
  14025. foreach ($choices as $index => $choice) {
  14026. if (in_array($choice, $result, true)) {
  14027. $results[] = (string) $index;
  14028. }
  14029. }
  14030. return $results;
  14031. }
  14032. private function getErrorOutput()
  14033. {
  14034. if ($this->output instanceof ConsoleOutputInterface) {
  14035. return $this->output->getErrorOutput();
  14036. }
  14037. return $this->output;
  14038. }
  14039. }
  14040. <?php
  14041. namespace Composer\IO;
  14042. use Composer\Config;
  14043. interface IOInterface
  14044. {
  14045. const QUIET = 1;
  14046. const NORMAL = 2;
  14047. const VERBOSE = 4;
  14048. const VERY_VERBOSE = 8;
  14049. const DEBUG = 16;
  14050. public function isInteractive();
  14051. public function isVerbose();
  14052. public function isVeryVerbose();
  14053. public function isDebug();
  14054. public function isDecorated();
  14055. public function write($messages, $newline = true, $verbosity = self::NORMAL);
  14056. public function writeError($messages, $newline = true, $verbosity = self::NORMAL);
  14057. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  14058. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  14059. public function ask($question, $default = null);
  14060. public function askConfirmation($question, $default = true);
  14061. public function askAndValidate($question, $validator, $attempts = null, $default = null);
  14062. public function askAndHideAnswer($question);
  14063. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false);
  14064. public function getAuthentications();
  14065. public function hasAuthentication($repositoryName);
  14066. public function getAuthentication($repositoryName);
  14067. public function setAuthentication($repositoryName, $username, $password = null);
  14068. public function loadConfiguration(Config $config);
  14069. }
  14070. <?php
  14071. namespace Composer\IO;
  14072. class NullIO extends BaseIO
  14073. {
  14074. public function isInteractive()
  14075. {
  14076. return false;
  14077. }
  14078. public function isVerbose()
  14079. {
  14080. return false;
  14081. }
  14082. public function isVeryVerbose()
  14083. {
  14084. return false;
  14085. }
  14086. public function isDebug()
  14087. {
  14088. return false;
  14089. }
  14090. public function isDecorated()
  14091. {
  14092. return false;
  14093. }
  14094. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  14095. {
  14096. }
  14097. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  14098. {
  14099. }
  14100. public function overwrite($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  14101. {
  14102. }
  14103. public function overwriteError($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  14104. {
  14105. }
  14106. public function ask($question, $default = null)
  14107. {
  14108. return $default;
  14109. }
  14110. public function askConfirmation($question, $default = true)
  14111. {
  14112. return $default;
  14113. }
  14114. public function askAndValidate($question, $validator, $attempts = false, $default = null)
  14115. {
  14116. return $default;
  14117. }
  14118. public function askAndHideAnswer($question)
  14119. {
  14120. return null;
  14121. }
  14122. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  14123. {
  14124. return $default;
  14125. }
  14126. }
  14127. <?php
  14128. namespace Composer;
  14129. use Composer\Autoload\AutoloadGenerator;
  14130. use Composer\DependencyResolver\DefaultPolicy;
  14131. use Composer\DependencyResolver\Operation\UpdateOperation;
  14132. use Composer\DependencyResolver\Operation\InstallOperation;
  14133. use Composer\DependencyResolver\Operation\UninstallOperation;
  14134. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  14135. use Composer\DependencyResolver\Operation\OperationInterface;
  14136. use Composer\DependencyResolver\PolicyInterface;
  14137. use Composer\DependencyResolver\Pool;
  14138. use Composer\DependencyResolver\Request;
  14139. use Composer\DependencyResolver\Rule;
  14140. use Composer\DependencyResolver\Solver;
  14141. use Composer\DependencyResolver\SolverProblemsException;
  14142. use Composer\Downloader\DownloadManager;
  14143. use Composer\EventDispatcher\EventDispatcher;
  14144. use Composer\Installer\InstallationManager;
  14145. use Composer\Installer\InstallerEvents;
  14146. use Composer\Installer\NoopInstaller;
  14147. use Composer\Installer\SuggestedPackagesReporter;
  14148. use Composer\IO\IOInterface;
  14149. use Composer\Package\AliasPackage;
  14150. use Composer\Package\BasePackage;
  14151. use Composer\Package\CompletePackage;
  14152. use Composer\Package\CompletePackageInterface;
  14153. use Composer\Package\Link;
  14154. use Composer\Package\Loader\ArrayLoader;
  14155. use Composer\Package\Dumper\ArrayDumper;
  14156. use Composer\Semver\Constraint\Constraint;
  14157. use Composer\Package\Locker;
  14158. use Composer\Package\PackageInterface;
  14159. use Composer\Package\RootPackageInterface;
  14160. use Composer\Repository\CompositeRepository;
  14161. use Composer\Repository\InstalledArrayRepository;
  14162. use Composer\Repository\PlatformRepository;
  14163. use Composer\Repository\RepositoryInterface;
  14164. use Composer\Repository\RepositoryManager;
  14165. use Composer\Repository\WritableRepositoryInterface;
  14166. use Composer\Script\ScriptEvents;
  14167. class Installer
  14168. {
  14169. protected $io;
  14170. protected $config;
  14171. protected $package;
  14172. protected $downloadManager;
  14173. protected $repositoryManager;
  14174. protected $locker;
  14175. protected $installationManager;
  14176. protected $eventDispatcher;
  14177. protected $autoloadGenerator;
  14178. protected $preferSource = false;
  14179. protected $preferDist = false;
  14180. protected $optimizeAutoloader = false;
  14181. protected $classMapAuthoritative = false;
  14182. protected $apcuAutoloader = false;
  14183. protected $devMode = false;
  14184. protected $dryRun = false;
  14185. protected $verbose = false;
  14186. protected $update = false;
  14187. protected $dumpAutoloader = true;
  14188. protected $runScripts = true;
  14189. protected $ignorePlatformReqs = false;
  14190. protected $preferStable = false;
  14191. protected $preferLowest = false;
  14192. protected $skipSuggest = false;
  14193. protected $writeLock;
  14194. protected $executeOperations = true;
  14195. protected $updateWhitelist = null;
  14196. protected $whitelistDependencies = false;
  14197. protected $whitelistAllDependencies = false;
  14198. protected $suggestedPackagesReporter;
  14199. protected $additionalInstalledRepository;
  14200. public function __construct(IOInterface $io, Config $config, RootPackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator)
  14201. {
  14202. $this->io = $io;
  14203. $this->config = $config;
  14204. $this->package = $package;
  14205. $this->downloadManager = $downloadManager;
  14206. $this->repositoryManager = $repositoryManager;
  14207. $this->locker = $locker;
  14208. $this->installationManager = $installationManager;
  14209. $this->eventDispatcher = $eventDispatcher;
  14210. $this->autoloadGenerator = $autoloadGenerator;
  14211. $this->writeLock = $config->get('lock');
  14212. }
  14213. public function run()
  14214. {
  14215. gc_collect_cycles();
  14216. gc_disable();
  14217. if (!$this->update && !$this->locker->isLocked()) {
  14218. $this->update = true;
  14219. }
  14220. if ($this->dryRun) {
  14221. $this->verbose = true;
  14222. $this->runScripts = false;
  14223. $this->executeOperations = false;
  14224. $this->writeLock = false;
  14225. $this->dumpAutoloader = false;
  14226. $this->installationManager->addInstaller(new NoopInstaller);
  14227. $this->mockLocalRepositories($this->repositoryManager);
  14228. }
  14229. if ($this->runScripts) {
  14230. $_SERVER['COMPOSER_DEV_MODE'] = $this->devMode ? '1' : '0';
  14231. putenv('COMPOSER_DEV_MODE='.$_SERVER['COMPOSER_DEV_MODE']);
  14232. $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
  14233. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  14234. }
  14235. $this->downloadManager->setPreferSource($this->preferSource);
  14236. $this->downloadManager->setPreferDist($this->preferDist);
  14237. $localRepo = $this->repositoryManager->getLocalRepository();
  14238. if ($this->update) {
  14239. $platformOverrides = $this->config->get('platform') ?: array();
  14240. } else {
  14241. $platformOverrides = $this->locker->getPlatformOverrides();
  14242. }
  14243. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  14244. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  14245. $aliases = $this->getRootAliases();
  14246. $this->aliasPlatformPackages($platformRepo, $aliases);
  14247. if (!$this->suggestedPackagesReporter) {
  14248. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($this->io);
  14249. }
  14250. try {
  14251. list($res, $devPackages) = $this->doInstall($localRepo, $installedRepo, $platformRepo, $aliases);
  14252. if ($res !== 0) {
  14253. return $res;
  14254. }
  14255. } catch (\Exception $e) {
  14256. if ($this->executeOperations && $this->config->get('notify-on-install')) {
  14257. $this->installationManager->notifyInstalls($this->io);
  14258. }
  14259. throw $e;
  14260. }
  14261. if ($this->executeOperations && $this->config->get('notify-on-install')) {
  14262. $this->installationManager->notifyInstalls($this->io);
  14263. }
  14264. if ($this->devMode && !$this->skipSuggest) {
  14265. $this->suggestedPackagesReporter->output($installedRepo);
  14266. }
  14267. foreach ($localRepo->getPackages() as $package) {
  14268. if (!$package instanceof CompletePackage || !$package->isAbandoned()) {
  14269. continue;
  14270. }
  14271. $replacement = is_string($package->getReplacementPackage())
  14272. ? 'Use ' . $package->getReplacementPackage() . ' instead'
  14273. : 'No replacement was suggested';
  14274. $this->io->writeError(
  14275. sprintf(
  14276. "<warning>Package %s is abandoned, you should avoid using it. %s.</warning>",
  14277. $package->getPrettyName(),
  14278. $replacement
  14279. )
  14280. );
  14281. }
  14282. if ($this->update && $this->writeLock) {
  14283. $localRepo->reload();
  14284. $platformReqs = $this->extractPlatformRequirements($this->package->getRequires());
  14285. $platformDevReqs = $this->extractPlatformRequirements($this->package->getDevRequires());
  14286. $updatedLock = $this->locker->setLockData(
  14287. array_diff($localRepo->getCanonicalPackages(), $devPackages),
  14288. $devPackages,
  14289. $platformReqs,
  14290. $platformDevReqs,
  14291. $aliases,
  14292. $this->package->getMinimumStability(),
  14293. $this->package->getStabilityFlags(),
  14294. $this->preferStable || $this->package->getPreferStable(),
  14295. $this->preferLowest,
  14296. $this->config->get('platform') ?: array()
  14297. );
  14298. if ($updatedLock) {
  14299. $this->io->writeError('<info>Writing lock file</info>');
  14300. }
  14301. }
  14302. if ($this->dumpAutoloader) {
  14303. if ($this->optimizeAutoloader) {
  14304. $this->io->writeError('<info>Generating optimized autoload files</info>');
  14305. } else {
  14306. $this->io->writeError('<info>Generating autoload files</info>');
  14307. }
  14308. $this->autoloadGenerator->setDevMode($this->devMode);
  14309. $this->autoloadGenerator->setClassMapAuthoritative($this->classMapAuthoritative);
  14310. $this->autoloadGenerator->setApcu($this->apcuAutoloader);
  14311. $this->autoloadGenerator->setRunScripts($this->runScripts);
  14312. $this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
  14313. }
  14314. if ($this->executeOperations) {
  14315. foreach ($localRepo->getPackages() as $package) {
  14316. $this->installationManager->ensureBinariesPresence($package);
  14317. }
  14318. }
  14319. $fundingCount = 0;
  14320. foreach ($localRepo->getPackages() as $package) {
  14321. if ($package instanceof CompletePackageInterface && !$package instanceof AliasPackage && $package->getFunding()) {
  14322. $fundingCount++;
  14323. }
  14324. }
  14325. if ($fundingCount) {
  14326. $this->io->writeError(array(
  14327. sprintf(
  14328. "<info>%d package%s you are using %s looking for funding.</info>",
  14329. $fundingCount,
  14330. 1 === $fundingCount ? '' : 's',
  14331. 1 === $fundingCount ? 'is' : 'are'
  14332. ),
  14333. '<info>Use the `composer fund` command to find out more!</info>',
  14334. ));
  14335. }
  14336. if ($this->runScripts) {
  14337. $eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
  14338. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  14339. }
  14340. if (!defined('HHVM_VERSION')) {
  14341. gc_enable();
  14342. }
  14343. return 0;
  14344. }
  14345. protected function doInstall($localRepo, $installedRepo, $platformRepo, $aliases)
  14346. {
  14347. $lockedRepository = null;
  14348. $repositories = null;
  14349. if (!$this->update || (!empty($this->updateWhitelist) && $this->locker->isLocked())) {
  14350. try {
  14351. $lockedRepository = $this->locker->getLockedRepository($this->devMode);
  14352. } catch (\RuntimeException $e) {
  14353. if ($this->package->getDevRequires()) {
  14354. throw $e;
  14355. }
  14356. $lockedRepository = $this->locker->getLockedRepository();
  14357. }
  14358. }
  14359. $this->allowListUpdateDependencies(
  14360. $lockedRepository ?: $localRepo,
  14361. $this->package->getRequires(),
  14362. $this->package->getDevRequires()
  14363. );
  14364. $this->io->writeError('<info>Loading composer repositories with package information</info>');
  14365. $policy = $this->createPolicy();
  14366. $pool = $this->createPool($this->update ? null : $lockedRepository);
  14367. $pool->addRepository($installedRepo, $aliases);
  14368. if ($this->update) {
  14369. $repositories = $this->repositoryManager->getRepositories();
  14370. foreach ($repositories as $repository) {
  14371. $pool->addRepository($repository, $aliases);
  14372. }
  14373. }
  14374. if ($lockedRepository) {
  14375. $pool->addRepository($lockedRepository, $aliases);
  14376. }
  14377. $request = $this->createRequest($this->package, $platformRepo);
  14378. if ($this->update) {
  14379. $removedUnstablePackages = array();
  14380. foreach ($localRepo->getPackages() as $package) {
  14381. if (
  14382. !$pool->isPackageAcceptable($package->getNames(), $package->getStability())
  14383. && $this->installationManager->isPackageInstalled($localRepo, $package)
  14384. ) {
  14385. $removedUnstablePackages[$package->getName()] = true;
  14386. $request->remove($package->getName(), new Constraint('=', $package->getVersion()));
  14387. }
  14388. }
  14389. $this->io->writeError('<info>Updating dependencies'.($this->devMode ? ' (including require-dev)' : '').'</info>');
  14390. $request->updateAll();
  14391. $links = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  14392. foreach ($links as $link) {
  14393. $request->install($link->getTarget(), $link->getConstraint());
  14394. }
  14395. if ($this->updateWhitelist) {
  14396. $currentPackages = $this->getCurrentPackages($installedRepo);
  14397. $candidates = array();
  14398. foreach ($links as $link) {
  14399. $candidates[$link->getTarget()] = true;
  14400. $rootRequires[$link->getTarget()] = $link;
  14401. }
  14402. foreach ($currentPackages as $package) {
  14403. $candidates[$package->getName()] = true;
  14404. }
  14405. foreach ($candidates as $candidate => $dummy) {
  14406. foreach ($currentPackages as $curPackage) {
  14407. if ($curPackage->getName() === $candidate) {
  14408. if (!$this->isUpdateable($curPackage) && !isset($removedUnstablePackages[$curPackage->getName()])) {
  14409. $constraint = new Constraint('=', $curPackage->getVersion());
  14410. $description = $this->locker->isLocked() ? '(locked at' : '(installed at';
  14411. $requiredAt = isset($rootRequires[$candidate]) ? ', required as ' . $rootRequires[$candidate]->getPrettyConstraint() : '';
  14412. $constraint->setPrettyString($description . ' ' . $curPackage->getPrettyVersion() . $requiredAt . ')');
  14413. $request->install($curPackage->getName(), $constraint);
  14414. }
  14415. break;
  14416. }
  14417. }
  14418. }
  14419. }
  14420. } else {
  14421. $this->io->writeError('<info>Installing dependencies'.($this->devMode ? ' (including require-dev)' : '').' from lock file</info>');
  14422. if (!$this->locker->isFresh()) {
  14423. $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. It is recommended that you run `composer update` or `composer update <package name>`.</warning>', true, IOInterface::QUIET);
  14424. }
  14425. foreach ($lockedRepository->getPackages() as $package) {
  14426. $version = $package->getVersion();
  14427. if (isset($aliases[$package->getName()][$version])) {
  14428. $version = $aliases[$package->getName()][$version]['alias_normalized'];
  14429. }
  14430. $constraint = new Constraint('=', $version);
  14431. $constraint->setPrettyString($package->getPrettyVersion());
  14432. $request->install($package->getName(), $constraint);
  14433. }
  14434. foreach ($this->locker->getPlatformRequirements($this->devMode) as $link) {
  14435. $request->install($link->getTarget(), $link->getConstraint());
  14436. }
  14437. }
  14438. $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-links');
  14439. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request);
  14440. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  14441. try {
  14442. $operations = $solver->solve($request, $this->ignorePlatformReqs);
  14443. $ruleSetSize = $solver->getRuleSetSize();
  14444. $solver = null;
  14445. } catch (SolverProblemsException $e) {
  14446. $this->io->writeError('<error>Your requirements could not be resolved to an installable set of packages.</error>', true, IOInterface::QUIET);
  14447. $this->io->writeError($e->getMessage());
  14448. if ($this->update && !$this->devMode) {
  14449. $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);
  14450. }
  14451. return array(max(1, $e->getCode()), array());
  14452. }
  14453. $operations = $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-updates', $operations);
  14454. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request, $operations);
  14455. $this->io->writeError("Analyzed ".count($pool)." packages to resolve dependencies", true, IOInterface::VERBOSE);
  14456. $this->io->writeError("Analyzed ".$ruleSetSize." rules to resolve dependencies", true, IOInterface::VERBOSE);
  14457. if (!$operations) {
  14458. $this->io->writeError('Nothing to install or update');
  14459. }
  14460. $operations = $this->movePluginsToFront($operations);
  14461. $operations = $this->moveUninstallsToFront($operations);
  14462. if ($this->update) {
  14463. $devPackages = $this->extractDevPackages($operations, $localRepo, $platformRepo, $aliases);
  14464. if (!$this->devMode) {
  14465. $operations = $this->filterDevPackageOperations($devPackages, $operations, $localRepo);
  14466. }
  14467. } else {
  14468. $devPackages = null;
  14469. }
  14470. if ($operations) {
  14471. $installs = $updates = $uninstalls = array();
  14472. foreach ($operations as $operation) {
  14473. if ($operation instanceof InstallOperation) {
  14474. $installs[] = $operation->getPackage()->getPrettyName().':'.$operation->getPackage()->getFullPrettyVersion();
  14475. } elseif ($operation instanceof UpdateOperation) {
  14476. $updates[] = $operation->getTargetPackage()->getPrettyName().':'.$operation->getTargetPackage()->getFullPrettyVersion();
  14477. } elseif ($operation instanceof UninstallOperation) {
  14478. $uninstalls[] = $operation->getPackage()->getPrettyName();
  14479. }
  14480. }
  14481. $this->io->writeError(sprintf(
  14482. "<info>Package operations: %d install%s, %d update%s, %d removal%s</info>",
  14483. count($installs),
  14484. 1 === count($installs) ? '' : 's',
  14485. count($updates),
  14486. 1 === count($updates) ? '' : 's',
  14487. count($uninstalls),
  14488. 1 === count($uninstalls) ? '' : 's'
  14489. ));
  14490. if ($installs) {
  14491. $this->io->writeError("Installs: ".implode(', ', $installs), true, IOInterface::VERBOSE);
  14492. }
  14493. if ($updates) {
  14494. $this->io->writeError("Updates: ".implode(', ', $updates), true, IOInterface::VERBOSE);
  14495. }
  14496. if ($uninstalls) {
  14497. $this->io->writeError("Removals: ".implode(', ', $uninstalls), true, IOInterface::VERBOSE);
  14498. }
  14499. }
  14500. foreach ($operations as $operation) {
  14501. $jobType = $operation->getJobType();
  14502. if ('install' === $jobType) {
  14503. $this->suggestedPackagesReporter->addSuggestionsFromPackage($operation->getPackage());
  14504. }
  14505. if ($this->update) {
  14506. $package = null;
  14507. if ('update' === $jobType) {
  14508. $package = $operation->getTargetPackage();
  14509. } elseif ('install' === $jobType) {
  14510. $package = $operation->getPackage();
  14511. }
  14512. if ($package && $package->isDev()) {
  14513. $references = $this->package->getReferences();
  14514. if (isset($references[$package->getName()])) {
  14515. $this->updateInstallReferences($package, $references[$package->getName()]);
  14516. }
  14517. }
  14518. if ('update' === $jobType) {
  14519. $targetPackage = $operation->getTargetPackage();
  14520. if ($targetPackage->isDev()) {
  14521. $initialPackage = $operation->getInitialPackage();
  14522. if ($targetPackage->getVersion() === $initialPackage->getVersion()
  14523. && (!$targetPackage->getSourceReference() || $targetPackage->getSourceReference() === $initialPackage->getSourceReference())
  14524. && (!$targetPackage->getDistReference() || $targetPackage->getDistReference() === $initialPackage->getDistReference())
  14525. ) {
  14526. $this->io->writeError(' - Skipping update of ' . $targetPackage->getPrettyName() . ' to the same reference-locked version', true, IOInterface::DEBUG);
  14527. $this->io->writeError('', true, IOInterface::DEBUG);
  14528. continue;
  14529. }
  14530. }
  14531. }
  14532. }
  14533. $event = 'Composer\Installer\PackageEvents::PRE_PACKAGE_'.strtoupper($jobType);
  14534. if (defined($event) && $this->runScripts) {
  14535. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  14536. }
  14537. if (!$this->executeOperations && false === strpos($operation->getJobType(), 'Alias')) {
  14538. $this->io->writeError(' - ' . $operation);
  14539. } elseif ($this->io->isDebug() && false !== strpos($operation->getJobType(), 'Alias')) {
  14540. $this->io->writeError(' - ' . $operation);
  14541. }
  14542. $this->installationManager->execute($localRepo, $operation);
  14543. if ($this->verbose && $this->io->isVeryVerbose() && in_array($jobType, array('install', 'update'))) {
  14544. $reason = $operation->getReason();
  14545. if ($reason instanceof Rule) {
  14546. switch ($reason->getReason()) {
  14547. case Rule::RULE_JOB_INSTALL:
  14548. $this->io->writeError(' REASON: Required by the root package: '.$reason->getPrettyString($pool));
  14549. $this->io->writeError('');
  14550. break;
  14551. case Rule::RULE_PACKAGE_REQUIRES:
  14552. $this->io->writeError(' REASON: '.$reason->getPrettyString($pool));
  14553. $this->io->writeError('');
  14554. break;
  14555. }
  14556. }
  14557. }
  14558. if ($this->executeOperations || $this->writeLock) {
  14559. $localRepo->write();
  14560. }
  14561. $event = 'Composer\Installer\PackageEvents::POST_PACKAGE_'.strtoupper($jobType);
  14562. if (defined($event) && $this->runScripts) {
  14563. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  14564. }
  14565. }
  14566. if ($this->executeOperations) {
  14567. $this->processPackageUrls($pool, $policy, $localRepo, $repositories);
  14568. $localRepo->write();
  14569. }
  14570. if ($operations) {
  14571. $vendorDir = $this->config->get('vendor-dir');
  14572. if (is_dir($vendorDir)) {
  14573. @touch($vendorDir);
  14574. }
  14575. }
  14576. return array(0, $devPackages);
  14577. }
  14578. private function extractDevPackages(array $operations, RepositoryInterface $localRepo, PlatformRepository $platformRepo, array $aliases)
  14579. {
  14580. if (!$this->package->getDevRequires()) {
  14581. return array();
  14582. }
  14583. $tempLocalRepo = clone $localRepo;
  14584. foreach ($operations as $operation) {
  14585. switch ($operation->getJobType()) {
  14586. case 'install':
  14587. case 'markAliasInstalled':
  14588. if (!$tempLocalRepo->hasPackage($operation->getPackage())) {
  14589. $tempLocalRepo->addPackage(clone $operation->getPackage());
  14590. }
  14591. break;
  14592. case 'uninstall':
  14593. case 'markAliasUninstalled':
  14594. $tempLocalRepo->removePackage($operation->getPackage());
  14595. break;
  14596. case 'update':
  14597. $tempLocalRepo->removePackage($operation->getInitialPackage());
  14598. if (!$tempLocalRepo->hasPackage($operation->getTargetPackage())) {
  14599. $tempLocalRepo->addPackage(clone $operation->getTargetPackage());
  14600. }
  14601. break;
  14602. default:
  14603. throw new \LogicException('Unknown type: '.$operation->getJobType());
  14604. }
  14605. }
  14606. $localRepo = new InstalledArrayRepository(array());
  14607. $loader = new ArrayLoader(null, true);
  14608. $dumper = new ArrayDumper();
  14609. foreach ($tempLocalRepo->getCanonicalPackages() as $pkg) {
  14610. $localRepo->addPackage($loader->load($dumper->dump($pkg)));
  14611. }
  14612. unset($tempLocalRepo, $loader, $dumper);
  14613. $policy = $this->createPolicy();
  14614. $pool = $this->createPool();
  14615. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  14616. $pool->addRepository($installedRepo, $aliases);
  14617. $request = $this->createRequest($this->package, $platformRepo);
  14618. $request->updateAll();
  14619. foreach ($this->package->getRequires() as $link) {
  14620. $request->install($link->getTarget(), $link->getConstraint());
  14621. }
  14622. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request);
  14623. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  14624. $ops = $solver->solve($request, $this->ignorePlatformReqs);
  14625. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request, $ops);
  14626. $devPackages = array();
  14627. foreach ($ops as $op) {
  14628. if ($op->getJobType() === 'uninstall') {
  14629. $devPackages[] = $op->getPackage();
  14630. }
  14631. }
  14632. return $devPackages;
  14633. }
  14634. private function filterDevPackageOperations(array $devPackages, array $operations, RepositoryInterface $localRepo)
  14635. {
  14636. $finalOps = array();
  14637. $packagesToSkip = array();
  14638. foreach ($devPackages as $pkg) {
  14639. $packagesToSkip[$pkg->getName()] = true;
  14640. if ($installedDevPkg = $localRepo->findPackage($pkg->getName(), '*')) {
  14641. if ($installedDevPkg instanceof AliasPackage) {
  14642. $finalOps[] = new MarkAliasUninstalledOperation($installedDevPkg, 'non-dev install removing it');
  14643. $installedDevPkg = $installedDevPkg->getAliasOf();
  14644. }
  14645. $finalOps[] = new UninstallOperation($installedDevPkg, 'non-dev install removing it');
  14646. }
  14647. }
  14648. foreach ($operations as $op) {
  14649. $package = $op->getJobType() === 'update' ? $op->getTargetPackage() : $op->getPackage();
  14650. if (isset($packagesToSkip[$package->getName()])) {
  14651. continue;
  14652. }
  14653. $finalOps[] = $op;
  14654. }
  14655. return $finalOps;
  14656. }
  14657. private function movePluginsToFront(array $operations)
  14658. {
  14659. $pluginsNoDeps = array();
  14660. $pluginsWithDeps = array();
  14661. $pluginRequires = array();
  14662. foreach (array_reverse($operations, true) as $idx => $op) {
  14663. if ($op instanceof InstallOperation) {
  14664. $package = $op->getPackage();
  14665. } elseif ($op instanceof UpdateOperation) {
  14666. $package = $op->getTargetPackage();
  14667. } else {
  14668. continue;
  14669. }
  14670. $isPlugin = $package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer';
  14671. if ($isPlugin || count(array_intersect($package->getNames(), $pluginRequires))) {
  14672. $requires = array_filter(array_keys($package->getRequires()), function ($req) {
  14673. return $req !== 'composer-plugin-api' && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req);
  14674. });
  14675. if ($isPlugin && !count($requires)) {
  14676. array_unshift($pluginsNoDeps, $op);
  14677. } else {
  14678. $pluginRequires = array_merge($pluginRequires, $requires);
  14679. array_unshift($pluginsWithDeps, $op);
  14680. }
  14681. unset($operations[$idx]);
  14682. }
  14683. }
  14684. return array_merge($pluginsNoDeps, $pluginsWithDeps, $operations);
  14685. }
  14686. private function moveUninstallsToFront(array $operations)
  14687. {
  14688. $uninstOps = array();
  14689. foreach ($operations as $idx => $op) {
  14690. if ($op instanceof UninstallOperation) {
  14691. $uninstOps[] = $op;
  14692. unset($operations[$idx]);
  14693. }
  14694. }
  14695. return array_merge($uninstOps, $operations);
  14696. }
  14697. private function createInstalledRepo(RepositoryInterface $localRepo, PlatformRepository $platformRepo)
  14698. {
  14699. $installedRootPackage = clone $this->package;
  14700. $installedRootPackage->setRequires(array());
  14701. $installedRootPackage->setDevRequires(array());
  14702. $repos = array(
  14703. $localRepo,
  14704. new InstalledArrayRepository(array($installedRootPackage)),
  14705. $platformRepo,
  14706. );
  14707. $installedRepo = new CompositeRepository($repos);
  14708. if ($this->additionalInstalledRepository) {
  14709. $installedRepo->addRepository($this->additionalInstalledRepository);
  14710. }
  14711. return $installedRepo;
  14712. }
  14713. private function createPool(RepositoryInterface $lockedRepository = null)
  14714. {
  14715. if ($this->update) {
  14716. $minimumStability = $this->package->getMinimumStability();
  14717. $stabilityFlags = $this->package->getStabilityFlags();
  14718. $requires = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  14719. } else {
  14720. $minimumStability = $this->locker->getMinimumStability();
  14721. $stabilityFlags = $this->locker->getStabilityFlags();
  14722. $requires = array();
  14723. foreach ($lockedRepository->getPackages() as $package) {
  14724. $constraint = new Constraint('=', $package->getVersion());
  14725. $constraint->setPrettyString($package->getPrettyVersion());
  14726. $requires[$package->getName()] = $constraint;
  14727. }
  14728. }
  14729. $rootConstraints = array();
  14730. foreach ($requires as $req => $constraint) {
  14731. if ($this->ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req)) {
  14732. continue;
  14733. }
  14734. if ($constraint instanceof Link) {
  14735. $rootConstraints[$req] = $constraint->getConstraint();
  14736. } else {
  14737. $rootConstraints[$req] = $constraint;
  14738. }
  14739. }
  14740. return new Pool($minimumStability, $stabilityFlags, $rootConstraints);
  14741. }
  14742. private function createPolicy()
  14743. {
  14744. $preferStable = null;
  14745. $preferLowest = null;
  14746. if (!$this->update) {
  14747. $preferStable = $this->locker->getPreferStable();
  14748. $preferLowest = $this->locker->getPreferLowest();
  14749. }
  14750. if (null === $preferStable) {
  14751. $preferStable = $this->preferStable || $this->package->getPreferStable();
  14752. }
  14753. if (null === $preferLowest) {
  14754. $preferLowest = $this->preferLowest;
  14755. }
  14756. return new DefaultPolicy($preferStable, $preferLowest);
  14757. }
  14758. private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo)
  14759. {
  14760. $request = new Request();
  14761. $constraint = new Constraint('=', $rootPackage->getVersion());
  14762. $constraint->setPrettyString($rootPackage->getPrettyVersion());
  14763. $request->install($rootPackage->getName(), $constraint);
  14764. $fixedPackages = $platformRepo->getPackages();
  14765. if ($this->additionalInstalledRepository) {
  14766. $additionalFixedPackages = $this->additionalInstalledRepository->getPackages();
  14767. $fixedPackages = array_merge($fixedPackages, $additionalFixedPackages);
  14768. }
  14769. $provided = $rootPackage->getProvides();
  14770. foreach ($fixedPackages as $package) {
  14771. $constraint = new Constraint('=', $package->getVersion());
  14772. $constraint->setPrettyString($package->getPrettyVersion());
  14773. if ($package->getRepository() !== $platformRepo
  14774. || !isset($provided[$package->getName()])
  14775. || !$provided[$package->getName()]->getConstraint()->matches($constraint)
  14776. ) {
  14777. $request->fix($package->getName(), $constraint);
  14778. }
  14779. }
  14780. return $request;
  14781. }
  14782. private function processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, $task, array $operations = null)
  14783. {
  14784. if ($task === 'force-updates' && null === $operations) {
  14785. throw new \InvalidArgumentException('Missing operations argument');
  14786. }
  14787. if ($task === 'force-links') {
  14788. $operations = array();
  14789. }
  14790. if ($this->update && $this->updateWhitelist) {
  14791. $currentPackages = $this->getCurrentPackages($installedRepo);
  14792. }
  14793. foreach ($localRepo->getCanonicalPackages() as $package) {
  14794. if (!$package->isDev()) {
  14795. continue;
  14796. }
  14797. foreach ($operations as $operation) {
  14798. if (('update' === $operation->getJobType() && $operation->getInitialPackage()->equals($package))
  14799. || ('uninstall' === $operation->getJobType() && $operation->getPackage()->equals($package))
  14800. ) {
  14801. continue 2;
  14802. }
  14803. }
  14804. if ($this->update) {
  14805. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  14806. foreach ($currentPackages as $curPackage) {
  14807. if ($curPackage->isDev() && $curPackage->getName() === $package->getName() && $curPackage->getVersion() === $package->getVersion()) {
  14808. if ($task === 'force-links') {
  14809. $package->setRequires($curPackage->getRequires());
  14810. $package->setConflicts($curPackage->getConflicts());
  14811. $package->setProvides($curPackage->getProvides());
  14812. $package->setReplaces($curPackage->getReplaces());
  14813. } elseif ($task === 'force-updates') {
  14814. if (($curPackage->getSourceReference() && $curPackage->getSourceReference() !== $package->getSourceReference())
  14815. || ($curPackage->getDistReference() && $curPackage->getDistReference() !== $package->getDistReference())
  14816. ) {
  14817. $operations[] = new UpdateOperation($package, $curPackage);
  14818. }
  14819. }
  14820. break;
  14821. }
  14822. }
  14823. continue;
  14824. }
  14825. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  14826. foreach ($matches as $index => $match) {
  14827. if (!in_array($match->getRepository(), $repositories, true)) {
  14828. unset($matches[$index]);
  14829. continue;
  14830. }
  14831. if ($match->getName() !== $package->getName()) {
  14832. unset($matches[$index]);
  14833. continue;
  14834. }
  14835. $matches[$index] = $match->getId();
  14836. }
  14837. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  14838. $newPackage = $pool->literalToPackage($matches[0]);
  14839. if ($task === 'force-links' && $newPackage) {
  14840. $package->setRequires($newPackage->getRequires());
  14841. $package->setConflicts($newPackage->getConflicts());
  14842. $package->setProvides($newPackage->getProvides());
  14843. $package->setReplaces($newPackage->getReplaces());
  14844. }
  14845. if (
  14846. $task === 'force-updates'
  14847. && $newPackage
  14848. && (
  14849. ($newPackage->getSourceReference() && $newPackage->getSourceReference() !== $package->getSourceReference())
  14850. || ($newPackage->getDistReference() && $newPackage->getDistReference() !== $package->getDistReference())
  14851. )
  14852. ) {
  14853. $operations[] = new UpdateOperation($package, $newPackage);
  14854. continue;
  14855. }
  14856. }
  14857. if ($task === 'force-updates') {
  14858. $references = $this->package->getReferences();
  14859. if (isset($references[$package->getName()]) && $references[$package->getName()] !== $package->getSourceReference()) {
  14860. $operations[] = new UpdateOperation($package, clone $package);
  14861. }
  14862. }
  14863. } else {
  14864. foreach ($lockedRepository->findPackages($package->getName()) as $lockedPackage) {
  14865. if ($lockedPackage->isDev() && $lockedPackage->getVersion() === $package->getVersion()) {
  14866. if ($task === 'force-links') {
  14867. $package->setRequires($lockedPackage->getRequires());
  14868. $package->setConflicts($lockedPackage->getConflicts());
  14869. $package->setProvides($lockedPackage->getProvides());
  14870. $package->setReplaces($lockedPackage->getReplaces());
  14871. } elseif ($task === 'force-updates') {
  14872. if (($lockedPackage->getSourceReference() && $lockedPackage->getSourceReference() !== $package->getSourceReference())
  14873. || ($lockedPackage->getDistReference() && $lockedPackage->getDistReference() !== $package->getDistReference())
  14874. ) {
  14875. $operations[] = new UpdateOperation($package, $lockedPackage);
  14876. }
  14877. }
  14878. break;
  14879. }
  14880. }
  14881. }
  14882. }
  14883. return $operations;
  14884. }
  14885. private function getCurrentPackages($installedRepo)
  14886. {
  14887. if ($this->locker->isLocked()) {
  14888. try {
  14889. return $this->locker->getLockedRepository(true)->getPackages();
  14890. } catch (\RuntimeException $e) {
  14891. return $this->locker->getLockedRepository()->getPackages();
  14892. }
  14893. }
  14894. return $installedRepo->getPackages();
  14895. }
  14896. private function getRootAliases()
  14897. {
  14898. if ($this->update) {
  14899. $aliases = $this->package->getAliases();
  14900. } else {
  14901. $aliases = $this->locker->getAliases();
  14902. }
  14903. $normalizedAliases = array();
  14904. foreach ($aliases as $alias) {
  14905. $normalizedAliases[$alias['package']][$alias['version']] = array(
  14906. 'alias' => $alias['alias'],
  14907. 'alias_normalized' => $alias['alias_normalized'],
  14908. );
  14909. }
  14910. return $normalizedAliases;
  14911. }
  14912. private function processPackageUrls($pool, $policy, $localRepo, $repositories)
  14913. {
  14914. if (!$this->update) {
  14915. return;
  14916. }
  14917. $rootRefs = $this->package->getReferences();
  14918. foreach ($localRepo->getCanonicalPackages() as $package) {
  14919. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  14920. foreach ($matches as $index => $match) {
  14921. if (!in_array($match->getRepository(), $repositories, true)) {
  14922. unset($matches[$index]);
  14923. continue;
  14924. }
  14925. if ($match->getName() !== $package->getName()) {
  14926. unset($matches[$index]);
  14927. continue;
  14928. }
  14929. $matches[$index] = $match->getId();
  14930. }
  14931. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  14932. $newPackage = $pool->literalToPackage($matches[0]);
  14933. $sourceUrl = $package->getSourceUrl();
  14934. $newSourceUrl = $newPackage->getSourceUrl();
  14935. $newReference = $newPackage->getSourceReference();
  14936. if ($package->isDev() && isset($rootRefs[$package->getName()]) && $package->getSourceReference() === $rootRefs[$package->getName()]) {
  14937. $newReference = $rootRefs[$package->getName()];
  14938. }
  14939. $this->updatePackageUrl($package, $newSourceUrl, $newPackage->getSourceType(), $newReference, $newPackage->getDistUrl(), $newPackage->getDistType(), $newPackage->getDistSha1Checksum());
  14940. if ($package instanceof CompletePackage && $newPackage instanceof CompletePackage) {
  14941. $package->setAbandoned($newPackage->getReplacementPackage() ?: $newPackage->isAbandoned());
  14942. }
  14943. $package->setDistMirrors($newPackage->getDistMirrors());
  14944. $package->setSourceMirrors($newPackage->getSourceMirrors());
  14945. $package->setTransportOptions($newPackage->getTransportOptions());
  14946. }
  14947. }
  14948. }
  14949. private function updatePackageUrl(PackageInterface $package, $sourceUrl, $sourceType, $sourceReference, $distUrl, $distType, $distShaSum)
  14950. {
  14951. $oldSourceRef = $package->getSourceReference();
  14952. if ($package->getSourceUrl() !== $sourceUrl) {
  14953. $package->setSourceType($sourceType);
  14954. $package->setSourceUrl($sourceUrl);
  14955. $package->setSourceReference($sourceReference);
  14956. }
  14957. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $distUrl)) {
  14958. $package->setDistUrl($distUrl);
  14959. $package->setDistType($distType);
  14960. $package->setDistSha1Checksum($distShaSum);
  14961. $this->updateInstallReferences($package, $sourceReference);
  14962. }
  14963. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  14964. $this->updateInstallReferences($package, $oldSourceRef);
  14965. }
  14966. }
  14967. private function updateInstallReferences(PackageInterface $package, $reference)
  14968. {
  14969. if (!$reference) {
  14970. return;
  14971. }
  14972. $package->setSourceReference($reference);
  14973. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $package->getDistUrl())) {
  14974. $package->setDistReference($reference);
  14975. $package->setDistUrl(preg_replace('{(?<=/|sha=)[a-f0-9]{40}(?=/|$)}i', $reference, $package->getDistUrl()));
  14976. } elseif ($package->getDistReference()) {
  14977. $package->setDistReference($reference);
  14978. }
  14979. }
  14980. private function aliasPlatformPackages(PlatformRepository $platformRepo, $aliases)
  14981. {
  14982. foreach ($aliases as $package => $versions) {
  14983. foreach ($versions as $version => $alias) {
  14984. $packages = $platformRepo->findPackages($package, $version);
  14985. foreach ($packages as $package) {
  14986. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  14987. $aliasPackage->setRootPackageAlias(true);
  14988. $platformRepo->addPackage($aliasPackage);
  14989. }
  14990. }
  14991. }
  14992. }
  14993. private function isUpdateable(PackageInterface $package)
  14994. {
  14995. if (!$this->updateWhitelist) {
  14996. throw new \LogicException('isUpdateable should only be called when an allow list is present');
  14997. }
  14998. foreach ($this->updateWhitelist as $pattern => $void) {
  14999. $patternRegexp = BasePackage::packageNameToRegexp($pattern);
  15000. if (preg_match($patternRegexp, $package->getName())) {
  15001. return true;
  15002. }
  15003. }
  15004. return false;
  15005. }
  15006. private function extractPlatformRequirements($links)
  15007. {
  15008. $platformReqs = array();
  15009. foreach ($links as $link) {
  15010. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  15011. $platformReqs[$link->getTarget()] = $link->getPrettyConstraint();
  15012. }
  15013. }
  15014. return $platformReqs;
  15015. }
  15016. private function allowListUpdateDependencies($localOrLockRepo, array $rootRequires, array $rootDevRequires)
  15017. {
  15018. if (!$this->updateWhitelist) {
  15019. return;
  15020. }
  15021. $rootRequires = array_merge($rootRequires, $rootDevRequires);
  15022. $skipPackages = array();
  15023. if (!$this->whitelistAllDependencies) {
  15024. foreach ($rootRequires as $require) {
  15025. $skipPackages[$require->getTarget()] = true;
  15026. }
  15027. }
  15028. $pool = new Pool('dev');
  15029. $pool->addRepository($localOrLockRepo);
  15030. $seen = array();
  15031. $rootRequiredPackageNames = array_keys($rootRequires);
  15032. foreach ($this->updateWhitelist as $packageName => $void) {
  15033. $packageQueue = new \SplQueue;
  15034. $nameMatchesRequiredPackage = false;
  15035. $depPackages = $pool->whatProvides($packageName);
  15036. $matchesByPattern = array();
  15037. if (empty($depPackages)) {
  15038. $allowListPatternSearchRegexp = BasePackage::packageNameToRegexp($packageName, '^%s$');
  15039. foreach ($localOrLockRepo->search($allowListPatternSearchRegexp) as $installedPackage) {
  15040. $matchesByPattern[] = $pool->whatProvides($installedPackage['name']);
  15041. }
  15042. $allowListPatternRegexp = BasePackage::packageNameToRegexp($packageName);
  15043. foreach ($rootRequiredPackageNames as $rootRequiredPackageName) {
  15044. if (preg_match($allowListPatternRegexp, $rootRequiredPackageName)) {
  15045. $nameMatchesRequiredPackage = true;
  15046. break;
  15047. }
  15048. }
  15049. }
  15050. if (!empty($matchesByPattern)) {
  15051. $depPackages = array_merge($depPackages, call_user_func_array('array_merge', $matchesByPattern));
  15052. }
  15053. if (count($depPackages) == 0 && !$nameMatchesRequiredPackage && !in_array($packageName, array('nothing', 'lock', 'mirrors'))) {
  15054. $this->io->writeError('<warning>Package "' . $packageName . '" listed for update is not installed. Ignoring.</warning>');
  15055. }
  15056. foreach ($depPackages as $depPackage) {
  15057. $packageQueue->enqueue($depPackage);
  15058. }
  15059. while (!$packageQueue->isEmpty()) {
  15060. $package = $packageQueue->dequeue();
  15061. if (isset($seen[$package->getId()])) {
  15062. continue;
  15063. }
  15064. $seen[$package->getId()] = true;
  15065. $this->updateWhitelist[$package->getName()] = true;
  15066. if (!$this->whitelistDependencies && !$this->whitelistAllDependencies) {
  15067. continue;
  15068. }
  15069. $requires = $package->getRequires();
  15070. foreach ($requires as $require) {
  15071. $requirePackages = $pool->whatProvides($require->getTarget());
  15072. foreach ($requirePackages as $requirePackage) {
  15073. if (isset($this->updateWhitelist[$requirePackage->getName()])) {
  15074. continue;
  15075. }
  15076. if (isset($skipPackages[$requirePackage->getName()]) && !preg_match(BasePackage::packageNameToRegexp($packageName), $requirePackage->getName())) {
  15077. $this->io->writeError('<warning>Dependency "' . $requirePackage->getName() . '" is also a root requirement, but is not explicitly allowed. Ignoring.</warning>');
  15078. continue;
  15079. }
  15080. $packageQueue->enqueue($requirePackage);
  15081. }
  15082. }
  15083. }
  15084. }
  15085. }
  15086. private function mockLocalRepositories(RepositoryManager $rm)
  15087. {
  15088. $packages = array();
  15089. foreach ($rm->getLocalRepository()->getPackages() as $package) {
  15090. $packages[(string) $package] = clone $package;
  15091. }
  15092. foreach ($packages as $key => $package) {
  15093. if ($package instanceof AliasPackage) {
  15094. $alias = (string) $package->getAliasOf();
  15095. $packages[$key] = new AliasPackage($packages[$alias], $package->getVersion(), $package->getPrettyVersion());
  15096. }
  15097. }
  15098. $rm->setLocalRepository(
  15099. new InstalledArrayRepository($packages)
  15100. );
  15101. }
  15102. public static function create(IOInterface $io, Composer $composer)
  15103. {
  15104. return new static(
  15105. $io,
  15106. $composer->getConfig(),
  15107. $composer->getPackage(),
  15108. $composer->getDownloadManager(),
  15109. $composer->getRepositoryManager(),
  15110. $composer->getLocker(),
  15111. $composer->getInstallationManager(),
  15112. $composer->getEventDispatcher(),
  15113. $composer->getAutoloadGenerator()
  15114. );
  15115. }
  15116. public function setAdditionalInstalledRepository(RepositoryInterface $additionalInstalledRepository)
  15117. {
  15118. $this->additionalInstalledRepository = $additionalInstalledRepository;
  15119. return $this;
  15120. }
  15121. public function setDryRun($dryRun = true)
  15122. {
  15123. $this->dryRun = (bool) $dryRun;
  15124. return $this;
  15125. }
  15126. public function isDryRun()
  15127. {
  15128. return $this->dryRun;
  15129. }
  15130. public function setPreferSource($preferSource = true)
  15131. {
  15132. $this->preferSource = (bool) $preferSource;
  15133. return $this;
  15134. }
  15135. public function setPreferDist($preferDist = true)
  15136. {
  15137. $this->preferDist = (bool) $preferDist;
  15138. return $this;
  15139. }
  15140. public function setOptimizeAutoloader($optimizeAutoloader = false)
  15141. {
  15142. $this->optimizeAutoloader = (bool) $optimizeAutoloader;
  15143. if (!$this->optimizeAutoloader) {
  15144. $this->setClassMapAuthoritative(false);
  15145. }
  15146. return $this;
  15147. }
  15148. public function setClassMapAuthoritative($classMapAuthoritative = false)
  15149. {
  15150. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  15151. if ($this->classMapAuthoritative) {
  15152. $this->setOptimizeAutoloader(true);
  15153. }
  15154. return $this;
  15155. }
  15156. public function setApcuAutoloader($apcuAutoloader = false)
  15157. {
  15158. $this->apcuAutoloader = (bool) $apcuAutoloader;
  15159. return $this;
  15160. }
  15161. public function setUpdate($update = true)
  15162. {
  15163. $this->update = (bool) $update;
  15164. return $this;
  15165. }
  15166. public function setDevMode($devMode = true)
  15167. {
  15168. $this->devMode = (bool) $devMode;
  15169. return $this;
  15170. }
  15171. public function setDumpAutoloader($dumpAutoloader = true)
  15172. {
  15173. $this->dumpAutoloader = (bool) $dumpAutoloader;
  15174. return $this;
  15175. }
  15176. public function setRunScripts($runScripts = true)
  15177. {
  15178. $this->runScripts = (bool) $runScripts;
  15179. return $this;
  15180. }
  15181. public function setConfig(Config $config)
  15182. {
  15183. $this->config = $config;
  15184. return $this;
  15185. }
  15186. public function setVerbose($verbose = true)
  15187. {
  15188. $this->verbose = (bool) $verbose;
  15189. return $this;
  15190. }
  15191. public function isVerbose()
  15192. {
  15193. return $this->verbose;
  15194. }
  15195. public function setIgnorePlatformRequirements($ignorePlatformReqs = false)
  15196. {
  15197. $this->ignorePlatformReqs = (bool) $ignorePlatformReqs;
  15198. return $this;
  15199. }
  15200. public function setUpdateWhitelist(array $packages)
  15201. {
  15202. $this->updateWhitelist = array_flip(array_map('strtolower', $packages));
  15203. return $this;
  15204. }
  15205. public function setUpdateAllowList(array $packages)
  15206. {
  15207. return $this->setUpdateWhitelist($packages);
  15208. }
  15209. public function setWhitelistDependencies($updateDependencies = true)
  15210. {
  15211. return $this->setWhitelistTransitiveDependencies($updateDependencies);
  15212. }
  15213. public function setWhitelistTransitiveDependencies($updateTransitiveDependencies = true)
  15214. {
  15215. $this->whitelistDependencies = (bool) $updateTransitiveDependencies;
  15216. return $this;
  15217. }
  15218. public function setAllowListTransitiveDependencies($updateTransitiveDependencies = true)
  15219. {
  15220. return $this->setWhitelistTransitiveDependencies($updateTransitiveDependencies);
  15221. }
  15222. public function setWhitelistAllDependencies($updateAllDependencies = true)
  15223. {
  15224. $this->whitelistAllDependencies = (bool) $updateAllDependencies;
  15225. return $this;
  15226. }
  15227. public function setAllowListAllDependencies($updateAllDependencies = true)
  15228. {
  15229. return $this->setWhitelistAllDependencies($updateAllDependencies);
  15230. }
  15231. public function setPreferStable($preferStable = true)
  15232. {
  15233. $this->preferStable = (bool) $preferStable;
  15234. return $this;
  15235. }
  15236. public function setPreferLowest($preferLowest = true)
  15237. {
  15238. $this->preferLowest = (bool) $preferLowest;
  15239. return $this;
  15240. }
  15241. public function setWriteLock($writeLock = true)
  15242. {
  15243. $this->writeLock = (bool) $writeLock;
  15244. return $this;
  15245. }
  15246. public function setExecuteOperations($executeOperations = true)
  15247. {
  15248. $this->executeOperations = (bool) $executeOperations;
  15249. return $this;
  15250. }
  15251. public function setSkipSuggest($skipSuggest = true)
  15252. {
  15253. $this->skipSuggest = (bool) $skipSuggest;
  15254. return $this;
  15255. }
  15256. public function disablePlugins()
  15257. {
  15258. $this->installationManager->disablePlugins();
  15259. return $this;
  15260. }
  15261. public function setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter)
  15262. {
  15263. $this->suggestedPackagesReporter = $suggestedPackagesReporter;
  15264. return $this;
  15265. }
  15266. }
  15267. <?php
  15268. namespace Composer\Installer;
  15269. use Composer\IO\IOInterface;
  15270. use Composer\Package\PackageInterface;
  15271. use Composer\Util\Filesystem;
  15272. use Composer\Util\Platform;
  15273. use Composer\Util\ProcessExecutor;
  15274. use Composer\Util\Silencer;
  15275. class BinaryInstaller
  15276. {
  15277. protected $binDir;
  15278. protected $binCompat;
  15279. protected $io;
  15280. protected $filesystem;
  15281. public function __construct(IOInterface $io, $binDir, $binCompat, Filesystem $filesystem = null)
  15282. {
  15283. $this->binDir = $binDir;
  15284. $this->binCompat = $binCompat;
  15285. $this->io = $io;
  15286. $this->filesystem = $filesystem ?: new Filesystem();
  15287. }
  15288. public function installBinaries(PackageInterface $package, $installPath, $warnOnOverwrite = true)
  15289. {
  15290. $binaries = $this->getBinaries($package);
  15291. if (!$binaries) {
  15292. return;
  15293. }
  15294. foreach ($binaries as $bin) {
  15295. $binPath = $installPath.'/'.$bin;
  15296. if (!file_exists($binPath)) {
  15297. $this->io->writeError(' <warning>Skipped installation of bin '.$bin.' for package '.$package->getName().': file not found in package</warning>');
  15298. continue;
  15299. }
  15300. $binPath = realpath($binPath);
  15301. $this->initializeBinDir();
  15302. $link = $this->binDir.'/'.basename($bin);
  15303. if (file_exists($link)) {
  15304. if (is_link($link)) {
  15305. Silencer::call('chmod', $link, 0777 & ~umask());
  15306. }
  15307. if ($warnOnOverwrite) {
  15308. $this->io->writeError(' Skipped installation of bin '.$bin.' for package '.$package->getName().': name conflicts with an existing file');
  15309. }
  15310. continue;
  15311. }
  15312. if ($this->binCompat === "auto") {
  15313. if (Platform::isWindows()) {
  15314. $this->installFullBinaries($binPath, $link, $bin, $package);
  15315. } else {
  15316. $this->installSymlinkBinaries($binPath, $link);
  15317. }
  15318. } elseif ($this->binCompat === "full") {
  15319. $this->installFullBinaries($binPath, $link, $bin, $package);
  15320. }
  15321. Silencer::call('chmod', $link, 0777 & ~umask());
  15322. }
  15323. }
  15324. public function removeBinaries(PackageInterface $package)
  15325. {
  15326. $this->initializeBinDir();
  15327. $binaries = $this->getBinaries($package);
  15328. if (!$binaries) {
  15329. return;
  15330. }
  15331. foreach ($binaries as $bin) {
  15332. $link = $this->binDir.'/'.basename($bin);
  15333. if (is_link($link) || file_exists($link)) {
  15334. $this->filesystem->unlink($link);
  15335. }
  15336. if (file_exists($link.'.bat')) {
  15337. $this->filesystem->unlink($link.'.bat');
  15338. }
  15339. }
  15340. if (is_dir($this->binDir) && $this->filesystem->isDirEmpty($this->binDir)) {
  15341. Silencer::call('rmdir', $this->binDir);
  15342. }
  15343. }
  15344. public static function determineBinaryCaller($bin)
  15345. {
  15346. if ('.bat' === substr($bin, -4) || '.exe' === substr($bin, -4)) {
  15347. return 'call';
  15348. }
  15349. $handle = fopen($bin, 'r');
  15350. $line = fgets($handle);
  15351. fclose($handle);
  15352. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  15353. return trim($match[1]);
  15354. }
  15355. return 'php';
  15356. }
  15357. protected function getBinaries(PackageInterface $package)
  15358. {
  15359. return $package->getBinaries();
  15360. }
  15361. protected function installFullBinaries($binPath, $link, $bin, PackageInterface $package)
  15362. {
  15363. if ('.bat' !== substr($binPath, -4)) {
  15364. $this->installUnixyProxyBinaries($binPath, $link);
  15365. @chmod($link, 0777 & ~umask());
  15366. $link .= '.bat';
  15367. if (file_exists($link)) {
  15368. $this->io->writeError(' Skipped installation of bin '.$bin.'.bat proxy for package '.$package->getName().': a .bat proxy was already installed');
  15369. }
  15370. }
  15371. if (!file_exists($link)) {
  15372. file_put_contents($link, $this->generateWindowsProxyCode($binPath, $link));
  15373. }
  15374. }
  15375. protected function installSymlinkBinaries($binPath, $link)
  15376. {
  15377. if (!$this->filesystem->relativeSymlink($binPath, $link)) {
  15378. $this->installUnixyProxyBinaries($binPath, $link);
  15379. }
  15380. }
  15381. protected function installUnixyProxyBinaries($binPath, $link)
  15382. {
  15383. file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
  15384. }
  15385. protected function initializeBinDir()
  15386. {
  15387. $this->filesystem->ensureDirectoryExists($this->binDir);
  15388. $this->binDir = realpath($this->binDir);
  15389. }
  15390. protected function generateWindowsProxyCode($bin, $link)
  15391. {
  15392. $binPath = $this->filesystem->findShortestPath($link, $bin);
  15393. $caller = self::determineBinaryCaller($bin);
  15394. return "@ECHO OFF\r\n".
  15395. "setlocal DISABLEDELAYEDEXPANSION\r\n".
  15396. "SET BIN_TARGET=%~dp0/".trim(ProcessExecutor::escape($binPath), '"\'')."\r\n".
  15397. "{$caller} \"%BIN_TARGET%\" %*\r\n";
  15398. }
  15399. protected function generateUnixyProxyCode($bin, $link)
  15400. {
  15401. $binPath = $this->filesystem->findShortestPath($link, $bin);
  15402. $binDir = ProcessExecutor::escape(dirname($binPath));
  15403. $binFile = basename($binPath);
  15404. $proxyCode = <<<PROXY
  15405. #!/usr/bin/env sh
  15406. dir=\$(cd "\${0%[/\\\\]*}" > /dev/null; cd $binDir && pwd)
  15407. if [ -d /proc/cygdrive ]; then
  15408. case \$(which php) in
  15409. \$(readlink -n /proc/cygdrive)/*)
  15410. # We are in Cygwin using Windows php, so the path must be translated
  15411. dir=\$(cygpath -m "\$dir");
  15412. ;;
  15413. esac
  15414. fi
  15415. "\${dir}/$binFile" "\$@"
  15416. PROXY;
  15417. return $proxyCode;
  15418. }
  15419. }
  15420. <?php
  15421. namespace Composer\Installer;
  15422. use Composer\Package\PackageInterface;
  15423. interface BinaryPresenceInterface
  15424. {
  15425. public function ensureBinariesPresence(PackageInterface $package);
  15426. }
  15427. <?php
  15428. namespace Composer\Installer;
  15429. use Composer\IO\IOInterface;
  15430. use Composer\Package\PackageInterface;
  15431. use Composer\Package\AliasPackage;
  15432. use Composer\Repository\RepositoryInterface;
  15433. use Composer\Repository\InstalledRepositoryInterface;
  15434. use Composer\DependencyResolver\Operation\OperationInterface;
  15435. use Composer\DependencyResolver\Operation\InstallOperation;
  15436. use Composer\DependencyResolver\Operation\UpdateOperation;
  15437. use Composer\DependencyResolver\Operation\UninstallOperation;
  15438. use Composer\DependencyResolver\Operation\MarkAliasInstalledOperation;
  15439. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  15440. use Composer\Util\StreamContextFactory;
  15441. class InstallationManager
  15442. {
  15443. private $installers = array();
  15444. private $cache = array();
  15445. private $notifiablePackages = array();
  15446. public function reset()
  15447. {
  15448. $this->notifiablePackages = array();
  15449. }
  15450. public function addInstaller(InstallerInterface $installer)
  15451. {
  15452. array_unshift($this->installers, $installer);
  15453. $this->cache = array();
  15454. }
  15455. public function removeInstaller(InstallerInterface $installer)
  15456. {
  15457. if (false !== ($key = array_search($installer, $this->installers, true))) {
  15458. array_splice($this->installers, $key, 1);
  15459. $this->cache = array();
  15460. }
  15461. }
  15462. public function disablePlugins()
  15463. {
  15464. foreach ($this->installers as $i => $installer) {
  15465. if (!$installer instanceof PluginInstaller) {
  15466. continue;
  15467. }
  15468. unset($this->installers[$i]);
  15469. }
  15470. }
  15471. public function getInstaller($type)
  15472. {
  15473. $type = strtolower($type);
  15474. if (isset($this->cache[$type])) {
  15475. return $this->cache[$type];
  15476. }
  15477. foreach ($this->installers as $installer) {
  15478. if ($installer->supports($type)) {
  15479. return $this->cache[$type] = $installer;
  15480. }
  15481. }
  15482. throw new \InvalidArgumentException('Unknown installer type: '.$type);
  15483. }
  15484. public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15485. {
  15486. if ($package instanceof AliasPackage) {
  15487. return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
  15488. }
  15489. return $this->getInstaller($package->getType())->isInstalled($repo, $package);
  15490. }
  15491. public function ensureBinariesPresence(PackageInterface $package)
  15492. {
  15493. try {
  15494. $installer = $this->getInstaller($package->getType());
  15495. } catch (\InvalidArgumentException $e) {
  15496. return;
  15497. }
  15498. if ($installer instanceof BinaryPresenceInterface) {
  15499. $installer->ensureBinariesPresence($package);
  15500. }
  15501. }
  15502. public function execute(RepositoryInterface $repo, OperationInterface $operation)
  15503. {
  15504. $method = $operation->getJobType();
  15505. $this->$method($repo, $operation);
  15506. }
  15507. public function install(RepositoryInterface $repo, InstallOperation $operation)
  15508. {
  15509. $package = $operation->getPackage();
  15510. $installer = $this->getInstaller($package->getType());
  15511. $installer->install($repo, $package);
  15512. $this->markForNotification($package);
  15513. }
  15514. public function update(RepositoryInterface $repo, UpdateOperation $operation)
  15515. {
  15516. $initial = $operation->getInitialPackage();
  15517. $target = $operation->getTargetPackage();
  15518. $initialType = $initial->getType();
  15519. $targetType = $target->getType();
  15520. if ($initialType === $targetType) {
  15521. $installer = $this->getInstaller($initialType);
  15522. $installer->update($repo, $initial, $target);
  15523. $this->markForNotification($target);
  15524. } else {
  15525. $this->getInstaller($initialType)->uninstall($repo, $initial);
  15526. $this->getInstaller($targetType)->install($repo, $target);
  15527. }
  15528. }
  15529. public function uninstall(RepositoryInterface $repo, UninstallOperation $operation)
  15530. {
  15531. $package = $operation->getPackage();
  15532. $installer = $this->getInstaller($package->getType());
  15533. $installer->uninstall($repo, $package);
  15534. }
  15535. public function markAliasInstalled(RepositoryInterface $repo, MarkAliasInstalledOperation $operation)
  15536. {
  15537. $package = $operation->getPackage();
  15538. if (!$repo->hasPackage($package)) {
  15539. $repo->addPackage(clone $package);
  15540. }
  15541. }
  15542. public function markAliasUninstalled(RepositoryInterface $repo, MarkAliasUninstalledOperation $operation)
  15543. {
  15544. $package = $operation->getPackage();
  15545. $repo->removePackage($package);
  15546. }
  15547. public function getInstallPath(PackageInterface $package)
  15548. {
  15549. $installer = $this->getInstaller($package->getType());
  15550. return $installer->getInstallPath($package);
  15551. }
  15552. public function notifyInstalls(IOInterface $io)
  15553. {
  15554. foreach ($this->notifiablePackages as $repoUrl => $packages) {
  15555. $repositoryName = parse_url($repoUrl, PHP_URL_HOST);
  15556. if ($io->hasAuthentication($repositoryName)) {
  15557. $auth = $io->getAuthentication($repositoryName);
  15558. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  15559. $authHeader = 'Authorization: Basic '.$authStr;
  15560. }
  15561. if (strpos($repoUrl, '%package%')) {
  15562. foreach ($packages as $package) {
  15563. $url = str_replace('%package%', $package->getPrettyName(), $repoUrl);
  15564. $params = array(
  15565. 'version' => $package->getPrettyVersion(),
  15566. 'version_normalized' => $package->getVersion(),
  15567. );
  15568. $opts = array('http' =>
  15569. array(
  15570. 'method' => 'POST',
  15571. 'header' => array('Content-type: application/x-www-form-urlencoded'),
  15572. 'content' => http_build_query($params, '', '&'),
  15573. 'timeout' => 3,
  15574. ),
  15575. );
  15576. if (isset($authHeader)) {
  15577. $opts['http']['header'][] = $authHeader;
  15578. }
  15579. $context = StreamContextFactory::getContext($url, $opts);
  15580. @file_get_contents($url, false, $context);
  15581. }
  15582. continue;
  15583. }
  15584. $postData = array('downloads' => array());
  15585. foreach ($packages as $package) {
  15586. $postData['downloads'][] = array(
  15587. 'name' => $package->getPrettyName(),
  15588. 'version' => $package->getVersion(),
  15589. );
  15590. }
  15591. $opts = array('http' =>
  15592. array(
  15593. 'method' => 'POST',
  15594. 'header' => array('Content-Type: application/json'),
  15595. 'content' => json_encode($postData),
  15596. 'timeout' => 6,
  15597. ),
  15598. );
  15599. if (isset($authHeader)) {
  15600. $opts['http']['header'][] = $authHeader;
  15601. }
  15602. $context = StreamContextFactory::getContext($repoUrl, $opts);
  15603. @file_get_contents($repoUrl, false, $context);
  15604. }
  15605. $this->reset();
  15606. }
  15607. private function markForNotification(PackageInterface $package)
  15608. {
  15609. if ($package->getNotificationUrl()) {
  15610. $this->notifiablePackages[$package->getNotificationUrl()][$package->getName()] = $package;
  15611. }
  15612. }
  15613. }
  15614. <?php
  15615. namespace Composer\Installer;
  15616. use Composer\Composer;
  15617. use Composer\DependencyResolver\PolicyInterface;
  15618. use Composer\DependencyResolver\Operation\OperationInterface;
  15619. use Composer\DependencyResolver\Pool;
  15620. use Composer\DependencyResolver\Request;
  15621. use Composer\EventDispatcher\Event;
  15622. use Composer\IO\IOInterface;
  15623. use Composer\Repository\CompositeRepository;
  15624. class InstallerEvent extends Event
  15625. {
  15626. private $composer;
  15627. private $io;
  15628. private $devMode;
  15629. private $policy;
  15630. private $pool;
  15631. private $installedRepo;
  15632. private $request;
  15633. private $operations;
  15634. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  15635. {
  15636. parent::__construct($eventName);
  15637. $this->composer = $composer;
  15638. $this->io = $io;
  15639. $this->devMode = $devMode;
  15640. $this->policy = $policy;
  15641. $this->pool = $pool;
  15642. $this->installedRepo = $installedRepo;
  15643. $this->request = $request;
  15644. $this->operations = $operations;
  15645. }
  15646. public function getComposer()
  15647. {
  15648. return $this->composer;
  15649. }
  15650. public function getIO()
  15651. {
  15652. return $this->io;
  15653. }
  15654. public function isDevMode()
  15655. {
  15656. return $this->devMode;
  15657. }
  15658. public function getPolicy()
  15659. {
  15660. return $this->policy;
  15661. }
  15662. public function getPool()
  15663. {
  15664. return $this->pool;
  15665. }
  15666. public function getInstalledRepo()
  15667. {
  15668. return $this->installedRepo;
  15669. }
  15670. public function getRequest()
  15671. {
  15672. return $this->request;
  15673. }
  15674. public function getOperations()
  15675. {
  15676. return $this->operations;
  15677. }
  15678. }
  15679. <?php
  15680. namespace Composer\Installer;
  15681. class InstallerEvents
  15682. {
  15683. const PRE_DEPENDENCIES_SOLVING = 'pre-dependencies-solving';
  15684. const POST_DEPENDENCIES_SOLVING = 'post-dependencies-solving';
  15685. }
  15686. <?php
  15687. namespace Composer\Installer;
  15688. use Composer\Package\PackageInterface;
  15689. use Composer\Repository\InstalledRepositoryInterface;
  15690. use InvalidArgumentException;
  15691. interface InstallerInterface
  15692. {
  15693. public function supports($packageType);
  15694. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package);
  15695. public function install(InstalledRepositoryInterface $repo, PackageInterface $package);
  15696. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target);
  15697. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package);
  15698. public function getInstallPath(PackageInterface $package);
  15699. }
  15700. <?php
  15701. namespace Composer\Installer;
  15702. use Composer\Composer;
  15703. use Composer\IO\IOInterface;
  15704. use Composer\Repository\InstalledRepositoryInterface;
  15705. use Composer\Package\PackageInterface;
  15706. use Composer\Util\Filesystem;
  15707. use Composer\Util\Silencer;
  15708. use Composer\Util\Platform;
  15709. class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
  15710. {
  15711. protected $composer;
  15712. protected $vendorDir;
  15713. protected $binDir;
  15714. protected $downloadManager;
  15715. protected $io;
  15716. protected $type;
  15717. protected $filesystem;
  15718. protected $binCompat;
  15719. protected $binaryInstaller;
  15720. public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null, BinaryInstaller $binaryInstaller = null)
  15721. {
  15722. $this->composer = $composer;
  15723. $this->downloadManager = $composer->getDownloadManager();
  15724. $this->io = $io;
  15725. $this->type = $type;
  15726. $this->filesystem = $filesystem ?: new Filesystem();
  15727. $this->vendorDir = rtrim($composer->getConfig()->get('vendor-dir'), '/');
  15728. $this->binaryInstaller = $binaryInstaller ?: new BinaryInstaller($this->io, rtrim($composer->getConfig()->get('bin-dir'), '/'), $composer->getConfig()->get('bin-compat'), $this->filesystem);
  15729. }
  15730. public function supports($packageType)
  15731. {
  15732. return $packageType === $this->type || null === $this->type;
  15733. }
  15734. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15735. {
  15736. if (!$repo->hasPackage($package)) {
  15737. return false;
  15738. }
  15739. $installPath = $this->getInstallPath($package);
  15740. if (is_readable($installPath)) {
  15741. return true;
  15742. }
  15743. return (Platform::isWindows() && $this->filesystem->isJunction($installPath)) || is_link($installPath);
  15744. }
  15745. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15746. {
  15747. $this->initializeVendorDir();
  15748. $downloadPath = $this->getInstallPath($package);
  15749. if (!is_readable($downloadPath) && $repo->hasPackage($package)) {
  15750. $this->binaryInstaller->removeBinaries($package);
  15751. }
  15752. $this->installCode($package);
  15753. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package));
  15754. if (!$repo->hasPackage($package)) {
  15755. $repo->addPackage(clone $package);
  15756. }
  15757. }
  15758. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15759. {
  15760. if (!$repo->hasPackage($initial)) {
  15761. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  15762. }
  15763. $this->initializeVendorDir();
  15764. $this->binaryInstaller->removeBinaries($initial);
  15765. $this->updateCode($initial, $target);
  15766. $this->binaryInstaller->installBinaries($target, $this->getInstallPath($target));
  15767. $repo->removePackage($initial);
  15768. if (!$repo->hasPackage($target)) {
  15769. $repo->addPackage(clone $target);
  15770. }
  15771. }
  15772. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15773. {
  15774. if (!$repo->hasPackage($package)) {
  15775. throw new \InvalidArgumentException('Package is not installed: '.$package);
  15776. }
  15777. $this->removeCode($package);
  15778. $this->binaryInstaller->removeBinaries($package);
  15779. $repo->removePackage($package);
  15780. $downloadPath = $this->getPackageBasePath($package);
  15781. if (strpos($package->getName(), '/')) {
  15782. $packageVendorDir = dirname($downloadPath);
  15783. if (is_dir($packageVendorDir) && $this->filesystem->isDirEmpty($packageVendorDir)) {
  15784. Silencer::call('rmdir', $packageVendorDir);
  15785. }
  15786. }
  15787. }
  15788. public function getInstallPath(PackageInterface $package)
  15789. {
  15790. $this->initializeVendorDir();
  15791. $basePath = ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
  15792. $targetDir = $package->getTargetDir();
  15793. return $basePath . ($targetDir ? '/'.$targetDir : '');
  15794. }
  15795. public function ensureBinariesPresence(PackageInterface $package)
  15796. {
  15797. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package), false);
  15798. }
  15799. protected function getPackageBasePath(PackageInterface $package)
  15800. {
  15801. $installPath = $this->getInstallPath($package);
  15802. $targetDir = $package->getTargetDir();
  15803. if ($targetDir) {
  15804. return preg_replace('{/*'.str_replace('/', '/+', preg_quote($targetDir)).'/?$}', '', $installPath);
  15805. }
  15806. return $installPath;
  15807. }
  15808. protected function installCode(PackageInterface $package)
  15809. {
  15810. $downloadPath = $this->getInstallPath($package);
  15811. $this->downloadManager->download($package, $downloadPath);
  15812. }
  15813. protected function updateCode(PackageInterface $initial, PackageInterface $target)
  15814. {
  15815. $initialDownloadPath = $this->getInstallPath($initial);
  15816. $targetDownloadPath = $this->getInstallPath($target);
  15817. if ($targetDownloadPath !== $initialDownloadPath) {
  15818. if (substr($initialDownloadPath, 0, strlen($targetDownloadPath)) === $targetDownloadPath
  15819. || substr($targetDownloadPath, 0, strlen($initialDownloadPath)) === $initialDownloadPath
  15820. ) {
  15821. $this->removeCode($initial);
  15822. $this->installCode($target);
  15823. return;
  15824. }
  15825. $this->filesystem->rename($initialDownloadPath, $targetDownloadPath);
  15826. }
  15827. $this->downloadManager->update($initial, $target, $targetDownloadPath);
  15828. }
  15829. protected function removeCode(PackageInterface $package)
  15830. {
  15831. $downloadPath = $this->getPackageBasePath($package);
  15832. $this->downloadManager->remove($package, $downloadPath);
  15833. }
  15834. protected function initializeVendorDir()
  15835. {
  15836. $this->filesystem->ensureDirectoryExists($this->vendorDir);
  15837. $this->vendorDir = realpath($this->vendorDir);
  15838. }
  15839. }
  15840. <?php
  15841. namespace Composer\Installer;
  15842. use Composer\Repository\InstalledRepositoryInterface;
  15843. use Composer\Package\PackageInterface;
  15844. use Composer\Package\Version\VersionParser;
  15845. use Composer\IO\IOInterface;
  15846. class MetapackageInstaller implements InstallerInterface
  15847. {
  15848. private $io;
  15849. public function __construct(IOInterface $io)
  15850. {
  15851. $this->io = $io;
  15852. }
  15853. public function supports($packageType)
  15854. {
  15855. return $packageType === 'metapackage';
  15856. }
  15857. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15858. {
  15859. return $repo->hasPackage($package);
  15860. }
  15861. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15862. {
  15863. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  15864. $repo->addPackage(clone $package);
  15865. }
  15866. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15867. {
  15868. if (!$repo->hasPackage($initial)) {
  15869. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  15870. }
  15871. $name = $target->getName();
  15872. $from = $initial->getFullPrettyVersion();
  15873. $to = $target->getFullPrettyVersion();
  15874. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  15875. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>)");
  15876. $repo->removePackage($initial);
  15877. $repo->addPackage(clone $target);
  15878. }
  15879. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15880. {
  15881. if (!$repo->hasPackage($package)) {
  15882. throw new \InvalidArgumentException('Package is not installed: '.$package);
  15883. }
  15884. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  15885. $repo->removePackage($package);
  15886. }
  15887. public function getInstallPath(PackageInterface $package)
  15888. {
  15889. return '';
  15890. }
  15891. }
  15892. <?php
  15893. namespace Composer\Installer;
  15894. use Composer\Repository\InstalledRepositoryInterface;
  15895. use Composer\Package\PackageInterface;
  15896. class NoopInstaller implements InstallerInterface
  15897. {
  15898. public function supports($packageType)
  15899. {
  15900. return true;
  15901. }
  15902. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15903. {
  15904. return $repo->hasPackage($package);
  15905. }
  15906. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15907. {
  15908. if (!$repo->hasPackage($package)) {
  15909. $repo->addPackage(clone $package);
  15910. }
  15911. }
  15912. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15913. {
  15914. if (!$repo->hasPackage($initial)) {
  15915. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  15916. }
  15917. $repo->removePackage($initial);
  15918. if (!$repo->hasPackage($target)) {
  15919. $repo->addPackage(clone $target);
  15920. }
  15921. }
  15922. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15923. {
  15924. if (!$repo->hasPackage($package)) {
  15925. throw new \InvalidArgumentException('Package is not installed: '.$package);
  15926. }
  15927. $repo->removePackage($package);
  15928. }
  15929. public function getInstallPath(PackageInterface $package)
  15930. {
  15931. $targetDir = $package->getTargetDir();
  15932. return $package->getPrettyName() . ($targetDir ? '/'.$targetDir : '');
  15933. }
  15934. }
  15935. <?php
  15936. namespace Composer\Installer;
  15937. use Composer\Composer;
  15938. use Composer\IO\IOInterface;
  15939. use Composer\DependencyResolver\Operation\OperationInterface;
  15940. use Composer\DependencyResolver\PolicyInterface;
  15941. use Composer\DependencyResolver\Pool;
  15942. use Composer\DependencyResolver\Request;
  15943. use Composer\Repository\CompositeRepository;
  15944. class PackageEvent extends InstallerEvent
  15945. {
  15946. private $operation;
  15947. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  15948. {
  15949. parent::__construct($eventName, $composer, $io, $devMode, $policy, $pool, $installedRepo, $request, $operations);
  15950. $this->operation = $operation;
  15951. }
  15952. public function getOperation()
  15953. {
  15954. return $this->operation;
  15955. }
  15956. }
  15957. <?php
  15958. namespace Composer\Installer;
  15959. class PackageEvents
  15960. {
  15961. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  15962. const POST_PACKAGE_INSTALL = 'post-package-install';
  15963. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  15964. const POST_PACKAGE_UPDATE = 'post-package-update';
  15965. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  15966. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  15967. }
  15968. <?php
  15969. namespace Composer\Installer;
  15970. use Composer\IO\IOInterface;
  15971. use Composer\Package\PackageInterface;
  15972. use Composer\Util\Filesystem;
  15973. use Composer\Util\ProcessExecutor;
  15974. class PearBinaryInstaller extends BinaryInstaller
  15975. {
  15976. private $installer;
  15977. private $vendorDir;
  15978. public function __construct(IOInterface $io, $binDir, $vendorDir, $binCompat, Filesystem $filesystem, PearInstaller $installer)
  15979. {
  15980. parent::__construct($io, $binDir, $binCompat, $filesystem);
  15981. $this->installer = $installer;
  15982. $this->vendorDir = $vendorDir;
  15983. }
  15984. protected function getBinaries(PackageInterface $package)
  15985. {
  15986. $binariesPath = $this->installer->getInstallPath($package) . '/bin/';
  15987. $binaries = array();
  15988. if (file_exists($binariesPath)) {
  15989. foreach (new \FilesystemIterator($binariesPath, \FilesystemIterator::KEY_AS_FILENAME | \FilesystemIterator::CURRENT_AS_FILEINFO) as $fileName => $value) {
  15990. if (!$value->isDir()) {
  15991. $binaries[] = 'bin/'.$fileName;
  15992. }
  15993. }
  15994. }
  15995. return $binaries;
  15996. }
  15997. protected function initializeBinDir()
  15998. {
  15999. parent::initializeBinDir();
  16000. file_put_contents($this->binDir.'/composer-php', $this->generateUnixyPhpProxyCode());
  16001. @chmod($this->binDir.'/composer-php', 0777 & ~umask());
  16002. file_put_contents($this->binDir.'/composer-php.bat', $this->generateWindowsPhpProxyCode());
  16003. @chmod($this->binDir.'/composer-php.bat', 0777 & ~umask());
  16004. }
  16005. protected function generateWindowsProxyCode($bin, $link)
  16006. {
  16007. $binPath = $this->filesystem->findShortestPath($link, $bin);
  16008. if ('.bat' === substr($bin, -4)) {
  16009. $caller = 'call';
  16010. } else {
  16011. $handle = fopen($bin, 'r');
  16012. $line = fgets($handle);
  16013. fclose($handle);
  16014. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  16015. $caller = trim($match[1]);
  16016. } else {
  16017. $caller = 'php';
  16018. }
  16019. if ($caller === 'php') {
  16020. return "@echo off\r\n".
  16021. "pushd .\r\n".
  16022. "cd %~dp0\r\n".
  16023. "set PHP_PROXY=%CD%\\composer-php.bat\r\n".
  16024. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  16025. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  16026. "popd\r\n".
  16027. "%PHP_PROXY% \"%BIN_TARGET%\" %*\r\n";
  16028. }
  16029. }
  16030. return "@echo off\r\n".
  16031. "pushd .\r\n".
  16032. "cd %~dp0\r\n".
  16033. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  16034. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  16035. "popd\r\n".
  16036. $caller." \"%BIN_TARGET%\" %*\r\n";
  16037. }
  16038. private function generateWindowsPhpProxyCode()
  16039. {
  16040. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  16041. return
  16042. "@echo off\r\n" .
  16043. "setlocal enabledelayedexpansion\r\n" .
  16044. "set BIN_DIR=%~dp0\r\n" .
  16045. "set VENDOR_DIR=%BIN_DIR%\\".$binToVendor."\r\n" .
  16046. "set DIRS=.\r\n" .
  16047. "FOR /D %%V IN (%VENDOR_DIR%\\*) DO (\r\n" .
  16048. " FOR /D %%P IN (%%V\\*) DO (\r\n" .
  16049. " set DIRS=!DIRS!;%%~fP\r\n" .
  16050. " )\r\n" .
  16051. ")\r\n" .
  16052. "php.exe -d include_path=!DIRS! %*\r\n";
  16053. }
  16054. private function generateUnixyPhpProxyCode()
  16055. {
  16056. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  16057. return
  16058. "#!/usr/bin/env sh\n".
  16059. "SRC_DIR=`pwd`\n".
  16060. "BIN_DIR=`dirname $0`\n".
  16061. "VENDOR_DIR=\$BIN_DIR/".escapeshellarg($binToVendor)."\n".
  16062. "DIRS=\"\"\n".
  16063. "for vendor in \$VENDOR_DIR/*; do\n".
  16064. " if [ -d \"\$vendor\" ]; then\n".
  16065. " for package in \$vendor/*; do\n".
  16066. " if [ -d \"\$package\" ]; then\n".
  16067. " DIRS=\"\${DIRS}:\${package}\"\n".
  16068. " fi\n".
  16069. " done\n".
  16070. " fi\n".
  16071. "done\n".
  16072. "php -d include_path=\".\$DIRS\" $@\n";
  16073. }
  16074. }
  16075. <?php
  16076. namespace Composer\Installer;
  16077. use Composer\IO\IOInterface;
  16078. use Composer\Composer;
  16079. use Composer\Downloader\PearPackageExtractor;
  16080. use Composer\Repository\InstalledRepositoryInterface;
  16081. use Composer\Package\PackageInterface;
  16082. use Composer\Util\Platform;
  16083. use Composer\Util\Filesystem;
  16084. class PearInstaller extends LibraryInstaller
  16085. {
  16086. public function __construct(IOInterface $io, Composer $composer, $type = 'pear-library')
  16087. {
  16088. $filesystem = new Filesystem();
  16089. $binaryInstaller = new PearBinaryInstaller($io, rtrim($composer->getConfig()->get('bin-dir'), '/'), rtrim($composer->getConfig()->get('vendor-dir'), '/'), $composer->getConfig()->get('bin-compat'), $filesystem, $this);
  16090. parent::__construct($io, $composer, $type, $filesystem, $binaryInstaller);
  16091. }
  16092. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  16093. {
  16094. $this->uninstall($repo, $initial);
  16095. $this->install($repo, $target);
  16096. }
  16097. protected function installCode(PackageInterface $package)
  16098. {
  16099. parent::installCode($package);
  16100. $isWindows = Platform::isWindows();
  16101. $php_bin = $this->binDir . ($isWindows ? '/composer-php.bat' : '/composer-php');
  16102. if (!$isWindows) {
  16103. $php_bin = '/usr/bin/env ' . $php_bin;
  16104. }
  16105. $installPath = $this->getInstallPath($package);
  16106. $vars = array(
  16107. 'os' => $isWindows ? 'windows' : 'linux',
  16108. 'php_bin' => $php_bin,
  16109. 'pear_php' => $installPath,
  16110. 'php_dir' => $installPath,
  16111. 'bin_dir' => $installPath . '/bin',
  16112. 'data_dir' => $installPath . '/data',
  16113. 'version' => $package->getPrettyVersion(),
  16114. );
  16115. $packageArchive = $this->getInstallPath($package).'/'.pathinfo($package->getDistUrl(), PATHINFO_BASENAME);
  16116. $pearExtractor = new PearPackageExtractor($packageArchive);
  16117. $pearExtractor->extractTo($this->getInstallPath($package), array('php' => '/', 'script' => '/bin', 'data' => '/data'), $vars);
  16118. $this->io->writeError(' Cleaning up', true, IOInterface::VERBOSE);
  16119. $this->filesystem->unlink($packageArchive);
  16120. }
  16121. }
  16122. <?php
  16123. namespace Composer\Installer;
  16124. use Composer\Composer;
  16125. use Composer\IO\IOInterface;
  16126. use Composer\Repository\InstalledRepositoryInterface;
  16127. use Composer\Package\PackageInterface;
  16128. class PluginInstaller extends LibraryInstaller
  16129. {
  16130. private $installationManager;
  16131. public function __construct(IOInterface $io, Composer $composer)
  16132. {
  16133. parent::__construct($io, $composer, 'composer-plugin');
  16134. $this->installationManager = $composer->getInstallationManager();
  16135. }
  16136. public function supports($packageType)
  16137. {
  16138. return $packageType === 'composer-plugin' || $packageType === 'composer-installer';
  16139. }
  16140. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  16141. {
  16142. $extra = $package->getExtra();
  16143. if (empty($extra['class'])) {
  16144. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  16145. }
  16146. parent::install($repo, $package);
  16147. try {
  16148. $this->composer->getPluginManager()->registerPackage($package, true);
  16149. } catch (\Exception $e) {
  16150. $this->io->writeError('Plugin installation failed ('.$e->getMessage().'), rolling back');
  16151. parent::uninstall($repo, $package);
  16152. throw $e;
  16153. }
  16154. }
  16155. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  16156. {
  16157. $extra = $target->getExtra();
  16158. if (empty($extra['class'])) {
  16159. throw new \UnexpectedValueException('Error while installing '.$target->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  16160. }
  16161. parent::update($repo, $initial, $target);
  16162. $this->composer->getPluginManager()->registerPackage($target, true);
  16163. }
  16164. }
  16165. <?php
  16166. namespace Composer\Installer;
  16167. use Composer\Package\PackageInterface;
  16168. use Composer\Downloader\DownloadManager;
  16169. use Composer\Repository\InstalledRepositoryInterface;
  16170. use Composer\Util\Filesystem;
  16171. class ProjectInstaller implements InstallerInterface
  16172. {
  16173. private $installPath;
  16174. private $downloadManager;
  16175. private $filesystem;
  16176. public function __construct($installPath, DownloadManager $dm)
  16177. {
  16178. $this->installPath = rtrim(strtr($installPath, '\\', '/'), '/').'/';
  16179. $this->downloadManager = $dm;
  16180. $this->filesystem = new Filesystem;
  16181. }
  16182. public function supports($packageType)
  16183. {
  16184. return true;
  16185. }
  16186. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  16187. {
  16188. return false;
  16189. }
  16190. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  16191. {
  16192. $installPath = $this->installPath;
  16193. if (file_exists($installPath) && !$this->filesystem->isDirEmpty($installPath)) {
  16194. throw new \InvalidArgumentException("Project directory $installPath is not empty.");
  16195. }
  16196. if (!is_dir($installPath)) {
  16197. mkdir($installPath, 0777, true);
  16198. }
  16199. $this->downloadManager->download($package, $installPath);
  16200. }
  16201. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  16202. {
  16203. throw new \InvalidArgumentException("not supported");
  16204. }
  16205. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  16206. {
  16207. throw new \InvalidArgumentException("not supported");
  16208. }
  16209. public function getInstallPath(PackageInterface $package)
  16210. {
  16211. return $this->installPath;
  16212. }
  16213. }
  16214. <?php
  16215. namespace Composer\Installer;
  16216. use Composer\IO\IOInterface;
  16217. use Composer\Package\PackageInterface;
  16218. use Composer\Repository\RepositoryInterface;
  16219. use Symfony\Component\Console\Formatter\OutputFormatter;
  16220. class SuggestedPackagesReporter
  16221. {
  16222. protected $suggestedPackages = array();
  16223. private $io;
  16224. public function __construct(IOInterface $io)
  16225. {
  16226. $this->io = $io;
  16227. }
  16228. public function getPackages()
  16229. {
  16230. return $this->suggestedPackages;
  16231. }
  16232. public function addPackage($source, $target, $reason)
  16233. {
  16234. $this->suggestedPackages[] = array(
  16235. 'source' => $source,
  16236. 'target' => $target,
  16237. 'reason' => $reason,
  16238. );
  16239. return $this;
  16240. }
  16241. public function addSuggestionsFromPackage(PackageInterface $package)
  16242. {
  16243. $source = $package->getPrettyName();
  16244. foreach ($package->getSuggests() as $target => $reason) {
  16245. $this->addPackage(
  16246. $source,
  16247. $target,
  16248. $reason
  16249. );
  16250. }
  16251. return $this;
  16252. }
  16253. public function output(RepositoryInterface $installedRepo = null)
  16254. {
  16255. $suggestedPackages = $this->getPackages();
  16256. $installedPackages = array();
  16257. if (null !== $installedRepo && ! empty($suggestedPackages)) {
  16258. foreach ($installedRepo->getPackages() as $package) {
  16259. $installedPackages = array_merge(
  16260. $installedPackages,
  16261. $package->getNames()
  16262. );
  16263. }
  16264. }
  16265. foreach ($suggestedPackages as $suggestion) {
  16266. if (in_array($suggestion['target'], $installedPackages)) {
  16267. continue;
  16268. }
  16269. $this->io->writeError(sprintf(
  16270. '%s suggests installing %s%s',
  16271. $suggestion['source'],
  16272. $this->escapeOutput($suggestion['target']),
  16273. $this->escapeOutput('' !== $suggestion['reason'] ? ' ('.$suggestion['reason'].')' : '')
  16274. ));
  16275. }
  16276. return $this;
  16277. }
  16278. private function escapeOutput($string)
  16279. {
  16280. return OutputFormatter::escape(
  16281. $this->removeControlCharacters($string)
  16282. );
  16283. }
  16284. private function removeControlCharacters($string)
  16285. {
  16286. return preg_replace(
  16287. '/[[:cntrl:]]/',
  16288. '',
  16289. str_replace("\n", ' ', $string)
  16290. );
  16291. }
  16292. }
  16293. <?php
  16294. namespace Composer\Json;
  16295. use JsonSchema\Validator;
  16296. use Seld\JsonLint\JsonParser;
  16297. use Seld\JsonLint\ParsingException;
  16298. use Composer\Util\RemoteFilesystem;
  16299. use Composer\IO\IOInterface;
  16300. use Composer\Downloader\TransportException;
  16301. class JsonFile
  16302. {
  16303. const LAX_SCHEMA = 1;
  16304. const STRICT_SCHEMA = 2;
  16305. const JSON_UNESCAPED_SLASHES = 64;
  16306. const JSON_PRETTY_PRINT = 128;
  16307. const JSON_UNESCAPED_UNICODE = 256;
  16308. const COMPOSER_SCHEMA_PATH = '/../../../res/composer-schema.json';
  16309. private $path;
  16310. private $rfs;
  16311. private $io;
  16312. public function __construct($path, RemoteFilesystem $rfs = null, IOInterface $io = null)
  16313. {
  16314. $this->path = $path;
  16315. if (null === $rfs && preg_match('{^https?://}i', $path)) {
  16316. throw new \InvalidArgumentException('http urls require a RemoteFilesystem instance to be passed');
  16317. }
  16318. $this->rfs = $rfs;
  16319. $this->io = $io;
  16320. }
  16321. public function getPath()
  16322. {
  16323. return $this->path;
  16324. }
  16325. public function exists()
  16326. {
  16327. return is_file($this->path);
  16328. }
  16329. public function read()
  16330. {
  16331. try {
  16332. if ($this->rfs) {
  16333. $json = $this->rfs->getContents($this->path, $this->path, false);
  16334. } else {
  16335. if ($this->io && $this->io->isDebug()) {
  16336. $this->io->writeError('Reading ' . $this->path);
  16337. }
  16338. $json = file_get_contents($this->path);
  16339. }
  16340. } catch (TransportException $e) {
  16341. throw new \RuntimeException($e->getMessage(), 0, $e);
  16342. } catch (\Exception $e) {
  16343. throw new \RuntimeException('Could not read '.$this->path."\n\n".$e->getMessage());
  16344. }
  16345. return static::parseJson($json, $this->path);
  16346. }
  16347. public function write(array $hash, $options = 448)
  16348. {
  16349. $dir = dirname($this->path);
  16350. if (!is_dir($dir)) {
  16351. if (file_exists($dir)) {
  16352. throw new \UnexpectedValueException(
  16353. $dir.' exists and is not a directory.'
  16354. );
  16355. }
  16356. if (!@mkdir($dir, 0777, true)) {
  16357. throw new \UnexpectedValueException(
  16358. $dir.' does not exist and could not be created.'
  16359. );
  16360. }
  16361. }
  16362. $retries = 3;
  16363. while ($retries--) {
  16364. try {
  16365. $this->filePutContentsIfModified($this->path, static::encode($hash, $options). ($options & self::JSON_PRETTY_PRINT ? "\n" : ''));
  16366. break;
  16367. } catch (\Exception $e) {
  16368. if ($retries) {
  16369. usleep(500000);
  16370. continue;
  16371. }
  16372. throw $e;
  16373. }
  16374. }
  16375. }
  16376. private function filePutContentsIfModified($path, $content)
  16377. {
  16378. $currentContent = @file_get_contents($path);
  16379. if (!$currentContent || ($currentContent != $content)) {
  16380. return file_put_contents($path, $content);
  16381. }
  16382. return 0;
  16383. }
  16384. public function validateSchema($schema = self::STRICT_SCHEMA, $schemaFile = null)
  16385. {
  16386. $content = file_get_contents($this->path);
  16387. $data = json_decode($content);
  16388. if (null === $data && 'null' !== $content) {
  16389. self::validateSyntax($content, $this->path);
  16390. }
  16391. if (null === $schemaFile) {
  16392. $schemaFile = __DIR__ . self::COMPOSER_SCHEMA_PATH;
  16393. }
  16394. if (false === strpos($schemaFile, '://')) {
  16395. $schemaFile = 'file://' . $schemaFile;
  16396. }
  16397. $schemaData = (object) array('$ref' => $schemaFile);
  16398. if ($schema === self::LAX_SCHEMA) {
  16399. $schemaData->additionalProperties = true;
  16400. $schemaData->required = array();
  16401. }
  16402. $validator = new Validator();
  16403. $validator->check($data, $schemaData);
  16404. if (!$validator->isValid()) {
  16405. $errors = array();
  16406. foreach ((array) $validator->getErrors() as $error) {
  16407. $errors[] = ($error['property'] ? $error['property'].' : ' : '').$error['message'];
  16408. }
  16409. throw new JsonValidationException('"'.$this->path.'" does not match the expected JSON schema', $errors);
  16410. }
  16411. return true;
  16412. }
  16413. public static function encode($data, $options = 448)
  16414. {
  16415. if (PHP_VERSION_ID >= 50400) {
  16416. $json = json_encode($data, $options);
  16417. if (false === $json) {
  16418. self::throwEncodeError(json_last_error());
  16419. }
  16420. if (PHP_VERSION_ID < 50428 || (PHP_VERSION_ID >= 50500 && PHP_VERSION_ID < 50512) || (defined('JSON_C_VERSION') && version_compare(phpversion('json'), '1.3.6', '<'))) {
  16421. $json = preg_replace('/\[\s+\]/', '[]', $json);
  16422. $json = preg_replace('/\{\s+\}/', '{}', $json);
  16423. }
  16424. return $json;
  16425. }
  16426. $json = json_encode($data);
  16427. if (false === $json) {
  16428. self::throwEncodeError(json_last_error());
  16429. }
  16430. $prettyPrint = (bool) ($options & self::JSON_PRETTY_PRINT);
  16431. $unescapeUnicode = (bool) ($options & self::JSON_UNESCAPED_UNICODE);
  16432. $unescapeSlashes = (bool) ($options & self::JSON_UNESCAPED_SLASHES);
  16433. if (!$prettyPrint && !$unescapeUnicode && !$unescapeSlashes) {
  16434. return $json;
  16435. }
  16436. return JsonFormatter::format($json, $unescapeUnicode, $unescapeSlashes);
  16437. }
  16438. private static function throwEncodeError($code)
  16439. {
  16440. switch ($code) {
  16441. case JSON_ERROR_DEPTH:
  16442. $msg = 'Maximum stack depth exceeded';
  16443. break;
  16444. case JSON_ERROR_STATE_MISMATCH:
  16445. $msg = 'Underflow or the modes mismatch';
  16446. break;
  16447. case JSON_ERROR_CTRL_CHAR:
  16448. $msg = 'Unexpected control character found';
  16449. break;
  16450. case JSON_ERROR_UTF8:
  16451. $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  16452. break;
  16453. default:
  16454. $msg = 'Unknown error';
  16455. }
  16456. throw new \RuntimeException('JSON encoding failed: '.$msg);
  16457. }
  16458. public static function parseJson($json, $file = null)
  16459. {
  16460. if (null === $json) {
  16461. return;
  16462. }
  16463. $data = json_decode($json, true);
  16464. if (null === $data && JSON_ERROR_NONE !== json_last_error()) {
  16465. self::validateSyntax($json, $file);
  16466. }
  16467. return $data;
  16468. }
  16469. protected static function validateSyntax($json, $file = null)
  16470. {
  16471. $parser = new JsonParser();
  16472. $result = $parser->lint($json);
  16473. if (null === $result) {
  16474. if (defined('JSON_ERROR_UTF8') && JSON_ERROR_UTF8 === json_last_error()) {
  16475. throw new \UnexpectedValueException('"'.$file.'" is not UTF-8, could not parse as JSON');
  16476. }
  16477. return true;
  16478. }
  16479. throw new ParsingException('"'.$file.'" does not contain valid JSON'."\n".$result->getMessage(), $result->getDetails());
  16480. }
  16481. }
  16482. <?php
  16483. namespace Composer\Json;
  16484. class JsonFormatter
  16485. {
  16486. public static function format($json, $unescapeUnicode, $unescapeSlashes)
  16487. {
  16488. $result = '';
  16489. $pos = 0;
  16490. $strLen = strlen($json);
  16491. $indentStr = ' ';
  16492. $newLine = "\n";
  16493. $outOfQuotes = true;
  16494. $buffer = '';
  16495. $noescape = true;
  16496. for ($i = 0; $i < $strLen; $i++) {
  16497. $char = substr($json, $i, 1);
  16498. if ('"' === $char && $noescape) {
  16499. $outOfQuotes = !$outOfQuotes;
  16500. }
  16501. if (!$outOfQuotes) {
  16502. $buffer .= $char;
  16503. $noescape = '\\' === $char ? !$noescape : true;
  16504. continue;
  16505. } elseif ('' !== $buffer) {
  16506. if ($unescapeSlashes) {
  16507. $buffer = str_replace('\\/', '/', $buffer);
  16508. }
  16509. if ($unescapeUnicode && function_exists('mb_convert_encoding')) {
  16510. $buffer = preg_replace_callback('/(\\\\+)u([0-9a-f]{4})/i', function ($match) {
  16511. $l = strlen($match[1]);
  16512. if ($l % 2) {
  16513. $code = hexdec($match[2]);
  16514. if (0xD800 <= $code && 0xDFFF >= $code) {
  16515. return $match[0];
  16516. }
  16517. return str_repeat('\\', $l - 1) . mb_convert_encoding(
  16518. pack('H*', $match[2]),
  16519. 'UTF-8',
  16520. 'UCS-2BE'
  16521. );
  16522. }
  16523. return $match[0];
  16524. }, $buffer);
  16525. }
  16526. $result .= $buffer.$char;
  16527. $buffer = '';
  16528. continue;
  16529. }
  16530. if (':' === $char) {
  16531. $char .= ' ';
  16532. } elseif ('}' === $char || ']' === $char) {
  16533. $pos--;
  16534. $prevChar = substr($json, $i - 1, 1);
  16535. if ('{' !== $prevChar && '[' !== $prevChar) {
  16536. $result .= $newLine;
  16537. for ($j = 0; $j < $pos; $j++) {
  16538. $result .= $indentStr;
  16539. }
  16540. } else {
  16541. $result = rtrim($result);
  16542. }
  16543. }
  16544. $result .= $char;
  16545. if (',' === $char || '{' === $char || '[' === $char) {
  16546. $result .= $newLine;
  16547. if ('{' === $char || '[' === $char) {
  16548. $pos++;
  16549. }
  16550. for ($j = 0; $j < $pos; $j++) {
  16551. $result .= $indentStr;
  16552. }
  16553. }
  16554. }
  16555. return $result;
  16556. }
  16557. }
  16558. <?php
  16559. namespace Composer\Json;
  16560. use Composer\Repository\PlatformRepository;
  16561. class JsonManipulator
  16562. {
  16563. private static $DEFINES = '(?(DEFINE)
  16564. (?<number> -? (?= [1-9]|0(?!\d) ) \d+ (\.\d+)? ([eE] [+-]? \d+)? )
  16565. (?<boolean> true | false | null )
  16566. (?<string> " ([^"\\\\]* | \\\\ ["\\\\bfnrt\/] | \\\\ u [0-9A-Fa-f]{4} )* " )
  16567. (?<array> \[ (?: (?&json) \s* (?: , (?&json) \s* )* )? \s* \] )
  16568. (?<pair> \s* (?&string) \s* : (?&json) \s* )
  16569. (?<object> \{ (?: (?&pair) (?: , (?&pair) )* )? \s* \} )
  16570. (?<json> \s* (?: (?&number) | (?&boolean) | (?&string) | (?&array) | (?&object) ) )
  16571. )';
  16572. private $contents;
  16573. private $newline;
  16574. private $indent;
  16575. public function __construct($contents)
  16576. {
  16577. $contents = trim($contents);
  16578. if ($contents === '') {
  16579. $contents = '{}';
  16580. }
  16581. if (!$this->pregMatch('#^\{(.*)\}$#s', $contents)) {
  16582. throw new \InvalidArgumentException('The json file must be an object ({})');
  16583. }
  16584. $this->newline = false !== strpos($contents, "\r\n") ? "\r\n" : "\n";
  16585. $this->contents = $contents === '{}' ? '{' . $this->newline . '}' : $contents;
  16586. $this->detectIndenting();
  16587. }
  16588. public function getContents()
  16589. {
  16590. return $this->contents . $this->newline;
  16591. }
  16592. public function addLink($type, $package, $constraint, $sortPackages = false)
  16593. {
  16594. $decoded = JsonFile::parseJson($this->contents);
  16595. if (!isset($decoded[$type])) {
  16596. return $this->addMainKey($type, array($package => $constraint));
  16597. }
  16598. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  16599. '(?P<property>'.preg_quote(JsonFile::encode($type)).'\s*:\s*)(?P<value>(?&json))(?P<end>.*)}sx';
  16600. if (!$this->pregMatch($regex, $this->contents, $matches)) {
  16601. return false;
  16602. }
  16603. $links = $matches['value'];
  16604. $packageRegex = str_replace('/', '\\\\?/', preg_quote($package));
  16605. $regex = '{'.self::$DEFINES.'"(?P<package>'.$packageRegex.')"(\s*:\s*)(?&string)}ix';
  16606. if ($this->pregMatch($regex, $links, $packageMatches)) {
  16607. $existingPackage = $packageMatches['package'];
  16608. $packageRegex = str_replace('/', '\\\\?/', preg_quote($existingPackage));
  16609. $links = preg_replace_callback('{'.self::$DEFINES.'"'.$packageRegex.'"(?P<separator>\s*:\s*)(?&string)}ix', function ($m) use ($existingPackage, $constraint) {
  16610. return JsonFile::encode(str_replace('\\/', '/', $existingPackage)) . $m['separator'] . '"' . $constraint . '"';
  16611. }, $links);
  16612. } else {
  16613. if ($this->pregMatch('#^\s*\{\s*\S+.*?(\s*\}\s*)$#s', $links, $match)) {
  16614. $links = preg_replace(
  16615. '{'.preg_quote($match[1]).'$}',
  16616. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $match[1], '\\$'),
  16617. $links
  16618. );
  16619. } else {
  16620. $links = '{' . $this->newline .
  16621. $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $this->newline .
  16622. $this->indent . '}';
  16623. }
  16624. }
  16625. if (true === $sortPackages) {
  16626. $requirements = json_decode($links, true);
  16627. $this->sortPackages($requirements);
  16628. $links = $this->format($requirements);
  16629. }
  16630. $this->contents = $matches['start'] . $matches['property'] . $links . $matches['end'];
  16631. return true;
  16632. }
  16633. private function sortPackages(array &$packages = array())
  16634. {
  16635. $prefix = function ($requirement) {
  16636. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $requirement)) {
  16637. return preg_replace(
  16638. array(
  16639. '/^php/',
  16640. '/^hhvm/',
  16641. '/^ext/',
  16642. '/^lib/',
  16643. '/^\D/',
  16644. ),
  16645. array(
  16646. '0-$0',
  16647. '1-$0',
  16648. '2-$0',
  16649. '3-$0',
  16650. '4-$0',
  16651. ),
  16652. $requirement
  16653. );
  16654. }
  16655. return '5-'.$requirement;
  16656. };
  16657. uksort($packages, function ($a, $b) use ($prefix) {
  16658. return strnatcmp($prefix($a), $prefix($b));
  16659. });
  16660. }
  16661. public function addRepository($name, $config)
  16662. {
  16663. return $this->addSubNode('repositories', $name, $config);
  16664. }
  16665. public function removeRepository($name)
  16666. {
  16667. return $this->removeSubNode('repositories', $name);
  16668. }
  16669. public function addConfigSetting($name, $value)
  16670. {
  16671. return $this->addSubNode('config', $name, $value);
  16672. }
  16673. public function removeConfigSetting($name)
  16674. {
  16675. return $this->removeSubNode('config', $name);
  16676. }
  16677. public function addProperty($name, $value)
  16678. {
  16679. if (substr($name, 0, 8) === 'suggest.') {
  16680. return $this->addSubNode('suggest', substr($name, 8), $value);
  16681. }
  16682. if (substr($name, 0, 6) === 'extra.') {
  16683. return $this->addSubNode('extra', substr($name, 6), $value);
  16684. }
  16685. if (substr($name, 0, 8) === 'scripts.') {
  16686. return $this->addSubNode('scripts', substr($name, 8), $value);
  16687. }
  16688. return $this->addMainKey($name, $value);
  16689. }
  16690. public function removeProperty($name)
  16691. {
  16692. if (substr($name, 0, 8) === 'suggest.') {
  16693. return $this->removeSubNode('suggest', substr($name, 8));
  16694. }
  16695. if (substr($name, 0, 6) === 'extra.') {
  16696. return $this->removeSubNode('extra', substr($name, 6));
  16697. }
  16698. if (substr($name, 0, 8) === 'scripts.') {
  16699. return $this->removeSubNode('scripts', substr($name, 8));
  16700. }
  16701. return $this->removeMainKey($name);
  16702. }
  16703. public function addSubNode($mainNode, $name, $value)
  16704. {
  16705. $decoded = JsonFile::parseJson($this->contents);
  16706. $subName = null;
  16707. if (in_array($mainNode, array('config', 'extra', 'scripts')) && false !== strpos($name, '.')) {
  16708. list($name, $subName) = explode('.', $name, 2);
  16709. }
  16710. if (!isset($decoded[$mainNode])) {
  16711. if ($subName !== null) {
  16712. $this->addMainKey($mainNode, array($name => array($subName => $value)));
  16713. } else {
  16714. $this->addMainKey($mainNode, array($name => $value));
  16715. }
  16716. return true;
  16717. }
  16718. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  16719. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  16720. try {
  16721. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  16722. return false;
  16723. }
  16724. } catch (\RuntimeException $e) {
  16725. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  16726. return false;
  16727. }
  16728. throw $e;
  16729. }
  16730. $children = $match['content'];
  16731. if (!@json_decode($children)) {
  16732. return false;
  16733. }
  16734. $that = $this;
  16735. $childRegex = '{'.self::$DEFINES.'(?P<start>"'.preg_quote($name).'"\s*:\s*)(?P<content>(?&json))(?P<end>,?)}x';
  16736. if ($this->pregMatch($childRegex, $children, $matches)) {
  16737. $children = preg_replace_callback($childRegex, function ($matches) use ($subName, $value, $that) {
  16738. if ($subName !== null) {
  16739. $curVal = json_decode($matches['content'], true);
  16740. if (!is_array($curVal)) {
  16741. $curVal = array();
  16742. }
  16743. $curVal[$subName] = $value;
  16744. $value = $curVal;
  16745. }
  16746. return $matches['start'] . $that->format($value, 1) . $matches['end'];
  16747. }, $children);
  16748. } else {
  16749. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $children, $match);
  16750. $whitespace = '';
  16751. if (!empty($match['trailingspace'])) {
  16752. $whitespace = $match['trailingspace'];
  16753. }
  16754. if (!empty($match['content'])) {
  16755. if ($subName !== null) {
  16756. $value = array($subName => $value);
  16757. }
  16758. $children = preg_replace(
  16759. '#'.$whitespace.'}$#',
  16760. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}', '\\$'),
  16761. $children
  16762. );
  16763. } else {
  16764. if ($subName !== null) {
  16765. $value = array($subName => $value);
  16766. }
  16767. $children = '{' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}';
  16768. }
  16769. }
  16770. $this->contents = preg_replace_callback($nodeRegex, function ($m) use ($children) {
  16771. return $m['start'] . $children . $m['end'];
  16772. }, $this->contents);
  16773. return true;
  16774. }
  16775. public function removeSubNode($mainNode, $name)
  16776. {
  16777. $decoded = JsonFile::parseJson($this->contents);
  16778. if (empty($decoded[$mainNode])) {
  16779. return true;
  16780. }
  16781. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  16782. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  16783. try {
  16784. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  16785. return false;
  16786. }
  16787. } catch (\RuntimeException $e) {
  16788. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  16789. return false;
  16790. }
  16791. throw $e;
  16792. }
  16793. $children = $match['content'];
  16794. if (!@json_decode($children, true)) {
  16795. return false;
  16796. }
  16797. $subName = null;
  16798. if (in_array($mainNode, array('config', 'extra', 'scripts')) && false !== strpos($name, '.')) {
  16799. list($name, $subName) = explode('.', $name, 2);
  16800. }
  16801. if (!isset($decoded[$mainNode][$name]) || ($subName && !isset($decoded[$mainNode][$name][$subName]))) {
  16802. return true;
  16803. }
  16804. $keyRegex = str_replace('/', '\\\\?/', preg_quote($name));
  16805. if ($this->pregMatch('{"'.$keyRegex.'"\s*:}i', $children)) {
  16806. if (preg_match_all('{'.self::$DEFINES.'"'.$keyRegex.'"\s*:\s*(?:(?&json))}x', $children, $matches)) {
  16807. $bestMatch = '';
  16808. foreach ($matches[0] as $match) {
  16809. if (strlen($bestMatch) < strlen($match)) {
  16810. $bestMatch = $match;
  16811. }
  16812. }
  16813. $childrenClean = preg_replace('{,\s*'.preg_quote($bestMatch).'}i', '', $children, -1, $count);
  16814. if (1 !== $count) {
  16815. $childrenClean = preg_replace('{'.preg_quote($bestMatch).'\s*,?\s*}i', '', $childrenClean, -1, $count);
  16816. if (1 !== $count) {
  16817. return false;
  16818. }
  16819. }
  16820. }
  16821. } else {
  16822. $childrenClean = $children;
  16823. }
  16824. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $childrenClean, $match);
  16825. if (empty($match['content'])) {
  16826. $newline = $this->newline;
  16827. $indent = $this->indent;
  16828. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($indent, $newline) {
  16829. return $matches['start'] . '{' . $newline . $indent . '}' . $matches['end'];
  16830. }, $this->contents);
  16831. if ($subName !== null) {
  16832. $curVal = json_decode($children, true);
  16833. unset($curVal[$name][$subName]);
  16834. $this->addSubNode($mainNode, $name, $curVal[$name]);
  16835. }
  16836. return true;
  16837. }
  16838. $that = $this;
  16839. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($that, $name, $subName, $childrenClean) {
  16840. if ($subName !== null) {
  16841. $curVal = json_decode($matches['content'], true);
  16842. unset($curVal[$name][$subName]);
  16843. $childrenClean = $that->format($curVal, 0);
  16844. }
  16845. return $matches['start'] . $childrenClean . $matches['end'];
  16846. }, $this->contents);
  16847. return true;
  16848. }
  16849. public function addMainKey($key, $content)
  16850. {
  16851. $decoded = JsonFile::parseJson($this->contents);
  16852. $content = $this->format($content);
  16853. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  16854. '(?P<key>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))(?P<end>.*)}sx';
  16855. if (isset($decoded[$key]) && $this->pregMatch($regex, $this->contents, $matches)) {
  16856. if (!@json_decode('{'.$matches['key'].'}')) {
  16857. return false;
  16858. }
  16859. $this->contents = $matches['start'] . JsonFile::encode($key).': '.$content . $matches['end'];
  16860. return true;
  16861. }
  16862. if ($this->pregMatch('#[^{\s](\s*)\}$#', $this->contents, $match)) {
  16863. $this->contents = preg_replace(
  16864. '#'.$match[1].'\}$#',
  16865. addcslashes(',' . $this->newline . $this->indent . JsonFile::encode($key). ': '. $content . $this->newline . '}', '\\$'),
  16866. $this->contents
  16867. );
  16868. return true;
  16869. }
  16870. $this->contents = preg_replace(
  16871. '#\}$#',
  16872. addcslashes($this->indent . JsonFile::encode($key). ': '.$content . $this->newline . '}', '\\$'),
  16873. $this->contents
  16874. );
  16875. return true;
  16876. }
  16877. public function removeMainKey($key)
  16878. {
  16879. $decoded = JsonFile::parseJson($this->contents);
  16880. if (!array_key_exists($key, $decoded)) {
  16881. return true;
  16882. }
  16883. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  16884. '(?P<removal>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))\s*,?\s*(?P<end>.*)}sx';
  16885. if ($this->pregMatch($regex, $this->contents, $matches)) {
  16886. if (!@json_decode('{'.$matches['removal'].'}')) {
  16887. return false;
  16888. }
  16889. if (preg_match('#,\s*$#', $matches['start']) && preg_match('#^\}$#', $matches['end'])) {
  16890. $matches['start'] = rtrim(preg_replace('#,(\s*)$#', '$1', $matches['start']), $this->indent);
  16891. }
  16892. $this->contents = $matches['start'] . $matches['end'];
  16893. if (preg_match('#^\{\s*\}\s*$#', $this->contents)) {
  16894. $this->contents = "{\n}";
  16895. }
  16896. return true;
  16897. }
  16898. return false;
  16899. }
  16900. public function format($data, $depth = 0)
  16901. {
  16902. if (is_array($data)) {
  16903. reset($data);
  16904. if (is_numeric(key($data))) {
  16905. foreach ($data as $key => $val) {
  16906. $data[$key] = $this->format($val, $depth + 1);
  16907. }
  16908. return '['.implode(', ', $data).']';
  16909. }
  16910. $out = '{' . $this->newline;
  16911. $elems = array();
  16912. foreach ($data as $key => $val) {
  16913. $elems[] = str_repeat($this->indent, $depth + 2) . JsonFile::encode($key). ': '.$this->format($val, $depth + 1);
  16914. }
  16915. return $out . implode(','.$this->newline, $elems) . $this->newline . str_repeat($this->indent, $depth + 1) . '}';
  16916. }
  16917. return JsonFile::encode($data);
  16918. }
  16919. protected function detectIndenting()
  16920. {
  16921. if ($this->pregMatch('{^([ \t]+)"}m', $this->contents, $match)) {
  16922. $this->indent = $match[1];
  16923. } else {
  16924. $this->indent = ' ';
  16925. }
  16926. }
  16927. protected function pregMatch($re, $str, &$matches = array())
  16928. {
  16929. $count = preg_match($re, $str, $matches);
  16930. if ($count === false) {
  16931. switch (preg_last_error()) {
  16932. case PREG_NO_ERROR:
  16933. throw new \RuntimeException('Failed to execute regex: PREG_NO_ERROR', PREG_NO_ERROR);
  16934. case PREG_INTERNAL_ERROR:
  16935. throw new \RuntimeException('Failed to execute regex: PREG_INTERNAL_ERROR', PREG_INTERNAL_ERROR);
  16936. case PREG_BACKTRACK_LIMIT_ERROR:
  16937. throw new \RuntimeException('Failed to execute regex: PREG_BACKTRACK_LIMIT_ERROR', PREG_BACKTRACK_LIMIT_ERROR);
  16938. case PREG_RECURSION_LIMIT_ERROR:
  16939. throw new \RuntimeException('Failed to execute regex: PREG_RECURSION_LIMIT_ERROR', PREG_RECURSION_LIMIT_ERROR);
  16940. case PREG_BAD_UTF8_ERROR:
  16941. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_ERROR', PREG_BAD_UTF8_ERROR);
  16942. case PREG_BAD_UTF8_OFFSET_ERROR:
  16943. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_OFFSET_ERROR', PREG_BAD_UTF8_OFFSET_ERROR);
  16944. case 6:
  16945. if (PHP_VERSION_ID > 70000) {
  16946. throw new \RuntimeException('Failed to execute regex: PREG_JIT_STACKLIMIT_ERROR', 6);
  16947. }
  16948. default:
  16949. throw new \RuntimeException('Failed to execute regex: Unknown error');
  16950. }
  16951. }
  16952. return $count;
  16953. }
  16954. }
  16955. <?php
  16956. namespace Composer\Json;
  16957. use Exception;
  16958. class JsonValidationException extends Exception
  16959. {
  16960. protected $errors;
  16961. public function __construct($message, $errors = array(), Exception $previous = null)
  16962. {
  16963. $this->errors = $errors;
  16964. parent::__construct($message, 0, $previous);
  16965. }
  16966. public function getErrors()
  16967. {
  16968. return $this->errors;
  16969. }
  16970. }
  16971. <?php
  16972. namespace Composer\Package;
  16973. use Composer\Semver\Constraint\Constraint;
  16974. use Composer\Package\Version\VersionParser;
  16975. class AliasPackage extends BasePackage implements CompletePackageInterface
  16976. {
  16977. protected $version;
  16978. protected $prettyVersion;
  16979. protected $dev;
  16980. protected $rootPackageAlias = false;
  16981. protected $stability;
  16982. protected $aliasOf;
  16983. protected $requires;
  16984. protected $devRequires;
  16985. protected $conflicts;
  16986. protected $provides;
  16987. protected $replaces;
  16988. public function __construct(PackageInterface $aliasOf, $version, $prettyVersion)
  16989. {
  16990. parent::__construct($aliasOf->getName());
  16991. $this->version = $version;
  16992. $this->prettyVersion = $prettyVersion;
  16993. $this->aliasOf = $aliasOf;
  16994. $this->stability = VersionParser::parseStability($version);
  16995. $this->dev = $this->stability === 'dev';
  16996. foreach (array('requires', 'devRequires', 'conflicts', 'provides', 'replaces') as $type) {
  16997. $links = $aliasOf->{'get' . ucfirst($type)}();
  16998. $this->$type = $this->replaceSelfVersionDependencies($links, $type);
  16999. }
  17000. }
  17001. public function getAliasOf()
  17002. {
  17003. return $this->aliasOf;
  17004. }
  17005. public function getVersion()
  17006. {
  17007. return $this->version;
  17008. }
  17009. public function getStability()
  17010. {
  17011. return $this->stability;
  17012. }
  17013. public function getPrettyVersion()
  17014. {
  17015. return $this->prettyVersion;
  17016. }
  17017. public function isDev()
  17018. {
  17019. return $this->dev;
  17020. }
  17021. public function getRequires()
  17022. {
  17023. return $this->requires;
  17024. }
  17025. public function getConflicts()
  17026. {
  17027. return $this->conflicts;
  17028. }
  17029. public function getProvides()
  17030. {
  17031. return $this->provides;
  17032. }
  17033. public function getReplaces()
  17034. {
  17035. return $this->replaces;
  17036. }
  17037. public function getDevRequires()
  17038. {
  17039. return $this->devRequires;
  17040. }
  17041. public function setRootPackageAlias($value)
  17042. {
  17043. return $this->rootPackageAlias = $value;
  17044. }
  17045. public function isRootPackageAlias()
  17046. {
  17047. return $this->rootPackageAlias;
  17048. }
  17049. protected function replaceSelfVersionDependencies(array $links, $linkType)
  17050. {
  17051. if (in_array($linkType, array('conflicts', 'provides', 'replaces'), true)) {
  17052. $newLinks = array();
  17053. foreach ($links as $link) {
  17054. if ('self.version' === $link->getPrettyConstraint()) {
  17055. $newLinks[] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  17056. }
  17057. }
  17058. $links = array_merge($links, $newLinks);
  17059. } else {
  17060. foreach ($links as $index => $link) {
  17061. if ('self.version' === $link->getPrettyConstraint()) {
  17062. $links[$index] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  17063. }
  17064. }
  17065. }
  17066. return $links;
  17067. }
  17068. public function getType()
  17069. {
  17070. return $this->aliasOf->getType();
  17071. }
  17072. public function getTargetDir()
  17073. {
  17074. return $this->aliasOf->getTargetDir();
  17075. }
  17076. public function getExtra()
  17077. {
  17078. return $this->aliasOf->getExtra();
  17079. }
  17080. public function setInstallationSource($type)
  17081. {
  17082. $this->aliasOf->setInstallationSource($type);
  17083. }
  17084. public function getInstallationSource()
  17085. {
  17086. return $this->aliasOf->getInstallationSource();
  17087. }
  17088. public function getSourceType()
  17089. {
  17090. return $this->aliasOf->getSourceType();
  17091. }
  17092. public function getSourceUrl()
  17093. {
  17094. return $this->aliasOf->getSourceUrl();
  17095. }
  17096. public function getSourceUrls()
  17097. {
  17098. return $this->aliasOf->getSourceUrls();
  17099. }
  17100. public function getSourceReference()
  17101. {
  17102. return $this->aliasOf->getSourceReference();
  17103. }
  17104. public function setSourceReference($reference)
  17105. {
  17106. return $this->aliasOf->setSourceReference($reference);
  17107. }
  17108. public function setSourceMirrors($mirrors)
  17109. {
  17110. return $this->aliasOf->setSourceMirrors($mirrors);
  17111. }
  17112. public function getSourceMirrors()
  17113. {
  17114. return $this->aliasOf->getSourceMirrors();
  17115. }
  17116. public function getDistType()
  17117. {
  17118. return $this->aliasOf->getDistType();
  17119. }
  17120. public function getDistUrl()
  17121. {
  17122. return $this->aliasOf->getDistUrl();
  17123. }
  17124. public function getDistUrls()
  17125. {
  17126. return $this->aliasOf->getDistUrls();
  17127. }
  17128. public function getDistReference()
  17129. {
  17130. return $this->aliasOf->getDistReference();
  17131. }
  17132. public function setDistReference($reference)
  17133. {
  17134. return $this->aliasOf->setDistReference($reference);
  17135. }
  17136. public function getDistSha1Checksum()
  17137. {
  17138. return $this->aliasOf->getDistSha1Checksum();
  17139. }
  17140. public function setTransportOptions(array $options)
  17141. {
  17142. return $this->aliasOf->setTransportOptions($options);
  17143. }
  17144. public function getTransportOptions()
  17145. {
  17146. return $this->aliasOf->getTransportOptions();
  17147. }
  17148. public function setDistMirrors($mirrors)
  17149. {
  17150. return $this->aliasOf->setDistMirrors($mirrors);
  17151. }
  17152. public function getDistMirrors()
  17153. {
  17154. return $this->aliasOf->getDistMirrors();
  17155. }
  17156. public function getScripts()
  17157. {
  17158. return $this->aliasOf->getScripts();
  17159. }
  17160. public function getLicense()
  17161. {
  17162. return $this->aliasOf->getLicense();
  17163. }
  17164. public function getAutoload()
  17165. {
  17166. return $this->aliasOf->getAutoload();
  17167. }
  17168. public function getDevAutoload()
  17169. {
  17170. return $this->aliasOf->getDevAutoload();
  17171. }
  17172. public function getIncludePaths()
  17173. {
  17174. return $this->aliasOf->getIncludePaths();
  17175. }
  17176. public function getRepositories()
  17177. {
  17178. return $this->aliasOf->getRepositories();
  17179. }
  17180. public function getReleaseDate()
  17181. {
  17182. return $this->aliasOf->getReleaseDate();
  17183. }
  17184. public function getBinaries()
  17185. {
  17186. return $this->aliasOf->getBinaries();
  17187. }
  17188. public function getKeywords()
  17189. {
  17190. return $this->aliasOf->getKeywords();
  17191. }
  17192. public function getDescription()
  17193. {
  17194. return $this->aliasOf->getDescription();
  17195. }
  17196. public function getHomepage()
  17197. {
  17198. return $this->aliasOf->getHomepage();
  17199. }
  17200. public function getSuggests()
  17201. {
  17202. return $this->aliasOf->getSuggests();
  17203. }
  17204. public function getAuthors()
  17205. {
  17206. return $this->aliasOf->getAuthors();
  17207. }
  17208. public function getSupport()
  17209. {
  17210. return $this->aliasOf->getSupport();
  17211. }
  17212. public function getFunding()
  17213. {
  17214. return $this->aliasOf->getFunding();
  17215. }
  17216. public function getNotificationUrl()
  17217. {
  17218. return $this->aliasOf->getNotificationUrl();
  17219. }
  17220. public function getArchiveExcludes()
  17221. {
  17222. return $this->aliasOf->getArchiveExcludes();
  17223. }
  17224. public function isAbandoned()
  17225. {
  17226. return $this->aliasOf->isAbandoned();
  17227. }
  17228. public function getReplacementPackage()
  17229. {
  17230. return $this->aliasOf->getReplacementPackage();
  17231. }
  17232. public function __toString()
  17233. {
  17234. return parent::__toString().' (alias of '.$this->aliasOf->getVersion().')';
  17235. }
  17236. public function setDistUrl($url)
  17237. {
  17238. return $this->aliasOf->setDistUrl($url);
  17239. }
  17240. public function setDistType($type)
  17241. {
  17242. return $this->aliasOf->setDistType($type);
  17243. }
  17244. }
  17245. <?php
  17246. namespace Composer\Package\Archiver;
  17247. use FilterIterator;
  17248. use PharData;
  17249. class ArchivableFilesFilter extends FilterIterator
  17250. {
  17251. private $dirs = array();
  17252. public function accept()
  17253. {
  17254. $file = $this->getInnerIterator()->current();
  17255. if ($file->isDir()) {
  17256. $this->dirs[] = (string) $file;
  17257. return false;
  17258. }
  17259. return true;
  17260. }
  17261. public function addEmptyDir(PharData $phar, $sources)
  17262. {
  17263. foreach ($this->dirs as $filepath) {
  17264. $localname = str_replace($sources . "/", '', $filepath);
  17265. $phar->addEmptyDir($localname);
  17266. }
  17267. }
  17268. }
  17269. <?php
  17270. namespace Composer\Package\Archiver;
  17271. use Composer\Util\Filesystem;
  17272. use FilesystemIterator;
  17273. use Symfony\Component\Finder\Finder;
  17274. use Symfony\Component\Finder\SplFileInfo;
  17275. class ArchivableFilesFinder extends \FilterIterator
  17276. {
  17277. protected $finder;
  17278. public function __construct($sources, array $excludes, $ignoreFilters = false)
  17279. {
  17280. $fs = new Filesystem();
  17281. $sources = $fs->normalizePath($sources);
  17282. if ($ignoreFilters) {
  17283. $filters = array();
  17284. } else {
  17285. $filters = array(
  17286. new HgExcludeFilter($sources),
  17287. new GitExcludeFilter($sources),
  17288. new ComposerExcludeFilter($sources, $excludes),
  17289. );
  17290. }
  17291. $this->finder = new Finder();
  17292. $filter = function (\SplFileInfo $file) use ($sources, $filters, $fs) {
  17293. if ($file->isLink() && strpos($file->getLinkTarget(), $sources) !== 0) {
  17294. return false;
  17295. }
  17296. $relativePath = preg_replace(
  17297. '#^'.preg_quote($sources, '#').'#',
  17298. '',
  17299. $fs->normalizePath($file->getRealPath())
  17300. );
  17301. $exclude = false;
  17302. foreach ($filters as $filter) {
  17303. $exclude = $filter->filter($relativePath, $exclude);
  17304. }
  17305. return !$exclude;
  17306. };
  17307. if (method_exists($filter, 'bindTo')) {
  17308. $filter = $filter->bindTo(null);
  17309. }
  17310. $this->finder
  17311. ->in($sources)
  17312. ->filter($filter)
  17313. ->ignoreVCS(true)
  17314. ->ignoreDotFiles(false);
  17315. parent::__construct($this->finder->getIterator());
  17316. }
  17317. public function accept()
  17318. {
  17319. $current = $this->getInnerIterator()->current();
  17320. if (!$current->isDir()) {
  17321. return true;
  17322. }
  17323. $iterator = new FilesystemIterator($current, FilesystemIterator::SKIP_DOTS);
  17324. return !$iterator->valid();
  17325. }
  17326. }
  17327. <?php
  17328. namespace Composer\Package\Archiver;
  17329. use Composer\Downloader\DownloadManager;
  17330. use Composer\Package\PackageInterface;
  17331. use Composer\Package\RootPackageInterface;
  17332. use Composer\Util\Filesystem;
  17333. use Composer\Json\JsonFile;
  17334. class ArchiveManager
  17335. {
  17336. protected $downloadManager;
  17337. protected $archivers = array();
  17338. protected $overwriteFiles = true;
  17339. public function __construct(DownloadManager $downloadManager)
  17340. {
  17341. $this->downloadManager = $downloadManager;
  17342. }
  17343. public function addArchiver(ArchiverInterface $archiver)
  17344. {
  17345. $this->archivers[] = $archiver;
  17346. }
  17347. public function setOverwriteFiles($overwriteFiles)
  17348. {
  17349. $this->overwriteFiles = $overwriteFiles;
  17350. return $this;
  17351. }
  17352. public function getPackageFilename(PackageInterface $package)
  17353. {
  17354. $nameParts = array(preg_replace('#[^a-z0-9-_]#i', '-', $package->getName()));
  17355. if (preg_match('{^[a-f0-9]{40}$}', $package->getDistReference())) {
  17356. array_push($nameParts, $package->getDistReference(), $package->getDistType());
  17357. } else {
  17358. array_push($nameParts, $package->getPrettyVersion(), $package->getDistReference());
  17359. }
  17360. if ($package->getSourceReference()) {
  17361. $nameParts[] = substr(sha1($package->getSourceReference()), 0, 6);
  17362. }
  17363. $name = implode('-', array_filter($nameParts, function ($p) {
  17364. return !empty($p);
  17365. }));
  17366. return str_replace('/', '-', $name);
  17367. }
  17368. public function archive(PackageInterface $package, $format, $targetDir, $fileName = null, $ignoreFilters = false)
  17369. {
  17370. if (empty($format)) {
  17371. throw new \InvalidArgumentException('Format must be specified');
  17372. }
  17373. $usableArchiver = null;
  17374. foreach ($this->archivers as $archiver) {
  17375. if ($archiver->supports($format, $package->getSourceType())) {
  17376. $usableArchiver = $archiver;
  17377. break;
  17378. }
  17379. }
  17380. if (null === $usableArchiver) {
  17381. throw new \RuntimeException(sprintf('No archiver found to support %s format', $format));
  17382. }
  17383. $filesystem = new Filesystem();
  17384. if (null === $fileName) {
  17385. $packageName = $this->getPackageFilename($package);
  17386. } else {
  17387. $packageName = $fileName;
  17388. }
  17389. $filesystem->ensureDirectoryExists($targetDir);
  17390. $target = realpath($targetDir).'/'.$packageName.'.'.$format;
  17391. $filesystem->ensureDirectoryExists(dirname($target));
  17392. if (!$this->overwriteFiles && file_exists($target)) {
  17393. return $target;
  17394. }
  17395. if ($package instanceof RootPackageInterface) {
  17396. $sourcePath = realpath('.');
  17397. } else {
  17398. $sourcePath = sys_get_temp_dir().'/composer_archive'.uniqid();
  17399. $filesystem->ensureDirectoryExists($sourcePath);
  17400. try {
  17401. $this->downloadManager->download($package, $sourcePath);
  17402. } catch (\Exception $e) {
  17403. $filesystem->removeDirectory($sourcePath);
  17404. throw $e;
  17405. }
  17406. if (file_exists($composerJsonPath = $sourcePath.'/composer.json')) {
  17407. $jsonFile = new JsonFile($composerJsonPath);
  17408. $jsonData = $jsonFile->read();
  17409. if (!empty($jsonData['archive']['exclude'])) {
  17410. $package->setArchiveExcludes($jsonData['archive']['exclude']);
  17411. }
  17412. }
  17413. }
  17414. $tempTarget = sys_get_temp_dir().'/composer_archive'.uniqid().'.'.$format;
  17415. $filesystem->ensureDirectoryExists(dirname($tempTarget));
  17416. $archivePath = $usableArchiver->archive($sourcePath, $tempTarget, $format, $package->getArchiveExcludes(), $ignoreFilters);
  17417. $filesystem->rename($archivePath, $target);
  17418. if (!$package instanceof RootPackageInterface) {
  17419. $filesystem->removeDirectory($sourcePath);
  17420. }
  17421. $filesystem->remove($tempTarget);
  17422. return $target;
  17423. }
  17424. }
  17425. <?php
  17426. namespace Composer\Package\Archiver;
  17427. interface ArchiverInterface
  17428. {
  17429. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false);
  17430. public function supports($format, $sourceType);
  17431. }
  17432. <?php
  17433. namespace Composer\Package\Archiver;
  17434. use Symfony\Component\Finder;
  17435. abstract class BaseExcludeFilter
  17436. {
  17437. protected $sourcePath;
  17438. protected $excludePatterns;
  17439. public function __construct($sourcePath)
  17440. {
  17441. $this->sourcePath = $sourcePath;
  17442. $this->excludePatterns = array();
  17443. }
  17444. public function filter($relativePath, $exclude)
  17445. {
  17446. foreach ($this->excludePatterns as $patternData) {
  17447. list($pattern, $negate, $stripLeadingSlash) = $patternData;
  17448. if ($stripLeadingSlash) {
  17449. $path = substr($relativePath, 1);
  17450. } else {
  17451. $path = $relativePath;
  17452. }
  17453. if (preg_match($pattern, $path)) {
  17454. $exclude = !$negate;
  17455. }
  17456. }
  17457. return $exclude;
  17458. }
  17459. protected function parseLines(array $lines, $lineParser)
  17460. {
  17461. return array_filter(
  17462. array_map(
  17463. function ($line) use ($lineParser) {
  17464. $line = trim($line);
  17465. if (!$line || 0 === strpos($line, '#')) {
  17466. return null;
  17467. }
  17468. return call_user_func($lineParser, $line);
  17469. },
  17470. $lines
  17471. ),
  17472. function ($pattern) {
  17473. return $pattern !== null;
  17474. }
  17475. );
  17476. }
  17477. protected function generatePatterns($rules)
  17478. {
  17479. $patterns = array();
  17480. foreach ($rules as $rule) {
  17481. $patterns[] = $this->generatePattern($rule);
  17482. }
  17483. return $patterns;
  17484. }
  17485. protected function generatePattern($rule)
  17486. {
  17487. $negate = false;
  17488. $pattern = '{';
  17489. if (strlen($rule) && $rule[0] === '!') {
  17490. $negate = true;
  17491. $rule = substr($rule, 1);
  17492. }
  17493. if (strlen($rule) && $rule[0] === '/') {
  17494. $pattern .= '^/';
  17495. $rule = substr($rule, 1);
  17496. } elseif (strlen($rule) - 1 === strpos($rule, '/')) {
  17497. $pattern .= '/';
  17498. $rule = substr($rule, 0, -1);
  17499. } elseif (false === strpos($rule, '/')) {
  17500. $pattern .= '/';
  17501. }
  17502. $pattern .= substr(Finder\Glob::toRegex($rule), 2, -2) . '(?=$|/)';
  17503. return array($pattern . '}', $negate, false);
  17504. }
  17505. }
  17506. <?php
  17507. namespace Composer\Package\Archiver;
  17508. class ComposerExcludeFilter extends BaseExcludeFilter
  17509. {
  17510. public function __construct($sourcePath, array $excludeRules)
  17511. {
  17512. parent::__construct($sourcePath);
  17513. $this->excludePatterns = $this->generatePatterns($excludeRules);
  17514. }
  17515. }
  17516. <?php
  17517. namespace Composer\Package\Archiver;
  17518. class GitExcludeFilter extends BaseExcludeFilter
  17519. {
  17520. public function __construct($sourcePath)
  17521. {
  17522. parent::__construct($sourcePath);
  17523. if (file_exists($sourcePath.'/.gitignore')) {
  17524. $this->excludePatterns = $this->parseLines(
  17525. file($sourcePath.'/.gitignore'),
  17526. array($this, 'parseGitIgnoreLine')
  17527. );
  17528. }
  17529. if (file_exists($sourcePath.'/.gitattributes')) {
  17530. $this->excludePatterns = array_merge(
  17531. $this->excludePatterns,
  17532. $this->parseLines(
  17533. file($sourcePath.'/.gitattributes'),
  17534. array($this, 'parseGitAttributesLine')
  17535. )
  17536. );
  17537. }
  17538. }
  17539. public function parseGitIgnoreLine($line)
  17540. {
  17541. return $this->generatePattern($line);
  17542. }
  17543. public function parseGitAttributesLine($line)
  17544. {
  17545. $parts = preg_split('#\s+#', $line);
  17546. if (count($parts) == 2 && $parts[1] === 'export-ignore') {
  17547. return $this->generatePattern($parts[0]);
  17548. }
  17549. return null;
  17550. }
  17551. }
  17552. <?php
  17553. namespace Composer\Package\Archiver;
  17554. use Symfony\Component\Finder;
  17555. class HgExcludeFilter extends BaseExcludeFilter
  17556. {
  17557. const HG_IGNORE_REGEX = 1;
  17558. const HG_IGNORE_GLOB = 2;
  17559. protected $patternMode;
  17560. public function __construct($sourcePath)
  17561. {
  17562. parent::__construct($sourcePath);
  17563. $this->patternMode = self::HG_IGNORE_REGEX;
  17564. if (file_exists($sourcePath.'/.hgignore')) {
  17565. $this->excludePatterns = $this->parseLines(
  17566. file($sourcePath.'/.hgignore'),
  17567. array($this, 'parseHgIgnoreLine')
  17568. );
  17569. }
  17570. }
  17571. public function parseHgIgnoreLine($line)
  17572. {
  17573. if (preg_match('#^syntax\s*:\s*(glob|regexp)$#', $line, $matches)) {
  17574. if ($matches[1] === 'glob') {
  17575. $this->patternMode = self::HG_IGNORE_GLOB;
  17576. } else {
  17577. $this->patternMode = self::HG_IGNORE_REGEX;
  17578. }
  17579. return null;
  17580. }
  17581. if ($this->patternMode == self::HG_IGNORE_GLOB) {
  17582. return $this->patternFromGlob($line);
  17583. }
  17584. return $this->patternFromRegex($line);
  17585. }
  17586. protected function patternFromGlob($line)
  17587. {
  17588. $pattern = '#'.substr(Finder\Glob::toRegex($line), 2, -1).'#';
  17589. $pattern = str_replace('[^/]*', '.*', $pattern);
  17590. return array($pattern, false, true);
  17591. }
  17592. public function patternFromRegex($line)
  17593. {
  17594. $pattern = '#'.preg_replace('/((?:\\\\\\\\)*)(\\\\?)#/', '\1\2\2\\#', $line).'#';
  17595. return array($pattern, false, true);
  17596. }
  17597. }
  17598. <?php
  17599. namespace Composer\Package\Archiver;
  17600. class PharArchiver implements ArchiverInterface
  17601. {
  17602. protected static $formats = array(
  17603. 'zip' => \Phar::ZIP,
  17604. 'tar' => \Phar::TAR,
  17605. 'tar.gz' => \Phar::TAR,
  17606. 'tar.bz2' => \Phar::TAR,
  17607. );
  17608. protected static $compressFormats = array(
  17609. 'tar.gz' => \Phar::GZ,
  17610. 'tar.bz2' => \Phar::BZ2,
  17611. );
  17612. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  17613. {
  17614. $sources = realpath($sources);
  17615. if (file_exists($target)) {
  17616. unlink($target);
  17617. }
  17618. try {
  17619. $filename = substr($target, 0, strrpos($target, $format) - 1);
  17620. if (isset(static::$compressFormats[$format])) {
  17621. $target = $filename . '.tar';
  17622. }
  17623. $phar = new \PharData($target, null, null, static::$formats[$format]);
  17624. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  17625. $filesOnly = new ArchivableFilesFilter($files);
  17626. $phar->buildFromIterator($filesOnly, $sources);
  17627. $filesOnly->addEmptyDir($phar, $sources);
  17628. if (isset(static::$compressFormats[$format])) {
  17629. if (!$phar->canCompress(static::$compressFormats[$format])) {
  17630. throw new \RuntimeException(sprintf('Can not compress to %s format', $format));
  17631. }
  17632. unlink($target);
  17633. $phar->compress(static::$compressFormats[$format]);
  17634. $target = $filename . '.' . $format;
  17635. }
  17636. return $target;
  17637. } catch (\UnexpectedValueException $e) {
  17638. $message = sprintf(
  17639. "Could not create archive '%s' from '%s': %s",
  17640. $target,
  17641. $sources,
  17642. $e->getMessage()
  17643. );
  17644. throw new \RuntimeException($message, $e->getCode(), $e);
  17645. }
  17646. }
  17647. public function supports($format, $sourceType)
  17648. {
  17649. return isset(static::$formats[$format]);
  17650. }
  17651. }
  17652. <?php
  17653. namespace Composer\Package\Archiver;
  17654. use ZipArchive;
  17655. use Composer\Util\Filesystem;
  17656. class ZipArchiver implements ArchiverInterface
  17657. {
  17658. protected static $formats = array(
  17659. 'zip' => 1,
  17660. );
  17661. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  17662. {
  17663. $fs = new Filesystem();
  17664. $sources = $fs->normalizePath($sources);
  17665. $zip = new ZipArchive();
  17666. $res = $zip->open($target, ZipArchive::CREATE);
  17667. if ($res === true) {
  17668. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  17669. foreach ($files as $file) {
  17670. $filepath = strtr($file->getPath()."/".$file->getFilename(), '\\', '/');
  17671. $localname = str_replace($sources.'/', '', $filepath);
  17672. if ($file->isDir()) {
  17673. $zip->addEmptyDir($localname);
  17674. } else {
  17675. $zip->addFile($filepath, $localname);
  17676. }
  17677. if (PHP_VERSION_ID >= 50600) {
  17678. $perms = fileperms($filepath);
  17679. $zip->setExternalAttributesName($localname, ZipArchive::OPSYS_UNIX, $perms << 16);
  17680. }
  17681. }
  17682. if ($zip->close()) {
  17683. return $target;
  17684. }
  17685. }
  17686. $message = sprintf(
  17687. "Could not create archive '%s' from '%s': %s",
  17688. $target,
  17689. $sources,
  17690. $zip->getStatusString()
  17691. );
  17692. throw new \RuntimeException($message);
  17693. }
  17694. public function supports($format, $sourceType)
  17695. {
  17696. return isset(static::$formats[$format]) && $this->compressionAvailable();
  17697. }
  17698. private function compressionAvailable()
  17699. {
  17700. return class_exists('ZipArchive');
  17701. }
  17702. }
  17703. <?php
  17704. namespace Composer\Package;
  17705. use Composer\Repository\RepositoryInterface;
  17706. use Composer\Repository\PlatformRepository;
  17707. abstract class BasePackage implements PackageInterface
  17708. {
  17709. public static $supportedLinkTypes = array(
  17710. 'require' => array('description' => 'requires', 'method' => 'requires'),
  17711. 'conflict' => array('description' => 'conflicts', 'method' => 'conflicts'),
  17712. 'provide' => array('description' => 'provides', 'method' => 'provides'),
  17713. 'replace' => array('description' => 'replaces', 'method' => 'replaces'),
  17714. 'require-dev' => array('description' => 'requires (for development)', 'method' => 'devRequires'),
  17715. );
  17716. const STABILITY_STABLE = 0;
  17717. const STABILITY_RC = 5;
  17718. const STABILITY_BETA = 10;
  17719. const STABILITY_ALPHA = 15;
  17720. const STABILITY_DEV = 20;
  17721. public static $stabilities = array(
  17722. 'stable' => self::STABILITY_STABLE,
  17723. 'RC' => self::STABILITY_RC,
  17724. 'beta' => self::STABILITY_BETA,
  17725. 'alpha' => self::STABILITY_ALPHA,
  17726. 'dev' => self::STABILITY_DEV,
  17727. );
  17728. public $id;
  17729. protected $name;
  17730. protected $prettyName;
  17731. protected $repository;
  17732. protected $transportOptions = array();
  17733. public function __construct($name)
  17734. {
  17735. $this->prettyName = $name;
  17736. $this->name = strtolower($name);
  17737. $this->id = -1;
  17738. }
  17739. public function getName()
  17740. {
  17741. return $this->name;
  17742. }
  17743. public function getPrettyName()
  17744. {
  17745. return $this->prettyName;
  17746. }
  17747. public function getNames()
  17748. {
  17749. $names = array(
  17750. $this->getName() => true,
  17751. );
  17752. foreach ($this->getProvides() as $link) {
  17753. $names[$link->getTarget()] = true;
  17754. }
  17755. foreach ($this->getReplaces() as $link) {
  17756. $names[$link->getTarget()] = true;
  17757. }
  17758. return array_keys($names);
  17759. }
  17760. public function setId($id)
  17761. {
  17762. $this->id = $id;
  17763. }
  17764. public function getId()
  17765. {
  17766. return $this->id;
  17767. }
  17768. public function setRepository(RepositoryInterface $repository)
  17769. {
  17770. if ($this->repository && $repository !== $this->repository) {
  17771. throw new \LogicException('A package can only be added to one repository');
  17772. }
  17773. $this->repository = $repository;
  17774. }
  17775. public function getRepository()
  17776. {
  17777. return $this->repository;
  17778. }
  17779. public function getTransportOptions()
  17780. {
  17781. return $this->transportOptions;
  17782. }
  17783. public function setTransportOptions(array $options)
  17784. {
  17785. $this->transportOptions = $options;
  17786. }
  17787. public function isPlatform()
  17788. {
  17789. return $this->getRepository() instanceof PlatformRepository;
  17790. }
  17791. public function getUniqueName()
  17792. {
  17793. return $this->getName().'-'.$this->getVersion();
  17794. }
  17795. public function equals(PackageInterface $package)
  17796. {
  17797. $self = $this;
  17798. if ($this instanceof AliasPackage) {
  17799. $self = $this->getAliasOf();
  17800. }
  17801. if ($package instanceof AliasPackage) {
  17802. $package = $package->getAliasOf();
  17803. }
  17804. return $package === $self;
  17805. }
  17806. public function __toString()
  17807. {
  17808. return $this->getUniqueName();
  17809. }
  17810. public function getPrettyString()
  17811. {
  17812. return $this->getPrettyName().' '.$this->getPrettyVersion();
  17813. }
  17814. public function getFullPrettyVersion($truncate = true)
  17815. {
  17816. if (!$this->isDev() || !in_array($this->getSourceType(), array('hg', 'git'))) {
  17817. return $this->getPrettyVersion();
  17818. }
  17819. if ($truncate && strlen($this->getSourceReference()) === 40) {
  17820. return $this->getPrettyVersion() . ' ' . substr($this->getSourceReference(), 0, 7);
  17821. }
  17822. return $this->getPrettyVersion() . ' ' . $this->getSourceReference();
  17823. }
  17824. public function getStabilityPriority()
  17825. {
  17826. return self::$stabilities[$this->getStability()];
  17827. }
  17828. public function __clone()
  17829. {
  17830. $this->repository = null;
  17831. $this->id = -1;
  17832. }
  17833. public static function packageNameToRegexp($allowListPattern, $wrap = '{^%s$}i')
  17834. {
  17835. $cleanedAllowListPattern = str_replace('\\*', '.*', preg_quote($allowListPattern));
  17836. return sprintf($wrap, $cleanedAllowListPattern);
  17837. }
  17838. }
  17839. <?php
  17840. namespace Composer\Package\Comparer;
  17841. class Comparer
  17842. {
  17843. private $source;
  17844. private $update;
  17845. private $changed;
  17846. public function setSource($source)
  17847. {
  17848. $this->source = $source;
  17849. }
  17850. public function setUpdate($update)
  17851. {
  17852. $this->update = $update;
  17853. }
  17854. public function getChanged($toString = false, $explicated = false)
  17855. {
  17856. $changed = $this->changed;
  17857. if (!count($changed)) {
  17858. return false;
  17859. }
  17860. if ($explicated) {
  17861. foreach ($changed as $sectionKey => $itemSection) {
  17862. foreach ($itemSection as $itemKey => $item) {
  17863. $changed[$sectionKey][$itemKey] = $item.' ('.$sectionKey.')';
  17864. }
  17865. }
  17866. }
  17867. if ($toString) {
  17868. foreach ($changed as $sectionKey => $itemSection) {
  17869. foreach ($itemSection as $itemKey => $item) {
  17870. $changed['string'][] = $item."\r\n";
  17871. }
  17872. }
  17873. $changed = implode("\r\n", $changed['string']);
  17874. }
  17875. return $changed;
  17876. }
  17877. public function doCompare()
  17878. {
  17879. $source = array();
  17880. $destination = array();
  17881. $this->changed = array();
  17882. $currentDirectory = getcwd();
  17883. chdir($this->source);
  17884. $source = $this->doTree('.', $source);
  17885. if (!is_array($source)) {
  17886. return;
  17887. }
  17888. chdir($currentDirectory);
  17889. chdir($this->update);
  17890. $destination = $this->doTree('.', $destination);
  17891. if (!is_array($destination)) {
  17892. exit;
  17893. }
  17894. chdir($currentDirectory);
  17895. foreach ($source as $dir => $value) {
  17896. foreach ($value as $file => $hash) {
  17897. if (isset($destination[$dir][$file])) {
  17898. if ($hash !== $destination[$dir][$file]) {
  17899. $this->changed['changed'][] = $dir.'/'.$file;
  17900. }
  17901. } else {
  17902. $this->changed['removed'][] = $dir.'/'.$file;
  17903. }
  17904. }
  17905. }
  17906. foreach ($destination as $dir => $value) {
  17907. foreach ($value as $file => $hash) {
  17908. if (!isset($source[$dir][$file])) {
  17909. $this->changed['added'][] = $dir.'/'.$file;
  17910. }
  17911. }
  17912. }
  17913. }
  17914. private function doTree($dir, &$array)
  17915. {
  17916. if ($dh = opendir($dir)) {
  17917. while ($file = readdir($dh)) {
  17918. if ($file !== '.' && $file !== '..') {
  17919. if (is_dir($dir.'/'.$file)) {
  17920. if (!count($array)) {
  17921. $array[0] = 'Temp';
  17922. }
  17923. if (!$this->doTree($dir.'/'.$file, $array)) {
  17924. return false;
  17925. }
  17926. } else {
  17927. if (filesize($dir.'/'.$file)) {
  17928. set_time_limit(30);
  17929. $array[$dir][$file] = md5_file($dir.'/'.$file);
  17930. }
  17931. }
  17932. }
  17933. }
  17934. if (count($array) > 1 && isset($array['0'])) {
  17935. unset($array['0']);
  17936. }
  17937. return $array;
  17938. }
  17939. return false;
  17940. }
  17941. }
  17942. <?php
  17943. namespace Composer\Package;
  17944. class CompletePackage extends Package implements CompletePackageInterface
  17945. {
  17946. protected $repositories;
  17947. protected $license = array();
  17948. protected $keywords;
  17949. protected $authors;
  17950. protected $description;
  17951. protected $homepage;
  17952. protected $scripts = array();
  17953. protected $support = array();
  17954. protected $funding = array();
  17955. protected $abandoned = false;
  17956. public function setScripts(array $scripts)
  17957. {
  17958. $this->scripts = $scripts;
  17959. }
  17960. public function getScripts()
  17961. {
  17962. return $this->scripts;
  17963. }
  17964. public function setRepositories($repositories)
  17965. {
  17966. $this->repositories = $repositories;
  17967. }
  17968. public function getRepositories()
  17969. {
  17970. return $this->repositories;
  17971. }
  17972. public function setLicense(array $license)
  17973. {
  17974. $this->license = $license;
  17975. }
  17976. public function getLicense()
  17977. {
  17978. return $this->license;
  17979. }
  17980. public function setKeywords(array $keywords)
  17981. {
  17982. $this->keywords = $keywords;
  17983. }
  17984. public function getKeywords()
  17985. {
  17986. return $this->keywords;
  17987. }
  17988. public function setAuthors(array $authors)
  17989. {
  17990. $this->authors = $authors;
  17991. }
  17992. public function getAuthors()
  17993. {
  17994. return $this->authors;
  17995. }
  17996. public function setDescription($description)
  17997. {
  17998. $this->description = $description;
  17999. }
  18000. public function getDescription()
  18001. {
  18002. return $this->description;
  18003. }
  18004. public function setHomepage($homepage)
  18005. {
  18006. $this->homepage = $homepage;
  18007. }
  18008. public function getHomepage()
  18009. {
  18010. return $this->homepage;
  18011. }
  18012. public function setSupport(array $support)
  18013. {
  18014. $this->support = $support;
  18015. }
  18016. public function getSupport()
  18017. {
  18018. return $this->support;
  18019. }
  18020. public function setFunding(array $funding)
  18021. {
  18022. $this->funding = $funding;
  18023. }
  18024. public function getFunding()
  18025. {
  18026. return $this->funding;
  18027. }
  18028. public function isAbandoned()
  18029. {
  18030. return (bool) $this->abandoned;
  18031. }
  18032. public function setAbandoned($abandoned)
  18033. {
  18034. $this->abandoned = $abandoned;
  18035. }
  18036. public function getReplacementPackage()
  18037. {
  18038. return is_string($this->abandoned) ? $this->abandoned : null;
  18039. }
  18040. }
  18041. <?php
  18042. namespace Composer\Package;
  18043. interface CompletePackageInterface extends PackageInterface
  18044. {
  18045. public function getScripts();
  18046. public function getRepositories();
  18047. public function getLicense();
  18048. public function getKeywords();
  18049. public function getDescription();
  18050. public function getHomepage();
  18051. public function getAuthors();
  18052. public function getSupport();
  18053. public function getFunding();
  18054. public function isAbandoned();
  18055. public function getReplacementPackage();
  18056. }
  18057. <?php
  18058. namespace Composer\Package\Dumper;
  18059. use Composer\Package\BasePackage;
  18060. use Composer\Package\PackageInterface;
  18061. use Composer\Package\CompletePackageInterface;
  18062. use Composer\Package\RootPackageInterface;
  18063. class ArrayDumper
  18064. {
  18065. public function dump(PackageInterface $package)
  18066. {
  18067. $keys = array(
  18068. 'binaries' => 'bin',
  18069. 'type',
  18070. 'extra',
  18071. 'installationSource' => 'installation-source',
  18072. 'autoload',
  18073. 'devAutoload' => 'autoload-dev',
  18074. 'notificationUrl' => 'notification-url',
  18075. 'includePaths' => 'include-path',
  18076. );
  18077. $data = array();
  18078. $data['name'] = $package->getPrettyName();
  18079. $data['version'] = $package->getPrettyVersion();
  18080. $data['version_normalized'] = $package->getVersion();
  18081. if ($package->getTargetDir()) {
  18082. $data['target-dir'] = $package->getTargetDir();
  18083. }
  18084. if ($package->getSourceType()) {
  18085. $data['source']['type'] = $package->getSourceType();
  18086. $data['source']['url'] = $package->getSourceUrl();
  18087. if (null !== ($value = $package->getSourceReference())) {
  18088. $data['source']['reference'] = $value;
  18089. }
  18090. if ($mirrors = $package->getSourceMirrors()) {
  18091. $data['source']['mirrors'] = $mirrors;
  18092. }
  18093. }
  18094. if ($package->getDistType()) {
  18095. $data['dist']['type'] = $package->getDistType();
  18096. $data['dist']['url'] = $package->getDistUrl();
  18097. if (null !== ($value = $package->getDistReference())) {
  18098. $data['dist']['reference'] = $value;
  18099. }
  18100. if (null !== ($value = $package->getDistSha1Checksum())) {
  18101. $data['dist']['shasum'] = $value;
  18102. }
  18103. if ($mirrors = $package->getDistMirrors()) {
  18104. $data['dist']['mirrors'] = $mirrors;
  18105. }
  18106. }
  18107. if ($package->getArchiveExcludes()) {
  18108. $data['archive']['exclude'] = $package->getArchiveExcludes();
  18109. }
  18110. foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
  18111. if ($links = $package->{'get'.ucfirst($opts['method'])}()) {
  18112. foreach ($links as $link) {
  18113. $data[$type][$link->getTarget()] = $link->getPrettyConstraint();
  18114. }
  18115. ksort($data[$type]);
  18116. }
  18117. }
  18118. if ($packages = $package->getSuggests()) {
  18119. ksort($packages);
  18120. $data['suggest'] = $packages;
  18121. }
  18122. if ($package->getReleaseDate()) {
  18123. $data['time'] = $package->getReleaseDate()->format(DATE_RFC3339);
  18124. }
  18125. $data = $this->dumpValues($package, $keys, $data);
  18126. if ($package instanceof CompletePackageInterface) {
  18127. $keys = array(
  18128. 'scripts',
  18129. 'license',
  18130. 'authors',
  18131. 'description',
  18132. 'homepage',
  18133. 'keywords',
  18134. 'repositories',
  18135. 'support',
  18136. 'funding',
  18137. );
  18138. $data = $this->dumpValues($package, $keys, $data);
  18139. if (isset($data['keywords']) && is_array($data['keywords'])) {
  18140. sort($data['keywords']);
  18141. }
  18142. if ($package->isAbandoned()) {
  18143. $data['abandoned'] = $package->getReplacementPackage() ?: true;
  18144. }
  18145. }
  18146. if ($package instanceof RootPackageInterface) {
  18147. $minimumStability = $package->getMinimumStability();
  18148. if ($minimumStability) {
  18149. $data['minimum-stability'] = $minimumStability;
  18150. }
  18151. }
  18152. if (count($package->getTransportOptions()) > 0) {
  18153. $data['transport-options'] = $package->getTransportOptions();
  18154. }
  18155. return $data;
  18156. }
  18157. private function dumpValues(PackageInterface $package, array $keys, array $data)
  18158. {
  18159. foreach ($keys as $method => $key) {
  18160. if (is_numeric($method)) {
  18161. $method = $key;
  18162. }
  18163. $getter = 'get'.ucfirst($method);
  18164. $value = $package->$getter();
  18165. if (null !== $value && !(is_array($value) && 0 === count($value))) {
  18166. $data[$key] = $value;
  18167. }
  18168. }
  18169. return $data;
  18170. }
  18171. }
  18172. <?php
  18173. namespace Composer\Package;
  18174. use Composer\Semver\Constraint\ConstraintInterface;
  18175. class Link
  18176. {
  18177. protected $source;
  18178. protected $target;
  18179. protected $constraint;
  18180. protected $description;
  18181. protected $prettyConstraint;
  18182. public function __construct($source, $target, ConstraintInterface $constraint = null, $description = 'relates to', $prettyConstraint = null)
  18183. {
  18184. $this->source = strtolower($source);
  18185. $this->target = strtolower($target);
  18186. $this->constraint = $constraint;
  18187. $this->description = $description;
  18188. $this->prettyConstraint = $prettyConstraint;
  18189. }
  18190. public function getDescription()
  18191. {
  18192. return $this->description;
  18193. }
  18194. public function getSource()
  18195. {
  18196. return $this->source;
  18197. }
  18198. public function getTarget()
  18199. {
  18200. return $this->target;
  18201. }
  18202. public function getConstraint()
  18203. {
  18204. return $this->constraint;
  18205. }
  18206. public function getPrettyConstraint()
  18207. {
  18208. if (null === $this->prettyConstraint) {
  18209. throw new \UnexpectedValueException(sprintf('Link %s has been misconfigured and had no prettyConstraint given.', $this));
  18210. }
  18211. return $this->prettyConstraint;
  18212. }
  18213. public function __toString()
  18214. {
  18215. return $this->source.' '.$this->description.' '.$this->target.' ('.$this->constraint.')';
  18216. }
  18217. public function getPrettyString(PackageInterface $sourcePackage)
  18218. {
  18219. return $sourcePackage->getPrettyString().' '.$this->description.' '.$this->target.' '.$this->constraint->getPrettyString().'';
  18220. }
  18221. }
  18222. <?php
  18223. namespace Composer\Package\LinkConstraint;
  18224. use Composer\Semver\Constraint\EmptyConstraint as SemverEmptyConstraint;
  18225. trigger_error('The ' . __NAMESPACE__ . '\EmptyConstraint class is deprecated, use Composer\Semver\Constraint\EmptyConstraint instead.', E_USER_DEPRECATED);
  18226. class EmptyConstraint extends SemverEmptyConstraint implements LinkConstraintInterface
  18227. {
  18228. }
  18229. <?php
  18230. namespace Composer\Package\LinkConstraint;
  18231. use Composer\Semver\Constraint\ConstraintInterface;
  18232. trigger_error('The ' . __NAMESPACE__ . '\LinkConstraintInterface interface is deprecated, use Composer\Semver\Constraint\ConstraintInterface instead.', E_USER_DEPRECATED);
  18233. interface LinkConstraintInterface extends ConstraintInterface
  18234. {
  18235. }
  18236. <?php
  18237. namespace Composer\Package\LinkConstraint;
  18238. use Composer\Semver\Constraint\MultiConstraint as SemverMultiConstraint;
  18239. trigger_error('The ' . __NAMESPACE__ . '\MultiConstraint class is deprecated, use Composer\Semver\Constraint\MultiConstraint instead.', E_USER_DEPRECATED);
  18240. class MultiConstraint extends SemverMultiConstraint implements LinkConstraintInterface
  18241. {
  18242. }
  18243. <?php
  18244. namespace Composer\Package\LinkConstraint;
  18245. use Composer\Semver\Constraint\AbstractConstraint;
  18246. trigger_error('The ' . __NAMESPACE__ . '\SpecificConstraint abstract class is deprecated, there is no replacement for it.', E_USER_DEPRECATED);
  18247. abstract class SpecificConstraint extends AbstractConstraint implements LinkConstraintInterface
  18248. {
  18249. }
  18250. <?php
  18251. namespace Composer\Package\LinkConstraint;
  18252. use Composer\Semver\Constraint\Constraint;
  18253. trigger_error('The ' . __NAMESPACE__ . '\VersionConstraint class is deprecated, use Composer\Semver\Constraint\Constraint instead.', E_USER_DEPRECATED);
  18254. class VersionConstraint extends Constraint implements LinkConstraintInterface
  18255. {
  18256. }
  18257. <?php
  18258. namespace Composer\Package\Loader;
  18259. use Composer\Package;
  18260. use Composer\Package\AliasPackage;
  18261. use Composer\Package\Link;
  18262. use Composer\Package\RootAliasPackage;
  18263. use Composer\Package\RootPackageInterface;
  18264. use Composer\Package\Version\VersionParser;
  18265. use Composer\Semver\VersionParser as SemverVersionParser;
  18266. class ArrayLoader implements LoaderInterface
  18267. {
  18268. protected $versionParser;
  18269. protected $loadOptions;
  18270. public function __construct(SemverVersionParser $parser = null, $loadOptions = false)
  18271. {
  18272. if (!$parser) {
  18273. $parser = new VersionParser;
  18274. }
  18275. $this->versionParser = $parser;
  18276. $this->loadOptions = $loadOptions;
  18277. }
  18278. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  18279. {
  18280. if (!isset($config['name'])) {
  18281. throw new \UnexpectedValueException('Unknown package has no name defined ('.json_encode($config).').');
  18282. }
  18283. if (!isset($config['version'])) {
  18284. throw new \UnexpectedValueException('Package '.$config['name'].' has no version defined.');
  18285. }
  18286. if (isset($config['version_normalized'])) {
  18287. $version = $config['version_normalized'];
  18288. } else {
  18289. $version = $this->versionParser->normalize($config['version']);
  18290. }
  18291. $package = new $class($config['name'], $version, $config['version']);
  18292. $package->setType(isset($config['type']) ? strtolower($config['type']) : 'library');
  18293. if (isset($config['target-dir'])) {
  18294. $package->setTargetDir($config['target-dir']);
  18295. }
  18296. if (isset($config['extra']) && is_array($config['extra'])) {
  18297. $package->setExtra($config['extra']);
  18298. }
  18299. if (isset($config['bin'])) {
  18300. foreach ((array) $config['bin'] as $key => $bin) {
  18301. $config['bin'][$key] = ltrim($bin, '/');
  18302. }
  18303. $package->setBinaries((array) $config['bin']);
  18304. }
  18305. if (isset($config['installation-source'])) {
  18306. $package->setInstallationSource($config['installation-source']);
  18307. }
  18308. if (isset($config['source'])) {
  18309. if (!isset($config['source']['type']) || !isset($config['source']['url']) || !isset($config['source']['reference'])) {
  18310. throw new \UnexpectedValueException(sprintf(
  18311. "Package %s's source key should be specified as {\"type\": ..., \"url\": ..., \"reference\": ...},\n%s given.",
  18312. $config['name'],
  18313. json_encode($config['source'])
  18314. ));
  18315. }
  18316. $package->setSourceType($config['source']['type']);
  18317. $package->setSourceUrl($config['source']['url']);
  18318. $package->setSourceReference(isset($config['source']['reference']) ? $config['source']['reference'] : null);
  18319. if (isset($config['source']['mirrors'])) {
  18320. $package->setSourceMirrors($config['source']['mirrors']);
  18321. }
  18322. }
  18323. if (isset($config['dist'])) {
  18324. if (!isset($config['dist']['type'])
  18325. || !isset($config['dist']['url'])) {
  18326. throw new \UnexpectedValueException(sprintf(
  18327. "Package %s's dist key should be specified as ".
  18328. "{\"type\": ..., \"url\": ..., \"reference\": ..., \"shasum\": ...},\n%s given.",
  18329. $config['name'],
  18330. json_encode($config['dist'])
  18331. ));
  18332. }
  18333. $package->setDistType($config['dist']['type']);
  18334. $package->setDistUrl($config['dist']['url']);
  18335. $package->setDistReference(isset($config['dist']['reference']) ? $config['dist']['reference'] : null);
  18336. $package->setDistSha1Checksum(isset($config['dist']['shasum']) ? $config['dist']['shasum'] : null);
  18337. if (isset($config['dist']['mirrors'])) {
  18338. $package->setDistMirrors($config['dist']['mirrors']);
  18339. }
  18340. }
  18341. foreach (Package\BasePackage::$supportedLinkTypes as $type => $opts) {
  18342. if (isset($config[$type])) {
  18343. $method = 'set'.ucfirst($opts['method']);
  18344. $package->{$method}(
  18345. $this->parseLinks(
  18346. $package->getName(),
  18347. $package->getPrettyVersion(),
  18348. $opts['description'],
  18349. $config[$type]
  18350. )
  18351. );
  18352. }
  18353. }
  18354. if (isset($config['suggest']) && is_array($config['suggest'])) {
  18355. foreach ($config['suggest'] as $target => $reason) {
  18356. if ('self.version' === trim($reason)) {
  18357. $config['suggest'][$target] = $package->getPrettyVersion();
  18358. }
  18359. }
  18360. $package->setSuggests($config['suggest']);
  18361. }
  18362. if (isset($config['autoload'])) {
  18363. $package->setAutoload($config['autoload']);
  18364. }
  18365. if (isset($config['autoload-dev'])) {
  18366. $package->setDevAutoload($config['autoload-dev']);
  18367. }
  18368. if (isset($config['include-path'])) {
  18369. $package->setIncludePaths($config['include-path']);
  18370. }
  18371. if (!empty($config['time'])) {
  18372. $time = preg_match('/^\d++$/D', $config['time']) ? '@'.$config['time'] : $config['time'];
  18373. try {
  18374. $date = new \DateTime($time, new \DateTimeZone('UTC'));
  18375. $package->setReleaseDate($date);
  18376. } catch (\Exception $e) {
  18377. }
  18378. }
  18379. if (!empty($config['notification-url'])) {
  18380. $package->setNotificationUrl($config['notification-url']);
  18381. }
  18382. if (!empty($config['archive']['exclude'])) {
  18383. $package->setArchiveExcludes($config['archive']['exclude']);
  18384. }
  18385. if ($package instanceof Package\CompletePackageInterface) {
  18386. if (isset($config['scripts']) && is_array($config['scripts'])) {
  18387. foreach ($config['scripts'] as $event => $listeners) {
  18388. $config['scripts'][$event] = (array) $listeners;
  18389. }
  18390. if (isset($config['scripts']['composer'])) {
  18391. trigger_error('The `composer` script name is reserved for internal use, please avoid defining it', E_USER_DEPRECATED);
  18392. }
  18393. $package->setScripts($config['scripts']);
  18394. }
  18395. if (!empty($config['description']) && is_string($config['description'])) {
  18396. $package->setDescription($config['description']);
  18397. }
  18398. if (!empty($config['homepage']) && is_string($config['homepage'])) {
  18399. $package->setHomepage($config['homepage']);
  18400. }
  18401. if (!empty($config['keywords']) && is_array($config['keywords'])) {
  18402. $package->setKeywords($config['keywords']);
  18403. }
  18404. if (!empty($config['license'])) {
  18405. $package->setLicense(is_array($config['license']) ? $config['license'] : array($config['license']));
  18406. }
  18407. if (!empty($config['authors']) && is_array($config['authors'])) {
  18408. $package->setAuthors($config['authors']);
  18409. }
  18410. if (isset($config['support'])) {
  18411. $package->setSupport($config['support']);
  18412. }
  18413. if (!empty($config['funding']) && is_array($config['funding'])) {
  18414. $package->setFunding($config['funding']);
  18415. }
  18416. if (isset($config['abandoned'])) {
  18417. $package->setAbandoned($config['abandoned']);
  18418. }
  18419. }
  18420. if ($aliasNormalized = $this->getBranchAlias($config)) {
  18421. if ($package instanceof RootPackageInterface) {
  18422. $package = new RootAliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  18423. } else {
  18424. $package = new AliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  18425. }
  18426. }
  18427. if ($this->loadOptions && isset($config['transport-options'])) {
  18428. $package->setTransportOptions($config['transport-options']);
  18429. }
  18430. return $package;
  18431. }
  18432. public function parseLinks($source, $sourceVersion, $description, $links)
  18433. {
  18434. $res = array();
  18435. foreach ($links as $target => $constraint) {
  18436. if (!is_string($constraint)) {
  18437. throw new \UnexpectedValueException('Link constraint in '.$source.' '.$description.' > '.$target.' should be a string, got '.gettype($constraint) . ' (' . var_export($constraint, true) . ')');
  18438. }
  18439. if ('self.version' === $constraint) {
  18440. $parsedConstraint = $this->versionParser->parseConstraints($sourceVersion);
  18441. } else {
  18442. $parsedConstraint = $this->versionParser->parseConstraints($constraint);
  18443. }
  18444. $res[strtolower($target)] = new Link($source, $target, $parsedConstraint, $description, $constraint);
  18445. }
  18446. return $res;
  18447. }
  18448. public function getBranchAlias(array $config)
  18449. {
  18450. if (('dev-' !== substr($config['version'], 0, 4) && '-dev' !== substr($config['version'], -4))
  18451. || !isset($config['extra']['branch-alias'])
  18452. || !is_array($config['extra']['branch-alias'])
  18453. ) {
  18454. return;
  18455. }
  18456. foreach ($config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  18457. if ('-dev' !== substr($targetBranch, -4)) {
  18458. continue;
  18459. }
  18460. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  18461. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  18462. continue;
  18463. }
  18464. if (strtolower($config['version']) !== strtolower($sourceBranch)) {
  18465. continue;
  18466. }
  18467. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  18468. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  18469. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  18470. ) {
  18471. continue;
  18472. }
  18473. return $validatedTargetBranch;
  18474. }
  18475. }
  18476. }
  18477. <?php
  18478. namespace Composer\Package\Loader;
  18479. class InvalidPackageException extends \Exception
  18480. {
  18481. private $errors;
  18482. private $warnings;
  18483. private $data;
  18484. public function __construct(array $errors, array $warnings, array $data)
  18485. {
  18486. $this->errors = $errors;
  18487. $this->warnings = $warnings;
  18488. $this->data = $data;
  18489. parent::__construct("Invalid package information: \n".implode("\n", array_merge($errors, $warnings)));
  18490. }
  18491. public function getData()
  18492. {
  18493. return $this->data;
  18494. }
  18495. public function getErrors()
  18496. {
  18497. return $this->errors;
  18498. }
  18499. public function getWarnings()
  18500. {
  18501. return $this->warnings;
  18502. }
  18503. }
  18504. <?php
  18505. namespace Composer\Package\Loader;
  18506. use Composer\Json\JsonFile;
  18507. class JsonLoader
  18508. {
  18509. private $loader;
  18510. public function __construct(LoaderInterface $loader)
  18511. {
  18512. $this->loader = $loader;
  18513. }
  18514. public function load($json)
  18515. {
  18516. if ($json instanceof JsonFile) {
  18517. $config = $json->read();
  18518. } elseif (file_exists($json)) {
  18519. $config = JsonFile::parseJson(file_get_contents($json), $json);
  18520. } elseif (is_string($json)) {
  18521. $config = JsonFile::parseJson($json);
  18522. }
  18523. return $this->loader->load($config);
  18524. }
  18525. }
  18526. <?php
  18527. namespace Composer\Package\Loader;
  18528. interface LoaderInterface
  18529. {
  18530. public function load(array $package, $class = 'Composer\Package\CompletePackage');
  18531. }
  18532. <?php
  18533. namespace Composer\Package\Loader;
  18534. use Composer\Package\BasePackage;
  18535. use Composer\Package\AliasPackage;
  18536. use Composer\Config;
  18537. use Composer\IO\IOInterface;
  18538. use Composer\Package\RootPackageInterface;
  18539. use Composer\Repository\RepositoryFactory;
  18540. use Composer\Package\Version\VersionGuesser;
  18541. use Composer\Package\Version\VersionParser;
  18542. use Composer\Repository\RepositoryManager;
  18543. use Composer\Util\ProcessExecutor;
  18544. class RootPackageLoader extends ArrayLoader
  18545. {
  18546. private $manager;
  18547. private $config;
  18548. private $versionGuesser;
  18549. private $io;
  18550. public function __construct(RepositoryManager $manager, Config $config, VersionParser $parser = null, VersionGuesser $versionGuesser = null, IOInterface $io = null)
  18551. {
  18552. parent::__construct($parser);
  18553. $this->manager = $manager;
  18554. $this->config = $config;
  18555. $this->versionGuesser = $versionGuesser ?: new VersionGuesser($config, new ProcessExecutor(), $this->versionParser);
  18556. $this->io = $io;
  18557. }
  18558. public function load(array $config, $class = 'Composer\Package\RootPackage', $cwd = null)
  18559. {
  18560. if (!isset($config['name'])) {
  18561. $config['name'] = '__root__';
  18562. } elseif ($this->io) {
  18563. if ($err = ValidatingArrayLoader::hasPackageNamingError($config['name'])) {
  18564. $this->io->writeError('<warning>Deprecation warning: Your package name '.$err.' Make sure you fix this as Composer 2.0 will error.</warning>');
  18565. }
  18566. }
  18567. $autoVersioned = false;
  18568. if (!isset($config['version'])) {
  18569. $commit = null;
  18570. if (getenv('COMPOSER_ROOT_VERSION')) {
  18571. $config['version'] = getenv('COMPOSER_ROOT_VERSION');
  18572. } else {
  18573. $versionData = $this->versionGuesser->guessVersion($config, $cwd ?: getcwd());
  18574. if ($versionData) {
  18575. $config['version'] = $versionData['pretty_version'];
  18576. $config['version_normalized'] = $versionData['version'];
  18577. $commit = $versionData['commit'];
  18578. }
  18579. }
  18580. if (!isset($config['version'])) {
  18581. $config['version'] = '1.0.0';
  18582. $autoVersioned = true;
  18583. }
  18584. if ($commit) {
  18585. $config['source'] = array(
  18586. 'type' => '',
  18587. 'url' => '',
  18588. 'reference' => $commit,
  18589. );
  18590. $config['dist'] = array(
  18591. 'type' => '',
  18592. 'url' => '',
  18593. 'reference' => $commit,
  18594. );
  18595. }
  18596. }
  18597. $realPackage = $package = parent::load($config, $class);
  18598. if ($realPackage instanceof AliasPackage) {
  18599. $realPackage = $package->getAliasOf();
  18600. }
  18601. if ($autoVersioned) {
  18602. $realPackage->replaceVersion($realPackage->getVersion(), 'No version set (parsed as 1.0.0)');
  18603. }
  18604. if (isset($config['minimum-stability'])) {
  18605. $realPackage->setMinimumStability(VersionParser::normalizeStability($config['minimum-stability']));
  18606. }
  18607. $aliases = array();
  18608. $stabilityFlags = array();
  18609. $references = array();
  18610. foreach (array('require', 'require-dev') as $linkType) {
  18611. if (isset($config[$linkType])) {
  18612. $linkInfo = BasePackage::$supportedLinkTypes[$linkType];
  18613. $method = 'get'.ucfirst($linkInfo['method']);
  18614. $links = array();
  18615. foreach ($realPackage->$method() as $link) {
  18616. $links[$link->getTarget()] = $link->getConstraint()->getPrettyString();
  18617. }
  18618. $aliases = $this->extractAliases($links, $aliases);
  18619. $stabilityFlags = $this->extractStabilityFlags($links, $stabilityFlags, $realPackage->getMinimumStability());
  18620. $references = $this->extractReferences($links, $references);
  18621. if (isset($links[$config['name']])) {
  18622. throw new \RuntimeException(sprintf('Root package \'%s\' cannot require itself in its composer.json' . PHP_EOL .
  18623. 'Did you accidentally name your root package after an external package?', $config['name']));
  18624. }
  18625. }
  18626. }
  18627. if ($this->io) {
  18628. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  18629. if (isset($config[$linkType])) {
  18630. foreach ($config[$linkType] as $linkName => $constraint) {
  18631. if ($err = ValidatingArrayLoader::hasPackageNamingError($linkName, true)) {
  18632. $this->io->writeError('<warning>Deprecation warning: '.$linkType.'.'.$err.' Make sure you fix this as Composer 2.0 will error.</warning>');
  18633. }
  18634. }
  18635. }
  18636. }
  18637. }
  18638. $realPackage->setAliases($aliases);
  18639. $realPackage->setStabilityFlags($stabilityFlags);
  18640. $realPackage->setReferences($references);
  18641. if (isset($config['prefer-stable'])) {
  18642. $realPackage->setPreferStable((bool) $config['prefer-stable']);
  18643. }
  18644. if (isset($config['config'])) {
  18645. $realPackage->setConfig($config['config']);
  18646. }
  18647. $repos = RepositoryFactory::defaultRepos(null, $this->config, $this->manager);
  18648. foreach ($repos as $repo) {
  18649. $this->manager->addRepository($repo);
  18650. }
  18651. $realPackage->setRepositories($this->config->getRepositories());
  18652. return $package;
  18653. }
  18654. private function extractAliases(array $requires, array $aliases)
  18655. {
  18656. foreach ($requires as $reqName => $reqVersion) {
  18657. if (preg_match('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $reqVersion, $match)) {
  18658. $aliases[] = array(
  18659. 'package' => strtolower($reqName),
  18660. 'version' => $this->versionParser->normalize($match[1], $reqVersion),
  18661. 'alias' => $match[2],
  18662. 'alias_normalized' => $this->versionParser->normalize($match[2], $reqVersion),
  18663. );
  18664. }
  18665. }
  18666. return $aliases;
  18667. }
  18668. private function extractStabilityFlags(array $requires, array $stabilityFlags, $minimumStability)
  18669. {
  18670. $stabilities = BasePackage::$stabilities;
  18671. $minimumStability = $stabilities[$minimumStability];
  18672. foreach ($requires as $reqName => $reqVersion) {
  18673. $constraints = array();
  18674. $orSplit = preg_split('{\s*\|\|?\s*}', trim($reqVersion));
  18675. foreach ($orSplit as $orConstraint) {
  18676. $andSplit = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $orConstraint);
  18677. foreach ($andSplit as $andConstraint) {
  18678. $constraints[] = $andConstraint;
  18679. }
  18680. }
  18681. $match = false;
  18682. foreach ($constraints as $constraint) {
  18683. if (preg_match('{^[^@]*?@('.implode('|', array_keys($stabilities)).')$}i', $constraint, $match)) {
  18684. $name = strtolower($reqName);
  18685. $stability = $stabilities[VersionParser::normalizeStability($match[1])];
  18686. if (isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) {
  18687. continue;
  18688. }
  18689. $stabilityFlags[$name] = $stability;
  18690. $match = true;
  18691. }
  18692. }
  18693. if ($match) {
  18694. continue;
  18695. }
  18696. foreach ($constraints as $constraint) {
  18697. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $constraint);
  18698. if (preg_match('{^[^,\s@]+$}', $reqVersion) && 'stable' !== ($stabilityName = VersionParser::parseStability($reqVersion))) {
  18699. $name = strtolower($reqName);
  18700. $stability = $stabilities[$stabilityName];
  18701. if ((isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) || ($minimumStability > $stability)) {
  18702. continue;
  18703. }
  18704. $stabilityFlags[$name] = $stability;
  18705. }
  18706. }
  18707. }
  18708. return $stabilityFlags;
  18709. }
  18710. private function extractReferences(array $requires, array $references)
  18711. {
  18712. foreach ($requires as $reqName => $reqVersion) {
  18713. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion);
  18714. if (preg_match('{^[^,\s@]+?#([a-f0-9]+)$}', $reqVersion, $match) && 'dev' === VersionParser::parseStability($reqVersion)) {
  18715. $name = strtolower($reqName);
  18716. $references[$name] = $match[1];
  18717. }
  18718. }
  18719. return $references;
  18720. }
  18721. }
  18722. <?php
  18723. namespace Composer\Package\Loader;
  18724. use Composer\Package\BasePackage;
  18725. use Composer\Semver\Constraint\Constraint;
  18726. use Composer\Package\Version\VersionParser;
  18727. use Composer\Repository\PlatformRepository;
  18728. use Composer\Spdx\SpdxLicenses;
  18729. class ValidatingArrayLoader implements LoaderInterface
  18730. {
  18731. const CHECK_ALL = 3;
  18732. const CHECK_UNBOUND_CONSTRAINTS = 1;
  18733. const CHECK_STRICT_CONSTRAINTS = 2;
  18734. private $loader;
  18735. private $versionParser;
  18736. private $errors;
  18737. private $warnings;
  18738. private $config;
  18739. private $strictName;
  18740. private $flags;
  18741. public function __construct(LoaderInterface $loader, $strictName = true, VersionParser $parser = null, $flags = 0)
  18742. {
  18743. $this->loader = $loader;
  18744. $this->versionParser = $parser ?: new VersionParser();
  18745. $this->strictName = $strictName;
  18746. $this->flags = $flags;
  18747. }
  18748. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  18749. {
  18750. $this->errors = array();
  18751. $this->warnings = array();
  18752. $this->config = $config;
  18753. if ($err = self::hasPackageNamingError($config['name'])) {
  18754. $this->warnings[] = 'Deprecation warning: Your package name '.$err.' Make sure you fix this as Composer 2.0 will error.';
  18755. }
  18756. if ($this->strictName) {
  18757. $this->validateRegex('name', '[A-Za-z0-9][A-Za-z0-9_.-]*/[A-Za-z0-9][A-Za-z0-9_.-]*', true);
  18758. } else {
  18759. $this->validateString('name', true);
  18760. }
  18761. if (!empty($this->config['version'])) {
  18762. try {
  18763. $this->versionParser->normalize($this->config['version']);
  18764. } catch (\Exception $e) {
  18765. $this->errors[] = 'version : invalid value ('.$this->config['version'].'): '.$e->getMessage();
  18766. unset($this->config['version']);
  18767. }
  18768. }
  18769. if (!empty($this->config['config']['platform'])) {
  18770. foreach ((array) $this->config['config']['platform'] as $key => $platform) {
  18771. try {
  18772. $this->versionParser->normalize($platform);
  18773. } catch (\Exception $e) {
  18774. $this->errors[] = 'config.platform.' . $key . ' : invalid value ('.$platform.'): '.$e->getMessage();
  18775. }
  18776. }
  18777. }
  18778. $this->validateRegex('type', '[A-Za-z0-9-]+');
  18779. $this->validateString('target-dir');
  18780. $this->validateArray('extra');
  18781. if (isset($this->config['bin'])) {
  18782. if (is_string($this->config['bin'])) {
  18783. $this->validateString('bin');
  18784. } else {
  18785. $this->validateFlatArray('bin');
  18786. }
  18787. }
  18788. $this->validateArray('scripts');
  18789. $this->validateString('description');
  18790. $this->validateUrl('homepage');
  18791. $this->validateFlatArray('keywords', '[\p{N}\p{L} ._-]+');
  18792. $releaseDate = null;
  18793. $this->validateString('time');
  18794. if (!empty($this->config['time'])) {
  18795. try {
  18796. $releaseDate = new \DateTime($this->config['time'], new \DateTimeZone('UTC'));
  18797. } catch (\Exception $e) {
  18798. $this->errors[] = 'time : invalid value ('.$this->config['time'].'): '.$e->getMessage();
  18799. unset($this->config['time']);
  18800. }
  18801. }
  18802. if (isset($this->config['license']) && (!$releaseDate || $releaseDate->getTimestamp() >= strtotime('-8days'))) {
  18803. if (is_array($this->config['license']) || is_string($this->config['license'])) {
  18804. $licenses = (array) $this->config['license'];
  18805. foreach ($licenses as $key => $license) {
  18806. if ('proprietary' === $license) {
  18807. unset($licenses[$key]);
  18808. }
  18809. }
  18810. $licenseValidator = new SpdxLicenses();
  18811. if (count($licenses) === 1 && !$licenseValidator->validate($licenses) && $licenseValidator->validate(trim($licenses[0]))) {
  18812. $this->warnings[] = sprintf(
  18813. 'License %s must not contain extra spaces, make sure to trim it.',
  18814. json_encode($this->config['license'])
  18815. );
  18816. } elseif (array() !== $licenses && !$licenseValidator->validate($licenses)) {
  18817. $this->warnings[] = sprintf(
  18818. 'License %s is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license.' . PHP_EOL .
  18819. 'If the software is closed-source, you may use "proprietary" as license.',
  18820. json_encode($this->config['license'])
  18821. );
  18822. }
  18823. }
  18824. }
  18825. if ($this->validateArray('authors') && !empty($this->config['authors'])) {
  18826. foreach ($this->config['authors'] as $key => $author) {
  18827. if (!is_array($author)) {
  18828. $this->errors[] = 'authors.'.$key.' : should be an array, '.gettype($author).' given';
  18829. unset($this->config['authors'][$key]);
  18830. continue;
  18831. }
  18832. foreach (array('homepage', 'email', 'name', 'role') as $authorData) {
  18833. if (isset($author[$authorData]) && !is_string($author[$authorData])) {
  18834. $this->errors[] = 'authors.'.$key.'.'.$authorData.' : invalid value, must be a string';
  18835. unset($this->config['authors'][$key][$authorData]);
  18836. }
  18837. }
  18838. if (isset($author['homepage']) && !$this->filterUrl($author['homepage'])) {
  18839. $this->warnings[] = 'authors.'.$key.'.homepage : invalid value ('.$author['homepage'].'), must be an http/https URL';
  18840. unset($this->config['authors'][$key]['homepage']);
  18841. }
  18842. if (isset($author['email']) && !filter_var($author['email'], FILTER_VALIDATE_EMAIL)) {
  18843. $this->warnings[] = 'authors.'.$key.'.email : invalid value ('.$author['email'].'), must be a valid email address';
  18844. unset($this->config['authors'][$key]['email']);
  18845. }
  18846. if (empty($this->config['authors'][$key])) {
  18847. unset($this->config['authors'][$key]);
  18848. }
  18849. }
  18850. if (empty($this->config['authors'])) {
  18851. unset($this->config['authors']);
  18852. }
  18853. }
  18854. if ($this->validateArray('support') && !empty($this->config['support'])) {
  18855. foreach (array('issues', 'forum', 'wiki', 'source', 'email', 'irc', 'docs', 'rss', 'chat') as $key) {
  18856. if (isset($this->config['support'][$key]) && !is_string($this->config['support'][$key])) {
  18857. $this->errors[] = 'support.'.$key.' : invalid value, must be a string';
  18858. unset($this->config['support'][$key]);
  18859. }
  18860. }
  18861. if (isset($this->config['support']['email']) && !filter_var($this->config['support']['email'], FILTER_VALIDATE_EMAIL)) {
  18862. $this->warnings[] = 'support.email : invalid value ('.$this->config['support']['email'].'), must be a valid email address';
  18863. unset($this->config['support']['email']);
  18864. }
  18865. if (isset($this->config['support']['irc']) && !$this->filterUrl($this->config['support']['irc'], array('irc'))) {
  18866. $this->warnings[] = 'support.irc : invalid value ('.$this->config['support']['irc'].'), must be a irc://<server>/<channel> URL';
  18867. unset($this->config['support']['irc']);
  18868. }
  18869. foreach (array('issues', 'forum', 'wiki', 'source', 'docs', 'chat') as $key) {
  18870. if (isset($this->config['support'][$key]) && !$this->filterUrl($this->config['support'][$key])) {
  18871. $this->warnings[] = 'support.'.$key.' : invalid value ('.$this->config['support'][$key].'), must be an http/https URL';
  18872. unset($this->config['support'][$key]);
  18873. }
  18874. }
  18875. if (empty($this->config['support'])) {
  18876. unset($this->config['support']);
  18877. }
  18878. }
  18879. if ($this->validateArray('funding') && !empty($this->config['funding'])) {
  18880. foreach ($this->config['funding'] as $key => $fundingOption) {
  18881. if (!is_array($fundingOption)) {
  18882. $this->errors[] = 'funding.'.$key.' : should be an array, '.gettype($fundingOption).' given';
  18883. unset($this->config['funding'][$key]);
  18884. continue;
  18885. }
  18886. foreach (array('type', 'url') as $fundingData) {
  18887. if (isset($fundingOption[$fundingData]) && !is_string($fundingOption[$fundingData])) {
  18888. $this->errors[] = 'funding.'.$key.'.'.$fundingData.' : invalid value, must be a string';
  18889. unset($this->config['funding'][$key][$fundingData]);
  18890. }
  18891. }
  18892. if (isset($fundingOption['url']) && !$this->filterUrl($fundingOption['url'])) {
  18893. $this->warnings[] = 'funding.'.$key.'.url : invalid value ('.$fundingOption['url'].'), must be an http/https URL';
  18894. unset($this->config['funding'][$key]['url']);
  18895. }
  18896. if (empty($this->config['funding'][$key])) {
  18897. unset($this->config['funding'][$key]);
  18898. }
  18899. }
  18900. if (empty($this->config['funding'])) {
  18901. unset($this->config['funding']);
  18902. }
  18903. }
  18904. $unboundConstraint = new Constraint('=', $this->versionParser->normalize('dev-master'));
  18905. $stableConstraint = new Constraint('=', '1.0.0');
  18906. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  18907. if ($this->validateArray($linkType) && isset($this->config[$linkType])) {
  18908. foreach ($this->config[$linkType] as $package => $constraint) {
  18909. if ($err = self::hasPackageNamingError($package, true)) {
  18910. $this->warnings[] = 'Deprecation warning: '.$linkType.'.'.$err.' Make sure you fix this as Composer 2.0 will error.';
  18911. } elseif (!preg_match('{^[A-Za-z0-9_./-]+$}', $package)) {
  18912. $this->warnings[] = $linkType.'.'.$package.' : invalid key, package names must be strings containing only [A-Za-z0-9_./-]';
  18913. }
  18914. if (!is_string($constraint)) {
  18915. $this->errors[] = $linkType.'.'.$package.' : invalid value, must be a string containing a version constraint';
  18916. unset($this->config[$linkType][$package]);
  18917. } elseif ('self.version' !== $constraint) {
  18918. try {
  18919. $linkConstraint = $this->versionParser->parseConstraints($constraint);
  18920. } catch (\Exception $e) {
  18921. $this->errors[] = $linkType.'.'.$package.' : invalid version constraint ('.$e->getMessage().')';
  18922. unset($this->config[$linkType][$package]);
  18923. continue;
  18924. }
  18925. if (
  18926. ($this->flags & self::CHECK_UNBOUND_CONSTRAINTS)
  18927. && 'require' === $linkType
  18928. && $linkConstraint->matches($unboundConstraint)
  18929. && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $package)
  18930. ) {
  18931. $this->warnings[] = $linkType.'.'.$package.' : unbound version constraints ('.$constraint.') should be avoided';
  18932. } elseif (
  18933. ($this->flags & self::CHECK_STRICT_CONSTRAINTS)
  18934. && 'require' === $linkType
  18935. && substr($linkConstraint, 0, 1) === '='
  18936. && $stableConstraint->versionCompare($stableConstraint, $linkConstraint, '<=')
  18937. ) {
  18938. $this->warnings[] = $linkType.'.'.$package.' : exact version constraints ('.$constraint.') should be avoided if the package follows semantic versioning';
  18939. }
  18940. }
  18941. }
  18942. }
  18943. }
  18944. if ($this->validateArray('suggest') && !empty($this->config['suggest'])) {
  18945. foreach ($this->config['suggest'] as $package => $description) {
  18946. if (!is_string($description)) {
  18947. $this->errors[] = 'suggest.'.$package.' : invalid value, must be a string describing why the package is suggested';
  18948. unset($this->config['suggest'][$package]);
  18949. }
  18950. }
  18951. }
  18952. if ($this->validateString('minimum-stability') && !empty($this->config['minimum-stability'])) {
  18953. if (!isset(BasePackage::$stabilities[$this->config['minimum-stability']])) {
  18954. $this->errors[] = 'minimum-stability : invalid value ('.$this->config['minimum-stability'].'), must be one of '.implode(', ', array_keys(BasePackage::$stabilities));
  18955. unset($this->config['minimum-stability']);
  18956. }
  18957. }
  18958. if ($this->validateArray('autoload') && !empty($this->config['autoload'])) {
  18959. $types = array('psr-0', 'psr-4', 'classmap', 'files', 'exclude-from-classmap');
  18960. foreach ($this->config['autoload'] as $type => $typeConfig) {
  18961. if (!in_array($type, $types)) {
  18962. $this->errors[] = 'autoload : invalid value ('.$type.'), must be one of '.implode(', ', $types);
  18963. unset($this->config['autoload'][$type]);
  18964. }
  18965. if ($type === 'psr-4') {
  18966. foreach ($typeConfig as $namespace => $dirs) {
  18967. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  18968. $this->errors[] = 'autoload.psr-4 : invalid value ('.$namespace.'), namespaces must end with a namespace separator, should be '.$namespace.'\\\\';
  18969. }
  18970. }
  18971. }
  18972. }
  18973. }
  18974. if (!empty($this->config['autoload']['psr-4']) && !empty($this->config['target-dir'])) {
  18975. $this->errors[] = 'target-dir : this can not be used together with the autoload.psr-4 setting, remove target-dir to upgrade to psr-4';
  18976. unset($this->config['autoload']['psr-4']);
  18977. }
  18978. $this->validateFlatArray('include-path');
  18979. $this->validateArray('transport-options');
  18980. if (isset($this->config['extra']['branch-alias'])) {
  18981. if (!is_array($this->config['extra']['branch-alias'])) {
  18982. $this->errors[] = 'extra.branch-alias : must be an array of versions => aliases';
  18983. } else {
  18984. foreach ($this->config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  18985. if ('-dev' !== substr($targetBranch, -4)) {
  18986. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must end in -dev';
  18987. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  18988. continue;
  18989. }
  18990. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  18991. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  18992. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must be a parseable number like 2.0-dev';
  18993. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  18994. continue;
  18995. }
  18996. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  18997. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  18998. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  18999. ) {
  19000. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') is not a valid numeric alias for this version';
  19001. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  19002. }
  19003. }
  19004. }
  19005. }
  19006. if ($this->errors) {
  19007. throw new InvalidPackageException($this->errors, $this->warnings, $config);
  19008. }
  19009. $package = $this->loader->load($this->config, $class);
  19010. $this->config = null;
  19011. return $package;
  19012. }
  19013. public function getWarnings()
  19014. {
  19015. return $this->warnings;
  19016. }
  19017. public function getErrors()
  19018. {
  19019. return $this->errors;
  19020. }
  19021. public static function hasPackageNamingError($name, $isLink = false)
  19022. {
  19023. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  19024. return;
  19025. }
  19026. if (!preg_match('{^[a-z0-9](?:[_.-]?[a-z0-9]+)*/[a-z0-9](?:(?:[_.]?|-{0,2})[a-z0-9]+)*$}iD', $name)) {
  19027. return $name.' is invalid, it should have a vendor name, a forward slash, and a package name. The vendor and package name can be words separated by -, . or _. The complete name should match "^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9](([_.]?|-{0,2})[a-z0-9]+)*$".';
  19028. }
  19029. $reservedNames = array('nul', 'con', 'prn', 'aux', 'com1', 'com2', 'com3', 'com4', 'com5', 'com6', 'com7', 'com8', 'com9', 'lpt1', 'lpt2', 'lpt3', 'lpt4', 'lpt5', 'lpt6', 'lpt7', 'lpt8', 'lpt9');
  19030. $bits = explode('/', strtolower($name));
  19031. if (in_array($bits[0], $reservedNames, true) || in_array($bits[1], $reservedNames, true)) {
  19032. return $name.' is reserved, package and vendor names can not match any of: '.implode(', ', $reservedNames).'.';
  19033. }
  19034. if (preg_match('{\.json$}', $name)) {
  19035. return $name.' is invalid, package names can not end in .json, consider renaming it or perhaps using a -json suffix instead.';
  19036. }
  19037. if (preg_match('{[A-Z]}', $name)) {
  19038. if ($isLink) {
  19039. return $name.' is invalid, it should not contain uppercase characters. Please use '.strtolower($name).' instead.';
  19040. }
  19041. $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  19042. $suggestName = strtolower($suggestName);
  19043. return $name.' is invalid, it should not contain uppercase characters. We suggest using '.$suggestName.' instead.';
  19044. }
  19045. }
  19046. private function validateRegex($property, $regex, $mandatory = false)
  19047. {
  19048. if (!$this->validateString($property, $mandatory)) {
  19049. return false;
  19050. }
  19051. if (!preg_match('{^'.$regex.'$}u', $this->config[$property])) {
  19052. $message = $property.' : invalid value ('.$this->config[$property].'), must match '.$regex;
  19053. if ($mandatory) {
  19054. $this->errors[] = $message;
  19055. } else {
  19056. $this->warnings[] = $message;
  19057. }
  19058. unset($this->config[$property]);
  19059. return false;
  19060. }
  19061. return true;
  19062. }
  19063. private function validateString($property, $mandatory = false)
  19064. {
  19065. if (isset($this->config[$property]) && !is_string($this->config[$property])) {
  19066. $this->errors[] = $property.' : should be a string, '.gettype($this->config[$property]).' given';
  19067. unset($this->config[$property]);
  19068. return false;
  19069. }
  19070. if (!isset($this->config[$property]) || trim($this->config[$property]) === '') {
  19071. if ($mandatory) {
  19072. $this->errors[] = $property.' : must be present';
  19073. }
  19074. unset($this->config[$property]);
  19075. return false;
  19076. }
  19077. return true;
  19078. }
  19079. private function validateArray($property, $mandatory = false)
  19080. {
  19081. if (isset($this->config[$property]) && !is_array($this->config[$property])) {
  19082. $this->errors[] = $property.' : should be an array, '.gettype($this->config[$property]).' given';
  19083. unset($this->config[$property]);
  19084. return false;
  19085. }
  19086. if (!isset($this->config[$property]) || !count($this->config[$property])) {
  19087. if ($mandatory) {
  19088. $this->errors[] = $property.' : must be present and contain at least one element';
  19089. }
  19090. unset($this->config[$property]);
  19091. return false;
  19092. }
  19093. return true;
  19094. }
  19095. private function validateFlatArray($property, $regex = null, $mandatory = false)
  19096. {
  19097. if (!$this->validateArray($property, $mandatory)) {
  19098. return false;
  19099. }
  19100. $pass = true;
  19101. foreach ($this->config[$property] as $key => $value) {
  19102. if (!is_string($value) && !is_numeric($value)) {
  19103. $this->errors[] = $property.'.'.$key.' : must be a string or int, '.gettype($value).' given';
  19104. unset($this->config[$property][$key]);
  19105. $pass = false;
  19106. continue;
  19107. }
  19108. if ($regex && !preg_match('{^'.$regex.'$}u', $value)) {
  19109. $this->warnings[] = $property.'.'.$key.' : invalid value ('.$value.'), must match '.$regex;
  19110. unset($this->config[$property][$key]);
  19111. $pass = false;
  19112. }
  19113. }
  19114. return $pass;
  19115. }
  19116. private function validateUrl($property, $mandatory = false)
  19117. {
  19118. if (!$this->validateString($property, $mandatory)) {
  19119. return false;
  19120. }
  19121. if (!$this->filterUrl($this->config[$property])) {
  19122. $this->warnings[] = $property.' : invalid value ('.$this->config[$property].'), must be an http/https URL';
  19123. unset($this->config[$property]);
  19124. return false;
  19125. }
  19126. return true;
  19127. }
  19128. private function filterUrl($value, array $schemes = array('http', 'https'))
  19129. {
  19130. if ($value === '') {
  19131. return true;
  19132. }
  19133. $bits = parse_url($value);
  19134. if (empty($bits['scheme']) || empty($bits['host'])) {
  19135. return false;
  19136. }
  19137. if (!in_array($bits['scheme'], $schemes, true)) {
  19138. return false;
  19139. }
  19140. return true;
  19141. }
  19142. }
  19143. <?php
  19144. namespace Composer\Package;
  19145. use Composer\Json\JsonFile;
  19146. use Composer\Installer\InstallationManager;
  19147. use Composer\Repository\RepositoryManager;
  19148. use Composer\Util\ProcessExecutor;
  19149. use Composer\Repository\ArrayRepository;
  19150. use Composer\Package\Dumper\ArrayDumper;
  19151. use Composer\Package\Loader\ArrayLoader;
  19152. use Composer\Plugin\PluginInterface;
  19153. use Composer\Util\Git as GitUtil;
  19154. use Composer\IO\IOInterface;
  19155. use Seld\JsonLint\ParsingException;
  19156. class Locker
  19157. {
  19158. private $lockFile;
  19159. private $repositoryManager;
  19160. private $installationManager;
  19161. private $hash;
  19162. private $contentHash;
  19163. private $loader;
  19164. private $dumper;
  19165. private $process;
  19166. private $lockDataCache;
  19167. public function __construct(IOInterface $io, JsonFile $lockFile, RepositoryManager $repositoryManager, InstallationManager $installationManager, $composerFileContents)
  19168. {
  19169. $this->lockFile = $lockFile;
  19170. $this->repositoryManager = $repositoryManager;
  19171. $this->installationManager = $installationManager;
  19172. $this->hash = md5($composerFileContents);
  19173. $this->contentHash = self::getContentHash($composerFileContents);
  19174. $this->loader = new ArrayLoader(null, true);
  19175. $this->dumper = new ArrayDumper();
  19176. $this->process = new ProcessExecutor($io);
  19177. }
  19178. public static function getContentHash($composerFileContents)
  19179. {
  19180. $content = json_decode($composerFileContents, true);
  19181. $relevantKeys = array(
  19182. 'name',
  19183. 'version',
  19184. 'require',
  19185. 'require-dev',
  19186. 'conflict',
  19187. 'replace',
  19188. 'provide',
  19189. 'minimum-stability',
  19190. 'prefer-stable',
  19191. 'repositories',
  19192. 'extra',
  19193. );
  19194. $relevantContent = array();
  19195. foreach (array_intersect($relevantKeys, array_keys($content)) as $key) {
  19196. $relevantContent[$key] = $content[$key];
  19197. }
  19198. if (isset($content['config']['platform'])) {
  19199. $relevantContent['config']['platform'] = $content['config']['platform'];
  19200. }
  19201. ksort($relevantContent);
  19202. return md5(json_encode($relevantContent));
  19203. }
  19204. public function isLocked()
  19205. {
  19206. if (!$this->lockFile->exists()) {
  19207. return false;
  19208. }
  19209. $data = $this->getLockData();
  19210. return isset($data['packages']);
  19211. }
  19212. public function isFresh()
  19213. {
  19214. $lock = $this->lockFile->read();
  19215. if (!empty($lock['content-hash'])) {
  19216. return $this->contentHash === $lock['content-hash'];
  19217. }
  19218. if (!empty($lock['hash'])) {
  19219. return $this->hash === $lock['hash'];
  19220. }
  19221. return false;
  19222. }
  19223. public function getLockedRepository($withDevReqs = false)
  19224. {
  19225. $lockData = $this->getLockData();
  19226. $packages = new ArrayRepository();
  19227. $lockedPackages = $lockData['packages'];
  19228. if ($withDevReqs) {
  19229. if (isset($lockData['packages-dev'])) {
  19230. $lockedPackages = array_merge($lockedPackages, $lockData['packages-dev']);
  19231. } else {
  19232. 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.');
  19233. }
  19234. }
  19235. if (empty($lockedPackages)) {
  19236. return $packages;
  19237. }
  19238. if (isset($lockedPackages[0]['name'])) {
  19239. foreach ($lockedPackages as $info) {
  19240. $packages->addPackage($this->loader->load($info));
  19241. }
  19242. return $packages;
  19243. }
  19244. 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.');
  19245. }
  19246. public function getPlatformRequirements($withDevReqs = false)
  19247. {
  19248. $lockData = $this->getLockData();
  19249. $requirements = array();
  19250. if (!empty($lockData['platform'])) {
  19251. $requirements = $this->loader->parseLinks(
  19252. '__ROOT__',
  19253. '1.0.0',
  19254. 'requires',
  19255. isset($lockData['platform']) ? $lockData['platform'] : array()
  19256. );
  19257. }
  19258. if ($withDevReqs && !empty($lockData['platform-dev'])) {
  19259. $devRequirements = $this->loader->parseLinks(
  19260. '__ROOT__',
  19261. '1.0.0',
  19262. 'requires',
  19263. isset($lockData['platform-dev']) ? $lockData['platform-dev'] : array()
  19264. );
  19265. $requirements = array_merge($requirements, $devRequirements);
  19266. }
  19267. return $requirements;
  19268. }
  19269. public function getMinimumStability()
  19270. {
  19271. $lockData = $this->getLockData();
  19272. return isset($lockData['minimum-stability']) ? $lockData['minimum-stability'] : 'stable';
  19273. }
  19274. public function getStabilityFlags()
  19275. {
  19276. $lockData = $this->getLockData();
  19277. return isset($lockData['stability-flags']) ? $lockData['stability-flags'] : array();
  19278. }
  19279. public function getPreferStable()
  19280. {
  19281. $lockData = $this->getLockData();
  19282. return isset($lockData['prefer-stable']) ? $lockData['prefer-stable'] : null;
  19283. }
  19284. public function getPreferLowest()
  19285. {
  19286. $lockData = $this->getLockData();
  19287. return isset($lockData['prefer-lowest']) ? $lockData['prefer-lowest'] : null;
  19288. }
  19289. public function getPlatformOverrides()
  19290. {
  19291. $lockData = $this->getLockData();
  19292. return isset($lockData['platform-overrides']) ? $lockData['platform-overrides'] : array();
  19293. }
  19294. public function getAliases()
  19295. {
  19296. $lockData = $this->getLockData();
  19297. return isset($lockData['aliases']) ? $lockData['aliases'] : array();
  19298. }
  19299. public function getLockData()
  19300. {
  19301. if (null !== $this->lockDataCache) {
  19302. return $this->lockDataCache;
  19303. }
  19304. if (!$this->lockFile->exists()) {
  19305. throw new \LogicException('No lockfile found. Unable to read locked packages');
  19306. }
  19307. return $this->lockDataCache = $this->lockFile->read();
  19308. }
  19309. public function setLockData(array $packages, $devPackages, array $platformReqs, $platformDevReqs, array $aliases, $minimumStability, array $stabilityFlags, $preferStable, $preferLowest, array $platformOverrides)
  19310. {
  19311. $lock = array(
  19312. '_readme' => array('This file locks the dependencies of your project to a known state',
  19313. 'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies',
  19314. 'This file is @gener'.'ated automatically', ),
  19315. 'content-hash' => $this->contentHash,
  19316. 'packages' => null,
  19317. 'packages-dev' => null,
  19318. 'aliases' => array(),
  19319. 'minimum-stability' => $minimumStability,
  19320. 'stability-flags' => $stabilityFlags,
  19321. 'prefer-stable' => $preferStable,
  19322. 'prefer-lowest' => $preferLowest,
  19323. );
  19324. foreach ($aliases as $package => $versions) {
  19325. foreach ($versions as $version => $alias) {
  19326. $lock['aliases'][] = array(
  19327. 'alias' => $alias['alias'],
  19328. 'alias_normalized' => $alias['alias_normalized'],
  19329. 'version' => $version,
  19330. 'package' => $package,
  19331. );
  19332. }
  19333. }
  19334. $lock['packages'] = $this->lockPackages($packages);
  19335. if (null !== $devPackages) {
  19336. $lock['packages-dev'] = $this->lockPackages($devPackages);
  19337. }
  19338. $lock['platform'] = $platformReqs;
  19339. $lock['platform-dev'] = $platformDevReqs;
  19340. if ($platformOverrides) {
  19341. $lock['platform-overrides'] = $platformOverrides;
  19342. }
  19343. $lock['plugin-api-version'] = PluginInterface::PLUGIN_API_VERSION;
  19344. if (empty($lock['packages']) && empty($lock['packages-dev']) && empty($lock['platform']) && empty($lock['platform-dev'])) {
  19345. if ($this->lockFile->exists()) {
  19346. unlink($this->lockFile->getPath());
  19347. }
  19348. return false;
  19349. }
  19350. try {
  19351. $isLocked = $this->isLocked();
  19352. } catch (ParsingException $e) {
  19353. $isLocked = false;
  19354. }
  19355. if (!$isLocked || $lock !== $this->getLockData()) {
  19356. $this->lockFile->write($lock);
  19357. $this->lockDataCache = null;
  19358. return true;
  19359. }
  19360. return false;
  19361. }
  19362. private function lockPackages(array $packages)
  19363. {
  19364. $locked = array();
  19365. foreach ($packages as $package) {
  19366. if ($package instanceof AliasPackage) {
  19367. continue;
  19368. }
  19369. $name = $package->getPrettyName();
  19370. $version = $package->getPrettyVersion();
  19371. if (!$name || !$version) {
  19372. throw new \LogicException(sprintf(
  19373. 'Package "%s" has no version or name and can not be locked',
  19374. $package
  19375. ));
  19376. }
  19377. $spec = $this->dumper->dump($package);
  19378. unset($spec['version_normalized']);
  19379. $time = isset($spec['time']) ? $spec['time'] : null;
  19380. unset($spec['time']);
  19381. if ($package->isDev() && $package->getInstallationSource() === 'source') {
  19382. $time = $this->getPackageTime($package) ?: $time;
  19383. }
  19384. if (null !== $time) {
  19385. $spec['time'] = $time;
  19386. }
  19387. unset($spec['installation-source']);
  19388. $locked[] = $spec;
  19389. }
  19390. usort($locked, function ($a, $b) {
  19391. $comparison = strcmp($a['name'], $b['name']);
  19392. if (0 !== $comparison) {
  19393. return $comparison;
  19394. }
  19395. return strcmp($a['version'], $b['version']);
  19396. });
  19397. return $locked;
  19398. }
  19399. private function getPackageTime(PackageInterface $package)
  19400. {
  19401. if (!function_exists('proc_open')) {
  19402. return null;
  19403. }
  19404. $path = realpath($this->installationManager->getInstallPath($package));
  19405. $sourceType = $package->getSourceType();
  19406. $datetime = null;
  19407. if ($path && in_array($sourceType, array('git', 'hg'))) {
  19408. $sourceRef = $package->getSourceReference() ?: $package->getDistReference();
  19409. switch ($sourceType) {
  19410. case 'git':
  19411. GitUtil::cleanEnv();
  19412. if (0 === $this->process->execute('git log -n1 --pretty=%ct '.ProcessExecutor::escape($sourceRef).GitUtil::getNoShowSignatureFlag($this->process), $output, $path) && preg_match('{^\s*\d+\s*$}', $output)) {
  19413. $datetime = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  19414. }
  19415. break;
  19416. case 'hg':
  19417. if (0 === $this->process->execute('hg log --template "{date|hgdate}" -r '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*(\d+)\s*}', $output, $match)) {
  19418. $datetime = new \DateTime('@'.$match[1], new \DateTimeZone('UTC'));
  19419. }
  19420. break;
  19421. }
  19422. }
  19423. return $datetime ? $datetime->format(DATE_RFC3339) : null;
  19424. }
  19425. }
  19426. <?php
  19427. namespace Composer\Package;
  19428. use Composer\Package\Version\VersionParser;
  19429. use Composer\Util\ComposerMirror;
  19430. class Package extends BasePackage
  19431. {
  19432. protected $type;
  19433. protected $targetDir;
  19434. protected $installationSource;
  19435. protected $sourceType;
  19436. protected $sourceUrl;
  19437. protected $sourceReference;
  19438. protected $sourceMirrors;
  19439. protected $distType;
  19440. protected $distUrl;
  19441. protected $distReference;
  19442. protected $distSha1Checksum;
  19443. protected $distMirrors;
  19444. protected $version;
  19445. protected $prettyVersion;
  19446. protected $releaseDate;
  19447. protected $extra = array();
  19448. protected $binaries = array();
  19449. protected $dev;
  19450. protected $stability;
  19451. protected $notificationUrl;
  19452. protected $requires = array();
  19453. protected $conflicts = array();
  19454. protected $provides = array();
  19455. protected $replaces = array();
  19456. protected $devRequires = array();
  19457. protected $suggests = array();
  19458. protected $autoload = array();
  19459. protected $devAutoload = array();
  19460. protected $includePaths = array();
  19461. protected $archiveExcludes = array();
  19462. public function __construct($name, $version, $prettyVersion)
  19463. {
  19464. parent::__construct($name);
  19465. $this->version = $version;
  19466. $this->prettyVersion = $prettyVersion;
  19467. $this->stability = VersionParser::parseStability($version);
  19468. $this->dev = $this->stability === 'dev';
  19469. }
  19470. public function isDev()
  19471. {
  19472. return $this->dev;
  19473. }
  19474. public function setType($type)
  19475. {
  19476. $this->type = $type;
  19477. }
  19478. public function getType()
  19479. {
  19480. return $this->type ?: 'library';
  19481. }
  19482. public function getStability()
  19483. {
  19484. return $this->stability;
  19485. }
  19486. public function setTargetDir($targetDir)
  19487. {
  19488. $this->targetDir = $targetDir;
  19489. }
  19490. public function getTargetDir()
  19491. {
  19492. if (null === $this->targetDir) {
  19493. return;
  19494. }
  19495. return ltrim(preg_replace('{ (?:^|[\\\\/]+) \.\.? (?:[\\\\/]+|$) (?:\.\.? (?:[\\\\/]+|$) )*}x', '/', $this->targetDir), '/');
  19496. }
  19497. public function setExtra(array $extra)
  19498. {
  19499. $this->extra = $extra;
  19500. }
  19501. public function getExtra()
  19502. {
  19503. return $this->extra;
  19504. }
  19505. public function setBinaries(array $binaries)
  19506. {
  19507. $this->binaries = $binaries;
  19508. }
  19509. public function getBinaries()
  19510. {
  19511. return $this->binaries;
  19512. }
  19513. public function setInstallationSource($type)
  19514. {
  19515. $this->installationSource = $type;
  19516. }
  19517. public function getInstallationSource()
  19518. {
  19519. return $this->installationSource;
  19520. }
  19521. public function setSourceType($type)
  19522. {
  19523. $this->sourceType = $type;
  19524. }
  19525. public function getSourceType()
  19526. {
  19527. return $this->sourceType;
  19528. }
  19529. public function setSourceUrl($url)
  19530. {
  19531. $this->sourceUrl = $url;
  19532. }
  19533. public function getSourceUrl()
  19534. {
  19535. return $this->sourceUrl;
  19536. }
  19537. public function setSourceReference($reference)
  19538. {
  19539. $this->sourceReference = $reference;
  19540. }
  19541. public function getSourceReference()
  19542. {
  19543. return $this->sourceReference;
  19544. }
  19545. public function setSourceMirrors($mirrors)
  19546. {
  19547. $this->sourceMirrors = $mirrors;
  19548. }
  19549. public function getSourceMirrors()
  19550. {
  19551. return $this->sourceMirrors;
  19552. }
  19553. public function getSourceUrls()
  19554. {
  19555. return $this->getUrls($this->sourceUrl, $this->sourceMirrors, $this->sourceReference, $this->sourceType, 'source');
  19556. }
  19557. public function setDistType($type)
  19558. {
  19559. $this->distType = $type;
  19560. }
  19561. public function getDistType()
  19562. {
  19563. return $this->distType;
  19564. }
  19565. public function setDistUrl($url)
  19566. {
  19567. $this->distUrl = $url;
  19568. }
  19569. public function getDistUrl()
  19570. {
  19571. return $this->distUrl;
  19572. }
  19573. public function setDistReference($reference)
  19574. {
  19575. $this->distReference = $reference;
  19576. }
  19577. public function getDistReference()
  19578. {
  19579. return $this->distReference;
  19580. }
  19581. public function setDistSha1Checksum($sha1checksum)
  19582. {
  19583. $this->distSha1Checksum = $sha1checksum;
  19584. }
  19585. public function getDistSha1Checksum()
  19586. {
  19587. return $this->distSha1Checksum;
  19588. }
  19589. public function setDistMirrors($mirrors)
  19590. {
  19591. $this->distMirrors = $mirrors;
  19592. }
  19593. public function getDistMirrors()
  19594. {
  19595. return $this->distMirrors;
  19596. }
  19597. public function getDistUrls()
  19598. {
  19599. return $this->getUrls($this->distUrl, $this->distMirrors, $this->distReference, $this->distType, 'dist');
  19600. }
  19601. public function getVersion()
  19602. {
  19603. return $this->version;
  19604. }
  19605. public function getPrettyVersion()
  19606. {
  19607. return $this->prettyVersion;
  19608. }
  19609. public function setReleaseDate(\DateTime $releaseDate)
  19610. {
  19611. $this->releaseDate = $releaseDate;
  19612. }
  19613. public function getReleaseDate()
  19614. {
  19615. return $this->releaseDate;
  19616. }
  19617. public function setRequires(array $requires)
  19618. {
  19619. $this->requires = $requires;
  19620. }
  19621. public function getRequires()
  19622. {
  19623. return $this->requires;
  19624. }
  19625. public function setConflicts(array $conflicts)
  19626. {
  19627. $this->conflicts = $conflicts;
  19628. }
  19629. public function getConflicts()
  19630. {
  19631. return $this->conflicts;
  19632. }
  19633. public function setProvides(array $provides)
  19634. {
  19635. $this->provides = $provides;
  19636. }
  19637. public function getProvides()
  19638. {
  19639. return $this->provides;
  19640. }
  19641. public function setReplaces(array $replaces)
  19642. {
  19643. $this->replaces = $replaces;
  19644. }
  19645. public function getReplaces()
  19646. {
  19647. return $this->replaces;
  19648. }
  19649. public function setDevRequires(array $devRequires)
  19650. {
  19651. $this->devRequires = $devRequires;
  19652. }
  19653. public function getDevRequires()
  19654. {
  19655. return $this->devRequires;
  19656. }
  19657. public function setSuggests(array $suggests)
  19658. {
  19659. $this->suggests = $suggests;
  19660. }
  19661. public function getSuggests()
  19662. {
  19663. return $this->suggests;
  19664. }
  19665. public function setAutoload(array $autoload)
  19666. {
  19667. $this->autoload = $autoload;
  19668. }
  19669. public function getAutoload()
  19670. {
  19671. return $this->autoload;
  19672. }
  19673. public function setDevAutoload(array $devAutoload)
  19674. {
  19675. $this->devAutoload = $devAutoload;
  19676. }
  19677. public function getDevAutoload()
  19678. {
  19679. return $this->devAutoload;
  19680. }
  19681. public function setIncludePaths(array $includePaths)
  19682. {
  19683. $this->includePaths = $includePaths;
  19684. }
  19685. public function getIncludePaths()
  19686. {
  19687. return $this->includePaths;
  19688. }
  19689. public function setNotificationUrl($notificationUrl)
  19690. {
  19691. $this->notificationUrl = $notificationUrl;
  19692. }
  19693. public function getNotificationUrl()
  19694. {
  19695. return $this->notificationUrl;
  19696. }
  19697. public function setArchiveExcludes(array $excludes)
  19698. {
  19699. $this->archiveExcludes = $excludes;
  19700. }
  19701. public function getArchiveExcludes()
  19702. {
  19703. return $this->archiveExcludes;
  19704. }
  19705. public function replaceVersion($version, $prettyVersion)
  19706. {
  19707. $this->version = $version;
  19708. $this->prettyVersion = $prettyVersion;
  19709. $this->stability = VersionParser::parseStability($version);
  19710. $this->dev = $this->stability === 'dev';
  19711. }
  19712. protected function getUrls($url, $mirrors, $ref, $type, $urlType)
  19713. {
  19714. if (!$url) {
  19715. return array();
  19716. }
  19717. $urls = array($url);
  19718. if ($mirrors) {
  19719. foreach ($mirrors as $mirror) {
  19720. if ($urlType === 'dist') {
  19721. $mirrorUrl = ComposerMirror::processUrl($mirror['url'], $this->name, $this->version, $ref, $type);
  19722. } elseif ($urlType === 'source' && $type === 'git') {
  19723. $mirrorUrl = ComposerMirror::processGitUrl($mirror['url'], $this->name, $url, $type);
  19724. } elseif ($urlType === 'source' && $type === 'hg') {
  19725. $mirrorUrl = ComposerMirror::processHgUrl($mirror['url'], $this->name, $url, $type);
  19726. }
  19727. if (!in_array($mirrorUrl, $urls)) {
  19728. $func = $mirror['preferred'] ? 'array_unshift' : 'array_push';
  19729. $func($urls, $mirrorUrl);
  19730. }
  19731. }
  19732. }
  19733. return $urls;
  19734. }
  19735. }
  19736. <?php
  19737. namespace Composer\Package;
  19738. use Composer\Repository\RepositoryInterface;
  19739. interface PackageInterface
  19740. {
  19741. public function getName();
  19742. public function getPrettyName();
  19743. public function getNames();
  19744. public function setId($id);
  19745. public function getId();
  19746. public function isDev();
  19747. public function getType();
  19748. public function getTargetDir();
  19749. public function getExtra();
  19750. public function setInstallationSource($type);
  19751. public function getInstallationSource();
  19752. public function getSourceType();
  19753. public function getSourceUrl();
  19754. public function getSourceUrls();
  19755. public function getSourceReference();
  19756. public function getSourceMirrors();
  19757. public function getDistType();
  19758. public function getDistUrl();
  19759. public function getDistUrls();
  19760. public function getDistReference();
  19761. public function getDistSha1Checksum();
  19762. public function getDistMirrors();
  19763. public function getVersion();
  19764. public function getPrettyVersion();
  19765. public function getFullPrettyVersion($truncate = true);
  19766. public function getReleaseDate();
  19767. public function getStability();
  19768. public function getRequires();
  19769. public function getConflicts();
  19770. public function getProvides();
  19771. public function getReplaces();
  19772. public function getDevRequires();
  19773. public function getSuggests();
  19774. public function getAutoload();
  19775. public function getDevAutoload();
  19776. public function getIncludePaths();
  19777. public function setRepository(RepositoryInterface $repository);
  19778. public function getRepository();
  19779. public function getBinaries();
  19780. public function getUniqueName();
  19781. public function getNotificationUrl();
  19782. public function __toString();
  19783. public function getPrettyString();
  19784. public function getArchiveExcludes();
  19785. public function getTransportOptions();
  19786. public function setSourceReference($reference);
  19787. public function setDistUrl($url);
  19788. public function setDistType($type);
  19789. public function setDistReference($reference);
  19790. }
  19791. <?php
  19792. namespace Composer\Package;
  19793. class RootAliasPackage extends AliasPackage implements RootPackageInterface
  19794. {
  19795. public function __construct(RootPackageInterface $aliasOf, $version, $prettyVersion)
  19796. {
  19797. parent::__construct($aliasOf, $version, $prettyVersion);
  19798. }
  19799. public function getAliases()
  19800. {
  19801. return $this->aliasOf->getAliases();
  19802. }
  19803. public function getMinimumStability()
  19804. {
  19805. return $this->aliasOf->getMinimumStability();
  19806. }
  19807. public function getStabilityFlags()
  19808. {
  19809. return $this->aliasOf->getStabilityFlags();
  19810. }
  19811. public function getReferences()
  19812. {
  19813. return $this->aliasOf->getReferences();
  19814. }
  19815. public function getPreferStable()
  19816. {
  19817. return $this->aliasOf->getPreferStable();
  19818. }
  19819. public function getConfig()
  19820. {
  19821. return $this->aliasOf->getConfig();
  19822. }
  19823. public function setRequires(array $require)
  19824. {
  19825. $this->requires = $this->replaceSelfVersionDependencies($require, 'requires');
  19826. $this->aliasOf->setRequires($require);
  19827. }
  19828. public function setDevRequires(array $devRequire)
  19829. {
  19830. $this->devRequires = $this->replaceSelfVersionDependencies($devRequire, 'devRequires');
  19831. $this->aliasOf->setDevRequires($devRequire);
  19832. }
  19833. public function setConflicts(array $conflicts)
  19834. {
  19835. $this->conflicts = $this->replaceSelfVersionDependencies($conflicts, 'conflicts');
  19836. $this->aliasOf->setConflicts($conflicts);
  19837. }
  19838. public function setProvides(array $provides)
  19839. {
  19840. $this->provides = $this->replaceSelfVersionDependencies($provides, 'provides');
  19841. $this->aliasOf->setProvides($provides);
  19842. }
  19843. public function setReplaces(array $replaces)
  19844. {
  19845. $this->replaces = $this->replaceSelfVersionDependencies($replaces, 'replaces');
  19846. $this->aliasOf->setReplaces($replaces);
  19847. }
  19848. public function setRepositories($repositories)
  19849. {
  19850. $this->aliasOf->setRepositories($repositories);
  19851. }
  19852. public function setAutoload(array $autoload)
  19853. {
  19854. $this->aliasOf->setAutoload($autoload);
  19855. }
  19856. public function setDevAutoload(array $devAutoload)
  19857. {
  19858. $this->aliasOf->setDevAutoload($devAutoload);
  19859. }
  19860. public function setStabilityFlags(array $stabilityFlags)
  19861. {
  19862. $this->aliasOf->setStabilityFlags($stabilityFlags);
  19863. }
  19864. public function setSuggests(array $suggests)
  19865. {
  19866. $this->aliasOf->setSuggests($suggests);
  19867. }
  19868. public function setExtra(array $extra)
  19869. {
  19870. $this->aliasOf->setExtra($extra);
  19871. }
  19872. public function __clone()
  19873. {
  19874. parent::__clone();
  19875. $this->aliasOf = clone $this->aliasOf;
  19876. }
  19877. }
  19878. <?php
  19879. namespace Composer\Package;
  19880. class RootPackage extends CompletePackage implements RootPackageInterface
  19881. {
  19882. protected $minimumStability = 'stable';
  19883. protected $preferStable = false;
  19884. protected $stabilityFlags = array();
  19885. protected $config = array();
  19886. protected $references = array();
  19887. protected $aliases = array();
  19888. public function setMinimumStability($minimumStability)
  19889. {
  19890. $this->minimumStability = $minimumStability;
  19891. }
  19892. public function getMinimumStability()
  19893. {
  19894. return $this->minimumStability;
  19895. }
  19896. public function setStabilityFlags(array $stabilityFlags)
  19897. {
  19898. $this->stabilityFlags = $stabilityFlags;
  19899. }
  19900. public function getStabilityFlags()
  19901. {
  19902. return $this->stabilityFlags;
  19903. }
  19904. public function setPreferStable($preferStable)
  19905. {
  19906. $this->preferStable = $preferStable;
  19907. }
  19908. public function getPreferStable()
  19909. {
  19910. return $this->preferStable;
  19911. }
  19912. public function setConfig(array $config)
  19913. {
  19914. $this->config = $config;
  19915. }
  19916. public function getConfig()
  19917. {
  19918. return $this->config;
  19919. }
  19920. public function setReferences(array $references)
  19921. {
  19922. $this->references = $references;
  19923. }
  19924. public function getReferences()
  19925. {
  19926. return $this->references;
  19927. }
  19928. public function setAliases(array $aliases)
  19929. {
  19930. $this->aliases = $aliases;
  19931. }
  19932. public function getAliases()
  19933. {
  19934. return $this->aliases;
  19935. }
  19936. }
  19937. <?php
  19938. namespace Composer\Package;
  19939. interface RootPackageInterface extends CompletePackageInterface
  19940. {
  19941. public function getAliases();
  19942. public function getMinimumStability();
  19943. public function getStabilityFlags();
  19944. public function getReferences();
  19945. public function getPreferStable();
  19946. public function getConfig();
  19947. public function setRequires(array $requires);
  19948. public function setDevRequires(array $devRequires);
  19949. public function setConflicts(array $conflicts);
  19950. public function setProvides(array $provides);
  19951. public function setReplaces(array $replaces);
  19952. public function setRepositories($repositories);
  19953. public function setAutoload(array $autoload);
  19954. public function setDevAutoload(array $devAutoload);
  19955. public function setStabilityFlags(array $stabilityFlags);
  19956. public function setSuggests(array $suggests);
  19957. public function setExtra(array $extra);
  19958. }
  19959. <?php
  19960. namespace Composer\Package\Version;
  19961. use Composer\Config;
  19962. use Composer\Repository\Vcs\HgDriver;
  19963. use Composer\IO\NullIO;
  19964. use Composer\Semver\VersionParser as SemverVersionParser;
  19965. use Composer\Util\Git as GitUtil;
  19966. use Composer\Util\ProcessExecutor;
  19967. use Composer\Util\Svn as SvnUtil;
  19968. class VersionGuesser
  19969. {
  19970. private $config;
  19971. private $process;
  19972. private $versionParser;
  19973. public function __construct(Config $config, ProcessExecutor $process, SemverVersionParser $versionParser)
  19974. {
  19975. $this->config = $config;
  19976. $this->process = $process;
  19977. $this->versionParser = $versionParser;
  19978. }
  19979. public function guessVersion(array $packageConfig, $path)
  19980. {
  19981. if (!function_exists('proc_open')) {
  19982. return null;
  19983. }
  19984. $versionData = $this->guessGitVersion($packageConfig, $path);
  19985. if (null !== $versionData && null !== $versionData['version']) {
  19986. return $this->postprocess($versionData);
  19987. }
  19988. $versionData = $this->guessHgVersion($packageConfig, $path);
  19989. if (null !== $versionData && null !== $versionData['version']) {
  19990. return $this->postprocess($versionData);
  19991. }
  19992. $versionData = $this->guessFossilVersion($packageConfig, $path);
  19993. if (null !== $versionData && null !== $versionData['version']) {
  19994. return $this->postprocess($versionData);
  19995. }
  19996. $versionData = $this->guessSvnVersion($packageConfig, $path);
  19997. if (null !== $versionData && null !== $versionData['version']) {
  19998. return $this->postprocess($versionData);
  19999. }
  20000. return null;
  20001. }
  20002. private function postprocess(array $versionData)
  20003. {
  20004. if (!empty($versionData['feature_version']) && $versionData['feature_version'] === $versionData['version'] && $versionData['feature_pretty_version'] === $versionData['feature_pretty_version']) {
  20005. unset($versionData['feature_version'], $versionData['feature_pretty_version']);
  20006. }
  20007. if ('-dev' === substr($versionData['version'], -4) && preg_match('{\.9{7}}', $versionData['version'])) {
  20008. $versionData['pretty_version'] = preg_replace('{(\.9{7})+}', '.x', $versionData['version']);
  20009. }
  20010. if (!empty($versionData['feature_version']) && '-dev' === substr($versionData['feature_version'], -4) && preg_match('{\.9{7}}', $versionData['feature_version'])) {
  20011. $versionData['feature_pretty_version'] = preg_replace('{(\.9{7})+}', '.x', $versionData['feature_version']);
  20012. }
  20013. return $versionData;
  20014. }
  20015. private function guessGitVersion(array $packageConfig, $path)
  20016. {
  20017. GitUtil::cleanEnv();
  20018. $commit = null;
  20019. $version = null;
  20020. $prettyVersion = null;
  20021. $featureVersion = null;
  20022. $featurePrettyVersion = null;
  20023. $isDetached = false;
  20024. if (0 === $this->process->execute('git branch --no-color --no-abbrev -v', $output, $path)) {
  20025. $branches = array();
  20026. $isFeatureBranch = false;
  20027. foreach ($this->process->splitLines($output) as $branch) {
  20028. if ($branch && preg_match('{^(?:\* ) *(\(no branch\)|\(detached from \S+\)|\(HEAD detached at \S+\)|\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  20029. if ($match[1] === '(no branch)' || substr($match[1], 0, 10) === '(detached ' || substr($match[1], 0, 17) === '(HEAD detached at') {
  20030. $version = 'dev-' . $match[2];
  20031. $prettyVersion = $version;
  20032. $isFeatureBranch = true;
  20033. $isDetached = true;
  20034. } else {
  20035. $version = $this->versionParser->normalizeBranch($match[1]);
  20036. $prettyVersion = 'dev-' . $match[1];
  20037. $isFeatureBranch = 0 === strpos($version, 'dev-');
  20038. }
  20039. if ($match[2]) {
  20040. $commit = $match[2];
  20041. }
  20042. }
  20043. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  20044. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  20045. $branches[] = $match[1];
  20046. }
  20047. }
  20048. }
  20049. if ($isFeatureBranch) {
  20050. $featureVersion = $version;
  20051. $featurePrettyVersion = $prettyVersion;
  20052. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'git rev-list %candidate%..%branch%', $path);
  20053. $version = $result['version'];
  20054. $prettyVersion = $result['pretty_version'];
  20055. }
  20056. }
  20057. if (!$version || $isDetached) {
  20058. $result = $this->versionFromGitTags($path);
  20059. if ($result) {
  20060. $version = $result['version'];
  20061. $prettyVersion = $result['pretty_version'];
  20062. $featureVersion = null;
  20063. $featurePrettyVersion = null;
  20064. }
  20065. }
  20066. if (!$commit) {
  20067. $command = 'git log --pretty="%H" -n1 HEAD'.GitUtil::getNoShowSignatureFlag($this->process);
  20068. if (0 === $this->process->execute($command, $output, $path)) {
  20069. $commit = trim($output) ?: null;
  20070. }
  20071. }
  20072. if ($featureVersion) {
  20073. return array('version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion, 'feature_version' => $featureVersion, 'feature_pretty_version' => $featurePrettyVersion);
  20074. }
  20075. return array('version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion);
  20076. }
  20077. private function versionFromGitTags($path)
  20078. {
  20079. if (0 === $this->process->execute('git describe --exact-match --tags', $output, $path)) {
  20080. try {
  20081. $version = $this->versionParser->normalize(trim($output));
  20082. return array('version' => $version, 'pretty_version' => trim($output));
  20083. } catch (\Exception $e) {
  20084. }
  20085. }
  20086. return null;
  20087. }
  20088. private function guessHgVersion(array $packageConfig, $path)
  20089. {
  20090. if (0 === $this->process->execute('hg branch', $output, $path)) {
  20091. $branch = trim($output);
  20092. $version = $this->versionParser->normalizeBranch($branch);
  20093. $isFeatureBranch = 0 === strpos($version, 'dev-');
  20094. if ('9999999-dev' === $version) {
  20095. return array('version' => $version, 'commit' => null, 'pretty_version' => 'dev-'.$branch);
  20096. }
  20097. if (!$isFeatureBranch) {
  20098. return array('version' => $version, 'commit' => null, 'pretty_version' => $version);
  20099. }
  20100. $driver = new HgDriver(array('url' => $path), new NullIO(), $this->config, $this->process);
  20101. $branches = array_keys($driver->getBranches());
  20102. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'hg log -r "not ancestors(\'%candidate%\') and ancestors(\'%branch%\')" --template "{node}\\n"', $path);
  20103. $result['commit'] = '';
  20104. $result['feature_version'] = $version;
  20105. $result['feature_pretty_version'] = $version;
  20106. return $result;
  20107. }
  20108. }
  20109. private function guessFeatureVersion(array $packageConfig, $version, array $branches, $scmCmdline, $path)
  20110. {
  20111. $prettyVersion = $version;
  20112. if ((isset($packageConfig['extra']['branch-alias']) && !isset($packageConfig['extra']['branch-alias'][$version]))
  20113. || strpos(json_encode($packageConfig), '"self.version"')
  20114. ) {
  20115. $branch = preg_replace('{^dev-}', '', $version);
  20116. $length = PHP_INT_MAX;
  20117. $nonFeatureBranches = '';
  20118. if (!empty($packageConfig['non-feature-branches'])) {
  20119. $nonFeatureBranches = implode('|', $packageConfig['non-feature-branches']);
  20120. }
  20121. foreach ($branches as $candidate) {
  20122. if ($candidate === $branch && preg_match('{^(' . $nonFeatureBranches . ')$}', $candidate)) {
  20123. break;
  20124. }
  20125. if ($candidate === $branch || !preg_match('{^(' . $nonFeatureBranches . '|master|trunk|default|develop|\d+\..+)$}', $candidate, $match)) {
  20126. continue;
  20127. }
  20128. $cmdLine = str_replace(array('%candidate%', '%branch%'), array($candidate, $branch), $scmCmdline);
  20129. if (0 !== $this->process->execute($cmdLine, $output, $path)) {
  20130. continue;
  20131. }
  20132. if (strlen($output) < $length) {
  20133. $length = strlen($output);
  20134. $version = $this->versionParser->normalizeBranch($candidate);
  20135. $prettyVersion = 'dev-' . $match[1];
  20136. }
  20137. }
  20138. }
  20139. return array('version' => $version, 'pretty_version' => $prettyVersion);
  20140. }
  20141. private function guessFossilVersion(array $packageConfig, $path)
  20142. {
  20143. $version = null;
  20144. $prettyVersion = null;
  20145. if (0 === $this->process->execute('fossil branch list', $output, $path)) {
  20146. $branch = trim($output);
  20147. $version = $this->versionParser->normalizeBranch($branch);
  20148. $prettyVersion = 'dev-' . $branch;
  20149. }
  20150. if (0 === $this->process->execute('fossil tag list', $output, $path)) {
  20151. try {
  20152. $version = $this->versionParser->normalize(trim($output));
  20153. $prettyVersion = trim($output);
  20154. } catch (\Exception $e) {
  20155. }
  20156. }
  20157. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  20158. }
  20159. private function guessSvnVersion(array $packageConfig, $path)
  20160. {
  20161. SvnUtil::cleanEnv();
  20162. if (0 === $this->process->execute('svn info --xml', $output, $path)) {
  20163. $trunkPath = isset($packageConfig['trunk-path']) ? preg_quote($packageConfig['trunk-path'], '#') : 'trunk';
  20164. $branchesPath = isset($packageConfig['branches-path']) ? preg_quote($packageConfig['branches-path'], '#') : 'branches';
  20165. $tagsPath = isset($packageConfig['tags-path']) ? preg_quote($packageConfig['tags-path'], '#') : 'tags';
  20166. $urlPattern = '#<url>.*/(' . $trunkPath . '|(' . $branchesPath . '|' . $tagsPath . ')/(.*))</url>#';
  20167. if (preg_match($urlPattern, $output, $matches)) {
  20168. if (isset($matches[2]) && ($branchesPath === $matches[2] || $tagsPath === $matches[2])) {
  20169. $version = $this->versionParser->normalizeBranch($matches[3]);
  20170. $prettyVersion = 'dev-' . $matches[3];
  20171. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  20172. }
  20173. $prettyVersion = trim($matches[1]);
  20174. $version = $this->versionParser->normalize($prettyVersion);
  20175. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  20176. }
  20177. }
  20178. }
  20179. }
  20180. <?php
  20181. namespace Composer\Package\Version;
  20182. use Composer\Repository\PlatformRepository;
  20183. use Composer\Semver\VersionParser as SemverVersionParser;
  20184. use Composer\Semver\Semver;
  20185. class VersionParser extends SemverVersionParser
  20186. {
  20187. private static $constraints = array();
  20188. public function parseConstraints($constraints)
  20189. {
  20190. if (!isset(self::$constraints[$constraints])) {
  20191. self::$constraints[$constraints] = parent::parseConstraints($constraints);
  20192. }
  20193. return self::$constraints[$constraints];
  20194. }
  20195. public function parseNameVersionPairs(array $pairs)
  20196. {
  20197. $pairs = array_values($pairs);
  20198. $result = array();
  20199. for ($i = 0, $count = count($pairs); $i < $count; $i++) {
  20200. $pair = preg_replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i]));
  20201. if (false === strpos($pair, ' ') && isset($pairs[$i + 1]) && false === strpos($pairs[$i + 1], '/') && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $pairs[$i + 1])) {
  20202. $pair .= ' '.$pairs[$i + 1];
  20203. $i++;
  20204. }
  20205. if (strpos($pair, ' ')) {
  20206. list($name, $version) = explode(' ', $pair, 2);
  20207. $result[] = array('name' => $name, 'version' => $version);
  20208. } else {
  20209. $result[] = array('name' => $pair);
  20210. }
  20211. }
  20212. return $result;
  20213. }
  20214. public static function isUpgrade($normalizedFrom, $normalizedTo)
  20215. {
  20216. if (substr($normalizedFrom, 0, 4) === 'dev-' || substr($normalizedTo, 0, 4) === 'dev-') {
  20217. return true;
  20218. }
  20219. $sorted = Semver::sort(array($normalizedTo, $normalizedFrom));
  20220. return $sorted[0] === $normalizedFrom;
  20221. }
  20222. }
  20223. <?php
  20224. namespace Composer\Package\Version;
  20225. use Composer\DependencyResolver\Pool;
  20226. use Composer\Package\BasePackage;
  20227. use Composer\Package\PackageInterface;
  20228. use Composer\Plugin\PluginInterface;
  20229. use Composer\Composer;
  20230. use Composer\Package\Loader\ArrayLoader;
  20231. use Composer\Package\Dumper\ArrayDumper;
  20232. use Composer\Semver\Constraint\Constraint;
  20233. class VersionSelector
  20234. {
  20235. private $pool;
  20236. private $parser;
  20237. public function __construct(Pool $pool)
  20238. {
  20239. $this->pool = $pool;
  20240. }
  20241. public function findBestCandidate($packageName, $targetPackageVersion = null, $targetPhpVersion = null, $preferredStability = 'stable')
  20242. {
  20243. $constraint = $targetPackageVersion ? $this->getParser()->parseConstraints($targetPackageVersion) : null;
  20244. $candidates = $this->pool->whatProvides(strtolower($packageName), $constraint, true);
  20245. if ($targetPhpVersion) {
  20246. $phpConstraint = new Constraint('==', $this->getParser()->normalize($targetPhpVersion));
  20247. $composerRuntimeConstraint = new Constraint('==', $this->getParser()->normalize(Composer::RUNTIME_API_VERSION));
  20248. $composerPluginConstraint = new Constraint('==', $this->getParser()->normalize(PluginInterface::PLUGIN_API_VERSION));
  20249. $candidates = array_filter($candidates, function ($pkg) use ($phpConstraint, $composerPluginConstraint, $composerRuntimeConstraint) {
  20250. $reqs = $pkg->getRequires();
  20251. return (!isset($reqs['php']) || $reqs['php']->getConstraint()->matches($phpConstraint))
  20252. && (!isset($reqs['composer-plugin-api']) || $reqs['composer-plugin-api']->getConstraint()->matches($composerPluginConstraint))
  20253. && (!isset($reqs['composer-runtime-api']) || $reqs['composer-runtime-api']->getConstraint()->matches($composerRuntimeConstraint));
  20254. });
  20255. }
  20256. if (!$candidates) {
  20257. return false;
  20258. }
  20259. $package = reset($candidates);
  20260. $minPriority = BasePackage::$stabilities[$preferredStability];
  20261. foreach ($candidates as $candidate) {
  20262. $candidatePriority = $candidate->getStabilityPriority();
  20263. $currentPriority = $package->getStabilityPriority();
  20264. if ($minPriority < $candidatePriority && $currentPriority < $candidatePriority) {
  20265. continue;
  20266. }
  20267. if ($minPriority < $candidatePriority && $candidatePriority < $currentPriority) {
  20268. $package = $candidate;
  20269. continue;
  20270. }
  20271. if ($minPriority >= $candidatePriority && $minPriority < $currentPriority) {
  20272. $package = $candidate;
  20273. continue;
  20274. }
  20275. if (version_compare($package->getVersion(), $candidate->getVersion(), '<')) {
  20276. $package = $candidate;
  20277. }
  20278. }
  20279. return $package;
  20280. }
  20281. public function findRecommendedRequireVersion(PackageInterface $package)
  20282. {
  20283. $version = $package->getVersion();
  20284. if (!$package->isDev()) {
  20285. return $this->transformVersion($version, $package->getPrettyVersion(), $package->getStability());
  20286. }
  20287. $loader = new ArrayLoader($this->getParser());
  20288. $dumper = new ArrayDumper();
  20289. $extra = $loader->getBranchAlias($dumper->dump($package));
  20290. if ($extra) {
  20291. $extra = preg_replace('{^(\d+\.\d+\.\d+)(\.9999999)-dev$}', '$1.0', $extra, -1, $count);
  20292. if ($count) {
  20293. $extra = str_replace('.9999999', '.0', $extra);
  20294. return $this->transformVersion($extra, $extra, 'dev');
  20295. }
  20296. }
  20297. return $package->getPrettyVersion();
  20298. }
  20299. private function transformVersion($version, $prettyVersion, $stability)
  20300. {
  20301. $semanticVersionParts = explode('.', $version);
  20302. if (count($semanticVersionParts) == 4 && preg_match('{^0\D?}', $semanticVersionParts[3])) {
  20303. if ($semanticVersionParts[0] === '0') {
  20304. unset($semanticVersionParts[3]);
  20305. } else {
  20306. unset($semanticVersionParts[2], $semanticVersionParts[3]);
  20307. }
  20308. $version = implode('.', $semanticVersionParts);
  20309. } else {
  20310. return $prettyVersion;
  20311. }
  20312. if ($stability != 'stable') {
  20313. $version .= '@'.$stability;
  20314. }
  20315. return '^' . $version;
  20316. }
  20317. private function getParser()
  20318. {
  20319. if ($this->parser === null) {
  20320. $this->parser = new VersionParser();
  20321. }
  20322. return $this->parser;
  20323. }
  20324. }
  20325. <?php
  20326. namespace Composer\Plugin\Capability;
  20327. interface Capability
  20328. {
  20329. }
  20330. <?php
  20331. namespace Composer\Plugin\Capability;
  20332. interface CommandProvider extends Capability
  20333. {
  20334. public function getCommands();
  20335. }
  20336. <?php
  20337. namespace Composer\Plugin;
  20338. interface Capable
  20339. {
  20340. public function getCapabilities();
  20341. }
  20342. <?php
  20343. namespace Composer\Plugin;
  20344. use Composer\EventDispatcher\Event;
  20345. use Symfony\Component\Console\Input\InputInterface;
  20346. use Symfony\Component\Console\Output\OutputInterface;
  20347. class CommandEvent extends Event
  20348. {
  20349. private $commandName;
  20350. private $input;
  20351. private $output;
  20352. public function __construct($name, $commandName, $input, $output, array $args = array(), array $flags = array())
  20353. {
  20354. parent::__construct($name, $args, $flags);
  20355. $this->commandName = $commandName;
  20356. $this->input = $input;
  20357. $this->output = $output;
  20358. }
  20359. public function getInput()
  20360. {
  20361. return $this->input;
  20362. }
  20363. public function getOutput()
  20364. {
  20365. return $this->output;
  20366. }
  20367. public function getCommandName()
  20368. {
  20369. return $this->commandName;
  20370. }
  20371. }
  20372. <?php
  20373. namespace Composer\Plugin;
  20374. class PluginEvents
  20375. {
  20376. const INIT = 'init';
  20377. const COMMAND = 'command';
  20378. const PRE_FILE_DOWNLOAD = 'pre-file-download';
  20379. const PRE_COMMAND_RUN = 'pre-command-run';
  20380. }
  20381. <?php
  20382. namespace Composer\Plugin;
  20383. use Composer\Composer;
  20384. use Composer\IO\IOInterface;
  20385. interface PluginInterface
  20386. {
  20387. const PLUGIN_API_VERSION = '1.1.0';
  20388. public function activate(Composer $composer, IOInterface $io);
  20389. }
  20390. <?php
  20391. namespace Composer\Plugin;
  20392. use Composer\Composer;
  20393. use Composer\EventDispatcher\EventSubscriberInterface;
  20394. use Composer\IO\IOInterface;
  20395. use Composer\Package\CompletePackage;
  20396. use Composer\Package\Package;
  20397. use Composer\Package\Version\VersionParser;
  20398. use Composer\Repository\RepositoryInterface;
  20399. use Composer\Package\PackageInterface;
  20400. use Composer\Package\Link;
  20401. use Composer\Semver\Constraint\Constraint;
  20402. use Composer\DependencyResolver\Pool;
  20403. use Composer\Plugin\Capability\Capability;
  20404. use Composer\Util\PackageSorter;
  20405. class PluginManager
  20406. {
  20407. protected $composer;
  20408. protected $io;
  20409. protected $globalComposer;
  20410. protected $versionParser;
  20411. protected $disablePlugins = false;
  20412. protected $plugins = array();
  20413. protected $registeredPlugins = array();
  20414. private static $classCounter = 0;
  20415. public function __construct(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  20416. {
  20417. $this->io = $io;
  20418. $this->composer = $composer;
  20419. $this->globalComposer = $globalComposer;
  20420. $this->versionParser = new VersionParser();
  20421. $this->disablePlugins = $disablePlugins;
  20422. }
  20423. public function loadInstalledPlugins()
  20424. {
  20425. if ($this->disablePlugins) {
  20426. return;
  20427. }
  20428. $repo = $this->composer->getRepositoryManager()->getLocalRepository();
  20429. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  20430. if ($repo) {
  20431. $this->loadRepository($repo);
  20432. }
  20433. if ($globalRepo) {
  20434. $this->loadRepository($globalRepo);
  20435. }
  20436. }
  20437. public function getPlugins()
  20438. {
  20439. return $this->plugins;
  20440. }
  20441. public function getGlobalComposer()
  20442. {
  20443. return $this->globalComposer;
  20444. }
  20445. public function registerPackage(PackageInterface $package, $failOnMissingClasses = false)
  20446. {
  20447. if ($this->disablePlugins) {
  20448. return;
  20449. }
  20450. if ($package->getType() === 'composer-plugin') {
  20451. $requiresComposer = null;
  20452. foreach ($package->getRequires() as $link) {
  20453. if ('composer-plugin-api' === $link->getTarget()) {
  20454. $requiresComposer = $link->getConstraint();
  20455. break;
  20456. }
  20457. }
  20458. if (!$requiresComposer) {
  20459. throw new \RuntimeException("Plugin ".$package->getName()." is missing a require statement for a version of the composer-plugin-api package.");
  20460. }
  20461. $currentPluginApiVersion = $this->getPluginApiVersion();
  20462. $currentPluginApiConstraint = new Constraint('==', $this->versionParser->normalize($currentPluginApiVersion));
  20463. if ($requiresComposer->getPrettyString() === '1.0.0' && $this->getPluginApiVersion() === '1.0.0') {
  20464. $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>');
  20465. } elseif (!$requiresComposer->matches($currentPluginApiConstraint)) {
  20466. $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>');
  20467. return;
  20468. }
  20469. }
  20470. $oldInstallerPlugin = ($package->getType() === 'composer-installer');
  20471. if (in_array($package->getName(), $this->registeredPlugins)) {
  20472. return;
  20473. }
  20474. $extra = $package->getExtra();
  20475. if (empty($extra['class'])) {
  20476. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  20477. }
  20478. $classes = is_array($extra['class']) ? $extra['class'] : array($extra['class']);
  20479. $localRepo = $this->composer->getRepositoryManager()->getLocalRepository();
  20480. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  20481. $pool = new Pool('dev');
  20482. $pool->addRepository($localRepo);
  20483. if ($globalRepo) {
  20484. $pool->addRepository($globalRepo);
  20485. }
  20486. $autoloadPackages = array($package->getName() => $package);
  20487. $autoloadPackages = $this->collectDependencies($pool, $autoloadPackages, $package);
  20488. $generator = $this->composer->getAutoloadGenerator();
  20489. $autoloads = array();
  20490. foreach ($autoloadPackages as $autoloadPackage) {
  20491. $downloadPath = $this->getInstallPath($autoloadPackage, $globalRepo && $globalRepo->hasPackage($autoloadPackage));
  20492. $autoloads[] = array($autoloadPackage, $downloadPath);
  20493. }
  20494. $map = $generator->parseAutoloads($autoloads, new Package('dummy', '1.0.0.0', '1.0.0'));
  20495. $classLoader = $generator->createLoader($map);
  20496. $classLoader->register();
  20497. foreach ($classes as $class) {
  20498. if (class_exists($class, false)) {
  20499. $class = trim($class, '\\');
  20500. $path = $classLoader->findFile($class);
  20501. $code = file_get_contents($path);
  20502. $separatorPos = strrpos($class, '\\');
  20503. $className = $class;
  20504. if ($separatorPos) {
  20505. $className = substr($class, $separatorPos + 1);
  20506. }
  20507. $code = preg_replace('{^((?:final\s+)?(?:\s*))class\s+('.preg_quote($className).')}mi', '$1class $2_composer_tmp'.self::$classCounter, $code, 1);
  20508. $code = str_replace('__FILE__', var_export($path, true), $code);
  20509. $code = str_replace('__DIR__', var_export(dirname($path), true), $code);
  20510. $code = str_replace('__CLASS__', var_export($class, true), $code);
  20511. $code = preg_replace('/^\s*<\?(php)?/i', '', $code, 1);
  20512. eval($code);
  20513. $class .= '_composer_tmp'.self::$classCounter;
  20514. self::$classCounter++;
  20515. }
  20516. if ($oldInstallerPlugin) {
  20517. $installer = new $class($this->io, $this->composer);
  20518. $this->composer->getInstallationManager()->addInstaller($installer);
  20519. } elseif (class_exists($class)) {
  20520. $plugin = new $class();
  20521. $this->addPlugin($plugin);
  20522. $this->registeredPlugins[] = $package->getName();
  20523. } elseif ($failOnMissingClasses) {
  20524. throw new \UnexpectedValueException('Plugin '.$package->getName().' could not be initialized, class not found: '.$class);
  20525. }
  20526. }
  20527. }
  20528. protected function getPluginApiVersion()
  20529. {
  20530. return PluginInterface::PLUGIN_API_VERSION;
  20531. }
  20532. public function addPlugin(PluginInterface $plugin)
  20533. {
  20534. $this->io->writeError('Loading plugin '.get_class($plugin), true, IOInterface::DEBUG);
  20535. $this->plugins[] = $plugin;
  20536. $plugin->activate($this->composer, $this->io);
  20537. if ($plugin instanceof EventSubscriberInterface) {
  20538. $this->composer->getEventDispatcher()->addSubscriber($plugin);
  20539. }
  20540. }
  20541. private function loadRepository(RepositoryInterface $repo)
  20542. {
  20543. $packages = $repo->getPackages();
  20544. $sortedPackages = array_reverse(PackageSorter::sortPackages($packages));
  20545. foreach ($sortedPackages as $package) {
  20546. if (!($package instanceof CompletePackage)) {
  20547. continue;
  20548. }
  20549. if ('composer-plugin' === $package->getType()) {
  20550. $this->registerPackage($package);
  20551. } elseif ('composer-installer' === $package->getType()) {
  20552. $this->registerPackage($package);
  20553. }
  20554. }
  20555. }
  20556. private function collectDependencies(Pool $pool, array $collected, PackageInterface $package)
  20557. {
  20558. $requires = array_merge(
  20559. $package->getRequires(),
  20560. $package->getDevRequires()
  20561. );
  20562. foreach ($requires as $requireLink) {
  20563. $requiredPackage = $this->lookupInstalledPackage($pool, $requireLink);
  20564. if ($requiredPackage && !isset($collected[$requiredPackage->getName()])) {
  20565. $collected[$requiredPackage->getName()] = $requiredPackage;
  20566. $collected = $this->collectDependencies($pool, $collected, $requiredPackage);
  20567. }
  20568. }
  20569. return $collected;
  20570. }
  20571. private function lookupInstalledPackage(Pool $pool, Link $link)
  20572. {
  20573. $packages = $pool->whatProvides($link->getTarget(), $link->getConstraint());
  20574. return !empty($packages) ? $packages[0] : null;
  20575. }
  20576. private function getInstallPath(PackageInterface $package, $global = false)
  20577. {
  20578. if (!$global) {
  20579. return $this->composer->getInstallationManager()->getInstallPath($package);
  20580. }
  20581. return $this->globalComposer->getInstallationManager()->getInstallPath($package);
  20582. }
  20583. protected function getCapabilityImplementationClassName(PluginInterface $plugin, $capability)
  20584. {
  20585. if (!($plugin instanceof Capable)) {
  20586. return null;
  20587. }
  20588. $capabilities = (array) $plugin->getCapabilities();
  20589. if (!empty($capabilities[$capability]) && is_string($capabilities[$capability]) && trim($capabilities[$capability])) {
  20590. return trim($capabilities[$capability]);
  20591. }
  20592. if (
  20593. array_key_exists($capability, $capabilities)
  20594. && (empty($capabilities[$capability]) || !is_string($capabilities[$capability]) || !trim($capabilities[$capability]))
  20595. ) {
  20596. throw new \UnexpectedValueException('Plugin '.get_class($plugin).' provided invalid capability class name(s), got '.var_export($capabilities[$capability], 1));
  20597. }
  20598. }
  20599. public function getPluginCapability(PluginInterface $plugin, $capabilityClassName, array $ctorArgs = array())
  20600. {
  20601. if ($capabilityClass = $this->getCapabilityImplementationClassName($plugin, $capabilityClassName)) {
  20602. if (!class_exists($capabilityClass)) {
  20603. throw new \RuntimeException("Cannot instantiate Capability, as class $capabilityClass from plugin ".get_class($plugin)." does not exist.");
  20604. }
  20605. $ctorArgs['plugin'] = $plugin;
  20606. $capabilityObj = new $capabilityClass($ctorArgs);
  20607. if (!$capabilityObj instanceof Capability || !$capabilityObj instanceof $capabilityClassName) {
  20608. throw new \RuntimeException(
  20609. 'Class ' . $capabilityClass . ' must implement both Composer\Plugin\Capability\Capability and '. $capabilityClassName . '.'
  20610. );
  20611. }
  20612. return $capabilityObj;
  20613. }
  20614. }
  20615. public function getPluginCapabilities($capabilityClassName, array $ctorArgs = array())
  20616. {
  20617. $capabilities = array();
  20618. foreach ($this->getPlugins() as $plugin) {
  20619. if ($capability = $this->getPluginCapability($plugin, $capabilityClassName, $ctorArgs)) {
  20620. $capabilities[] = $capability;
  20621. }
  20622. }
  20623. return $capabilities;
  20624. }
  20625. }
  20626. <?php
  20627. namespace Composer\Plugin;
  20628. use Composer\EventDispatcher\Event;
  20629. use Symfony\Component\Console\Input\InputInterface;
  20630. class PreCommandRunEvent extends Event
  20631. {
  20632. private $input;
  20633. private $command;
  20634. public function __construct($name, InputInterface $input, $command)
  20635. {
  20636. parent::__construct($name);
  20637. $this->input = $input;
  20638. $this->command = $command;
  20639. }
  20640. public function getInput()
  20641. {
  20642. return $this->input;
  20643. }
  20644. public function getCommand()
  20645. {
  20646. return $this->command;
  20647. }
  20648. }
  20649. <?php
  20650. namespace Composer\Plugin;
  20651. use Composer\EventDispatcher\Event;
  20652. use Composer\Util\RemoteFilesystem;
  20653. class PreFileDownloadEvent extends Event
  20654. {
  20655. private $rfs;
  20656. private $processedUrl;
  20657. public function __construct($name, RemoteFilesystem $rfs, $processedUrl)
  20658. {
  20659. parent::__construct($name);
  20660. $this->rfs = $rfs;
  20661. $this->processedUrl = $processedUrl;
  20662. }
  20663. public function getRemoteFilesystem()
  20664. {
  20665. return $this->rfs;
  20666. }
  20667. public function setRemoteFilesystem(RemoteFilesystem $rfs)
  20668. {
  20669. $this->rfs = $rfs;
  20670. }
  20671. public function getProcessedUrl()
  20672. {
  20673. return $this->processedUrl;
  20674. }
  20675. }
  20676. <?php
  20677. namespace Composer\Question;
  20678. use Symfony\Component\Console\Exception\InvalidArgumentException;
  20679. use Symfony\Component\Console\Question\Question;
  20680. class StrictConfirmationQuestion extends Question
  20681. {
  20682. private $trueAnswerRegex;
  20683. private $falseAnswerRegex;
  20684. public function __construct($question, $default = true, $trueAnswerRegex = '/^y(?:es)?$/i', $falseAnswerRegex = '/^no?$/i')
  20685. {
  20686. parent::__construct($question, (bool) $default);
  20687. $this->trueAnswerRegex = $trueAnswerRegex;
  20688. $this->falseAnswerRegex = $falseAnswerRegex;
  20689. $this->setNormalizer($this->getDefaultNormalizer());
  20690. $this->setValidator($this->getDefaultValidator());
  20691. }
  20692. private function getDefaultNormalizer()
  20693. {
  20694. $default = $this->getDefault();
  20695. $trueRegex = $this->trueAnswerRegex;
  20696. $falseRegex = $this->falseAnswerRegex;
  20697. return function ($answer) use ($default, $trueRegex, $falseRegex) {
  20698. if (is_bool($answer)) {
  20699. return $answer;
  20700. }
  20701. if (empty($answer) && !empty($default)) {
  20702. return $default;
  20703. }
  20704. if (preg_match($trueRegex, $answer)) {
  20705. return true;
  20706. }
  20707. if (preg_match($falseRegex, $answer)) {
  20708. return false;
  20709. }
  20710. return null;
  20711. };
  20712. }
  20713. private function getDefaultValidator()
  20714. {
  20715. return function ($answer) {
  20716. if (!is_bool($answer)) {
  20717. throw new InvalidArgumentException('Please answer yes, y, no, or n.');
  20718. }
  20719. return $answer;
  20720. };
  20721. }
  20722. }
  20723. <?php
  20724. namespace Composer\Repository;
  20725. use Composer\Package\AliasPackage;
  20726. use Composer\Package\PackageInterface;
  20727. use Composer\Package\CompletePackageInterface;
  20728. use Composer\Package\Version\VersionParser;
  20729. use Composer\Semver\Constraint\ConstraintInterface;
  20730. use Composer\Semver\Constraint\Constraint;
  20731. class ArrayRepository extends BaseRepository
  20732. {
  20733. protected $packages;
  20734. protected $packageMap;
  20735. public function __construct(array $packages = array())
  20736. {
  20737. foreach ($packages as $package) {
  20738. $this->addPackage($package);
  20739. }
  20740. }
  20741. public function findPackage($name, $constraint)
  20742. {
  20743. $name = strtolower($name);
  20744. if (!$constraint instanceof ConstraintInterface) {
  20745. $versionParser = new VersionParser();
  20746. $constraint = $versionParser->parseConstraints($constraint);
  20747. }
  20748. foreach ($this->getPackages() as $package) {
  20749. if ($name === $package->getName()) {
  20750. $pkgConstraint = new Constraint('==', $package->getVersion());
  20751. if ($constraint->matches($pkgConstraint)) {
  20752. return $package;
  20753. }
  20754. }
  20755. }
  20756. return null;
  20757. }
  20758. public function findPackages($name, $constraint = null)
  20759. {
  20760. $name = strtolower($name);
  20761. $packages = array();
  20762. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  20763. $versionParser = new VersionParser();
  20764. $constraint = $versionParser->parseConstraints($constraint);
  20765. }
  20766. foreach ($this->getPackages() as $package) {
  20767. if ($name === $package->getName()) {
  20768. $pkgConstraint = new Constraint('==', $package->getVersion());
  20769. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  20770. $packages[] = $package;
  20771. }
  20772. }
  20773. }
  20774. return $packages;
  20775. }
  20776. public function search($query, $mode = 0, $type = null)
  20777. {
  20778. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  20779. $matches = array();
  20780. foreach ($this->getPackages() as $package) {
  20781. $name = $package->getName();
  20782. if (isset($matches[$name])) {
  20783. continue;
  20784. }
  20785. if (preg_match($regex, $name)
  20786. || ($mode === self::SEARCH_FULLTEXT && $package instanceof CompletePackageInterface && preg_match($regex, implode(' ', (array) $package->getKeywords()) . ' ' . $package->getDescription()))
  20787. ) {
  20788. if (null !== $type && $package->getType() !== $type) {
  20789. continue;
  20790. }
  20791. $matches[$name] = array(
  20792. 'name' => $package->getPrettyName(),
  20793. 'description' => $package instanceof CompletePackageInterface ? $package->getDescription() : null,
  20794. );
  20795. }
  20796. }
  20797. return array_values($matches);
  20798. }
  20799. public function hasPackage(PackageInterface $package)
  20800. {
  20801. if ($this->packageMap === null) {
  20802. $this->packageMap = array();
  20803. foreach ($this->getPackages() as $repoPackage) {
  20804. $this->packageMap[$repoPackage->getUniqueName()] = $repoPackage;
  20805. }
  20806. }
  20807. return isset($this->packageMap[$package->getUniqueName()]);
  20808. }
  20809. public function addPackage(PackageInterface $package)
  20810. {
  20811. if (null === $this->packages) {
  20812. $this->initialize();
  20813. }
  20814. $package->setRepository($this);
  20815. $this->packages[] = $package;
  20816. if ($package instanceof AliasPackage) {
  20817. $aliasedPackage = $package->getAliasOf();
  20818. if (null === $aliasedPackage->getRepository()) {
  20819. $this->addPackage($aliasedPackage);
  20820. }
  20821. }
  20822. $this->packageMap = null;
  20823. }
  20824. protected function createAliasPackage(PackageInterface $package, $alias, $prettyAlias)
  20825. {
  20826. return new AliasPackage($package instanceof AliasPackage ? $package->getAliasOf() : $package, $alias, $prettyAlias);
  20827. }
  20828. public function removePackage(PackageInterface $package)
  20829. {
  20830. $packageId = $package->getUniqueName();
  20831. foreach ($this->getPackages() as $key => $repoPackage) {
  20832. if ($packageId === $repoPackage->getUniqueName()) {
  20833. array_splice($this->packages, $key, 1);
  20834. $this->packageMap = null;
  20835. return;
  20836. }
  20837. }
  20838. }
  20839. public function getPackages()
  20840. {
  20841. if (null === $this->packages) {
  20842. $this->initialize();
  20843. }
  20844. return $this->packages;
  20845. }
  20846. public function count()
  20847. {
  20848. return count($this->packages);
  20849. }
  20850. protected function initialize()
  20851. {
  20852. $this->packages = array();
  20853. }
  20854. }
  20855. <?php
  20856. namespace Composer\Repository;
  20857. use Composer\IO\IOInterface;
  20858. use Composer\Json\JsonFile;
  20859. use Composer\Package\Loader\ArrayLoader;
  20860. use Composer\Package\Loader\LoaderInterface;
  20861. use Composer\Util\Zip;
  20862. class ArtifactRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  20863. {
  20864. protected $loader;
  20865. protected $lookup;
  20866. protected $repoConfig;
  20867. private $io;
  20868. public function __construct(array $repoConfig, IOInterface $io)
  20869. {
  20870. parent::__construct();
  20871. if (!extension_loaded('zip')) {
  20872. throw new \RuntimeException('The artifact repository requires PHP\'s zip extension');
  20873. }
  20874. $this->loader = new ArrayLoader();
  20875. $this->lookup = $repoConfig['url'];
  20876. $this->io = $io;
  20877. $this->repoConfig = $repoConfig;
  20878. }
  20879. public function getRepoConfig()
  20880. {
  20881. return $this->repoConfig;
  20882. }
  20883. protected function initialize()
  20884. {
  20885. parent::initialize();
  20886. $this->scanDirectory($this->lookup);
  20887. }
  20888. private function scanDirectory($path)
  20889. {
  20890. $io = $this->io;
  20891. $directory = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
  20892. $iterator = new \RecursiveIteratorIterator($directory);
  20893. $regex = new \RegexIterator($iterator, '/^.+\.(zip|phar)$/i');
  20894. foreach ($regex as $file) {
  20895. if (!$file->isFile()) {
  20896. continue;
  20897. }
  20898. $package = $this->getComposerInformation($file);
  20899. if (!$package) {
  20900. $io->writeError("File <comment>{$file->getBasename()}</comment> doesn't seem to hold a package", true, IOInterface::VERBOSE);
  20901. continue;
  20902. }
  20903. $template = 'Found package <info>%s</info> (<comment>%s</comment>) in file <info>%s</info>';
  20904. $io->writeError(sprintf($template, $package->getName(), $package->getPrettyVersion(), $file->getBasename()), true, IOInterface::VERBOSE);
  20905. $this->addPackage($package);
  20906. }
  20907. }
  20908. private function getComposerInformation(\SplFileInfo $file)
  20909. {
  20910. $json = Zip::getComposerJson($file->getPathname());
  20911. if (null === $json) {
  20912. return false;
  20913. }
  20914. $package = JsonFile::parseJson($json, $file->getPathname().'#composer.json');
  20915. $package['dist'] = array(
  20916. 'type' => 'zip',
  20917. 'url' => strtr($file->getPathname(), '\\', '/'),
  20918. 'shasum' => sha1_file($file->getRealPath()),
  20919. );
  20920. try {
  20921. $package = $this->loader->load($package);
  20922. } catch (\UnexpectedValueException $e) {
  20923. throw new \UnexpectedValueException('Failed loading package in '.$file.': '.$e->getMessage(), 0, $e);
  20924. }
  20925. return $package;
  20926. }
  20927. }
  20928. <?php
  20929. namespace Composer\Repository;
  20930. use Composer\Package\RootPackageInterface;
  20931. use Composer\Semver\Constraint\ConstraintInterface;
  20932. use Composer\Semver\Constraint\Constraint;
  20933. use Composer\Package\Link;
  20934. abstract class BaseRepository implements RepositoryInterface
  20935. {
  20936. public function getDependents($needle, $constraint = null, $invert = false, $recurse = true, $packagesFound = null)
  20937. {
  20938. $needles = array_map('strtolower', (array) $needle);
  20939. $results = array();
  20940. if (null === $packagesFound) {
  20941. $packagesFound = $needles;
  20942. }
  20943. $rootPackage = null;
  20944. foreach ($this->getPackages() as $package) {
  20945. if ($package instanceof RootPackageInterface) {
  20946. $rootPackage = $package;
  20947. break;
  20948. }
  20949. }
  20950. foreach ($this->getPackages() as $package) {
  20951. $links = $package->getRequires();
  20952. $packagesInTree = $packagesFound;
  20953. if (!$invert) {
  20954. $links += $package->getReplaces();
  20955. foreach ($package->getReplaces() as $link) {
  20956. foreach ($needles as $needle) {
  20957. if ($link->getSource() === $needle) {
  20958. if ($constraint === null || ($link->getConstraint()->matches($constraint) === !$invert)) {
  20959. if (in_array($link->getTarget(), $packagesInTree)) {
  20960. $results[] = array($package, $link, false);
  20961. continue;
  20962. }
  20963. $packagesInTree[] = $link->getTarget();
  20964. $dependents = $recurse ? $this->getDependents($link->getTarget(), null, false, true, $packagesInTree) : array();
  20965. $results[] = array($package, $link, $dependents);
  20966. $needles[] = $link->getTarget();
  20967. }
  20968. }
  20969. }
  20970. }
  20971. }
  20972. if ($package instanceof RootPackageInterface) {
  20973. $links += $package->getDevRequires();
  20974. }
  20975. foreach ($links as $link) {
  20976. foreach ($needles as $needle) {
  20977. if ($link->getTarget() === $needle) {
  20978. if ($constraint === null || ($link->getConstraint()->matches($constraint) === !$invert)) {
  20979. if (in_array($link->getSource(), $packagesInTree)) {
  20980. $results[] = array($package, $link, false);
  20981. continue;
  20982. }
  20983. $packagesInTree[] = $link->getSource();
  20984. $dependents = $recurse ? $this->getDependents($link->getSource(), null, false, true, $packagesInTree) : array();
  20985. $results[] = array($package, $link, $dependents);
  20986. }
  20987. }
  20988. }
  20989. }
  20990. if ($invert && in_array($package->getName(), $needles)) {
  20991. foreach ($package->getConflicts() as $link) {
  20992. foreach ($this->findPackages($link->getTarget()) as $pkg) {
  20993. $version = new Constraint('=', $pkg->getVersion());
  20994. if ($link->getConstraint()->matches($version) === $invert) {
  20995. $results[] = array($package, $link, false);
  20996. }
  20997. }
  20998. }
  20999. }
  21000. if ($invert && $constraint && in_array($package->getName(), $needles) && $constraint->matches(new Constraint('=', $package->getVersion()))) {
  21001. foreach ($package->getRequires() as $link) {
  21002. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  21003. if ($this->findPackage($link->getTarget(), $link->getConstraint())) {
  21004. continue;
  21005. }
  21006. $platformPkg = $this->findPackage($link->getTarget(), '*');
  21007. $description = $platformPkg ? 'but '.$platformPkg->getPrettyVersion().' is installed' : 'but it is missing';
  21008. $results[] = array($package, new Link($package->getName(), $link->getTarget(), null, 'requires', $link->getPrettyConstraint().' '.$description), false);
  21009. continue;
  21010. }
  21011. foreach ($this->getPackages() as $pkg) {
  21012. if (!in_array($link->getTarget(), $pkg->getNames())) {
  21013. continue;
  21014. }
  21015. $version = new Constraint('=', $pkg->getVersion());
  21016. if (!$link->getConstraint()->matches($version)) {
  21017. if ($rootPackage) {
  21018. foreach (array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()) as $rootReq) {
  21019. if (in_array($rootReq->getTarget(), $pkg->getNames()) && !$rootReq->getConstraint()->matches($link->getConstraint())) {
  21020. $results[] = array($package, $link, false);
  21021. $results[] = array($rootPackage, $rootReq, false);
  21022. continue 3;
  21023. }
  21024. }
  21025. $results[] = array($package, $link, false);
  21026. $results[] = array($rootPackage, new Link($rootPackage->getName(), $link->getTarget(), null, 'does not require', 'but ' . $pkg->getPrettyVersion() . ' is installed'), false);
  21027. } else {
  21028. $results[] = array($package, $link, false);
  21029. }
  21030. }
  21031. continue 2;
  21032. }
  21033. }
  21034. }
  21035. }
  21036. ksort($results);
  21037. return $results;
  21038. }
  21039. }
  21040. <?php
  21041. namespace Composer\Repository;
  21042. use Composer\Package\Loader\ArrayLoader;
  21043. use Composer\Package\PackageInterface;
  21044. use Composer\Package\AliasPackage;
  21045. use Composer\Package\Version\VersionParser;
  21046. use Composer\DependencyResolver\Pool;
  21047. use Composer\Json\JsonFile;
  21048. use Composer\Cache;
  21049. use Composer\Config;
  21050. use Composer\Composer;
  21051. use Composer\Factory;
  21052. use Composer\IO\IOInterface;
  21053. use Composer\Util\RemoteFilesystem;
  21054. use Composer\Plugin\PluginEvents;
  21055. use Composer\Plugin\PreFileDownloadEvent;
  21056. use Composer\EventDispatcher\EventDispatcher;
  21057. use Composer\Downloader\TransportException;
  21058. use Composer\Semver\Constraint\ConstraintInterface;
  21059. use Composer\Semver\Constraint\Constraint;
  21060. class ComposerRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  21061. {
  21062. protected $config;
  21063. protected $repoConfig;
  21064. protected $options;
  21065. protected $url;
  21066. protected $baseUrl;
  21067. protected $io;
  21068. protected $rfs;
  21069. protected $cache;
  21070. protected $notifyUrl;
  21071. protected $searchUrl;
  21072. protected $hasProviders = false;
  21073. protected $providersUrl;
  21074. protected $lazyProvidersUrl;
  21075. protected $providerListing;
  21076. protected $providers = array();
  21077. protected $providersByUid = array();
  21078. protected $loader;
  21079. protected $rootAliases;
  21080. protected $allowSslDowngrade = false;
  21081. protected $eventDispatcher;
  21082. protected $sourceMirrors;
  21083. protected $distMirrors;
  21084. private $degradedMode = false;
  21085. private $rootData;
  21086. private $hasPartialPackages;
  21087. private $partialPackagesByName;
  21088. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  21089. {
  21090. parent::__construct();
  21091. if (!preg_match('{^[\w.]+\??://}', $repoConfig['url'])) {
  21092. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  21093. }
  21094. $repoConfig['url'] = rtrim($repoConfig['url'], '/');
  21095. if ('https?' === substr($repoConfig['url'], 0, 6)) {
  21096. $repoConfig['url'] = (extension_loaded('openssl') ? 'https' : 'http') . substr($repoConfig['url'], 6);
  21097. }
  21098. $urlBits = parse_url($repoConfig['url']);
  21099. if ($urlBits === false || empty($urlBits['scheme'])) {
  21100. throw new \UnexpectedValueException('Invalid url given for Composer repository: '.$repoConfig['url']);
  21101. }
  21102. if (!isset($repoConfig['options'])) {
  21103. $repoConfig['options'] = array();
  21104. }
  21105. if (isset($repoConfig['allow_ssl_downgrade']) && true === $repoConfig['allow_ssl_downgrade']) {
  21106. $this->allowSslDowngrade = true;
  21107. }
  21108. $this->config = $config;
  21109. $this->options = $repoConfig['options'];
  21110. $this->url = $repoConfig['url'];
  21111. if (preg_match('{^(?P<proto>https?)://packagist\.org/?$}i', $this->url, $match)) {
  21112. $this->url = $match['proto'].'://repo.packagist.org';
  21113. }
  21114. $this->baseUrl = rtrim(preg_replace('{(?:/[^/\\\\]+\.json)?(?:[?#].*)?$}', '', $this->url), '/');
  21115. $this->io = $io;
  21116. $this->cache = new Cache($io, $config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->url), 'a-z0-9.$');
  21117. $this->loader = new ArrayLoader();
  21118. if ($rfs && $this->options) {
  21119. $rfs = clone $rfs;
  21120. $rfs->setOptions($this->options);
  21121. }
  21122. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $this->config, $this->options);
  21123. $this->eventDispatcher = $eventDispatcher;
  21124. $this->repoConfig = $repoConfig;
  21125. }
  21126. public function getRepoConfig()
  21127. {
  21128. return $this->repoConfig;
  21129. }
  21130. public function setRootAliases(array $rootAliases)
  21131. {
  21132. $this->rootAliases = $rootAliases;
  21133. }
  21134. public function findPackage($name, $constraint)
  21135. {
  21136. if (!$this->hasProviders()) {
  21137. return parent::findPackage($name, $constraint);
  21138. }
  21139. $name = strtolower($name);
  21140. if (!$constraint instanceof ConstraintInterface) {
  21141. $versionParser = new VersionParser();
  21142. $constraint = $versionParser->parseConstraints($constraint);
  21143. }
  21144. foreach ($this->getProviderNames() as $providerName) {
  21145. if ($name === $providerName) {
  21146. $packages = $this->whatProvides(new Pool('dev'), $providerName);
  21147. foreach ($packages as $package) {
  21148. if ($name === $package->getName()) {
  21149. $pkgConstraint = new Constraint('==', $package->getVersion());
  21150. if ($constraint->matches($pkgConstraint)) {
  21151. return $package;
  21152. }
  21153. }
  21154. }
  21155. break;
  21156. }
  21157. }
  21158. }
  21159. public function findPackages($name, $constraint = null)
  21160. {
  21161. if (!$this->hasProviders()) {
  21162. return parent::findPackages($name, $constraint);
  21163. }
  21164. $name = strtolower($name);
  21165. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  21166. $versionParser = new VersionParser();
  21167. $constraint = $versionParser->parseConstraints($constraint);
  21168. }
  21169. $packages = array();
  21170. foreach ($this->getProviderNames() as $providerName) {
  21171. if ($name === $providerName) {
  21172. $candidates = $this->whatProvides(new Pool('dev'), $providerName);
  21173. foreach ($candidates as $package) {
  21174. if ($name === $package->getName()) {
  21175. $pkgConstraint = new Constraint('==', $package->getVersion());
  21176. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  21177. $packages[] = $package;
  21178. }
  21179. }
  21180. }
  21181. break;
  21182. }
  21183. }
  21184. return $packages;
  21185. }
  21186. public function getPackages()
  21187. {
  21188. if ($this->hasProviders()) {
  21189. throw new \LogicException('Composer repositories that have providers can not load the complete list of packages, use getProviderNames instead.');
  21190. }
  21191. return parent::getPackages();
  21192. }
  21193. public function search($query, $mode = 0, $type = null)
  21194. {
  21195. $this->loadRootServerFile();
  21196. if ($this->searchUrl && $mode === self::SEARCH_FULLTEXT) {
  21197. $url = str_replace(array('%query%', '%type%'), array($query, $type), $this->searchUrl);
  21198. $origin = RemoteFilesystem::getOrigin($url);
  21199. $json = $this->rfs->getContents($origin, $url, false);
  21200. $search = JsonFile::parseJson($json, $url);
  21201. if (empty($search['results'])) {
  21202. return array();
  21203. }
  21204. $results = array();
  21205. foreach ($search['results'] as $result) {
  21206. if (empty($result['virtual'])) {
  21207. $results[] = $result;
  21208. }
  21209. }
  21210. return $results;
  21211. }
  21212. if ($this->hasProviders()) {
  21213. $results = array();
  21214. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  21215. foreach ($this->getProviderNames() as $name) {
  21216. if (preg_match($regex, $name)) {
  21217. $results[] = array('name' => $name);
  21218. }
  21219. }
  21220. return $results;
  21221. }
  21222. return parent::search($query, $mode);
  21223. }
  21224. public function getProviderNames()
  21225. {
  21226. $this->loadRootServerFile();
  21227. if (null === $this->providerListing) {
  21228. $this->loadProviderListings($this->loadRootServerFile());
  21229. }
  21230. if ($this->hasPartialPackages) {
  21231. if (null === $this->partialPackagesByName) {
  21232. $this->initializePartialPackages();
  21233. }
  21234. return array_keys($this->partialPackagesByName);
  21235. }
  21236. if ($this->lazyProvidersUrl) {
  21237. return array();
  21238. }
  21239. if ($this->providersUrl) {
  21240. return array_keys($this->providerListing);
  21241. }
  21242. return array();
  21243. }
  21244. protected function configurePackageTransportOptions(PackageInterface $package)
  21245. {
  21246. foreach ($package->getDistUrls() as $url) {
  21247. if (strpos($url, $this->baseUrl) === 0) {
  21248. $package->setTransportOptions($this->options);
  21249. return;
  21250. }
  21251. }
  21252. }
  21253. public function hasProviders()
  21254. {
  21255. $this->loadRootServerFile();
  21256. return $this->hasProviders;
  21257. }
  21258. public function resetPackageIds()
  21259. {
  21260. foreach ($this->providersByUid as $package) {
  21261. if ($package instanceof AliasPackage) {
  21262. $package->getAliasOf()->setId(-1);
  21263. }
  21264. $package->setId(-1);
  21265. }
  21266. }
  21267. public function whatProvides(Pool $pool, $name, $bypassFilters = false)
  21268. {
  21269. if (isset($this->providers[$name]) && !$bypassFilters) {
  21270. return $this->providers[$name];
  21271. }
  21272. if ($this->hasPartialPackages && null === $this->partialPackagesByName) {
  21273. $this->initializePartialPackages();
  21274. }
  21275. if (!$this->hasPartialPackages || !isset($this->partialPackagesByName[$name])) {
  21276. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name) || '__root__' === $name || 'composer-plugin-api' === $name) {
  21277. return array();
  21278. }
  21279. if (null === $this->providerListing) {
  21280. $this->loadProviderListings($this->loadRootServerFile());
  21281. }
  21282. $useLastModifiedCheck = false;
  21283. if ($this->lazyProvidersUrl && !isset($this->providerListing[$name])) {
  21284. $hash = null;
  21285. $url = str_replace('%package%', $name, $this->lazyProvidersUrl);
  21286. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  21287. $useLastModifiedCheck = true;
  21288. } elseif ($this->providersUrl) {
  21289. if (!isset($this->providerListing[$name])) {
  21290. return array();
  21291. }
  21292. $hash = $this->providerListing[$name]['sha256'];
  21293. $url = str_replace(array('%package%', '%hash%'), array($name, $hash), $this->providersUrl);
  21294. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  21295. } else {
  21296. return array();
  21297. }
  21298. $packages = null;
  21299. if ($cacheKey) {
  21300. if (!$useLastModifiedCheck && $hash && $this->cache->sha256($cacheKey) === $hash) {
  21301. $packages = json_decode($this->cache->read($cacheKey), true);
  21302. } elseif ($useLastModifiedCheck) {
  21303. if ($contents = $this->cache->read($cacheKey)) {
  21304. $contents = json_decode($contents, true);
  21305. if (isset($contents['last-modified'])) {
  21306. $response = $this->fetchFileIfLastModified($url, $cacheKey, $contents['last-modified']);
  21307. if (true === $response) {
  21308. $packages = $contents;
  21309. } elseif ($response) {
  21310. $packages = $response;
  21311. }
  21312. }
  21313. }
  21314. }
  21315. }
  21316. if (!$packages) {
  21317. try {
  21318. $packages = $this->fetchFile($url, $cacheKey, $hash, $useLastModifiedCheck);
  21319. } catch (TransportException $e) {
  21320. if ($e->getStatusCode() === 404 && $this->lazyProvidersUrl) {
  21321. $packages = array('packages' => array());
  21322. } else {
  21323. throw $e;
  21324. }
  21325. }
  21326. }
  21327. $loadingPartialPackage = false;
  21328. } else {
  21329. $packages = array('packages' => array('versions' => $this->partialPackagesByName[$name]));
  21330. $loadingPartialPackage = true;
  21331. }
  21332. $this->providers[$name] = array();
  21333. foreach ($packages['packages'] as $versions) {
  21334. foreach ($versions as $version) {
  21335. if (!$loadingPartialPackage && $this->hasPartialPackages && isset($this->partialPackagesByName[$version['name']])) {
  21336. continue;
  21337. }
  21338. if (isset($this->providersByUid[$version['uid']])) {
  21339. if (!isset($this->providers[$name][$version['uid']])) {
  21340. if ($this->providersByUid[$version['uid']] instanceof AliasPackage) {
  21341. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']]->getAliasOf();
  21342. $this->providers[$name][$version['uid'].'-alias'] = $this->providersByUid[$version['uid']];
  21343. } else {
  21344. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']];
  21345. }
  21346. if (isset($this->providersByUid[$version['uid'].'-root'])) {
  21347. $this->providers[$name][$version['uid'].'-root'] = $this->providersByUid[$version['uid'].'-root'];
  21348. }
  21349. }
  21350. } else {
  21351. if (!$bypassFilters && !$pool->isPackageAcceptable(strtolower($version['name']), VersionParser::parseStability($version['version']))) {
  21352. continue;
  21353. }
  21354. $package = $this->createPackage($version, 'Composer\Package\CompletePackage');
  21355. $package->setRepository($this);
  21356. if ($package instanceof AliasPackage) {
  21357. $aliased = $package->getAliasOf();
  21358. $aliased->setRepository($this);
  21359. $this->providers[$name][$version['uid']] = $aliased;
  21360. $this->providers[$name][$version['uid'].'-alias'] = $package;
  21361. $this->providersByUid[$version['uid']] = $package;
  21362. } else {
  21363. $this->providers[$name][$version['uid']] = $package;
  21364. $this->providersByUid[$version['uid']] = $package;
  21365. }
  21366. unset($rootAliasData);
  21367. if (isset($this->rootAliases[$package->getName()][$package->getVersion()])) {
  21368. $rootAliasData = $this->rootAliases[$package->getName()][$package->getVersion()];
  21369. } elseif ($package instanceof AliasPackage && isset($this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()])) {
  21370. $rootAliasData = $this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()];
  21371. }
  21372. if (isset($rootAliasData)) {
  21373. $alias = $this->createAliasPackage($package, $rootAliasData['alias_normalized'], $rootAliasData['alias']);
  21374. $alias->setRepository($this);
  21375. $this->providers[$name][$version['uid'].'-root'] = $alias;
  21376. $this->providersByUid[$version['uid'].'-root'] = $alias;
  21377. }
  21378. }
  21379. }
  21380. }
  21381. $result = $this->providers[$name];
  21382. if ($bypassFilters) {
  21383. foreach ($this->providers[$name] as $uid => $provider) {
  21384. unset($this->providersByUid[$uid]);
  21385. }
  21386. unset($this->providers[$name]);
  21387. }
  21388. return $result;
  21389. }
  21390. protected function initialize()
  21391. {
  21392. parent::initialize();
  21393. $repoData = $this->loadDataFromServer();
  21394. foreach ($repoData as $package) {
  21395. $this->addPackage($this->createPackage($package, 'Composer\Package\CompletePackage'));
  21396. }
  21397. }
  21398. public function addPackage(PackageInterface $package)
  21399. {
  21400. parent::addPackage($package);
  21401. $this->configurePackageTransportOptions($package);
  21402. }
  21403. protected function loadRootServerFile()
  21404. {
  21405. if (null !== $this->rootData) {
  21406. return $this->rootData;
  21407. }
  21408. if (!extension_loaded('openssl') && 'https' === substr($this->url, 0, 5)) {
  21409. throw new \RuntimeException('You must enable the openssl extension in your php.ini to load information from '.$this->url);
  21410. }
  21411. $jsonUrlParts = parse_url($this->url);
  21412. if (isset($jsonUrlParts['path']) && false !== strpos($jsonUrlParts['path'], '.json')) {
  21413. $jsonUrl = $this->url;
  21414. } else {
  21415. $jsonUrl = $this->url . '/packages.json';
  21416. }
  21417. $data = $this->fetchFile($jsonUrl, 'packages.json');
  21418. if (!empty($data['notify-batch'])) {
  21419. $this->notifyUrl = $this->canonicalizeUrl($data['notify-batch']);
  21420. } elseif (!empty($data['notify'])) {
  21421. $this->notifyUrl = $this->canonicalizeUrl($data['notify']);
  21422. }
  21423. if (!empty($data['search'])) {
  21424. $this->searchUrl = $this->canonicalizeUrl($data['search']);
  21425. }
  21426. if (!empty($data['mirrors'])) {
  21427. foreach ($data['mirrors'] as $mirror) {
  21428. if (!empty($mirror['git-url'])) {
  21429. $this->sourceMirrors['git'][] = array('url' => $mirror['git-url'], 'preferred' => !empty($mirror['preferred']));
  21430. }
  21431. if (!empty($mirror['hg-url'])) {
  21432. $this->sourceMirrors['hg'][] = array('url' => $mirror['hg-url'], 'preferred' => !empty($mirror['preferred']));
  21433. }
  21434. if (!empty($mirror['dist-url'])) {
  21435. $this->distMirrors[] = array(
  21436. 'url' => $this->canonicalizeUrl($mirror['dist-url']),
  21437. 'preferred' => !empty($mirror['preferred']),
  21438. );
  21439. }
  21440. }
  21441. }
  21442. if (!empty($data['providers-lazy-url'])) {
  21443. $this->lazyProvidersUrl = $this->canonicalizeUrl($data['providers-lazy-url']);
  21444. $this->hasProviders = true;
  21445. $this->hasPartialPackages = !empty($data['packages']) && is_array($data['packages']);
  21446. }
  21447. if ($this->allowSslDowngrade) {
  21448. $this->url = str_replace('https://', 'http://', $this->url);
  21449. $this->baseUrl = str_replace('https://', 'http://', $this->baseUrl);
  21450. }
  21451. if (!empty($data['providers-url'])) {
  21452. $this->providersUrl = $this->canonicalizeUrl($data['providers-url']);
  21453. $this->hasProviders = true;
  21454. }
  21455. if (!empty($data['providers']) || !empty($data['providers-includes'])) {
  21456. $this->hasProviders = true;
  21457. }
  21458. if (preg_match('{^https?://repo\.packagist\.org/?$}i', $this->url) && !empty($this->repoConfig['force-lazy-providers'])) {
  21459. $this->url = 'https://repo.packagist.org';
  21460. $this->baseUrl = 'https://repo.packagist.org';
  21461. $this->lazyProvidersUrl = $this->canonicalizeUrl('https://repo.packagist.org/p/%package%.json');
  21462. $this->providersUrl = null;
  21463. } elseif (!empty($this->repoConfig['force-lazy-providers'])) {
  21464. $this->lazyProvidersUrl = $this->canonicalizeUrl('/p/%package%.json');
  21465. $this->providersUrl = null;
  21466. }
  21467. return $this->rootData = $data;
  21468. }
  21469. protected function canonicalizeUrl($url)
  21470. {
  21471. if ('/' === $url[0]) {
  21472. if (preg_match('{^[^:]++://[^/]*+}', $this->url, $matches)) {
  21473. return $matches[0] . $url;
  21474. }
  21475. return $this->url;
  21476. }
  21477. return $url;
  21478. }
  21479. protected function loadDataFromServer()
  21480. {
  21481. $data = $this->loadRootServerFile();
  21482. return $this->loadIncludes($data);
  21483. }
  21484. protected function loadProviderListings($data)
  21485. {
  21486. if (isset($data['providers'])) {
  21487. if (!is_array($this->providerListing)) {
  21488. $this->providerListing = array();
  21489. }
  21490. $this->providerListing = array_merge($this->providerListing, $data['providers']);
  21491. }
  21492. if ($this->providersUrl && isset($data['provider-includes'])) {
  21493. $includes = $data['provider-includes'];
  21494. foreach ($includes as $include => $metadata) {
  21495. $url = $this->baseUrl . '/' . str_replace('%hash%', $metadata['sha256'], $include);
  21496. $cacheKey = str_replace(array('%hash%','$'), '', $include);
  21497. if ($this->cache->sha256($cacheKey) === $metadata['sha256']) {
  21498. $includedData = json_decode($this->cache->read($cacheKey), true);
  21499. } else {
  21500. $includedData = $this->fetchFile($url, $cacheKey, $metadata['sha256']);
  21501. }
  21502. $this->loadProviderListings($includedData);
  21503. }
  21504. }
  21505. }
  21506. protected function loadIncludes($data)
  21507. {
  21508. $packages = array();
  21509. if (!isset($data['packages']) && !isset($data['includes'])) {
  21510. foreach ($data as $pkg) {
  21511. foreach ($pkg['versions'] as $metadata) {
  21512. $packages[] = $metadata;
  21513. }
  21514. }
  21515. return $packages;
  21516. }
  21517. if (isset($data['packages'])) {
  21518. foreach ($data['packages'] as $package => $versions) {
  21519. foreach ($versions as $version => $metadata) {
  21520. $packages[] = $metadata;
  21521. }
  21522. }
  21523. }
  21524. if (isset($data['includes'])) {
  21525. foreach ($data['includes'] as $include => $metadata) {
  21526. if ($this->cache->sha1($include) === $metadata['sha1']) {
  21527. $includedData = json_decode($this->cache->read($include), true);
  21528. } else {
  21529. $includedData = $this->fetchFile($include);
  21530. }
  21531. $packages = array_merge($packages, $this->loadIncludes($includedData));
  21532. }
  21533. }
  21534. return $packages;
  21535. }
  21536. protected function createPackage(array $data, $class = 'Composer\Package\CompletePackage')
  21537. {
  21538. try {
  21539. if (!isset($data['notification-url'])) {
  21540. $data['notification-url'] = $this->notifyUrl;
  21541. }
  21542. $package = $this->loader->load($data, $class);
  21543. if (isset($this->sourceMirrors[$package->getSourceType()])) {
  21544. $package->setSourceMirrors($this->sourceMirrors[$package->getSourceType()]);
  21545. }
  21546. $package->setDistMirrors($this->distMirrors);
  21547. $this->configurePackageTransportOptions($package);
  21548. return $package;
  21549. } catch (\Exception $e) {
  21550. 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);
  21551. }
  21552. }
  21553. protected function fetchFile($filename, $cacheKey = null, $sha256 = null, $storeLastModifiedTime = false)
  21554. {
  21555. if (null === $cacheKey) {
  21556. $cacheKey = $filename;
  21557. $filename = $this->baseUrl.'/'.$filename;
  21558. }
  21559. if (($pos = strpos($filename, '$')) && preg_match('{^https?://.*}i', $filename)) {
  21560. $filename = substr($filename, 0, $pos) . '%24' . substr($filename, $pos + 1);
  21561. }
  21562. $retries = 3;
  21563. while ($retries--) {
  21564. try {
  21565. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  21566. if ($this->eventDispatcher) {
  21567. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  21568. }
  21569. $origin = RemoteFilesystem::getOrigin($filename);
  21570. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  21571. $json = $rfs->getContents($origin, $filename, false);
  21572. if ($sha256 && $sha256 !== hash('sha256', $json)) {
  21573. if ($this->allowSslDowngrade) {
  21574. $this->url = str_replace('http://', 'https://', $this->url);
  21575. $this->baseUrl = str_replace('http://', 'https://', $this->baseUrl);
  21576. $filename = str_replace('http://', 'https://', $filename);
  21577. }
  21578. if ($retries) {
  21579. usleep(100000);
  21580. continue;
  21581. }
  21582. 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.');
  21583. }
  21584. $data = JsonFile::parseJson($json, $filename);
  21585. RemoteFilesystem::outputWarnings($this->io, $this->url, $data);
  21586. if ($cacheKey) {
  21587. if ($storeLastModifiedTime) {
  21588. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  21589. if ($lastModifiedDate) {
  21590. $data['last-modified'] = $lastModifiedDate;
  21591. $json = json_encode($data);
  21592. }
  21593. }
  21594. $this->cache->write($cacheKey, $json);
  21595. }
  21596. break;
  21597. } catch (\Exception $e) {
  21598. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  21599. throw $e;
  21600. }
  21601. if ($retries) {
  21602. usleep(100000);
  21603. continue;
  21604. }
  21605. if ($e instanceof RepositorySecurityException) {
  21606. throw $e;
  21607. }
  21608. if ($cacheKey && ($contents = $this->cache->read($cacheKey))) {
  21609. if (!$this->degradedMode) {
  21610. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  21611. $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>');
  21612. }
  21613. $this->degradedMode = true;
  21614. $data = JsonFile::parseJson($contents, $this->cache->getRoot().$cacheKey);
  21615. break;
  21616. }
  21617. throw $e;
  21618. }
  21619. }
  21620. return $data;
  21621. }
  21622. protected function fetchFileIfLastModified($filename, $cacheKey, $lastModifiedTime)
  21623. {
  21624. $retries = 3;
  21625. while ($retries--) {
  21626. try {
  21627. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  21628. if ($this->eventDispatcher) {
  21629. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  21630. }
  21631. $origin = RemoteFilesystem::getOrigin($filename);
  21632. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  21633. $options = array('http' => array('header' => array('If-Modified-Since: '.$lastModifiedTime)));
  21634. $json = $rfs->getContents($origin, $filename, false, $options);
  21635. if ($json === '' && $rfs->findStatusCode($rfs->getLastHeaders()) === 304) {
  21636. return true;
  21637. }
  21638. $data = JsonFile::parseJson($json, $filename);
  21639. RemoteFilesystem::outputWarnings($this->io, $this->url, $data);
  21640. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  21641. if ($lastModifiedDate) {
  21642. $data['last-modified'] = $lastModifiedDate;
  21643. $json = json_encode($data);
  21644. }
  21645. $this->cache->write($cacheKey, $json);
  21646. return $data;
  21647. } catch (\Exception $e) {
  21648. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  21649. throw $e;
  21650. }
  21651. if ($retries) {
  21652. usleep(100000);
  21653. continue;
  21654. }
  21655. if (!$this->degradedMode) {
  21656. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  21657. $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>');
  21658. }
  21659. $this->degradedMode = true;
  21660. return true;
  21661. }
  21662. }
  21663. }
  21664. private function initializePartialPackages()
  21665. {
  21666. $rootData = $this->loadRootServerFile();
  21667. $this->partialPackagesByName = array();
  21668. foreach ($rootData['packages'] as $package => $versions) {
  21669. $package = strtolower($package);
  21670. foreach ($versions as $version) {
  21671. $this->partialPackagesByName[$package][] = $version;
  21672. if (!empty($version['provide']) && is_array($version['provide'])) {
  21673. foreach ($version['provide'] as $provided => $providedVersion) {
  21674. $this->partialPackagesByName[strtolower($provided)][] = $version;
  21675. }
  21676. }
  21677. if (!empty($version['replace']) && is_array($version['replace'])) {
  21678. foreach ($version['replace'] as $provided => $providedVersion) {
  21679. $this->partialPackagesByName[strtolower($provided)][] = $version;
  21680. }
  21681. }
  21682. }
  21683. }
  21684. $this->rootData = true;
  21685. }
  21686. }
  21687. <?php
  21688. namespace Composer\Repository;
  21689. use Composer\Package\PackageInterface;
  21690. class CompositeRepository extends BaseRepository
  21691. {
  21692. private $repositories;
  21693. public function __construct(array $repositories)
  21694. {
  21695. $this->repositories = array();
  21696. foreach ($repositories as $repo) {
  21697. $this->addRepository($repo);
  21698. }
  21699. }
  21700. public function getRepositories()
  21701. {
  21702. return $this->repositories;
  21703. }
  21704. public function hasPackage(PackageInterface $package)
  21705. {
  21706. foreach ($this->repositories as $repository) {
  21707. if ($repository->hasPackage($package)) {
  21708. return true;
  21709. }
  21710. }
  21711. return false;
  21712. }
  21713. public function findPackage($name, $constraint)
  21714. {
  21715. foreach ($this->repositories as $repository) {
  21716. $package = $repository->findPackage($name, $constraint);
  21717. if (null !== $package) {
  21718. return $package;
  21719. }
  21720. }
  21721. return null;
  21722. }
  21723. public function findPackages($name, $constraint = null)
  21724. {
  21725. $packages = array();
  21726. foreach ($this->repositories as $repository) {
  21727. $packages[] = $repository->findPackages($name, $constraint);
  21728. }
  21729. return $packages ? call_user_func_array('array_merge', $packages) : array();
  21730. }
  21731. public function search($query, $mode = 0, $type = null)
  21732. {
  21733. $matches = array();
  21734. foreach ($this->repositories as $repository) {
  21735. $matches[] = $repository->search($query, $mode, $type);
  21736. }
  21737. return $matches ? call_user_func_array('array_merge', $matches) : array();
  21738. }
  21739. public function getPackages()
  21740. {
  21741. $packages = array();
  21742. foreach ($this->repositories as $repository) {
  21743. $packages[] = $repository->getPackages();
  21744. }
  21745. return $packages ? call_user_func_array('array_merge', $packages) : array();
  21746. }
  21747. public function removePackage(PackageInterface $package)
  21748. {
  21749. foreach ($this->repositories as $repository) {
  21750. $repository->removePackage($package);
  21751. }
  21752. }
  21753. public function count()
  21754. {
  21755. $total = 0;
  21756. foreach ($this->repositories as $repository) {
  21757. $total += $repository->count();
  21758. }
  21759. return $total;
  21760. }
  21761. public function addRepository(RepositoryInterface $repository)
  21762. {
  21763. if ($repository instanceof self) {
  21764. foreach ($repository->getRepositories() as $repo) {
  21765. $this->addRepository($repo);
  21766. }
  21767. } else {
  21768. $this->repositories[] = $repository;
  21769. }
  21770. }
  21771. }
  21772. <?php
  21773. namespace Composer\Repository;
  21774. interface ConfigurableRepositoryInterface
  21775. {
  21776. public function getRepoConfig();
  21777. }
  21778. <?php
  21779. namespace Composer\Repository;
  21780. use Composer\Json\JsonFile;
  21781. use Composer\Package\Loader\ArrayLoader;
  21782. use Composer\Package\Dumper\ArrayDumper;
  21783. class FilesystemRepository extends WritableArrayRepository
  21784. {
  21785. private $file;
  21786. public function __construct(JsonFile $repositoryFile)
  21787. {
  21788. parent::__construct();
  21789. $this->file = $repositoryFile;
  21790. }
  21791. protected function initialize()
  21792. {
  21793. parent::initialize();
  21794. if (!$this->file->exists()) {
  21795. return;
  21796. }
  21797. try {
  21798. $packages = $this->file->read();
  21799. if (isset($packages['packages'])) {
  21800. $packages = $packages['packages'];
  21801. }
  21802. if (!is_array($packages)) {
  21803. throw new \UnexpectedValueException('Could not parse package list from the repository');
  21804. }
  21805. } catch (\Exception $e) {
  21806. throw new InvalidRepositoryException('Invalid repository data in '.$this->file->getPath().', packages could not be loaded: ['.get_class($e).'] '.$e->getMessage());
  21807. }
  21808. $loader = new ArrayLoader(null, true);
  21809. foreach ($packages as $packageData) {
  21810. $package = $loader->load($packageData);
  21811. $this->addPackage($package);
  21812. }
  21813. }
  21814. public function reload()
  21815. {
  21816. $this->packages = null;
  21817. $this->initialize();
  21818. }
  21819. public function write()
  21820. {
  21821. $data = array();
  21822. $dumper = new ArrayDumper();
  21823. foreach ($this->getCanonicalPackages() as $package) {
  21824. $data[] = $dumper->dump($package);
  21825. }
  21826. usort($data, function ($a, $b) {
  21827. return strcmp($a['name'], $b['name']);
  21828. });
  21829. $this->file->write($data);
  21830. }
  21831. }
  21832. <?php
  21833. namespace Composer\Repository;
  21834. class InstalledArrayRepository extends WritableArrayRepository implements InstalledRepositoryInterface
  21835. {
  21836. }
  21837. <?php
  21838. namespace Composer\Repository;
  21839. class InstalledFilesystemRepository extends FilesystemRepository implements InstalledRepositoryInterface
  21840. {
  21841. }
  21842. <?php
  21843. namespace Composer\Repository;
  21844. interface InstalledRepositoryInterface extends WritableRepositoryInterface
  21845. {
  21846. }
  21847. <?php
  21848. namespace Composer\Repository;
  21849. class InvalidRepositoryException extends \Exception
  21850. {
  21851. }
  21852. <?php
  21853. namespace Composer\Repository;
  21854. use Composer\Package\Loader\ArrayLoader;
  21855. use Composer\Package\Loader\ValidatingArrayLoader;
  21856. class PackageRepository extends ArrayRepository
  21857. {
  21858. private $config;
  21859. public function __construct(array $config)
  21860. {
  21861. parent::__construct();
  21862. $this->config = $config['package'];
  21863. if (!is_numeric(key($this->config))) {
  21864. $this->config = array($this->config);
  21865. }
  21866. }
  21867. protected function initialize()
  21868. {
  21869. parent::initialize();
  21870. $loader = new ValidatingArrayLoader(new ArrayLoader(null, true), false);
  21871. foreach ($this->config as $package) {
  21872. try {
  21873. $package = $loader->load($package);
  21874. } catch (\Exception $e) {
  21875. throw new InvalidRepositoryException('A repository of type "package" contains an invalid package definition: '.$e->getMessage()."\n\nInvalid package definition:\n".json_encode($package));
  21876. }
  21877. $this->addPackage($package);
  21878. }
  21879. }
  21880. }
  21881. <?php
  21882. namespace Composer\Repository;
  21883. use Composer\Config;
  21884. use Composer\IO\IOInterface;
  21885. use Composer\Json\JsonFile;
  21886. use Composer\Package\Loader\ArrayLoader;
  21887. use Composer\Package\Version\VersionGuesser;
  21888. use Composer\Package\Version\VersionParser;
  21889. use Composer\Util\Platform;
  21890. use Composer\Util\ProcessExecutor;
  21891. use Composer\Util\Filesystem;
  21892. use Composer\Util\Git as GitUtil;
  21893. class PathRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  21894. {
  21895. private $loader;
  21896. private $versionGuesser;
  21897. private $url;
  21898. private $repoConfig;
  21899. private $process;
  21900. private $options;
  21901. public function __construct(array $repoConfig, IOInterface $io, Config $config)
  21902. {
  21903. if (!isset($repoConfig['url'])) {
  21904. throw new \RuntimeException('You must specify the `url` configuration for the path repository');
  21905. }
  21906. $this->loader = new ArrayLoader(null, true);
  21907. $this->url = Platform::expandPath($repoConfig['url']);
  21908. $this->process = new ProcessExecutor($io);
  21909. $this->versionGuesser = new VersionGuesser($config, $this->process, new VersionParser());
  21910. $this->repoConfig = $repoConfig;
  21911. $this->options = isset($repoConfig['options']) ? $repoConfig['options'] : array();
  21912. if (!isset($this->options['relative'])) {
  21913. $filesystem = new Filesystem();
  21914. $this->options['relative'] = !$filesystem->isAbsolutePath($this->url);
  21915. }
  21916. parent::__construct();
  21917. }
  21918. public function getRepoConfig()
  21919. {
  21920. return $this->repoConfig;
  21921. }
  21922. protected function initialize()
  21923. {
  21924. parent::initialize();
  21925. $urlMatches = $this->getUrlMatches();
  21926. if (empty($urlMatches)) {
  21927. if (preg_match('{[*{}]}', $this->url)) {
  21928. $url = $this->url;
  21929. while (preg_match('{[*{}]}', $url)) {
  21930. $url = dirname($url);
  21931. }
  21932. if (is_dir($url)) {
  21933. return;
  21934. }
  21935. }
  21936. throw new \RuntimeException('The `url` supplied for the path (' . $this->url . ') repository does not exist');
  21937. }
  21938. foreach ($urlMatches as $url) {
  21939. $path = realpath($url) . DIRECTORY_SEPARATOR;
  21940. $composerFilePath = $path.'composer.json';
  21941. if (!file_exists($composerFilePath)) {
  21942. continue;
  21943. }
  21944. $json = file_get_contents($composerFilePath);
  21945. $package = JsonFile::parseJson($json, $composerFilePath);
  21946. $package['dist'] = array(
  21947. 'type' => 'path',
  21948. 'url' => $url,
  21949. 'reference' => sha1($json . serialize($this->options)),
  21950. );
  21951. $package['transport-options'] = $this->options;
  21952. if (!isset($package['version']) && ($rootVersion = getenv('COMPOSER_ROOT_VERSION'))) {
  21953. if (
  21954. 0 === $this->process->execute('git rev-parse HEAD', $ref1, $path)
  21955. && 0 === $this->process->execute('git rev-parse HEAD', $ref2)
  21956. && $ref1 === $ref2
  21957. ) {
  21958. $package['version'] = $rootVersion;
  21959. }
  21960. }
  21961. $output = '';
  21962. if (is_dir($path . DIRECTORY_SEPARATOR . '.git') && 0 === $this->process->execute('git log -n1 --pretty=%H'.GitUtil::getNoShowSignatureFlag($this->process), $output, $path)) {
  21963. $package['dist']['reference'] = trim($output);
  21964. }
  21965. if (!isset($package['version'])) {
  21966. $versionData = $this->versionGuesser->guessVersion($package, $path);
  21967. if (is_array($versionData) && $versionData['pretty_version']) {
  21968. if (!empty($versionData['feature_pretty_version'])) {
  21969. $package['version'] = $versionData['feature_pretty_version'];
  21970. $this->addPackage($this->loader->load($package));
  21971. }
  21972. $package['version'] = $versionData['pretty_version'];
  21973. } else {
  21974. $package['version'] = 'dev-master';
  21975. }
  21976. }
  21977. $package = $this->loader->load($package);
  21978. $this->addPackage($package);
  21979. }
  21980. }
  21981. private function getUrlMatches()
  21982. {
  21983. $flags = GLOB_MARK | GLOB_ONLYDIR;
  21984. if (defined('GLOB_BRACE')) {
  21985. $flags |= GLOB_BRACE;
  21986. } elseif (strpos($this->url, '{') !== false || strpos($this->url, '}') !== false) {
  21987. throw new \RuntimeException('The operating system does not support GLOB_BRACE which is required for the url '. $this->url);
  21988. }
  21989. return array_map(function ($val) {
  21990. return rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $val), '/');
  21991. }, glob($this->url, $flags));
  21992. }
  21993. }
  21994. <?php
  21995. namespace Composer\Repository\Pear;
  21996. use Composer\Util\RemoteFilesystem;
  21997. abstract class BaseChannelReader
  21998. {
  21999. const CHANNEL_NS = 'http://pear.php.net/channel-1.0';
  22000. const ALL_CATEGORIES_NS = 'http://pear.php.net/dtd/rest.allcategories';
  22001. const CATEGORY_PACKAGES_INFO_NS = 'http://pear.php.net/dtd/rest.categorypackageinfo';
  22002. const ALL_PACKAGES_NS = 'http://pear.php.net/dtd/rest.allpackages';
  22003. const ALL_RELEASES_NS = 'http://pear.php.net/dtd/rest.allreleases';
  22004. const PACKAGE_INFO_NS = 'http://pear.php.net/dtd/rest.package';
  22005. private $rfs;
  22006. protected function __construct(RemoteFilesystem $rfs)
  22007. {
  22008. $this->rfs = $rfs;
  22009. }
  22010. protected function requestContent($origin, $path)
  22011. {
  22012. $url = rtrim($origin, '/') . '/' . ltrim($path, '/');
  22013. $content = $this->rfs->getContents($origin, $url, false);
  22014. if (!$content) {
  22015. throw new \UnexpectedValueException('The PEAR channel at ' . $url . ' did not respond.');
  22016. }
  22017. return str_replace('http://pear.php.net/rest/', 'https://pear.php.net/rest/', $content);
  22018. }
  22019. protected function requestXml($origin, $path)
  22020. {
  22021. $xml = simplexml_load_string($this->requestContent($origin, $path), "SimpleXMLElement", LIBXML_NOERROR);
  22022. if (false === $xml) {
  22023. throw new \UnexpectedValueException(sprintf('The PEAR channel at ' . $origin . ' is broken. (Invalid XML at file `%s`)', $path));
  22024. }
  22025. return $xml;
  22026. }
  22027. }
  22028. <?php
  22029. namespace Composer\Repository\Pear;
  22030. class ChannelInfo
  22031. {
  22032. private $name;
  22033. private $alias;
  22034. private $packages;
  22035. public function __construct($name, $alias, array $packages)
  22036. {
  22037. $this->name = $name;
  22038. $this->alias = $alias;
  22039. $this->packages = $packages;
  22040. }
  22041. public function getName()
  22042. {
  22043. return $this->name;
  22044. }
  22045. public function getAlias()
  22046. {
  22047. return $this->alias;
  22048. }
  22049. public function getPackages()
  22050. {
  22051. return $this->packages;
  22052. }
  22053. }
  22054. <?php
  22055. namespace Composer\Repository\Pear;
  22056. use Composer\Util\RemoteFilesystem;
  22057. class ChannelReader extends BaseChannelReader
  22058. {
  22059. private $readerMap;
  22060. public function __construct(RemoteFilesystem $rfs)
  22061. {
  22062. parent::__construct($rfs);
  22063. $rest10reader = new ChannelRest10Reader($rfs);
  22064. $rest11reader = new ChannelRest11Reader($rfs);
  22065. $this->readerMap = array(
  22066. 'REST1.3' => $rest11reader,
  22067. 'REST1.2' => $rest11reader,
  22068. 'REST1.1' => $rest11reader,
  22069. 'REST1.0' => $rest10reader,
  22070. );
  22071. }
  22072. public function read($url)
  22073. {
  22074. $xml = $this->requestXml($url, "/channel.xml");
  22075. $channelName = (string) $xml->name;
  22076. $channelAlias = (string) $xml->suggestedalias;
  22077. $supportedVersions = array_keys($this->readerMap);
  22078. $selectedRestVersion = $this->selectRestVersion($xml, $supportedVersions);
  22079. if (!$selectedRestVersion) {
  22080. throw new \UnexpectedValueException(sprintf('PEAR repository %s does not supports any of %s protocols.', $url, implode(', ', $supportedVersions)));
  22081. }
  22082. $reader = $this->readerMap[$selectedRestVersion['version']];
  22083. $packageDefinitions = $reader->read($selectedRestVersion['baseUrl']);
  22084. return new ChannelInfo($channelName, $channelAlias, $packageDefinitions);
  22085. }
  22086. private function selectRestVersion($channelXml, $supportedVersions)
  22087. {
  22088. $channelXml->registerXPathNamespace('ns', self::CHANNEL_NS);
  22089. foreach ($supportedVersions as $version) {
  22090. $xpathTest = "ns:servers/ns:*/ns:rest/ns:baseurl[@type='{$version}']";
  22091. $testResult = $channelXml->xpath($xpathTest);
  22092. foreach ($testResult as $result) {
  22093. $result = (string) $result;
  22094. if (preg_match('{^https://}i', $result)) {
  22095. return array('version' => $version, 'baseUrl' => $result);
  22096. }
  22097. }
  22098. if (count($testResult) > 0) {
  22099. return array('version' => $version, 'baseUrl' => (string) $testResult[0]);
  22100. }
  22101. }
  22102. return null;
  22103. }
  22104. }
  22105. <?php
  22106. namespace Composer\Repository\Pear;
  22107. use Composer\Downloader\TransportException;
  22108. class ChannelRest10Reader extends BaseChannelReader
  22109. {
  22110. private $dependencyReader;
  22111. public function __construct($rfs)
  22112. {
  22113. parent::__construct($rfs);
  22114. $this->dependencyReader = new PackageDependencyParser();
  22115. }
  22116. public function read($baseUrl)
  22117. {
  22118. return $this->readPackages($baseUrl);
  22119. }
  22120. private function readPackages($baseUrl)
  22121. {
  22122. $result = array();
  22123. $xmlPath = '/p/packages.xml';
  22124. $xml = $this->requestXml($baseUrl, $xmlPath);
  22125. $xml->registerXPathNamespace('ns', self::ALL_PACKAGES_NS);
  22126. foreach ($xml->xpath('ns:p') as $node) {
  22127. $packageName = (string) $node;
  22128. $packageInfo = $this->readPackage($baseUrl, $packageName);
  22129. $result[] = $packageInfo;
  22130. }
  22131. return $result;
  22132. }
  22133. private function readPackage($baseUrl, $packageName)
  22134. {
  22135. $xmlPath = '/p/' . strtolower($packageName) . '/info.xml';
  22136. $xml = $this->requestXml($baseUrl, $xmlPath);
  22137. $xml->registerXPathNamespace('ns', self::PACKAGE_INFO_NS);
  22138. $channelName = (string) $xml->c;
  22139. $packageName = (string) $xml->n;
  22140. $license = (string) $xml->l;
  22141. $shortDescription = (string) $xml->s;
  22142. $description = (string) $xml->d;
  22143. return new PackageInfo(
  22144. $channelName,
  22145. $packageName,
  22146. $license,
  22147. $shortDescription,
  22148. $description,
  22149. $this->readPackageReleases($baseUrl, $packageName)
  22150. );
  22151. }
  22152. private function readPackageReleases($baseUrl, $packageName)
  22153. {
  22154. $result = array();
  22155. try {
  22156. $xmlPath = '/r/' . strtolower($packageName) . '/allreleases.xml';
  22157. $xml = $this->requestXml($baseUrl, $xmlPath);
  22158. $xml->registerXPathNamespace('ns', self::ALL_RELEASES_NS);
  22159. foreach ($xml->xpath('ns:r') as $node) {
  22160. $releaseVersion = (string) $node->v;
  22161. $releaseStability = (string) $node->s;
  22162. try {
  22163. $result[$releaseVersion] = new ReleaseInfo(
  22164. $releaseStability,
  22165. $this->readPackageReleaseDependencies($baseUrl, $packageName, $releaseVersion)
  22166. );
  22167. } catch (TransportException $exception) {
  22168. if ($exception->getCode() != 404) {
  22169. throw $exception;
  22170. }
  22171. }
  22172. }
  22173. } catch (TransportException $exception) {
  22174. if ($exception->getCode() != 404) {
  22175. throw $exception;
  22176. }
  22177. }
  22178. return $result;
  22179. }
  22180. private function readPackageReleaseDependencies($baseUrl, $packageName, $version)
  22181. {
  22182. $dependencyReader = new PackageDependencyParser();
  22183. $depthPath = '/r/' . strtolower($packageName) . '/deps.' . $version . '.txt';
  22184. $content = $this->requestContent($baseUrl, $depthPath);
  22185. $dependencyArray = unserialize($content);
  22186. return $dependencyReader->buildDependencyInfo($dependencyArray);
  22187. }
  22188. }
  22189. <?php
  22190. namespace Composer\Repository\Pear;
  22191. class ChannelRest11Reader extends BaseChannelReader
  22192. {
  22193. private $dependencyReader;
  22194. public function __construct($rfs)
  22195. {
  22196. parent::__construct($rfs);
  22197. $this->dependencyReader = new PackageDependencyParser();
  22198. }
  22199. public function read($baseUrl)
  22200. {
  22201. return $this->readChannelPackages($baseUrl);
  22202. }
  22203. private function readChannelPackages($baseUrl)
  22204. {
  22205. $result = array();
  22206. $xml = $this->requestXml($baseUrl, "/c/categories.xml");
  22207. $xml->registerXPathNamespace('ns', self::ALL_CATEGORIES_NS);
  22208. foreach ($xml->xpath('ns:c') as $node) {
  22209. $categoryName = (string) $node;
  22210. $categoryPackages = $this->readCategoryPackages($baseUrl, $categoryName);
  22211. $result = array_merge($result, $categoryPackages);
  22212. }
  22213. return $result;
  22214. }
  22215. private function readCategoryPackages($baseUrl, $categoryName)
  22216. {
  22217. $result = array();
  22218. $categoryPath = '/c/'.urlencode($categoryName).'/packagesinfo.xml';
  22219. $xml = $this->requestXml($baseUrl, $categoryPath);
  22220. $xml->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  22221. foreach ($xml->xpath('ns:pi') as $node) {
  22222. $packageInfo = $this->parsePackage($node);
  22223. $result[] = $packageInfo;
  22224. }
  22225. return $result;
  22226. }
  22227. private function parsePackage($packageInfo)
  22228. {
  22229. $packageInfo->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  22230. $channelName = (string) $packageInfo->p->c;
  22231. $packageName = (string) $packageInfo->p->n;
  22232. $license = (string) $packageInfo->p->l;
  22233. $shortDescription = (string) $packageInfo->p->s;
  22234. $description = (string) $packageInfo->p->d;
  22235. $dependencies = array();
  22236. foreach ($packageInfo->xpath('ns:deps') as $node) {
  22237. $dependencyVersion = (string) $node->v;
  22238. $dependencyArray = unserialize((string) $node->d);
  22239. $dependencyInfo = $this->dependencyReader->buildDependencyInfo($dependencyArray);
  22240. $dependencies[$dependencyVersion] = $dependencyInfo;
  22241. }
  22242. $releases = array();
  22243. $releasesInfo = $packageInfo->xpath('ns:a/ns:r');
  22244. if ($releasesInfo) {
  22245. foreach ($releasesInfo as $node) {
  22246. $releaseVersion = (string) $node->v;
  22247. $releaseStability = (string) $node->s;
  22248. $releases[$releaseVersion] = new ReleaseInfo(
  22249. $releaseStability,
  22250. isset($dependencies[$releaseVersion]) ? $dependencies[$releaseVersion] : new DependencyInfo(array(), array())
  22251. );
  22252. }
  22253. }
  22254. return new PackageInfo(
  22255. $channelName,
  22256. $packageName,
  22257. $license,
  22258. $shortDescription,
  22259. $description,
  22260. $releases
  22261. );
  22262. }
  22263. }
  22264. <?php
  22265. namespace Composer\Repository\Pear;
  22266. class DependencyConstraint
  22267. {
  22268. private $type;
  22269. private $constraint;
  22270. private $channelName;
  22271. private $packageName;
  22272. public function __construct($type, $constraint, $channelName, $packageName)
  22273. {
  22274. $this->type = $type;
  22275. $this->constraint = $constraint;
  22276. $this->channelName = $channelName;
  22277. $this->packageName = $packageName;
  22278. }
  22279. public function getChannelName()
  22280. {
  22281. return $this->channelName;
  22282. }
  22283. public function getConstraint()
  22284. {
  22285. return $this->constraint;
  22286. }
  22287. public function getPackageName()
  22288. {
  22289. return $this->packageName;
  22290. }
  22291. public function getType()
  22292. {
  22293. return $this->type;
  22294. }
  22295. }
  22296. <?php
  22297. namespace Composer\Repository\Pear;
  22298. class DependencyInfo
  22299. {
  22300. private $requires;
  22301. private $optionals;
  22302. public function __construct($requires, $optionals)
  22303. {
  22304. $this->requires = $requires;
  22305. $this->optionals = $optionals;
  22306. }
  22307. public function getRequires()
  22308. {
  22309. return $this->requires;
  22310. }
  22311. public function getOptionals()
  22312. {
  22313. return $this->optionals;
  22314. }
  22315. }
  22316. <?php
  22317. namespace Composer\Repository\Pear;
  22318. class PackageDependencyParser
  22319. {
  22320. public function buildDependencyInfo($depArray)
  22321. {
  22322. if (!is_array($depArray)) {
  22323. return new DependencyInfo(array(), array());
  22324. }
  22325. if (!$this->isHash($depArray)) {
  22326. return new DependencyInfo($this->buildDependency10Info($depArray), array());
  22327. }
  22328. return $this->buildDependency20Info($depArray);
  22329. }
  22330. private function buildDependency10Info($depArray)
  22331. {
  22332. static $dep10toOperatorMap = array('has' => '==', 'eq' => '==', 'ge' => '>=', 'gt' => '>', 'le' => '<=', 'lt' => '<', 'not' => '!=');
  22333. $result = array();
  22334. foreach ($depArray as $depItem) {
  22335. if (empty($depItem['rel']) || !array_key_exists($depItem['rel'], $dep10toOperatorMap)) {
  22336. continue;
  22337. }
  22338. $depType = !empty($depItem['optional']) && 'yes' == $depItem['optional']
  22339. ? 'optional'
  22340. : 'required';
  22341. $depType = 'not' == $depItem['rel']
  22342. ? 'conflicts'
  22343. : $depType;
  22344. $depVersion = !empty($depItem['version']) ? $this->parseVersion($depItem['version']) : '*';
  22345. $depVersionConstraint = ('has' == $depItem['rel'] || 'not' == $depItem['rel']) && '*' == $depVersion
  22346. ? '*'
  22347. : $dep10toOperatorMap[$depItem['rel']] . $depVersion;
  22348. switch ($depItem['type']) {
  22349. case 'php':
  22350. $depChannelName = 'php';
  22351. $depPackageName = '';
  22352. break;
  22353. case 'pkg':
  22354. $depChannelName = !empty($depItem['channel']) ? $depItem['channel'] : 'pear.php.net';
  22355. $depPackageName = $depItem['name'];
  22356. break;
  22357. case 'ext':
  22358. $depChannelName = 'ext';
  22359. $depPackageName = $depItem['name'];
  22360. break;
  22361. case 'os':
  22362. case 'sapi':
  22363. $depChannelName = '';
  22364. $depPackageName = '';
  22365. break;
  22366. default:
  22367. $depChannelName = '';
  22368. $depPackageName = '';
  22369. break;
  22370. }
  22371. if ('' != $depChannelName) {
  22372. $result[] = new DependencyConstraint(
  22373. $depType,
  22374. $depVersionConstraint,
  22375. $depChannelName,
  22376. $depPackageName
  22377. );
  22378. }
  22379. }
  22380. return $result;
  22381. }
  22382. private function buildDependency20Info($depArray)
  22383. {
  22384. $result = array();
  22385. $optionals = array();
  22386. $defaultOptionals = array();
  22387. foreach ($depArray as $depType => $depTypeGroup) {
  22388. if (!is_array($depTypeGroup)) {
  22389. continue;
  22390. }
  22391. if ('required' == $depType || 'optional' == $depType) {
  22392. foreach ($depTypeGroup as $depItemType => $depItem) {
  22393. switch ($depItemType) {
  22394. case 'php':
  22395. $result[] = new DependencyConstraint(
  22396. $depType,
  22397. $this->parse20VersionConstraint($depItem),
  22398. 'php',
  22399. ''
  22400. );
  22401. break;
  22402. case 'package':
  22403. $deps = $this->buildDepPackageConstraints($depItem, $depType);
  22404. $result = array_merge($result, $deps);
  22405. break;
  22406. case 'extension':
  22407. $deps = $this->buildDepExtensionConstraints($depItem, $depType);
  22408. $result = array_merge($result, $deps);
  22409. break;
  22410. case 'subpackage':
  22411. $deps = $this->buildDepPackageConstraints($depItem, 'replaces');
  22412. $defaultOptionals += $deps;
  22413. break;
  22414. case 'os':
  22415. case 'pearinstaller':
  22416. break;
  22417. default:
  22418. break;
  22419. }
  22420. }
  22421. } elseif ('group' == $depType) {
  22422. if ($this->isHash($depTypeGroup)) {
  22423. $depTypeGroup = array($depTypeGroup);
  22424. }
  22425. foreach ($depTypeGroup as $depItem) {
  22426. $groupName = $depItem['attribs']['name'];
  22427. if (!isset($optionals[$groupName])) {
  22428. $optionals[$groupName] = array();
  22429. }
  22430. if (isset($depItem['subpackage'])) {
  22431. $optionals[$groupName] += $this->buildDepPackageConstraints($depItem['subpackage'], 'replaces');
  22432. } else {
  22433. $result += $this->buildDepPackageConstraints($depItem['package'], 'optional');
  22434. }
  22435. }
  22436. }
  22437. }
  22438. if (count($defaultOptionals) > 0) {
  22439. $optionals['*'] = $defaultOptionals;
  22440. }
  22441. return new DependencyInfo($result, $optionals);
  22442. }
  22443. private function buildDepExtensionConstraints($depItem, $depType)
  22444. {
  22445. if ($this->isHash($depItem)) {
  22446. $depItem = array($depItem);
  22447. }
  22448. $result = array();
  22449. foreach ($depItem as $subDepItem) {
  22450. $depChannelName = 'ext';
  22451. $depPackageName = $subDepItem['name'];
  22452. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  22453. $result[] = new DependencyConstraint(
  22454. $depType,
  22455. $depVersionConstraint,
  22456. $depChannelName,
  22457. $depPackageName
  22458. );
  22459. }
  22460. return $result;
  22461. }
  22462. private function buildDepPackageConstraints($depItem, $depType)
  22463. {
  22464. if ($this->isHash($depItem)) {
  22465. $depItem = array($depItem);
  22466. }
  22467. $result = array();
  22468. foreach ($depItem as $subDepItem) {
  22469. if (!array_key_exists('channel', $subDepItem)) {
  22470. $subDepItem['channel'] = $subDepItem['uri'];
  22471. }
  22472. $depChannelName = $subDepItem['channel'];
  22473. $depPackageName = $subDepItem['name'];
  22474. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  22475. if (isset($subDepItem['conflicts'])) {
  22476. $depType = 'conflicts';
  22477. }
  22478. $result[] = new DependencyConstraint(
  22479. $depType,
  22480. $depVersionConstraint,
  22481. $depChannelName,
  22482. $depPackageName
  22483. );
  22484. }
  22485. return $result;
  22486. }
  22487. private function parse20VersionConstraint(array $data)
  22488. {
  22489. static $dep20toOperatorMap = array('has' => '==', 'min' => '>=', 'max' => '<=', 'exclude' => '!=');
  22490. $versions = array();
  22491. $values = array_intersect_key($data, $dep20toOperatorMap);
  22492. if (0 == count($values)) {
  22493. return '*';
  22494. }
  22495. if (isset($values['min']) && isset($values['exclude']) && $data['min'] == $data['exclude']) {
  22496. $versions[] = '>' . $this->parseVersion($values['min']);
  22497. } elseif (isset($values['max']) && isset($values['exclude']) && $data['max'] == $data['exclude']) {
  22498. $versions[] = '<' . $this->parseVersion($values['max']);
  22499. } else {
  22500. foreach ($values as $op => $version) {
  22501. if ('exclude' == $op && is_array($version)) {
  22502. foreach ($version as $versionPart) {
  22503. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($versionPart);
  22504. }
  22505. } else {
  22506. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($version);
  22507. }
  22508. }
  22509. }
  22510. return implode(',', $versions);
  22511. }
  22512. private function parseVersion($version)
  22513. {
  22514. if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?}i', $version, $matches)) {
  22515. $version = $matches[1]
  22516. .(!empty($matches[2]) ? $matches[2] : '.0')
  22517. .(!empty($matches[3]) ? $matches[3] : '.0')
  22518. .(!empty($matches[4]) ? $matches[4] : '.0');
  22519. return $version;
  22520. }
  22521. return null;
  22522. }
  22523. private function isHash(array $array)
  22524. {
  22525. return !array_key_exists(1, $array) && !array_key_exists(0, $array);
  22526. }
  22527. }
  22528. <?php
  22529. namespace Composer\Repository\Pear;
  22530. class PackageInfo
  22531. {
  22532. private $channelName;
  22533. private $packageName;
  22534. private $license;
  22535. private $shortDescription;
  22536. private $description;
  22537. private $releases;
  22538. public function __construct($channelName, $packageName, $license, $shortDescription, $description, $releases)
  22539. {
  22540. $this->channelName = $channelName;
  22541. $this->packageName = $packageName;
  22542. $this->license = $license;
  22543. $this->shortDescription = $shortDescription;
  22544. $this->description = $description;
  22545. $this->releases = $releases;
  22546. }
  22547. public function getChannelName()
  22548. {
  22549. return $this->channelName;
  22550. }
  22551. public function getPackageName()
  22552. {
  22553. return $this->packageName;
  22554. }
  22555. public function getDescription()
  22556. {
  22557. return $this->description;
  22558. }
  22559. public function getShortDescription()
  22560. {
  22561. return $this->shortDescription;
  22562. }
  22563. public function getLicense()
  22564. {
  22565. return $this->license;
  22566. }
  22567. public function getReleases()
  22568. {
  22569. return $this->releases;
  22570. }
  22571. }
  22572. <?php
  22573. namespace Composer\Repository\Pear;
  22574. class ReleaseInfo
  22575. {
  22576. private $stability;
  22577. private $dependencyInfo;
  22578. public function __construct($stability, $dependencyInfo)
  22579. {
  22580. $this->stability = $stability;
  22581. $this->dependencyInfo = $dependencyInfo;
  22582. }
  22583. public function getDependencyInfo()
  22584. {
  22585. return $this->dependencyInfo;
  22586. }
  22587. public function getStability()
  22588. {
  22589. return $this->stability;
  22590. }
  22591. }
  22592. <?php
  22593. namespace Composer\Repository;
  22594. use Composer\IO\IOInterface;
  22595. use Composer\Semver\VersionParser as SemverVersionParser;
  22596. use Composer\Package\Version\VersionParser;
  22597. use Composer\Repository\Pear\ChannelReader;
  22598. use Composer\Package\CompletePackage;
  22599. use Composer\Repository\Pear\ChannelInfo;
  22600. use Composer\EventDispatcher\EventDispatcher;
  22601. use Composer\Package\Link;
  22602. use Composer\Semver\Constraint\Constraint;
  22603. use Composer\Util\RemoteFilesystem;
  22604. use Composer\Config;
  22605. use Composer\Factory;
  22606. class PearRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  22607. {
  22608. private $url;
  22609. private $io;
  22610. private $rfs;
  22611. private $versionParser;
  22612. private $repoConfig;
  22613. private $vendorAlias;
  22614. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, RemoteFilesystem $rfs = null)
  22615. {
  22616. parent::__construct();
  22617. if (!preg_match('{^https?://}', $repoConfig['url'])) {
  22618. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  22619. }
  22620. $urlBits = parse_url($repoConfig['url']);
  22621. if (empty($urlBits['scheme']) || empty($urlBits['host'])) {
  22622. throw new \UnexpectedValueException('Invalid url given for PEAR repository: '.$repoConfig['url']);
  22623. }
  22624. $this->url = rtrim($repoConfig['url'], '/');
  22625. $this->io = $io;
  22626. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  22627. $this->vendorAlias = isset($repoConfig['vendor-alias']) ? $repoConfig['vendor-alias'] : null;
  22628. $this->versionParser = new VersionParser();
  22629. $this->repoConfig = $repoConfig;
  22630. }
  22631. public function getRepoConfig()
  22632. {
  22633. return $this->repoConfig;
  22634. }
  22635. protected function initialize()
  22636. {
  22637. parent::initialize();
  22638. $this->io->writeError('Initializing PEAR repository '.$this->url);
  22639. $reader = new ChannelReader($this->rfs);
  22640. try {
  22641. $channelInfo = $reader->read($this->url);
  22642. } catch (\Exception $e) {
  22643. $this->io->writeError('<warning>PEAR repository from '.$this->url.' could not be loaded. '.$e->getMessage().'</warning>');
  22644. return;
  22645. }
  22646. $packages = $this->buildComposerPackages($channelInfo, $this->versionParser);
  22647. foreach ($packages as $package) {
  22648. $this->addPackage($package);
  22649. }
  22650. }
  22651. private function buildComposerPackages(ChannelInfo $channelInfo, SemverVersionParser $versionParser)
  22652. {
  22653. $result = array();
  22654. foreach ($channelInfo->getPackages() as $packageDefinition) {
  22655. foreach ($packageDefinition->getReleases() as $version => $releaseInfo) {
  22656. try {
  22657. $normalizedVersion = $versionParser->normalize($version);
  22658. } catch (\UnexpectedValueException $e) {
  22659. $this->io->writeError('Could not load '.$packageDefinition->getPackageName().' '.$version.': '.$e->getMessage(), true, IOInterface::VERBOSE);
  22660. continue;
  22661. }
  22662. $composerPackageName = $this->buildComposerPackageName($packageDefinition->getChannelName(), $packageDefinition->getPackageName());
  22663. $urlBits = parse_url($this->url);
  22664. $scheme = (isset($urlBits['scheme']) && 'https' === $urlBits['scheme'] && extension_loaded('openssl')) ? 'https' : 'http';
  22665. $distUrl = "{$scheme}://{$packageDefinition->getChannelName()}/get/{$packageDefinition->getPackageName()}-{$version}.tgz";
  22666. $requires = array();
  22667. $suggests = array();
  22668. $conflicts = array();
  22669. $replaces = array();
  22670. if ($channelInfo->getName() == $packageDefinition->getChannelName()) {
  22671. $composerPackageAlias = $this->buildComposerPackageName($channelInfo->getAlias(), $packageDefinition->getPackageName());
  22672. $aliasConstraint = new Constraint('==', $normalizedVersion);
  22673. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  22674. }
  22675. if (!empty($this->vendorAlias)
  22676. && ($this->vendorAlias != 'pear-'.$channelInfo->getAlias() || $channelInfo->getName() != $packageDefinition->getChannelName())
  22677. ) {
  22678. $composerPackageAlias = "{$this->vendorAlias}/{$packageDefinition->getPackageName()}";
  22679. $aliasConstraint = new Constraint('==', $normalizedVersion);
  22680. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  22681. }
  22682. foreach ($releaseInfo->getDependencyInfo()->getRequires() as $dependencyConstraint) {
  22683. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  22684. $constraint = $versionParser->parseConstraints($dependencyConstraint->getConstraint());
  22685. $link = new Link($composerPackageName, $dependencyPackageName, $constraint, $dependencyConstraint->getType(), $dependencyConstraint->getConstraint());
  22686. switch ($dependencyConstraint->getType()) {
  22687. case 'required':
  22688. $requires[] = $link;
  22689. break;
  22690. case 'conflicts':
  22691. $conflicts[] = $link;
  22692. break;
  22693. case 'replaces':
  22694. $replaces[] = $link;
  22695. break;
  22696. }
  22697. }
  22698. foreach ($releaseInfo->getDependencyInfo()->getOptionals() as $group => $dependencyConstraints) {
  22699. foreach ($dependencyConstraints as $dependencyConstraint) {
  22700. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  22701. $suggests[$group.'-'.$dependencyPackageName] = $dependencyConstraint->getConstraint();
  22702. }
  22703. }
  22704. $package = new CompletePackage($composerPackageName, $normalizedVersion, $version);
  22705. $package->setType('pear-library');
  22706. $package->setDescription($packageDefinition->getDescription());
  22707. $package->setLicense(array($packageDefinition->getLicense()));
  22708. $package->setDistType('file');
  22709. $package->setDistUrl($distUrl);
  22710. $package->setAutoload(array('classmap' => array('')));
  22711. $package->setIncludePaths(array('/'));
  22712. $package->setRequires($requires);
  22713. $package->setConflicts($conflicts);
  22714. $package->setSuggests($suggests);
  22715. $package->setReplaces($replaces);
  22716. $result[] = $package;
  22717. }
  22718. }
  22719. return $result;
  22720. }
  22721. private function buildComposerPackageName($channelName, $packageName)
  22722. {
  22723. if ('php' === $channelName) {
  22724. return "php";
  22725. }
  22726. if ('ext' === $channelName) {
  22727. return "ext-{$packageName}";
  22728. }
  22729. return "pear-{$channelName}/{$packageName}";
  22730. }
  22731. }
  22732. <?php
  22733. namespace Composer\Repository;
  22734. use Composer\Composer;
  22735. use Composer\Package\CompletePackage;
  22736. use Composer\Package\PackageInterface;
  22737. use Composer\Package\Version\VersionParser;
  22738. use Composer\Plugin\PluginInterface;
  22739. use Composer\Util\ProcessExecutor;
  22740. use Composer\Util\Silencer;
  22741. use Composer\Util\Platform;
  22742. use Composer\XdebugHandler\XdebugHandler;
  22743. use Symfony\Component\Process\ExecutableFinder;
  22744. class PlatformRepository extends ArrayRepository
  22745. {
  22746. const PLATFORM_PACKAGE_REGEX = '{^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[a-z0-9](?:[_.-]?[a-z0-9]+)*|composer-(?:plugin|runtime)-api)$}iD';
  22747. private $versionParser;
  22748. private $overrides = array();
  22749. private $process;
  22750. public function __construct(array $packages = array(), array $overrides = array(), ProcessExecutor $process = null)
  22751. {
  22752. $this->process = $process === null ? (new ProcessExecutor()) : $process;
  22753. foreach ($overrides as $name => $version) {
  22754. $this->overrides[strtolower($name)] = array('name' => $name, 'version' => $version);
  22755. }
  22756. parent::__construct($packages);
  22757. }
  22758. protected function initialize()
  22759. {
  22760. parent::initialize();
  22761. $this->versionParser = new VersionParser();
  22762. foreach ($this->overrides as $override) {
  22763. if (!preg_match(self::PLATFORM_PACKAGE_REGEX, $override['name'])) {
  22764. throw new \InvalidArgumentException('Invalid platform package name in config.platform: '.$override['name']);
  22765. }
  22766. $this->addOverriddenPackage($override);
  22767. }
  22768. $prettyVersion = PluginInterface::PLUGIN_API_VERSION;
  22769. $version = $this->versionParser->normalize($prettyVersion);
  22770. $composerPluginApi = new CompletePackage('composer-plugin-api', $version, $prettyVersion);
  22771. $composerPluginApi->setDescription('The Composer Plugin API');
  22772. $this->addPackage($composerPluginApi);
  22773. $prettyVersion = Composer::RUNTIME_API_VERSION;
  22774. $version = $this->versionParser->normalize($prettyVersion);
  22775. $composerRuntimeApi = new CompletePackage('composer-runtime-api', $version, $prettyVersion);
  22776. $composerRuntimeApi->setDescription('The Composer Runtime API');
  22777. $this->addPackage($composerRuntimeApi);
  22778. try {
  22779. $prettyVersion = PHP_VERSION;
  22780. $version = $this->versionParser->normalize($prettyVersion);
  22781. } catch (\UnexpectedValueException $e) {
  22782. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', PHP_VERSION);
  22783. $version = $this->versionParser->normalize($prettyVersion);
  22784. }
  22785. $php = new CompletePackage('php', $version, $prettyVersion);
  22786. $php->setDescription('The PHP interpreter');
  22787. $this->addPackage($php);
  22788. if (PHP_DEBUG) {
  22789. $phpdebug = new CompletePackage('php-debug', $version, $prettyVersion);
  22790. $phpdebug->setDescription('The PHP interpreter, with debugging symbols');
  22791. $this->addPackage($phpdebug);
  22792. }
  22793. if (defined('PHP_ZTS') && PHP_ZTS) {
  22794. $phpzts = new CompletePackage('php-zts', $version, $prettyVersion);
  22795. $phpzts->setDescription('The PHP interpreter, with Zend Thread Safety');
  22796. $this->addPackage($phpzts);
  22797. }
  22798. if (PHP_INT_SIZE === 8) {
  22799. $php64 = new CompletePackage('php-64bit', $version, $prettyVersion);
  22800. $php64->setDescription('The PHP interpreter, 64bit');
  22801. $this->addPackage($php64);
  22802. }
  22803. if (defined('AF_INET6') || Silencer::call('inet_pton', '::') !== false) {
  22804. $phpIpv6 = new CompletePackage('php-ipv6', $version, $prettyVersion);
  22805. $phpIpv6->setDescription('The PHP interpreter, with IPv6 support');
  22806. $this->addPackage($phpIpv6);
  22807. }
  22808. $loadedExtensions = get_loaded_extensions();
  22809. foreach ($loadedExtensions as $name) {
  22810. if (in_array($name, array('standard', 'Core'))) {
  22811. continue;
  22812. }
  22813. $reflExt = new \ReflectionExtension($name);
  22814. $prettyVersion = $reflExt->getVersion();
  22815. $this->addExtension($name, $prettyVersion);
  22816. }
  22817. if (!in_array('xdebug', $loadedExtensions, true) && ($prettyVersion = XdebugHandler::getSkippedVersion())) {
  22818. $this->addExtension('xdebug', $prettyVersion);
  22819. }
  22820. foreach ($loadedExtensions as $name) {
  22821. $prettyVersion = null;
  22822. $description = 'The '.$name.' PHP library';
  22823. switch ($name) {
  22824. case 'curl':
  22825. $curlVersion = curl_version();
  22826. $prettyVersion = $curlVersion['version'];
  22827. break;
  22828. case 'iconv':
  22829. $prettyVersion = ICONV_VERSION;
  22830. break;
  22831. case 'intl':
  22832. $name = 'ICU';
  22833. if (defined('INTL_ICU_VERSION')) {
  22834. $prettyVersion = INTL_ICU_VERSION;
  22835. } else {
  22836. $reflector = new \ReflectionExtension('intl');
  22837. ob_start();
  22838. $reflector->info();
  22839. $output = ob_get_clean();
  22840. preg_match('/^ICU version => (.*)$/m', $output, $matches);
  22841. $prettyVersion = $matches[1];
  22842. }
  22843. break;
  22844. case 'imagick':
  22845. $imagick = new \Imagick();
  22846. $imageMagickVersion = $imagick->getVersion();
  22847. preg_match('/^ImageMagick ([\d.]+)(?:-(\d+))?/', $imageMagickVersion['versionString'], $matches);
  22848. if (isset($matches[2])) {
  22849. $prettyVersion = "{$matches[1]}.{$matches[2]}";
  22850. } else {
  22851. $prettyVersion = $matches[1];
  22852. }
  22853. break;
  22854. case 'libxml':
  22855. $prettyVersion = LIBXML_DOTTED_VERSION;
  22856. break;
  22857. case 'openssl':
  22858. $prettyVersion = preg_replace_callback('{^(?:OpenSSL|LibreSSL)?\s*([0-9.]+)([a-z]*).*}i', function ($match) {
  22859. if (empty($match[2])) {
  22860. return $match[1];
  22861. }
  22862. if (!preg_match('{^z*[a-z]$}', $match[2])) {
  22863. return 0;
  22864. }
  22865. $len = strlen($match[2]);
  22866. $patchVersion = ($len - 1) * 26;
  22867. $patchVersion += ord($match[2][$len - 1]) - 96;
  22868. return $match[1].'.'.$patchVersion;
  22869. }, OPENSSL_VERSION_TEXT);
  22870. $description = OPENSSL_VERSION_TEXT;
  22871. break;
  22872. case 'pcre':
  22873. $prettyVersion = preg_replace('{^(\S+).*}', '$1', PCRE_VERSION);
  22874. break;
  22875. case 'uuid':
  22876. $prettyVersion = phpversion('uuid');
  22877. break;
  22878. case 'xsl':
  22879. $prettyVersion = LIBXSLT_DOTTED_VERSION;
  22880. break;
  22881. default:
  22882. continue 2;
  22883. }
  22884. try {
  22885. $version = $this->versionParser->normalize($prettyVersion);
  22886. } catch (\UnexpectedValueException $e) {
  22887. continue;
  22888. }
  22889. $lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
  22890. $lib->setDescription($description);
  22891. $this->addPackage($lib);
  22892. }
  22893. $hhvmVersion = defined('HHVM_VERSION') ? HHVM_VERSION : null;
  22894. if ($hhvmVersion === null && !Platform::isWindows()) {
  22895. $finder = new ExecutableFinder();
  22896. $hhvm = $finder->find('hhvm');
  22897. if ($hhvm !== null) {
  22898. $exitCode = $this->process->execute(
  22899. ProcessExecutor::escape($hhvm).
  22900. ' --php -d hhvm.jit=0 -r "echo HHVM_VERSION;" 2>/dev/null',
  22901. $hhvmVersion
  22902. );
  22903. if ($exitCode !== 0) {
  22904. $hhvmVersion = null;
  22905. }
  22906. }
  22907. }
  22908. if ($hhvmVersion) {
  22909. try {
  22910. $prettyVersion = $hhvmVersion;
  22911. $version = $this->versionParser->normalize($prettyVersion);
  22912. } catch (\UnexpectedValueException $e) {
  22913. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', $hhvmVersion);
  22914. $version = $this->versionParser->normalize($prettyVersion);
  22915. }
  22916. $hhvm = new CompletePackage('hhvm', $version, $prettyVersion);
  22917. $hhvm->setDescription('The HHVM Runtime (64bit)');
  22918. $this->addPackage($hhvm);
  22919. }
  22920. }
  22921. public function addPackage(PackageInterface $package)
  22922. {
  22923. if (isset($this->overrides[$package->getName()])) {
  22924. $overrider = $this->findPackage($package->getName(), '*');
  22925. if ($package->getVersion() === $overrider->getVersion()) {
  22926. $actualText = 'same as actual';
  22927. } else {
  22928. $actualText = 'actual: '.$package->getPrettyVersion();
  22929. }
  22930. $overrider->setDescription($overrider->getDescription().' ('.$actualText.')');
  22931. return;
  22932. }
  22933. if (isset($this->overrides['php']) && 0 === strpos($package->getName(), 'php-')) {
  22934. $overrider = $this->addOverriddenPackage($this->overrides['php'], $package->getPrettyName());
  22935. if ($package->getVersion() === $overrider->getVersion()) {
  22936. $actualText = 'same as actual';
  22937. } else {
  22938. $actualText = 'actual: '.$package->getPrettyVersion();
  22939. }
  22940. $overrider->setDescription($overrider->getDescription().' ('.$actualText.')');
  22941. return;
  22942. }
  22943. parent::addPackage($package);
  22944. }
  22945. private function addOverriddenPackage(array $override, $name = null)
  22946. {
  22947. $version = $this->versionParser->normalize($override['version']);
  22948. $package = new CompletePackage($name ?: $override['name'], $version, $override['version']);
  22949. $package->setDescription('Package overridden via config.platform');
  22950. $package->setExtra(array('config.platform' => true));
  22951. parent::addPackage($package);
  22952. return $package;
  22953. }
  22954. private function addExtension($name, $prettyVersion)
  22955. {
  22956. $extraDescription = null;
  22957. try {
  22958. $version = $this->versionParser->normalize($prettyVersion);
  22959. } catch (\UnexpectedValueException $e) {
  22960. $extraDescription = ' (actual version: '.$prettyVersion.')';
  22961. if (preg_match('{^(\d+\.\d+\.\d+(?:\.\d+)?)}', $prettyVersion, $match)) {
  22962. $prettyVersion = $match[1];
  22963. } else {
  22964. $prettyVersion = '0';
  22965. }
  22966. $version = $this->versionParser->normalize($prettyVersion);
  22967. }
  22968. $packageName = $this->buildPackageName($name);
  22969. $ext = new CompletePackage($packageName, $version, $prettyVersion);
  22970. $ext->setDescription('The '.$name.' PHP extension'.$extraDescription);
  22971. $this->addPackage($ext);
  22972. }
  22973. private function buildPackageName($name)
  22974. {
  22975. return 'ext-' . str_replace(' ', '-', $name);
  22976. }
  22977. }
  22978. <?php
  22979. namespace Composer\Repository;
  22980. use Composer\Factory;
  22981. use Composer\IO\IOInterface;
  22982. use Composer\Config;
  22983. use Composer\EventDispatcher\EventDispatcher;
  22984. use Composer\Util\RemoteFilesystem;
  22985. use Composer\Json\JsonFile;
  22986. class RepositoryFactory
  22987. {
  22988. public static function configFromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  22989. {
  22990. if (0 === strpos($repository, 'http')) {
  22991. $repoConfig = array('type' => 'composer', 'url' => $repository);
  22992. } elseif ("json" === pathinfo($repository, PATHINFO_EXTENSION)) {
  22993. $json = new JsonFile($repository, Factory::createRemoteFilesystem($io, $config));
  22994. $data = $json->read();
  22995. if (!empty($data['packages']) || !empty($data['includes']) || !empty($data['provider-includes'])) {
  22996. $repoConfig = array('type' => 'composer', 'url' => 'file://' . strtr(realpath($repository), '\\', '/'));
  22997. } elseif ($allowFilesystem) {
  22998. $repoConfig = array('type' => 'filesystem', 'json' => $json);
  22999. } else {
  23000. throw new \InvalidArgumentException("Invalid repository URL ($repository) given. This file does not contain a valid composer repository.");
  23001. }
  23002. } elseif ('{' === substr($repository, 0, 1)) {
  23003. $repoConfig = JsonFile::parseJson($repository);
  23004. } else {
  23005. throw new \InvalidArgumentException("Invalid repository url ($repository) given. Has to be a .json file, an http url or a JSON object.");
  23006. }
  23007. return $repoConfig;
  23008. }
  23009. public static function fromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  23010. {
  23011. $repoConfig = static::configFromString($io, $config, $repository, $allowFilesystem);
  23012. return static::createRepo($io, $config, $repoConfig);
  23013. }
  23014. public static function createRepo(IOInterface $io, Config $config, array $repoConfig)
  23015. {
  23016. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  23017. $repos = static::createRepos($rm, array($repoConfig));
  23018. return reset($repos);
  23019. }
  23020. public static function defaultRepos(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  23021. {
  23022. if (!$config) {
  23023. $config = Factory::createConfig($io);
  23024. }
  23025. if ($io) {
  23026. $io->loadConfiguration($config);
  23027. }
  23028. if (!$rm) {
  23029. if (!$io) {
  23030. throw new \InvalidArgumentException('This function requires either an IOInterface or a RepositoryManager');
  23031. }
  23032. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  23033. }
  23034. return static::createRepos($rm, $config->getRepositories());
  23035. }
  23036. public static function manager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  23037. {
  23038. $rm = new RepositoryManager($io, $config, $eventDispatcher, $rfs);
  23039. $rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository');
  23040. $rm->setRepositoryClass('vcs', 'Composer\Repository\VcsRepository');
  23041. $rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
  23042. $rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository');
  23043. $rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository');
  23044. $rm->setRepositoryClass('git-bitbucket', 'Composer\Repository\VcsRepository');
  23045. $rm->setRepositoryClass('github', 'Composer\Repository\VcsRepository');
  23046. $rm->setRepositoryClass('gitlab', 'Composer\Repository\VcsRepository');
  23047. $rm->setRepositoryClass('svn', 'Composer\Repository\VcsRepository');
  23048. $rm->setRepositoryClass('fossil', 'Composer\Repository\VcsRepository');
  23049. $rm->setRepositoryClass('perforce', 'Composer\Repository\VcsRepository');
  23050. $rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository');
  23051. $rm->setRepositoryClass('hg-bitbucket', 'Composer\Repository\VcsRepository');
  23052. $rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');
  23053. $rm->setRepositoryClass('path', 'Composer\Repository\PathRepository');
  23054. return $rm;
  23055. }
  23056. private static function createRepos(RepositoryManager $rm, array $repoConfigs)
  23057. {
  23058. $repos = array();
  23059. foreach ($repoConfigs as $index => $repo) {
  23060. if (is_string($repo)) {
  23061. throw new \UnexpectedValueException('"repositories" should be an array of repository definitions, only a single repository was given');
  23062. }
  23063. if (!is_array($repo)) {
  23064. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') should be an array, '.gettype($repo).' given');
  23065. }
  23066. if (!isset($repo['type'])) {
  23067. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') must have a type defined');
  23068. }
  23069. $name = self::generateRepositoryName($index, $repo, $repos);
  23070. if ($repo['type'] === 'filesystem') {
  23071. $repos[$name] = new FilesystemRepository($repo['json']);
  23072. } else {
  23073. $repos[$name] = $rm->createRepository($repo['type'], $repo, $index);
  23074. }
  23075. }
  23076. return $repos;
  23077. }
  23078. public static function generateRepositoryName($index, array $repo, array $existingRepos)
  23079. {
  23080. $name = is_int($index) && isset($repo['url']) ? preg_replace('{^https?://}i', '', $repo['url']) : $index;
  23081. while (isset($existingRepos[$name])) {
  23082. $name .= '2';
  23083. }
  23084. return $name;
  23085. }
  23086. }
  23087. <?php
  23088. namespace Composer\Repository;
  23089. use Composer\Package\PackageInterface;
  23090. interface RepositoryInterface extends \Countable
  23091. {
  23092. const SEARCH_FULLTEXT = 0;
  23093. const SEARCH_NAME = 1;
  23094. public function hasPackage(PackageInterface $package);
  23095. public function findPackage($name, $constraint);
  23096. public function findPackages($name, $constraint = null);
  23097. public function getPackages();
  23098. public function search($query, $mode = 0);
  23099. }
  23100. <?php
  23101. namespace Composer\Repository;
  23102. use Composer\IO\IOInterface;
  23103. use Composer\Config;
  23104. use Composer\EventDispatcher\EventDispatcher;
  23105. use Composer\Package\PackageInterface;
  23106. use Composer\Util\RemoteFilesystem;
  23107. class RepositoryManager
  23108. {
  23109. private $localRepository;
  23110. private $repositories = array();
  23111. private $repositoryClasses = array();
  23112. private $io;
  23113. private $config;
  23114. private $eventDispatcher;
  23115. private $rfs;
  23116. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  23117. {
  23118. $this->io = $io;
  23119. $this->config = $config;
  23120. $this->eventDispatcher = $eventDispatcher;
  23121. $this->rfs = $rfs;
  23122. }
  23123. public function findPackage($name, $constraint)
  23124. {
  23125. foreach ($this->repositories as $repository) {
  23126. if ($package = $repository->findPackage($name, $constraint)) {
  23127. return $package;
  23128. }
  23129. }
  23130. return null;
  23131. }
  23132. public function findPackages($name, $constraint)
  23133. {
  23134. $packages = array();
  23135. foreach ($this->getRepositories() as $repository) {
  23136. $packages = array_merge($packages, $repository->findPackages($name, $constraint));
  23137. }
  23138. return $packages;
  23139. }
  23140. public function addRepository(RepositoryInterface $repository)
  23141. {
  23142. $this->repositories[] = $repository;
  23143. }
  23144. public function prependRepository(RepositoryInterface $repository)
  23145. {
  23146. array_unshift($this->repositories, $repository);
  23147. }
  23148. public function createRepository($type, $config, $name = null)
  23149. {
  23150. if (!isset($this->repositoryClasses[$type])) {
  23151. throw new \InvalidArgumentException('Repository type is not registered: '.$type);
  23152. }
  23153. if (isset($config['packagist']) && false === $config['packagist']) {
  23154. $this->io->writeError('<warning>Repository "'.$name.'" ('.json_encode($config).') has a packagist key which should be in its own repository definition</warning>');
  23155. }
  23156. $class = $this->repositoryClasses[$type];
  23157. $reflMethod = new \ReflectionMethod($class, '__construct');
  23158. $params = $reflMethod->getParameters();
  23159. if (isset($params[4])) {
  23160. $paramType = null;
  23161. if (\PHP_VERSION_ID >= 70000) {
  23162. $reflectionType = $params[4]->getType();
  23163. if ($reflectionType) {
  23164. $paramType = $reflectionType instanceof \ReflectionNamedType ? $reflectionType->getName() : (string)$reflectionType;
  23165. }
  23166. } else {
  23167. $paramType = $params[4]->getClass() ? $params[4]->getClass()->getName() : null;
  23168. }
  23169. if ($paramType === 'Composer\Util\RemoteFilesystem') {
  23170. return new $class($config, $this->io, $this->config, $this->eventDispatcher, $this->rfs);
  23171. }
  23172. }
  23173. return new $class($config, $this->io, $this->config, $this->eventDispatcher);
  23174. }
  23175. public function setRepositoryClass($type, $class)
  23176. {
  23177. $this->repositoryClasses[$type] = $class;
  23178. }
  23179. public function getRepositories()
  23180. {
  23181. return $this->repositories;
  23182. }
  23183. public function setLocalRepository(WritableRepositoryInterface $repository)
  23184. {
  23185. $this->localRepository = $repository;
  23186. }
  23187. public function getLocalRepository()
  23188. {
  23189. return $this->localRepository;
  23190. }
  23191. }
  23192. <?php
  23193. namespace Composer\Repository;
  23194. class RepositorySecurityException extends \Exception
  23195. {
  23196. }
  23197. <?php
  23198. namespace Composer\Repository\Vcs;
  23199. use Composer\Cache;
  23200. use Composer\Downloader\TransportException;
  23201. use Composer\Json\JsonFile;
  23202. use Composer\Util\Bitbucket;
  23203. abstract class BitbucketDriver extends VcsDriver
  23204. {
  23205. protected $cache;
  23206. protected $owner;
  23207. protected $repository;
  23208. protected $hasIssues;
  23209. protected $rootIdentifier;
  23210. protected $tags;
  23211. protected $branches;
  23212. protected $infoCache = array();
  23213. protected $branchesUrl = '';
  23214. protected $tagsUrl = '';
  23215. protected $homeUrl = '';
  23216. protected $website = '';
  23217. protected $cloneHttpsUrl = '';
  23218. protected $fallbackDriver;
  23219. protected $vcsType;
  23220. public function initialize()
  23221. {
  23222. preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)$#i', $this->url, $match);
  23223. $this->owner = $match[1];
  23224. $this->repository = $match[2];
  23225. $this->originUrl = 'bitbucket.org';
  23226. $this->cache = new Cache(
  23227. $this->io,
  23228. implode('/', array(
  23229. $this->config->get('cache-repo-dir'),
  23230. $this->originUrl,
  23231. $this->owner,
  23232. $this->repository,
  23233. ))
  23234. );
  23235. }
  23236. public function getUrl()
  23237. {
  23238. if ($this->fallbackDriver) {
  23239. return $this->fallbackDriver->getUrl();
  23240. }
  23241. return $this->cloneHttpsUrl;
  23242. }
  23243. protected function getRepoData()
  23244. {
  23245. $resource = sprintf(
  23246. 'https://api.bitbucket.org/2.0/repositories/%s/%s?%s',
  23247. $this->owner,
  23248. $this->repository,
  23249. http_build_query(
  23250. array('fields' => '-project,-owner'),
  23251. null,
  23252. '&'
  23253. )
  23254. );
  23255. $repoData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource, true), $resource);
  23256. if ($this->fallbackDriver) {
  23257. return false;
  23258. }
  23259. $this->parseCloneUrls($repoData['links']['clone']);
  23260. $this->hasIssues = !empty($repoData['has_issues']);
  23261. $this->branchesUrl = $repoData['links']['branches']['href'];
  23262. $this->tagsUrl = $repoData['links']['tags']['href'];
  23263. $this->homeUrl = $repoData['links']['html']['href'];
  23264. $this->website = $repoData['website'];
  23265. $this->vcsType = $repoData['scm'];
  23266. return true;
  23267. }
  23268. public function getComposerInformation($identifier)
  23269. {
  23270. if ($this->fallbackDriver) {
  23271. return $this->fallbackDriver->getComposerInformation($identifier);
  23272. }
  23273. if (!isset($this->infoCache[$identifier])) {
  23274. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  23275. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  23276. }
  23277. $composer = $this->getBaseComposerInformation($identifier);
  23278. if ($composer) {
  23279. if (!isset($composer['support']['source'])) {
  23280. $label = array_search(
  23281. $identifier,
  23282. $this->getTags()
  23283. ) ?: array_search(
  23284. $identifier,
  23285. $this->getBranches()
  23286. ) ?: $identifier;
  23287. if (array_key_exists($label, $tags = $this->getTags())) {
  23288. $hash = $tags[$label];
  23289. } elseif (array_key_exists($label, $branches = $this->getBranches())) {
  23290. $hash = $branches[$label];
  23291. }
  23292. if (! isset($hash)) {
  23293. $composer['support']['source'] = sprintf(
  23294. 'https://%s/%s/%s/src',
  23295. $this->originUrl,
  23296. $this->owner,
  23297. $this->repository
  23298. );
  23299. } else {
  23300. $composer['support']['source'] = sprintf(
  23301. 'https://%s/%s/%s/src/%s/?at=%s',
  23302. $this->originUrl,
  23303. $this->owner,
  23304. $this->repository,
  23305. $hash,
  23306. $label
  23307. );
  23308. }
  23309. }
  23310. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  23311. $composer['support']['issues'] = sprintf(
  23312. 'https://%s/%s/%s/issues',
  23313. $this->originUrl,
  23314. $this->owner,
  23315. $this->repository
  23316. );
  23317. }
  23318. if (!isset($composer['homepage'])) {
  23319. $composer['homepage'] = empty($this->website) ? $this->homeUrl : $this->website;
  23320. }
  23321. }
  23322. $this->infoCache[$identifier] = $composer;
  23323. if ($this->shouldCache($identifier)) {
  23324. $this->cache->write($identifier, json_encode($composer));
  23325. }
  23326. }
  23327. return $this->infoCache[$identifier];
  23328. }
  23329. public function getFileContent($file, $identifier)
  23330. {
  23331. if ($this->fallbackDriver) {
  23332. return $this->fallbackDriver->getFileContent($file, $identifier);
  23333. }
  23334. if (strpos($identifier, '/') !== false) {
  23335. $branches = $this->getBranches();
  23336. if (isset($branches[$identifier])) {
  23337. $identifier = $branches[$identifier];
  23338. }
  23339. }
  23340. $resource = sprintf(
  23341. 'https://api.bitbucket.org/2.0/repositories/%s/%s/src/%s/%s',
  23342. $this->owner,
  23343. $this->repository,
  23344. $identifier,
  23345. $file
  23346. );
  23347. return $this->getContentsWithOAuthCredentials($resource);
  23348. }
  23349. public function getChangeDate($identifier)
  23350. {
  23351. if ($this->fallbackDriver) {
  23352. return $this->fallbackDriver->getChangeDate($identifier);
  23353. }
  23354. if (strpos($identifier, '/') !== false) {
  23355. $branches = $this->getBranches();
  23356. if (isset($branches[$identifier])) {
  23357. $identifier = $branches[$identifier];
  23358. }
  23359. }
  23360. $resource = sprintf(
  23361. 'https://api.bitbucket.org/2.0/repositories/%s/%s/commit/%s?fields=date',
  23362. $this->owner,
  23363. $this->repository,
  23364. $identifier
  23365. );
  23366. $commit = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  23367. return new \DateTime($commit['date']);
  23368. }
  23369. public function getSource($identifier)
  23370. {
  23371. if ($this->fallbackDriver) {
  23372. return $this->fallbackDriver->getSource($identifier);
  23373. }
  23374. return array('type' => $this->vcsType, 'url' => $this->getUrl(), 'reference' => $identifier);
  23375. }
  23376. public function getDist($identifier)
  23377. {
  23378. if ($this->fallbackDriver) {
  23379. return $this->fallbackDriver->getDist($identifier);
  23380. }
  23381. $url = sprintf(
  23382. 'https://bitbucket.org/%s/%s/get/%s.zip',
  23383. $this->owner,
  23384. $this->repository,
  23385. $identifier
  23386. );
  23387. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  23388. }
  23389. public function getTags()
  23390. {
  23391. if ($this->fallbackDriver) {
  23392. return $this->fallbackDriver->getTags();
  23393. }
  23394. if (null === $this->tags) {
  23395. $this->tags = array();
  23396. $resource = sprintf(
  23397. '%s?%s',
  23398. $this->tagsUrl,
  23399. http_build_query(
  23400. array(
  23401. 'pagelen' => 100,
  23402. 'fields' => 'values.name,values.target.hash,next',
  23403. 'sort' => '-target.date',
  23404. ),
  23405. null,
  23406. '&'
  23407. )
  23408. );
  23409. $hasNext = true;
  23410. while ($hasNext) {
  23411. $tagsData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  23412. foreach ($tagsData['values'] as $data) {
  23413. $this->tags[$data['name']] = $data['target']['hash'];
  23414. }
  23415. if (empty($tagsData['next'])) {
  23416. $hasNext = false;
  23417. } else {
  23418. $resource = $tagsData['next'];
  23419. }
  23420. }
  23421. if ($this->vcsType === 'hg') {
  23422. unset($this->tags['tip']);
  23423. }
  23424. }
  23425. return $this->tags;
  23426. }
  23427. public function getBranches()
  23428. {
  23429. if ($this->fallbackDriver) {
  23430. return $this->fallbackDriver->getBranches();
  23431. }
  23432. if (null === $this->branches) {
  23433. $this->branches = array();
  23434. $resource = sprintf(
  23435. '%s?%s',
  23436. $this->branchesUrl,
  23437. http_build_query(
  23438. array(
  23439. 'pagelen' => 100,
  23440. 'fields' => 'values.name,values.target.hash,values.heads,next',
  23441. 'sort' => '-target.date',
  23442. ),
  23443. null,
  23444. '&'
  23445. )
  23446. );
  23447. $hasNext = true;
  23448. while ($hasNext) {
  23449. $branchData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  23450. foreach ($branchData['values'] as $data) {
  23451. if ($this->vcsType === 'hg' && empty($data['heads'])) {
  23452. continue;
  23453. }
  23454. $this->branches[$data['name']] = $data['target']['hash'];
  23455. }
  23456. if (empty($branchData['next'])) {
  23457. $hasNext = false;
  23458. } else {
  23459. $resource = $branchData['next'];
  23460. }
  23461. }
  23462. }
  23463. return $this->branches;
  23464. }
  23465. protected function getContentsWithOAuthCredentials($url, $fetchingRepoData = false)
  23466. {
  23467. try {
  23468. return parent::getContents($url);
  23469. } catch (TransportException $e) {
  23470. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process, $this->remoteFilesystem);
  23471. if (403 === $e->getCode() || (401 === $e->getCode() && strpos($e->getMessage(), 'Could not authenticate against') === 0)) {
  23472. if (!$this->io->hasAuthentication($this->originUrl)
  23473. && $bitbucketUtil->authorizeOAuth($this->originUrl)
  23474. ) {
  23475. return parent::getContents($url);
  23476. }
  23477. if (!$this->io->isInteractive() && $fetchingRepoData) {
  23478. return $this->attemptCloneFallback();
  23479. }
  23480. }
  23481. throw $e;
  23482. }
  23483. }
  23484. abstract protected function generateSshUrl();
  23485. protected function attemptCloneFallback()
  23486. {
  23487. try {
  23488. $this->setupFallbackDriver($this->generateSshUrl());
  23489. } catch (\RuntimeException $e) {
  23490. $this->fallbackDriver = null;
  23491. $this->io->writeError(
  23492. '<error>Failed to clone the ' . $this->generateSshUrl() . ' repository, try running in interactive mode'
  23493. . ' so that you can enter your Bitbucket OAuth consumer credentials</error>'
  23494. );
  23495. throw $e;
  23496. }
  23497. }
  23498. abstract protected function setupFallbackDriver($url);
  23499. protected function parseCloneUrls(array $cloneLinks)
  23500. {
  23501. foreach ($cloneLinks as $cloneLink) {
  23502. if ($cloneLink['name'] === 'https') {
  23503. $this->cloneHttpsUrl = preg_replace('/https:\/\/([^@]+@)?/', 'https://', $cloneLink['href']);
  23504. }
  23505. }
  23506. }
  23507. protected function getMainBranchData()
  23508. {
  23509. $resource = sprintf(
  23510. 'https://api.bitbucket.org/2.0/repositories/%s/%s?fields=mainbranch',
  23511. $this->owner,
  23512. $this->repository
  23513. );
  23514. $data = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  23515. if (isset($data['mainbranch'])) {
  23516. return $data['mainbranch'];
  23517. }
  23518. return null;
  23519. }
  23520. }
  23521. <?php
  23522. namespace Composer\Repository\Vcs;
  23523. use Composer\Cache;
  23524. use Composer\Config;
  23525. use Composer\Util\ProcessExecutor;
  23526. use Composer\Util\Filesystem;
  23527. use Composer\IO\IOInterface;
  23528. class FossilDriver extends VcsDriver
  23529. {
  23530. protected $tags;
  23531. protected $branches;
  23532. protected $rootIdentifier;
  23533. protected $repoFile;
  23534. protected $checkoutDir;
  23535. protected $infoCache = array();
  23536. public function initialize()
  23537. {
  23538. $this->checkFossil();
  23539. $this->config->prohibitUrlByConfig($this->url, $this->io);
  23540. if (Filesystem::isLocalPath($this->url) && is_dir($this->url)) {
  23541. $this->checkoutDir = $this->url;
  23542. } else {
  23543. if (!Cache::isUsable($this->config->get('cache-repo-dir')) || !Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  23544. throw new \RuntimeException('FossilDriver requires a usable cache directory, and it looks like you set it to be disabled');
  23545. }
  23546. $localName = preg_replace('{[^a-z0-9]}i', '-', $this->url);
  23547. $this->repoFile = $this->config->get('cache-repo-dir') . '/' . $localName . '.fossil';
  23548. $this->checkoutDir = $this->config->get('cache-vcs-dir') . '/' . $localName . '/';
  23549. $this->updateLocalRepo();
  23550. }
  23551. $this->getTags();
  23552. $this->getBranches();
  23553. }
  23554. protected function checkFossil()
  23555. {
  23556. if (0 !== $this->process->execute('fossil version', $ignoredOutput)) {
  23557. throw new \RuntimeException("fossil was not found, check that it is installed and in your PATH env.\n\n" . $this->process->getErrorOutput());
  23558. }
  23559. }
  23560. protected function updateLocalRepo()
  23561. {
  23562. $fs = new Filesystem();
  23563. $fs->ensureDirectoryExists($this->checkoutDir);
  23564. if (!is_writable(dirname($this->checkoutDir))) {
  23565. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$this->checkoutDir.'" directory is not writable by the current user.');
  23566. }
  23567. if (is_file($this->repoFile) && is_dir($this->checkoutDir) && 0 === $this->process->execute('fossil info', $output, $this->checkoutDir)) {
  23568. if (0 !== $this->process->execute('fossil pull', $output, $this->checkoutDir)) {
  23569. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  23570. }
  23571. } else {
  23572. $fs->removeDirectory($this->checkoutDir);
  23573. $fs->remove($this->repoFile);
  23574. $fs->ensureDirectoryExists($this->checkoutDir);
  23575. if (0 !== $this->process->execute(sprintf('fossil clone %s %s', ProcessExecutor::escape($this->url), ProcessExecutor::escape($this->repoFile)), $output)) {
  23576. $output = $this->process->getErrorOutput();
  23577. throw new \RuntimeException('Failed to clone '.$this->url.' to repository ' . $this->repoFile . "\n\n" .$output);
  23578. }
  23579. if (0 !== $this->process->execute(sprintf('fossil open %s --nested', ProcessExecutor::escape($this->repoFile)), $output, $this->checkoutDir)) {
  23580. $output = $this->process->getErrorOutput();
  23581. throw new \RuntimeException('Failed to open repository '.$this->repoFile.' in ' . $this->checkoutDir . "\n\n" .$output);
  23582. }
  23583. }
  23584. }
  23585. public function getRootIdentifier()
  23586. {
  23587. if (null === $this->rootIdentifier) {
  23588. $this->rootIdentifier = 'trunk';
  23589. }
  23590. return $this->rootIdentifier;
  23591. }
  23592. public function getUrl()
  23593. {
  23594. return $this->url;
  23595. }
  23596. public function getSource($identifier)
  23597. {
  23598. return array('type' => 'fossil', 'url' => $this->getUrl(), 'reference' => $identifier);
  23599. }
  23600. public function getDist($identifier)
  23601. {
  23602. return null;
  23603. }
  23604. public function getFileContent($file, $identifier)
  23605. {
  23606. $command = sprintf('fossil cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  23607. $this->process->execute($command, $content, $this->checkoutDir);
  23608. if (!trim($content)) {
  23609. return null;
  23610. }
  23611. return $content;
  23612. }
  23613. public function getChangeDate($identifier)
  23614. {
  23615. $this->process->execute('fossil finfo -b -n 1 composer.json', $output, $this->checkoutDir);
  23616. list($ckout, $date, $message) = explode(' ', trim($output), 3);
  23617. return new \DateTime($date, new \DateTimeZone('UTC'));
  23618. }
  23619. public function getTags()
  23620. {
  23621. if (null === $this->tags) {
  23622. $tags = array();
  23623. $this->process->execute('fossil tag list', $output, $this->checkoutDir);
  23624. foreach ($this->process->splitLines($output) as $tag) {
  23625. $tags[$tag] = $tag;
  23626. }
  23627. $this->tags = $tags;
  23628. }
  23629. return $this->tags;
  23630. }
  23631. public function getBranches()
  23632. {
  23633. if (null === $this->branches) {
  23634. $branches = array();
  23635. $bookmarks = array();
  23636. $this->process->execute('fossil branch list', $output, $this->checkoutDir);
  23637. foreach ($this->process->splitLines($output) as $branch) {
  23638. $branch = trim(preg_replace('/^\*/', '', trim($branch)));
  23639. $branches[$branch] = $branch;
  23640. }
  23641. $this->branches = $branches;
  23642. }
  23643. return $this->branches;
  23644. }
  23645. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23646. {
  23647. if (preg_match('#(^(?:https?|ssh)://(?:[^@]@)?(?:chiselapp\.com|fossil\.))#i', $url)) {
  23648. return true;
  23649. }
  23650. if (preg_match('!/fossil/|\.fossil!', $url)) {
  23651. return true;
  23652. }
  23653. if (Filesystem::isLocalPath($url)) {
  23654. $url = Filesystem::getPlatformPath($url);
  23655. if (!is_dir($url)) {
  23656. return false;
  23657. }
  23658. $process = new ProcessExecutor($io);
  23659. if ($process->execute('fossil info', $output, $url) === 0) {
  23660. return true;
  23661. }
  23662. }
  23663. return false;
  23664. }
  23665. }
  23666. <?php
  23667. namespace Composer\Repository\Vcs;
  23668. use Composer\Config;
  23669. use Composer\IO\IOInterface;
  23670. class GitBitbucketDriver extends BitbucketDriver
  23671. {
  23672. public function getRootIdentifier()
  23673. {
  23674. if ($this->fallbackDriver) {
  23675. return $this->fallbackDriver->getRootIdentifier();
  23676. }
  23677. if (null === $this->rootIdentifier) {
  23678. if (! $this->getRepoData()) {
  23679. return $this->fallbackDriver->getRootIdentifier();
  23680. }
  23681. if ($this->vcsType !== 'git') {
  23682. throw new \RuntimeException(
  23683. $this->url.' does not appear to be a git repository, use '.
  23684. $this->cloneHttpsUrl.' if this is a mercurial bitbucket repository'
  23685. );
  23686. }
  23687. $mainBranchData = $this->getMainBranchData();
  23688. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'master';
  23689. }
  23690. return $this->rootIdentifier;
  23691. }
  23692. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23693. {
  23694. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/(.+?)\.git$#i', $url)) {
  23695. return false;
  23696. }
  23697. if (!extension_loaded('openssl')) {
  23698. $io->writeError('Skipping Bitbucket git driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  23699. return false;
  23700. }
  23701. return true;
  23702. }
  23703. protected function setupFallbackDriver($url)
  23704. {
  23705. $this->fallbackDriver = new GitDriver(
  23706. array('url' => $url),
  23707. $this->io,
  23708. $this->config,
  23709. $this->process,
  23710. $this->remoteFilesystem
  23711. );
  23712. $this->fallbackDriver->initialize();
  23713. }
  23714. protected function generateSshUrl()
  23715. {
  23716. return 'git@' . $this->originUrl . ':' . $this->owner.'/'.$this->repository.'.git';
  23717. }
  23718. }
  23719. <?php
  23720. namespace Composer\Repository\Vcs;
  23721. use Composer\Util\ProcessExecutor;
  23722. use Composer\Util\Filesystem;
  23723. use Composer\Util\Git as GitUtil;
  23724. use Composer\IO\IOInterface;
  23725. use Composer\Cache;
  23726. use Composer\Config;
  23727. class GitDriver extends VcsDriver
  23728. {
  23729. protected $cache;
  23730. protected $tags;
  23731. protected $branches;
  23732. protected $rootIdentifier;
  23733. protected $repoDir;
  23734. protected $infoCache = array();
  23735. public function initialize()
  23736. {
  23737. if (Filesystem::isLocalPath($this->url)) {
  23738. $this->url = preg_replace('{[\\/]\.git/?$}', '', $this->url);
  23739. $this->repoDir = $this->url;
  23740. $cacheUrl = realpath($this->url);
  23741. } else {
  23742. if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  23743. throw new \RuntimeException('GitDriver requires a usable cache directory, and it looks like you set it to be disabled');
  23744. }
  23745. $this->repoDir = $this->config->get('cache-vcs-dir') . '/' . preg_replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
  23746. GitUtil::cleanEnv();
  23747. $fs = new Filesystem();
  23748. $fs->ensureDirectoryExists(dirname($this->repoDir));
  23749. if (!is_writable(dirname($this->repoDir))) {
  23750. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.dirname($this->repoDir).'" directory is not writable by the current user.');
  23751. }
  23752. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $this->url)) {
  23753. 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.');
  23754. }
  23755. $gitUtil = new GitUtil($this->io, $this->config, $this->process, $fs);
  23756. if (!$gitUtil->syncMirror($this->url, $this->repoDir)) {
  23757. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated</error>');
  23758. }
  23759. $cacheUrl = $this->url;
  23760. }
  23761. $this->getTags();
  23762. $this->getBranches();
  23763. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $cacheUrl));
  23764. }
  23765. public function getRootIdentifier()
  23766. {
  23767. if (null === $this->rootIdentifier) {
  23768. $this->rootIdentifier = 'master';
  23769. $this->process->execute('git branch --no-color', $output, $this->repoDir);
  23770. $branches = $this->process->splitLines($output);
  23771. if (!in_array('* master', $branches)) {
  23772. foreach ($branches as $branch) {
  23773. if ($branch && preg_match('{^\* +(\S+)}', $branch, $match)) {
  23774. $this->rootIdentifier = $match[1];
  23775. break;
  23776. }
  23777. }
  23778. }
  23779. }
  23780. return $this->rootIdentifier;
  23781. }
  23782. public function getUrl()
  23783. {
  23784. return $this->url;
  23785. }
  23786. public function getSource($identifier)
  23787. {
  23788. return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $identifier);
  23789. }
  23790. public function getDist($identifier)
  23791. {
  23792. return null;
  23793. }
  23794. public function getFileContent($file, $identifier)
  23795. {
  23796. $resource = sprintf('%s:%s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  23797. $this->process->execute(sprintf('git show %s', $resource), $content, $this->repoDir);
  23798. if (!trim($content)) {
  23799. return null;
  23800. }
  23801. return $content;
  23802. }
  23803. public function getChangeDate($identifier)
  23804. {
  23805. $this->process->execute(sprintf(
  23806. 'git -c log.showSignature=false log -1 --format=%%at %s',
  23807. ProcessExecutor::escape($identifier)
  23808. ), $output, $this->repoDir);
  23809. return new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  23810. }
  23811. public function getTags()
  23812. {
  23813. if (null === $this->tags) {
  23814. $this->tags = array();
  23815. $this->process->execute('git show-ref --tags --dereference', $output, $this->repoDir);
  23816. foreach ($output = $this->process->splitLines($output) as $tag) {
  23817. if ($tag && preg_match('{^([a-f0-9]{40}) refs/tags/(\S+?)(\^\{\})?$}', $tag, $match)) {
  23818. $this->tags[$match[2]] = $match[1];
  23819. }
  23820. }
  23821. }
  23822. return $this->tags;
  23823. }
  23824. public function getBranches()
  23825. {
  23826. if (null === $this->branches) {
  23827. $branches = array();
  23828. $this->process->execute('git branch --no-color --no-abbrev -v', $output, $this->repoDir);
  23829. foreach ($this->process->splitLines($output) as $branch) {
  23830. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  23831. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+)(?: .*)?$}', $branch, $match)) {
  23832. $branches[$match[1]] = $match[2];
  23833. }
  23834. }
  23835. }
  23836. $this->branches = $branches;
  23837. }
  23838. return $this->branches;
  23839. }
  23840. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23841. {
  23842. if (preg_match('#(^git://|\.git/?$|git(?:olite)?@|//git\.|//github.com/)#i', $url)) {
  23843. return true;
  23844. }
  23845. if (Filesystem::isLocalPath($url)) {
  23846. $url = Filesystem::getPlatformPath($url);
  23847. if (!is_dir($url)) {
  23848. return false;
  23849. }
  23850. $process = new ProcessExecutor($io);
  23851. if ($process->execute('git tag', $output, $url) === 0) {
  23852. return true;
  23853. }
  23854. }
  23855. if (!$deep) {
  23856. return false;
  23857. }
  23858. $gitUtil = new GitUtil($io, $config, new ProcessExecutor($io), new Filesystem());
  23859. GitUtil::cleanEnv();
  23860. try {
  23861. $gitUtil->runCommand(function ($url) {
  23862. return 'git ls-remote --heads ' . ProcessExecutor::escape($url);
  23863. }, $url, sys_get_temp_dir());
  23864. } catch (\RuntimeException $e) {
  23865. return false;
  23866. }
  23867. return true;
  23868. }
  23869. }
  23870. <?php
  23871. namespace Composer\Repository\Vcs;
  23872. use Composer\Config;
  23873. use Composer\Downloader\TransportException;
  23874. use Composer\Json\JsonFile;
  23875. use Composer\Cache;
  23876. use Composer\IO\IOInterface;
  23877. use Composer\Util\GitHub;
  23878. class GitHubDriver extends VcsDriver
  23879. {
  23880. protected $cache;
  23881. protected $owner;
  23882. protected $repository;
  23883. protected $tags;
  23884. protected $branches;
  23885. protected $rootIdentifier;
  23886. protected $repoData;
  23887. protected $hasIssues;
  23888. protected $infoCache = array();
  23889. protected $isPrivate = false;
  23890. private $isArchived = false;
  23891. private $fundingInfo;
  23892. protected $gitDriver;
  23893. public function initialize()
  23894. {
  23895. preg_match('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/(.+?)(?:\.git|/)?$#', $this->url, $match);
  23896. $this->owner = $match[3];
  23897. $this->repository = $match[4];
  23898. $this->originUrl = strtolower(!empty($match[1]) ? $match[1] : $match[2]);
  23899. if ($this->originUrl === 'www.github.com') {
  23900. $this->originUrl = 'github.com';
  23901. }
  23902. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  23903. if ( $this->config->get('use-github-api') === false || (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api'] ) ){
  23904. $this->setupGitDriver($this->url);
  23905. return;
  23906. }
  23907. $this->fetchRootIdentifier();
  23908. }
  23909. public function getRepositoryUrl()
  23910. {
  23911. return 'https://'.$this->originUrl.'/'.$this->owner.'/'.$this->repository;
  23912. }
  23913. public function getRootIdentifier()
  23914. {
  23915. if ($this->gitDriver) {
  23916. return $this->gitDriver->getRootIdentifier();
  23917. }
  23918. return $this->rootIdentifier;
  23919. }
  23920. public function getUrl()
  23921. {
  23922. if ($this->gitDriver) {
  23923. return $this->gitDriver->getUrl();
  23924. }
  23925. return 'https://' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  23926. }
  23927. protected function getApiUrl()
  23928. {
  23929. if ('github.com' === $this->originUrl) {
  23930. $apiUrl = 'api.github.com';
  23931. } else {
  23932. $apiUrl = $this->originUrl . '/api/v3';
  23933. }
  23934. return 'https://' . $apiUrl;
  23935. }
  23936. public function getSource($identifier)
  23937. {
  23938. if ($this->gitDriver) {
  23939. return $this->gitDriver->getSource($identifier);
  23940. }
  23941. if ($this->isPrivate) {
  23942. $url = $this->generateSshUrl();
  23943. } else {
  23944. $url = $this->getUrl();
  23945. }
  23946. return array('type' => 'git', 'url' => $url, 'reference' => $identifier);
  23947. }
  23948. public function getDist($identifier)
  23949. {
  23950. $url = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$identifier;
  23951. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  23952. }
  23953. public function getComposerInformation($identifier)
  23954. {
  23955. if ($this->gitDriver) {
  23956. return $this->gitDriver->getComposerInformation($identifier);
  23957. }
  23958. if (!isset($this->infoCache[$identifier])) {
  23959. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  23960. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  23961. }
  23962. $composer = $this->getBaseComposerInformation($identifier);
  23963. if ($composer) {
  23964. if (!isset($composer['support']['source'])) {
  23965. $label = array_search($identifier, $this->getTags()) ?: array_search($identifier, $this->getBranches()) ?: $identifier;
  23966. $composer['support']['source'] = sprintf('https://%s/%s/%s/tree/%s', $this->originUrl, $this->owner, $this->repository, $label);
  23967. }
  23968. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  23969. $composer['support']['issues'] = sprintf('https://%s/%s/%s/issues', $this->originUrl, $this->owner, $this->repository);
  23970. }
  23971. if (!isset($composer['abandoned']) && $this->isArchived) {
  23972. $composer['abandoned'] = true;
  23973. }
  23974. if (!isset($composer['funding']) && $funding = $this->getFundingInfo()) {
  23975. $composer['funding'] = $funding;
  23976. }
  23977. }
  23978. if ($this->shouldCache($identifier)) {
  23979. $this->cache->write($identifier, json_encode($composer));
  23980. }
  23981. $this->infoCache[$identifier] = $composer;
  23982. }
  23983. return $this->infoCache[$identifier];
  23984. }
  23985. private function getFundingInfo()
  23986. {
  23987. if (null !== $this->fundingInfo) {
  23988. return $this->fundingInfo;
  23989. }
  23990. if ($this->originUrl !== 'github.com') {
  23991. return $this->fundingInfo = false;
  23992. }
  23993. foreach (array($this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/.github/FUNDING.yml', $this->getApiUrl() . '/repos/'.$this->owner.'/.github/contents/FUNDING.yml') as $file) {
  23994. try {
  23995. $result = $this->remoteFilesystem->getContents($this->originUrl, $file, false, array(
  23996. 'retry-auth-failure' => false,
  23997. ));
  23998. $response = json_decode($result, true);
  23999. } catch (TransportException $e) {
  24000. continue;
  24001. }
  24002. if (empty($response['content']) || $response['encoding'] !== 'base64' || !($funding = base64_decode($response['content']))) {
  24003. continue;
  24004. }
  24005. break;
  24006. }
  24007. if (empty($funding)) {
  24008. return $this->fundingInfo = false;
  24009. }
  24010. $result = array();
  24011. $key = null;
  24012. foreach (preg_split('{\r?\n}', $funding) as $line) {
  24013. $line = trim($line);
  24014. if (preg_match('{^(\w+)\s*:\s*(.+)$}', $line, $match)) {
  24015. if (preg_match('{^\[(.*)\](?:\s*#.*)?$}', $match[2], $match2)) {
  24016. foreach (array_map('trim', preg_split('{[\'"]?\s*,\s*[\'"]?}', $match2[1])) as $item) {
  24017. $result[] = array('type' => $match[1], 'url' => trim($item, '"\' '));
  24018. }
  24019. } elseif (preg_match('{^([^#].*?)(\s+#.*)?$}', $match[2], $match2)) {
  24020. $result[] = array('type' => $match[1], 'url' => trim($match2[1], '"\' '));
  24021. }
  24022. $key = null;
  24023. } elseif (preg_match('{^(\w+)\s*:\s*#\s*$}', $line, $match)) {
  24024. $key = $match[1];
  24025. } elseif ($key && preg_match('{^-\s*(.+)(\s+#.*)?$}', $line, $match)) {
  24026. $result[] = array('type' => $key, 'url' => trim($match[1], '"\' '));
  24027. }
  24028. }
  24029. foreach ($result as $key => $item) {
  24030. switch ($item['type']) {
  24031. case 'tidelift':
  24032. $result[$key]['url'] = 'https://tidelift.com/funding/github/' . $item['url'];
  24033. break;
  24034. case 'github':
  24035. $result[$key]['url'] = 'https://github.com/' . basename($item['url']);
  24036. break;
  24037. case 'patreon':
  24038. $result[$key]['url'] = 'https://www.patreon.com/' . basename($item['url']);
  24039. break;
  24040. case 'otechie':
  24041. $result[$key]['url'] = 'https://otechie.com/' . basename($item['url']);
  24042. break;
  24043. case 'open_collective':
  24044. $result[$key]['url'] = 'https://opencollective.com/' . basename($item['url']);
  24045. break;
  24046. case 'liberapay':
  24047. $result[$key]['url'] = 'https://liberapay.com/' . basename($item['url']);
  24048. break;
  24049. case 'ko_fi':
  24050. $result[$key]['url'] = 'https://ko-fi.com/' . basename($item['url']);
  24051. break;
  24052. case 'issuehunt':
  24053. $result[$key]['url'] = 'https://issuehunt.io/r/' . $item['url'];
  24054. break;
  24055. case 'community_bridge':
  24056. $result[$key]['url'] = 'https://funding.communitybridge.org/projects/' . basename($item['url']);
  24057. break;
  24058. }
  24059. }
  24060. return $this->fundingInfo = $result;
  24061. }
  24062. public function getFileContent($file, $identifier)
  24063. {
  24064. if ($this->gitDriver) {
  24065. return $this->gitDriver->getFileContent($file, $identifier);
  24066. }
  24067. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/' . $file . '?ref='.urlencode($identifier);
  24068. $resource = JsonFile::parseJson($this->getContents($resource));
  24069. if (empty($resource['content']) || $resource['encoding'] !== 'base64' || !($content = base64_decode($resource['content']))) {
  24070. throw new \RuntimeException('Could not retrieve ' . $file . ' for '.$identifier);
  24071. }
  24072. return $content;
  24073. }
  24074. public function getChangeDate($identifier)
  24075. {
  24076. if ($this->gitDriver) {
  24077. return $this->gitDriver->getChangeDate($identifier);
  24078. }
  24079. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier);
  24080. $commit = JsonFile::parseJson($this->getContents($resource), $resource);
  24081. return new \DateTime($commit['commit']['committer']['date']);
  24082. }
  24083. public function getTags()
  24084. {
  24085. if ($this->gitDriver) {
  24086. return $this->gitDriver->getTags();
  24087. }
  24088. if (null === $this->tags) {
  24089. $this->tags = array();
  24090. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/tags?per_page=100';
  24091. do {
  24092. $tagsData = JsonFile::parseJson($this->getContents($resource), $resource);
  24093. foreach ($tagsData as $tag) {
  24094. $this->tags[$tag['name']] = $tag['commit']['sha'];
  24095. }
  24096. $resource = $this->getNextPage();
  24097. } while ($resource);
  24098. }
  24099. return $this->tags;
  24100. }
  24101. public function getBranches()
  24102. {
  24103. if ($this->gitDriver) {
  24104. return $this->gitDriver->getBranches();
  24105. }
  24106. if (null === $this->branches) {
  24107. $this->branches = array();
  24108. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/git/refs/heads?per_page=100';
  24109. do {
  24110. $branchData = JsonFile::parseJson($this->getContents($resource), $resource);
  24111. foreach ($branchData as $branch) {
  24112. $name = substr($branch['ref'], 11);
  24113. if ($name !== 'gh-pages') {
  24114. $this->branches[$name] = $branch['object']['sha'];
  24115. }
  24116. }
  24117. $resource = $this->getNextPage();
  24118. } while ($resource);
  24119. }
  24120. return $this->branches;
  24121. }
  24122. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  24123. {
  24124. if (!preg_match('#^((?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/(.+?)(?:\.git|/)?$#', $url, $matches)) {
  24125. return false;
  24126. }
  24127. $originUrl = !empty($matches[2]) ? $matches[2] : $matches[3];
  24128. if (!in_array(strtolower(preg_replace('{^www\.}i', '', $originUrl)), $config->get('github-domains'))) {
  24129. return false;
  24130. }
  24131. if (!extension_loaded('openssl')) {
  24132. $io->writeError('Skipping GitHub driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  24133. return false;
  24134. }
  24135. return true;
  24136. }
  24137. public function getRepoData()
  24138. {
  24139. $this->fetchRootIdentifier();
  24140. return $this->repoData;
  24141. }
  24142. protected function generateSshUrl()
  24143. {
  24144. if (false !== strpos($this->originUrl, ':')) {
  24145. return 'ssh://git@' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  24146. }
  24147. return 'git@' . $this->originUrl . ':'.$this->owner.'/'.$this->repository.'.git';
  24148. }
  24149. protected function getContents($url, $fetchingRepoData = false)
  24150. {
  24151. try {
  24152. return parent::getContents($url);
  24153. } catch (TransportException $e) {
  24154. $gitHubUtil = new GitHub($this->io, $this->config, $this->process, $this->remoteFilesystem);
  24155. switch ($e->getCode()) {
  24156. case 401:
  24157. case 404:
  24158. if (!$fetchingRepoData) {
  24159. throw $e;
  24160. }
  24161. if ($gitHubUtil->authorizeOAuth($this->originUrl)) {
  24162. return parent::getContents($url);
  24163. }
  24164. if (!$this->io->isInteractive()) {
  24165. return $this->attemptCloneFallback();
  24166. }
  24167. $scopesIssued = array();
  24168. $scopesNeeded = array();
  24169. if ($headers = $e->getHeaders()) {
  24170. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-OAuth-Scopes')) {
  24171. $scopesIssued = explode(' ', $scopes);
  24172. }
  24173. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-Accepted-OAuth-Scopes')) {
  24174. $scopesNeeded = explode(' ', $scopes);
  24175. }
  24176. }
  24177. $scopesFailed = array_diff($scopesNeeded, $scopesIssued);
  24178. if (!$headers || !count($scopesNeeded) || count($scopesFailed)) {
  24179. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'Your GitHub credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  24180. }
  24181. return parent::getContents($url);
  24182. case 403:
  24183. if (!$this->io->hasAuthentication($this->originUrl) && $gitHubUtil->authorizeOAuth($this->originUrl)) {
  24184. return parent::getContents($url);
  24185. }
  24186. if (!$this->io->isInteractive() && $fetchingRepoData) {
  24187. return $this->attemptCloneFallback();
  24188. }
  24189. $rateLimited = $gitHubUtil->isRateLimited($e->getHeaders());
  24190. if (!$this->io->hasAuthentication($this->originUrl)) {
  24191. if (!$this->io->isInteractive()) {
  24192. $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>');
  24193. throw $e;
  24194. }
  24195. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'API limit exhausted. Enter your GitHub credentials to get a larger API limit (<info>'.$this->url.'</info>)');
  24196. return parent::getContents($url);
  24197. }
  24198. if ($rateLimited) {
  24199. $rateLimit = $gitHubUtil->getRateLimit($e->getHeaders());
  24200. $this->io->writeError(sprintf(
  24201. '<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>',
  24202. $rateLimit['limit'],
  24203. $rateLimit['reset']
  24204. ));
  24205. }
  24206. throw $e;
  24207. default:
  24208. throw $e;
  24209. }
  24210. }
  24211. }
  24212. protected function fetchRootIdentifier()
  24213. {
  24214. if ($this->repoData) {
  24215. return;
  24216. }
  24217. $repoDataUrl = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository;
  24218. $this->repoData = JsonFile::parseJson($this->getContents($repoDataUrl, true), $repoDataUrl);
  24219. if (null === $this->repoData && null !== $this->gitDriver) {
  24220. return;
  24221. }
  24222. $this->owner = $this->repoData['owner']['login'];
  24223. $this->repository = $this->repoData['name'];
  24224. $this->isPrivate = !empty($this->repoData['private']);
  24225. if (isset($this->repoData['default_branch'])) {
  24226. $this->rootIdentifier = $this->repoData['default_branch'];
  24227. } elseif (isset($this->repoData['master_branch'])) {
  24228. $this->rootIdentifier = $this->repoData['master_branch'];
  24229. } else {
  24230. $this->rootIdentifier = 'master';
  24231. }
  24232. $this->hasIssues = !empty($this->repoData['has_issues']);
  24233. $this->isArchived = !empty($this->repoData['archived']);
  24234. }
  24235. protected function attemptCloneFallback()
  24236. {
  24237. $this->isPrivate = true;
  24238. try {
  24239. $this->setupGitDriver($this->generateSshUrl());
  24240. return;
  24241. } catch (\RuntimeException $e) {
  24242. $this->gitDriver = null;
  24243. $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>');
  24244. throw $e;
  24245. }
  24246. }
  24247. protected function setupGitDriver($url)
  24248. {
  24249. $this->gitDriver = new GitDriver(
  24250. array('url' => $url),
  24251. $this->io,
  24252. $this->config,
  24253. $this->process,
  24254. $this->remoteFilesystem
  24255. );
  24256. $this->gitDriver->initialize();
  24257. }
  24258. protected function getNextPage()
  24259. {
  24260. $headers = $this->remoteFilesystem->getLastHeaders();
  24261. foreach ($headers as $header) {
  24262. if (preg_match('{^link:\s*(.+?)\s*$}i', $header, $match)) {
  24263. $links = explode(',', $match[1]);
  24264. foreach ($links as $link) {
  24265. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  24266. return $match[1];
  24267. }
  24268. }
  24269. }
  24270. }
  24271. }
  24272. }
  24273. <?php
  24274. namespace Composer\Repository\Vcs;
  24275. use Composer\Config;
  24276. use Composer\Cache;
  24277. use Composer\IO\IOInterface;
  24278. use Composer\Json\JsonFile;
  24279. use Composer\Downloader\TransportException;
  24280. use Composer\Util\RemoteFilesystem;
  24281. use Composer\Util\GitLab;
  24282. class GitLabDriver extends VcsDriver
  24283. {
  24284. private $scheme;
  24285. private $namespace;
  24286. private $repository;
  24287. private $project;
  24288. private $commits = array();
  24289. private $tags;
  24290. private $branches;
  24291. protected $gitDriver;
  24292. private $isPrivate = true;
  24293. private $hasNonstandardOrigin = false;
  24294. const URL_REGEX = '#^(?:(?P<scheme>https?)://(?P<domain>.+?)(?::(?P<port>[0-9]+))?/|git@(?P<domain2>[^:]+):)(?P<parts>.+)/(?P<repo>[^/]+?)(?:\.git|/)?$#';
  24295. public function initialize()
  24296. {
  24297. if (!preg_match(self::URL_REGEX, $this->url, $match)) {
  24298. throw new \InvalidArgumentException('The URL provided is invalid. It must be the HTTP URL of a GitLab project.');
  24299. }
  24300. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  24301. $configuredDomains = $this->config->get('gitlab-domains');
  24302. $urlParts = explode('/', $match['parts']);
  24303. $this->scheme = !empty($match['scheme'])
  24304. ? $match['scheme']
  24305. : (isset($this->repoConfig['secure-http']) && $this->repoConfig['secure-http'] === false ? 'http' : 'https')
  24306. ;
  24307. $this->originUrl = $this->determineOrigin($configuredDomains, $guessedDomain, $urlParts, $match['port']);
  24308. if (false !== strpos($this->originUrl, ':') || false !== strpos($this->originUrl, '/')) {
  24309. $this->hasNonstandardOrigin = true;
  24310. }
  24311. $this->namespace = implode('/', $urlParts);
  24312. $this->repository = preg_replace('#(\.git)$#', '', $match['repo']);
  24313. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository);
  24314. $this->fetchProject();
  24315. }
  24316. public function setRemoteFilesystem(RemoteFilesystem $remoteFilesystem)
  24317. {
  24318. $this->remoteFilesystem = $remoteFilesystem;
  24319. }
  24320. public function getComposerInformation($identifier)
  24321. {
  24322. if ($this->gitDriver) {
  24323. return $this->gitDriver->getComposerInformation($identifier);
  24324. }
  24325. if (!isset($this->infoCache[$identifier])) {
  24326. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  24327. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  24328. }
  24329. $composer = $this->getBaseComposerInformation($identifier);
  24330. if ($composer) {
  24331. if (!isset($composer['support']['issues']) && isset($this->project['_links']['issues'])) {
  24332. $composer['support']['issues'] = $this->project['_links']['issues'];
  24333. }
  24334. if (!isset($composer['abandoned']) && !empty($this->project['archived'])) {
  24335. $composer['abandoned'] = true;
  24336. }
  24337. }
  24338. if ($this->shouldCache($identifier)) {
  24339. $this->cache->write($identifier, json_encode($composer));
  24340. }
  24341. $this->infoCache[$identifier] = $composer;
  24342. }
  24343. return $this->infoCache[$identifier];
  24344. }
  24345. public function getFileContent($file, $identifier)
  24346. {
  24347. if ($this->gitDriver) {
  24348. return $this->gitDriver->getFileContent($file, $identifier);
  24349. }
  24350. if (!preg_match('{[a-f0-9]{40}}i', $identifier)) {
  24351. $branches = $this->getBranches();
  24352. if (isset($branches[$identifier])) {
  24353. $identifier = $branches[$identifier];
  24354. }
  24355. }
  24356. $resource = $this->getApiUrl().'/repository/files/'.$this->urlEncodeAll($file).'/raw?ref='.$identifier;
  24357. try {
  24358. $content = $this->getContents($resource);
  24359. } catch (TransportException $e) {
  24360. if ($e->getCode() !== 404) {
  24361. throw $e;
  24362. }
  24363. return null;
  24364. }
  24365. return $content;
  24366. }
  24367. public function getChangeDate($identifier)
  24368. {
  24369. if ($this->gitDriver) {
  24370. return $this->gitDriver->getChangeDate($identifier);
  24371. }
  24372. if (isset($this->commits[$identifier])) {
  24373. return new \DateTime($this->commits[$identifier]['committed_date']);
  24374. }
  24375. return new \DateTime();
  24376. }
  24377. public function getRepositoryUrl()
  24378. {
  24379. return $this->isPrivate ? $this->project['ssh_url_to_repo'] : $this->project['http_url_to_repo'];
  24380. }
  24381. public function getUrl()
  24382. {
  24383. if ($this->gitDriver) {
  24384. return $this->gitDriver->getUrl();
  24385. }
  24386. return $this->project['web_url'];
  24387. }
  24388. public function getDist($identifier)
  24389. {
  24390. $url = $this->getApiUrl().'/repository/archive.zip?sha='.$identifier;
  24391. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  24392. }
  24393. public function getSource($identifier)
  24394. {
  24395. if ($this->gitDriver) {
  24396. return $this->gitDriver->getSource($identifier);
  24397. }
  24398. return array('type' => 'git', 'url' => $this->getRepositoryUrl(), 'reference' => $identifier);
  24399. }
  24400. public function getRootIdentifier()
  24401. {
  24402. if ($this->gitDriver) {
  24403. return $this->gitDriver->getRootIdentifier();
  24404. }
  24405. return $this->project['default_branch'];
  24406. }
  24407. public function getBranches()
  24408. {
  24409. if ($this->gitDriver) {
  24410. return $this->gitDriver->getBranches();
  24411. }
  24412. if (!$this->branches) {
  24413. $this->branches = $this->getReferences('branches');
  24414. }
  24415. return $this->branches;
  24416. }
  24417. public function getTags()
  24418. {
  24419. if ($this->gitDriver) {
  24420. return $this->gitDriver->getTags();
  24421. }
  24422. if (!$this->tags) {
  24423. $this->tags = $this->getReferences('tags');
  24424. }
  24425. return $this->tags;
  24426. }
  24427. public function getApiUrl()
  24428. {
  24429. return $this->scheme.'://'.$this->originUrl.'/api/v4/projects/'.$this->urlEncodeAll($this->namespace).'%2F'.$this->urlEncodeAll($this->repository);
  24430. }
  24431. private function urlEncodeAll($string)
  24432. {
  24433. $encoded = '';
  24434. for ($i = 0; isset($string[$i]); $i++) {
  24435. $character = $string[$i];
  24436. if (!ctype_alnum($character) && !in_array($character, array('-', '_'), true)) {
  24437. $character = '%' . sprintf('%02X', ord($character));
  24438. }
  24439. $encoded .= $character;
  24440. }
  24441. return $encoded;
  24442. }
  24443. protected function getReferences($type)
  24444. {
  24445. $perPage = 100;
  24446. $resource = $this->getApiUrl().'/repository/'.$type.'?per_page='.$perPage;
  24447. $references = array();
  24448. do {
  24449. $data = JsonFile::parseJson($this->getContents($resource), $resource);
  24450. foreach ($data as $datum) {
  24451. $references[$datum['name']] = $datum['commit']['id'];
  24452. $this->commits[$datum['commit']['id']] = $datum['commit'];
  24453. }
  24454. if (count($data) >= $perPage) {
  24455. $resource = $this->getNextPage();
  24456. } else {
  24457. $resource = false;
  24458. }
  24459. } while ($resource);
  24460. return $references;
  24461. }
  24462. protected function fetchProject()
  24463. {
  24464. $resource = $this->getApiUrl();
  24465. $this->project = JsonFile::parseJson($this->getContents($resource, true), $resource);
  24466. if (isset($this->project['visibility'])) {
  24467. $this->isPrivate = $this->project['visibility'] !== 'public';
  24468. } else {
  24469. $this->isPrivate = false;
  24470. }
  24471. }
  24472. protected function attemptCloneFallback()
  24473. {
  24474. try {
  24475. if ($this->isPrivate === false) {
  24476. $url = $this->generatePublicUrl();
  24477. } else {
  24478. $url = $this->generateSshUrl();
  24479. }
  24480. $this->setupGitDriver($url);
  24481. return;
  24482. } catch (\RuntimeException $e) {
  24483. $this->gitDriver = null;
  24484. $this->io->writeError('<error>Failed to clone the '.$url.' repository, try running in interactive mode so that you can enter your credentials</error>');
  24485. throw $e;
  24486. }
  24487. }
  24488. protected function generateSshUrl()
  24489. {
  24490. if ($this->hasNonstandardOrigin) {
  24491. return 'ssh://git@'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository.'.git';
  24492. }
  24493. return 'git@' . $this->originUrl . ':'.$this->namespace.'/'.$this->repository.'.git';
  24494. }
  24495. protected function generatePublicUrl()
  24496. {
  24497. return $this->scheme . '://' . $this->originUrl . '/'.$this->namespace.'/'.$this->repository.'.git';
  24498. }
  24499. protected function setupGitDriver($url)
  24500. {
  24501. $this->gitDriver = new GitDriver(
  24502. array('url' => $url),
  24503. $this->io,
  24504. $this->config,
  24505. $this->process,
  24506. $this->remoteFilesystem
  24507. );
  24508. $this->gitDriver->initialize();
  24509. }
  24510. protected function getContents($url, $fetchingRepoData = false)
  24511. {
  24512. try {
  24513. $res = parent::getContents($url);
  24514. if ($fetchingRepoData) {
  24515. $json = JsonFile::parseJson($res, $url);
  24516. if (!isset($json['default_branch']) && isset($json['permissions'])) {
  24517. $this->isPrivate = $json['visibility'] !== 'public';
  24518. $moreThanGuestAccess = false;
  24519. foreach ($json['permissions'] as $permission) {
  24520. if ($permission && $permission['access_level'] > 10) {
  24521. $moreThanGuestAccess = true;
  24522. }
  24523. }
  24524. if (!$moreThanGuestAccess) {
  24525. $this->io->writeError('<warning>GitLab token with Guest only access detected</warning>');
  24526. return $this->attemptCloneFallback();
  24527. }
  24528. }
  24529. if (!isset($json['default_branch'])) {
  24530. if (!empty($json['id'])) {
  24531. $this->isPrivate = false;
  24532. }
  24533. throw new TransportException('GitLab API seems to not be authenticated as it did not return a default_branch', 401);
  24534. }
  24535. }
  24536. return $res;
  24537. } catch (TransportException $e) {
  24538. $gitLabUtil = new GitLab($this->io, $this->config, $this->process, $this->remoteFilesystem);
  24539. switch ($e->getCode()) {
  24540. case 401:
  24541. case 404:
  24542. if (!$fetchingRepoData) {
  24543. throw $e;
  24544. }
  24545. if ($gitLabUtil->authorizeOAuth($this->originUrl)) {
  24546. return parent::getContents($url);
  24547. }
  24548. if (!$this->io->isInteractive()) {
  24549. return $this->attemptCloneFallback();
  24550. }
  24551. $this->io->writeError('<warning>Failed to download ' . $this->namespace . '/' . $this->repository . ':' . $e->getMessage() . '</warning>');
  24552. $gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, 'Your credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  24553. return parent::getContents($url);
  24554. case 403:
  24555. if (!$this->io->hasAuthentication($this->originUrl) && $gitLabUtil->authorizeOAuth($this->originUrl)) {
  24556. return parent::getContents($url);
  24557. }
  24558. if (!$this->io->isInteractive() && $fetchingRepoData) {
  24559. return $this->attemptCloneFallback();
  24560. }
  24561. throw $e;
  24562. default:
  24563. throw $e;
  24564. }
  24565. }
  24566. }
  24567. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  24568. {
  24569. if (!preg_match(self::URL_REGEX, $url, $match)) {
  24570. return false;
  24571. }
  24572. $scheme = !empty($match['scheme']) ? $match['scheme'] : null;
  24573. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  24574. $urlParts = explode('/', $match['parts']);
  24575. if (false === self::determineOrigin((array) $config->get('gitlab-domains'), $guessedDomain, $urlParts, $match['port'])) {
  24576. return false;
  24577. }
  24578. if ('https' === $scheme && !extension_loaded('openssl')) {
  24579. $io->writeError('Skipping GitLab driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  24580. return false;
  24581. }
  24582. return true;
  24583. }
  24584. private function getNextPage()
  24585. {
  24586. $headers = $this->remoteFilesystem->getLastHeaders();
  24587. foreach ($headers as $header) {
  24588. if (preg_match('{^link:\s*(.+?)\s*$}i', $header, $match)) {
  24589. $links = explode(',', $match[1]);
  24590. foreach ($links as $link) {
  24591. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  24592. return $match[1];
  24593. }
  24594. }
  24595. }
  24596. }
  24597. }
  24598. private static function determineOrigin(array $configuredDomains, $guessedDomain, array &$urlParts, $portNumber)
  24599. {
  24600. $guessedDomain = strtolower($guessedDomain);
  24601. if (in_array($guessedDomain, $configuredDomains) || ($portNumber && in_array($guessedDomain.':'.$portNumber, $configuredDomains))) {
  24602. if ($portNumber) {
  24603. return $guessedDomain.':'.$portNumber;
  24604. }
  24605. return $guessedDomain;
  24606. }
  24607. if ($portNumber) {
  24608. $guessedDomain .= ':'.$portNumber;
  24609. }
  24610. while (null !== ($part = array_shift($urlParts))) {
  24611. $guessedDomain .= '/' . $part;
  24612. if (in_array($guessedDomain, $configuredDomains) || ($portNumber && in_array(preg_replace('{:\d+}', '', $guessedDomain), $configuredDomains))) {
  24613. return $guessedDomain;
  24614. }
  24615. }
  24616. return false;
  24617. }
  24618. }
  24619. <?php
  24620. namespace Composer\Repository\Vcs;
  24621. use Composer\Config;
  24622. use Composer\IO\IOInterface;
  24623. class HgBitbucketDriver extends BitbucketDriver
  24624. {
  24625. public function getRootIdentifier()
  24626. {
  24627. if ($this->fallbackDriver) {
  24628. return $this->fallbackDriver->getRootIdentifier();
  24629. }
  24630. if (null === $this->rootIdentifier) {
  24631. if (! $this->getRepoData()) {
  24632. return $this->fallbackDriver->getRootIdentifier();
  24633. }
  24634. if ($this->vcsType !== 'hg') {
  24635. throw new \RuntimeException(
  24636. $this->url.' does not appear to be a mercurial repository, use '.
  24637. $this->cloneHttpsUrl.' if this is a git bitbucket repository'
  24638. );
  24639. }
  24640. $mainBranchData = $this->getMainBranchData();
  24641. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'default';
  24642. }
  24643. return $this->rootIdentifier;
  24644. }
  24645. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  24646. {
  24647. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+)/?$#i', $url)) {
  24648. return false;
  24649. }
  24650. if (!extension_loaded('openssl')) {
  24651. $io->writeError('Skipping Bitbucket hg driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  24652. return false;
  24653. }
  24654. return true;
  24655. }
  24656. protected function setupFallbackDriver($url)
  24657. {
  24658. $this->fallbackDriver = new HgDriver(
  24659. array('url' => $url),
  24660. $this->io,
  24661. $this->config,
  24662. $this->process,
  24663. $this->remoteFilesystem
  24664. );
  24665. $this->fallbackDriver->initialize();
  24666. }
  24667. protected function generateSshUrl()
  24668. {
  24669. return 'ssh://hg@' . $this->originUrl . '/' . $this->owner.'/'.$this->repository;
  24670. }
  24671. }
  24672. <?php
  24673. namespace Composer\Repository\Vcs;
  24674. use Composer\Config;
  24675. use Composer\Cache;
  24676. use Composer\Util\Hg as HgUtils;
  24677. use Composer\Util\ProcessExecutor;
  24678. use Composer\Util\Filesystem;
  24679. use Composer\IO\IOInterface;
  24680. class HgDriver extends VcsDriver
  24681. {
  24682. protected $tags;
  24683. protected $branches;
  24684. protected $rootIdentifier;
  24685. protected $repoDir;
  24686. protected $infoCache = array();
  24687. public function initialize()
  24688. {
  24689. if (Filesystem::isLocalPath($this->url)) {
  24690. $this->repoDir = $this->url;
  24691. } else {
  24692. if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  24693. throw new \RuntimeException('HgDriver requires a usable cache directory, and it looks like you set it to be disabled');
  24694. }
  24695. $cacheDir = $this->config->get('cache-vcs-dir');
  24696. $this->repoDir = $cacheDir . '/' . preg_replace('{[^a-z0-9]}i', '-', $this->url) . '/';
  24697. $fs = new Filesystem();
  24698. $fs->ensureDirectoryExists($cacheDir);
  24699. if (!is_writable(dirname($this->repoDir))) {
  24700. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$cacheDir.'" directory is not writable by the current user.');
  24701. }
  24702. $this->config->prohibitUrlByConfig($this->url, $this->io);
  24703. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  24704. if (is_dir($this->repoDir) && 0 === $this->process->execute('hg summary', $output, $this->repoDir)) {
  24705. if (0 !== $this->process->execute('hg pull', $output, $this->repoDir)) {
  24706. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  24707. }
  24708. } else {
  24709. $fs->removeDirectory($this->repoDir);
  24710. $repoDir = $this->repoDir;
  24711. $command = function ($url) use ($repoDir) {
  24712. return sprintf('hg clone --noupdate %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($repoDir));
  24713. };
  24714. $hgUtils->runCommand($command, $this->url, null);
  24715. }
  24716. }
  24717. $this->getTags();
  24718. $this->getBranches();
  24719. }
  24720. public function getRootIdentifier()
  24721. {
  24722. if (null === $this->rootIdentifier) {
  24723. $this->process->execute(sprintf('hg tip --template "{node}"'), $output, $this->repoDir);
  24724. $output = $this->process->splitLines($output);
  24725. $this->rootIdentifier = $output[0];
  24726. }
  24727. return $this->rootIdentifier;
  24728. }
  24729. public function getUrl()
  24730. {
  24731. return $this->url;
  24732. }
  24733. public function getSource($identifier)
  24734. {
  24735. return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier);
  24736. }
  24737. public function getDist($identifier)
  24738. {
  24739. return null;
  24740. }
  24741. public function getFileContent($file, $identifier)
  24742. {
  24743. $resource = sprintf('hg cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  24744. $this->process->execute($resource, $content, $this->repoDir);
  24745. if (!trim($content)) {
  24746. return;
  24747. }
  24748. return $content;
  24749. }
  24750. public function getChangeDate($identifier)
  24751. {
  24752. $this->process->execute(
  24753. sprintf(
  24754. 'hg log --template "{date|rfc3339date}" -r %s',
  24755. ProcessExecutor::escape($identifier)
  24756. ),
  24757. $output,
  24758. $this->repoDir
  24759. );
  24760. return new \DateTime(trim($output), new \DateTimeZone('UTC'));
  24761. }
  24762. public function getTags()
  24763. {
  24764. if (null === $this->tags) {
  24765. $tags = array();
  24766. $this->process->execute('hg tags', $output, $this->repoDir);
  24767. foreach ($this->process->splitLines($output) as $tag) {
  24768. if ($tag && preg_match('(^([^\s]+)\s+\d+:(.*)$)', $tag, $match)) {
  24769. $tags[$match[1]] = $match[2];
  24770. }
  24771. }
  24772. unset($tags['tip']);
  24773. $this->tags = $tags;
  24774. }
  24775. return $this->tags;
  24776. }
  24777. public function getBranches()
  24778. {
  24779. if (null === $this->branches) {
  24780. $branches = array();
  24781. $bookmarks = array();
  24782. $this->process->execute('hg branches', $output, $this->repoDir);
  24783. foreach ($this->process->splitLines($output) as $branch) {
  24784. if ($branch && preg_match('(^([^\s]+)\s+\d+:([a-f0-9]+))', $branch, $match)) {
  24785. $branches[$match[1]] = $match[2];
  24786. }
  24787. }
  24788. $this->process->execute('hg bookmarks', $output, $this->repoDir);
  24789. foreach ($this->process->splitLines($output) as $branch) {
  24790. if ($branch && preg_match('(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)', $branch, $match)) {
  24791. $bookmarks[$match[1]] = $match[2];
  24792. }
  24793. }
  24794. $this->branches = array_merge($bookmarks, $branches);
  24795. }
  24796. return $this->branches;
  24797. }
  24798. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  24799. {
  24800. if (preg_match('#(^(?:https?|ssh)://(?:[^@]+@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
  24801. return true;
  24802. }
  24803. if (Filesystem::isLocalPath($url)) {
  24804. $url = Filesystem::getPlatformPath($url);
  24805. if (!is_dir($url)) {
  24806. return false;
  24807. }
  24808. $process = new ProcessExecutor($io);
  24809. if ($process->execute('hg summary', $output, $url) === 0) {
  24810. return true;
  24811. }
  24812. }
  24813. if (!$deep) {
  24814. return false;
  24815. }
  24816. $processExecutor = new ProcessExecutor($io);
  24817. $exit = $processExecutor->execute(sprintf('hg identify %s', ProcessExecutor::escape($url)), $ignored);
  24818. return $exit === 0;
  24819. }
  24820. }
  24821. <?php
  24822. namespace Composer\Repository\Vcs;
  24823. use Composer\Config;
  24824. use Composer\Cache;
  24825. use Composer\IO\IOInterface;
  24826. use Composer\Util\ProcessExecutor;
  24827. use Composer\Util\Perforce;
  24828. class PerforceDriver extends VcsDriver
  24829. {
  24830. protected $depot;
  24831. protected $branch;
  24832. protected $perforce;
  24833. public function initialize()
  24834. {
  24835. $this->depot = $this->repoConfig['depot'];
  24836. $this->branch = '';
  24837. if (!empty($this->repoConfig['branch'])) {
  24838. $this->branch = $this->repoConfig['branch'];
  24839. }
  24840. $this->initPerforce($this->repoConfig);
  24841. $this->perforce->p4Login();
  24842. $this->perforce->checkStream();
  24843. $this->perforce->writeP4ClientSpec();
  24844. $this->perforce->connectClient();
  24845. return true;
  24846. }
  24847. private function initPerforce($repoConfig)
  24848. {
  24849. if (!empty($this->perforce)) {
  24850. return;
  24851. }
  24852. if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  24853. throw new \RuntimeException('PerforceDriver requires a usable cache directory, and it looks like you set it to be disabled');
  24854. }
  24855. $repoDir = $this->config->get('cache-vcs-dir') . '/' . $this->depot;
  24856. $this->perforce = Perforce::create($repoConfig, $this->getUrl(), $repoDir, $this->process, $this->io);
  24857. }
  24858. public function getFileContent($file, $identifier)
  24859. {
  24860. return $this->perforce->getFileContent($file, $identifier);
  24861. }
  24862. public function getChangeDate($identifier)
  24863. {
  24864. return null;
  24865. }
  24866. public function getRootIdentifier()
  24867. {
  24868. return $this->branch;
  24869. }
  24870. public function getBranches()
  24871. {
  24872. return $this->perforce->getBranches();
  24873. }
  24874. public function getTags()
  24875. {
  24876. return $this->perforce->getTags();
  24877. }
  24878. public function getDist($identifier)
  24879. {
  24880. return null;
  24881. }
  24882. public function getSource($identifier)
  24883. {
  24884. $source = array(
  24885. 'type' => 'perforce',
  24886. 'url' => $this->repoConfig['url'],
  24887. 'reference' => $identifier,
  24888. 'p4user' => $this->perforce->getUser(),
  24889. );
  24890. return $source;
  24891. }
  24892. public function getUrl()
  24893. {
  24894. return $this->url;
  24895. }
  24896. public function hasComposerFile($identifier)
  24897. {
  24898. $composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier);
  24899. $composerInfoIdentifier = $identifier;
  24900. return !empty($composerInfo);
  24901. }
  24902. public function getContents($url)
  24903. {
  24904. return false;
  24905. }
  24906. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  24907. {
  24908. if ($deep || preg_match('#\b(perforce|p4)\b#i', $url)) {
  24909. return Perforce::checkServerExists($url, new ProcessExecutor($io));
  24910. }
  24911. return false;
  24912. }
  24913. public function cleanup()
  24914. {
  24915. $this->perforce->cleanupClientSpec();
  24916. $this->perforce = null;
  24917. }
  24918. public function getDepot()
  24919. {
  24920. return $this->depot;
  24921. }
  24922. public function getBranch()
  24923. {
  24924. return $this->branch;
  24925. }
  24926. }
  24927. <?php
  24928. namespace Composer\Repository\Vcs;
  24929. use Composer\Cache;
  24930. use Composer\Config;
  24931. use Composer\Json\JsonFile;
  24932. use Composer\Util\ProcessExecutor;
  24933. use Composer\Util\Filesystem;
  24934. use Composer\Util\Svn as SvnUtil;
  24935. use Composer\IO\IOInterface;
  24936. use Composer\Downloader\TransportException;
  24937. class SvnDriver extends VcsDriver
  24938. {
  24939. protected $cache;
  24940. protected $baseUrl;
  24941. protected $tags;
  24942. protected $branches;
  24943. protected $rootIdentifier;
  24944. protected $infoCache = array();
  24945. protected $trunkPath = 'trunk';
  24946. protected $branchesPath = 'branches';
  24947. protected $tagsPath = 'tags';
  24948. protected $packagePath = '';
  24949. protected $cacheCredentials = true;
  24950. private $util;
  24951. public function initialize()
  24952. {
  24953. $this->url = $this->baseUrl = rtrim(self::normalizeUrl($this->url), '/');
  24954. SvnUtil::cleanEnv();
  24955. if (isset($this->repoConfig['trunk-path'])) {
  24956. $this->trunkPath = $this->repoConfig['trunk-path'];
  24957. }
  24958. if (isset($this->repoConfig['branches-path'])) {
  24959. $this->branchesPath = $this->repoConfig['branches-path'];
  24960. }
  24961. if (isset($this->repoConfig['tags-path'])) {
  24962. $this->tagsPath = $this->repoConfig['tags-path'];
  24963. }
  24964. if (array_key_exists('svn-cache-credentials', $this->repoConfig)) {
  24965. $this->cacheCredentials = (bool) $this->repoConfig['svn-cache-credentials'];
  24966. }
  24967. if (isset($this->repoConfig['package-path'])) {
  24968. $this->packagePath = '/' . trim($this->repoConfig['package-path'], '/');
  24969. }
  24970. if (false !== ($pos = strrpos($this->url, '/' . $this->trunkPath))) {
  24971. $this->baseUrl = substr($this->url, 0, $pos);
  24972. }
  24973. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->baseUrl));
  24974. $this->getBranches();
  24975. $this->getTags();
  24976. }
  24977. public function getRootIdentifier()
  24978. {
  24979. return $this->rootIdentifier ?: $this->trunkPath;
  24980. }
  24981. public function getUrl()
  24982. {
  24983. return $this->url;
  24984. }
  24985. public function getSource($identifier)
  24986. {
  24987. return array('type' => 'svn', 'url' => $this->baseUrl, 'reference' => $identifier);
  24988. }
  24989. public function getDist($identifier)
  24990. {
  24991. return null;
  24992. }
  24993. protected function shouldCache($identifier)
  24994. {
  24995. return $this->cache && preg_match('{@\d+$}', $identifier);
  24996. }
  24997. public function getComposerInformation($identifier)
  24998. {
  24999. if (!isset($this->infoCache[$identifier])) {
  25000. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier.'.json')) {
  25001. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  25002. }
  25003. try {
  25004. $composer = $this->getBaseComposerInformation($identifier);
  25005. } catch (TransportException $e) {
  25006. $message = $e->getMessage();
  25007. if (stripos($message, 'path not found') === false && stripos($message, 'svn: warning: W160013') === false) {
  25008. throw $e;
  25009. }
  25010. $composer = '';
  25011. }
  25012. if ($this->shouldCache($identifier)) {
  25013. $this->cache->write($identifier.'.json', json_encode($composer));
  25014. }
  25015. $this->infoCache[$identifier] = $composer;
  25016. }
  25017. return $this->infoCache[$identifier];
  25018. }
  25019. public function getFileContent($file, $identifier)
  25020. {
  25021. $identifier = '/' . trim($identifier, '/') . '/';
  25022. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  25023. if (!empty($match[2])) {
  25024. $path = $match[1];
  25025. $rev = $match[2];
  25026. } else {
  25027. $path = $identifier;
  25028. $rev = '';
  25029. }
  25030. try {
  25031. $resource = $path.$file;
  25032. $output = $this->execute('svn cat', $this->baseUrl . $resource . $rev);
  25033. if (!trim($output)) {
  25034. return null;
  25035. }
  25036. } catch (\RuntimeException $e) {
  25037. throw new TransportException($e->getMessage());
  25038. }
  25039. return $output;
  25040. }
  25041. public function getChangeDate($identifier)
  25042. {
  25043. $identifier = '/' . trim($identifier, '/') . '/';
  25044. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  25045. if (!empty($match[2])) {
  25046. $path = $match[1];
  25047. $rev = $match[2];
  25048. } else {
  25049. $path = $identifier;
  25050. $rev = '';
  25051. }
  25052. $output = $this->execute('svn info', $this->baseUrl . $path . $rev);
  25053. foreach ($this->process->splitLines($output) as $line) {
  25054. if ($line && preg_match('{^Last Changed Date: ([^(]+)}', $line, $match)) {
  25055. return new \DateTime($match[1], new \DateTimeZone('UTC'));
  25056. }
  25057. }
  25058. return null;
  25059. }
  25060. public function getTags()
  25061. {
  25062. if (null === $this->tags) {
  25063. $this->tags = array();
  25064. if ($this->tagsPath !== false) {
  25065. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath);
  25066. if ($output) {
  25067. foreach ($this->process->splitLines($output) as $line) {
  25068. $line = trim($line);
  25069. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  25070. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  25071. $this->tags[rtrim($match[2], '/')] = $this->buildIdentifier(
  25072. '/' . $this->tagsPath . '/' . $match[2],
  25073. $match[1]
  25074. );
  25075. }
  25076. }
  25077. }
  25078. }
  25079. }
  25080. }
  25081. return $this->tags;
  25082. }
  25083. public function getBranches()
  25084. {
  25085. if (null === $this->branches) {
  25086. $this->branches = array();
  25087. if (false === $this->trunkPath) {
  25088. $trunkParent = $this->baseUrl . '/';
  25089. } else {
  25090. $trunkParent = $this->baseUrl . '/' . $this->trunkPath;
  25091. }
  25092. $output = $this->execute('svn ls --verbose', $trunkParent);
  25093. if ($output) {
  25094. foreach ($this->process->splitLines($output) as $line) {
  25095. $line = trim($line);
  25096. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  25097. if (isset($match[1]) && isset($match[2]) && $match[2] === './') {
  25098. $this->branches['trunk'] = $this->buildIdentifier(
  25099. '/' . $this->trunkPath,
  25100. $match[1]
  25101. );
  25102. $this->rootIdentifier = $this->branches['trunk'];
  25103. break;
  25104. }
  25105. }
  25106. }
  25107. }
  25108. unset($output);
  25109. if ($this->branchesPath !== false) {
  25110. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath);
  25111. if ($output) {
  25112. foreach ($this->process->splitLines(trim($output)) as $line) {
  25113. $line = trim($line);
  25114. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  25115. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  25116. $this->branches[rtrim($match[2], '/')] = $this->buildIdentifier(
  25117. '/' . $this->branchesPath . '/' . $match[2],
  25118. $match[1]
  25119. );
  25120. }
  25121. }
  25122. }
  25123. }
  25124. }
  25125. }
  25126. return $this->branches;
  25127. }
  25128. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  25129. {
  25130. $url = self::normalizeUrl($url);
  25131. if (preg_match('#(^svn://|^svn\+ssh://|svn\.)#i', $url)) {
  25132. return true;
  25133. }
  25134. if (!$deep && !Filesystem::isLocalPath($url)) {
  25135. return false;
  25136. }
  25137. $processExecutor = new ProcessExecutor($io);
  25138. $exit = $processExecutor->execute(
  25139. "svn info --non-interactive ".ProcessExecutor::escape($url),
  25140. $ignoredOutput
  25141. );
  25142. if ($exit === 0) {
  25143. return true;
  25144. }
  25145. if (false !== stripos($processExecutor->getErrorOutput(), 'authorization failed:')) {
  25146. return true;
  25147. }
  25148. if (false !== stripos($processExecutor->getErrorOutput(), 'Authentication failed')) {
  25149. return true;
  25150. }
  25151. return false;
  25152. }
  25153. protected static function normalizeUrl($url)
  25154. {
  25155. $fs = new Filesystem();
  25156. if ($fs->isAbsolutePath($url)) {
  25157. return 'file://' . strtr($url, '\\', '/');
  25158. }
  25159. return $url;
  25160. }
  25161. protected function execute($command, $url)
  25162. {
  25163. if (null === $this->util) {
  25164. $this->util = new SvnUtil($this->baseUrl, $this->io, $this->config, $this->process);
  25165. $this->util->setCacheCredentials($this->cacheCredentials);
  25166. }
  25167. try {
  25168. return $this->util->execute($command, $url);
  25169. } catch (\RuntimeException $e) {
  25170. if (null === $this->util->binaryVersion()) {
  25171. 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());
  25172. }
  25173. throw new \RuntimeException(
  25174. 'Repository '.$this->url.' could not be processed, '.$e->getMessage()
  25175. );
  25176. }
  25177. }
  25178. protected function buildIdentifier($baseDir, $revision)
  25179. {
  25180. return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision;
  25181. }
  25182. }
  25183. <?php
  25184. namespace Composer\Repository\Vcs;
  25185. use Composer\Cache;
  25186. use Composer\Downloader\TransportException;
  25187. use Composer\Config;
  25188. use Composer\Factory;
  25189. use Composer\IO\IOInterface;
  25190. use Composer\Json\JsonFile;
  25191. use Composer\Util\ProcessExecutor;
  25192. use Composer\Util\RemoteFilesystem;
  25193. use Composer\Util\Filesystem;
  25194. abstract class VcsDriver implements VcsDriverInterface
  25195. {
  25196. protected $url;
  25197. protected $originUrl;
  25198. protected $repoConfig;
  25199. protected $io;
  25200. protected $config;
  25201. protected $process;
  25202. protected $remoteFilesystem;
  25203. protected $infoCache = array();
  25204. protected $cache;
  25205. final public function __construct(array $repoConfig, IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  25206. {
  25207. if (Filesystem::isLocalPath($repoConfig['url'])) {
  25208. $repoConfig['url'] = Filesystem::getPlatformPath($repoConfig['url']);
  25209. }
  25210. $this->url = $repoConfig['url'];
  25211. $this->originUrl = $repoConfig['url'];
  25212. $this->repoConfig = $repoConfig;
  25213. $this->io = $io;
  25214. $this->config = $config;
  25215. $this->process = $process ?: new ProcessExecutor($io);
  25216. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  25217. }
  25218. protected function shouldCache($identifier)
  25219. {
  25220. return $this->cache && preg_match('{[a-f0-9]{40}}i', $identifier);
  25221. }
  25222. public function getComposerInformation($identifier)
  25223. {
  25224. if (!isset($this->infoCache[$identifier])) {
  25225. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  25226. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  25227. }
  25228. $composer = $this->getBaseComposerInformation($identifier);
  25229. if ($this->shouldCache($identifier)) {
  25230. $this->cache->write($identifier, json_encode($composer));
  25231. }
  25232. $this->infoCache[$identifier] = $composer;
  25233. }
  25234. return $this->infoCache[$identifier];
  25235. }
  25236. protected function getBaseComposerInformation($identifier)
  25237. {
  25238. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  25239. if (!$composerFileContent) {
  25240. return null;
  25241. }
  25242. $composer = JsonFile::parseJson($composerFileContent, $identifier . ':composer.json');
  25243. if (empty($composer['time']) && $changeDate = $this->getChangeDate($identifier)) {
  25244. $composer['time'] = $changeDate->format(DATE_RFC3339);
  25245. }
  25246. return $composer;
  25247. }
  25248. public function hasComposerFile($identifier)
  25249. {
  25250. try {
  25251. return (bool) $this->getComposerInformation($identifier);
  25252. } catch (TransportException $e) {
  25253. }
  25254. return false;
  25255. }
  25256. protected function getScheme()
  25257. {
  25258. if (extension_loaded('openssl')) {
  25259. return 'https';
  25260. }
  25261. return 'http';
  25262. }
  25263. protected function getContents($url)
  25264. {
  25265. $options = isset($this->repoConfig['options']) ? $this->repoConfig['options'] : array();
  25266. return $this->remoteFilesystem->getContents($this->originUrl, $url, false, $options);
  25267. }
  25268. public function cleanup()
  25269. {
  25270. return;
  25271. }
  25272. }
  25273. <?php
  25274. namespace Composer\Repository\Vcs;
  25275. use Composer\Config;
  25276. use Composer\IO\IOInterface;
  25277. interface VcsDriverInterface
  25278. {
  25279. public function initialize();
  25280. public function getComposerInformation($identifier);
  25281. public function getFileContent($file, $identifier);
  25282. public function getChangeDate($identifier);
  25283. public function getRootIdentifier();
  25284. public function getBranches();
  25285. public function getTags();
  25286. public function getDist($identifier);
  25287. public function getSource($identifier);
  25288. public function getUrl();
  25289. public function hasComposerFile($identifier);
  25290. public function cleanup();
  25291. public static function supports(IOInterface $io, Config $config, $url, $deep = false);
  25292. }
  25293. <?php
  25294. namespace Composer\Repository;
  25295. use Composer\Downloader\TransportException;
  25296. use Composer\Repository\Vcs\VcsDriverInterface;
  25297. use Composer\Package\Version\VersionParser;
  25298. use Composer\Package\Loader\ArrayLoader;
  25299. use Composer\Package\Loader\ValidatingArrayLoader;
  25300. use Composer\Package\Loader\InvalidPackageException;
  25301. use Composer\Package\Loader\LoaderInterface;
  25302. use Composer\EventDispatcher\EventDispatcher;
  25303. use Composer\Semver\Constraint\Constraint;
  25304. use Composer\IO\IOInterface;
  25305. use Composer\Config;
  25306. class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  25307. {
  25308. protected $url;
  25309. protected $packageName;
  25310. protected $isVerbose;
  25311. protected $isVeryVerbose;
  25312. protected $io;
  25313. protected $config;
  25314. protected $versionParser;
  25315. protected $type;
  25316. protected $loader;
  25317. protected $repoConfig;
  25318. protected $branchErrorOccurred = false;
  25319. private $drivers;
  25320. private $driver;
  25321. private $versionCache;
  25322. private $emptyReferences = array();
  25323. private $versionTransportExceptions = array();
  25324. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, array $drivers = null, VersionCacheInterface $versionCache = null)
  25325. {
  25326. parent::__construct();
  25327. $this->drivers = $drivers ?: array(
  25328. 'github' => 'Composer\Repository\Vcs\GitHubDriver',
  25329. 'gitlab' => 'Composer\Repository\Vcs\GitLabDriver',
  25330. 'git-bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
  25331. 'git' => 'Composer\Repository\Vcs\GitDriver',
  25332. 'hg-bitbucket' => 'Composer\Repository\Vcs\HgBitbucketDriver',
  25333. 'hg' => 'Composer\Repository\Vcs\HgDriver',
  25334. 'perforce' => 'Composer\Repository\Vcs\PerforceDriver',
  25335. 'fossil' => 'Composer\Repository\Vcs\FossilDriver',
  25336. 'svn' => 'Composer\Repository\Vcs\SvnDriver',
  25337. );
  25338. $this->url = $repoConfig['url'];
  25339. $this->io = $io;
  25340. $this->type = isset($repoConfig['type']) ? $repoConfig['type'] : 'vcs';
  25341. $this->isVerbose = $io->isVerbose();
  25342. $this->isVeryVerbose = $io->isVeryVerbose();
  25343. $this->config = $config;
  25344. $this->repoConfig = $repoConfig;
  25345. $this->versionCache = $versionCache;
  25346. }
  25347. public function getRepoConfig()
  25348. {
  25349. return $this->repoConfig;
  25350. }
  25351. public function setLoader(LoaderInterface $loader)
  25352. {
  25353. $this->loader = $loader;
  25354. }
  25355. public function getDriver()
  25356. {
  25357. if ($this->driver) {
  25358. return $this->driver;
  25359. }
  25360. if (isset($this->drivers[$this->type])) {
  25361. $class = $this->drivers[$this->type];
  25362. $this->driver = new $class($this->repoConfig, $this->io, $this->config);
  25363. $this->driver->initialize();
  25364. return $this->driver;
  25365. }
  25366. foreach ($this->drivers as $driver) {
  25367. if ($driver::supports($this->io, $this->config, $this->url)) {
  25368. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  25369. $this->driver->initialize();
  25370. return $this->driver;
  25371. }
  25372. }
  25373. foreach ($this->drivers as $driver) {
  25374. if ($driver::supports($this->io, $this->config, $this->url, true)) {
  25375. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  25376. $this->driver->initialize();
  25377. return $this->driver;
  25378. }
  25379. }
  25380. }
  25381. public function hadInvalidBranches()
  25382. {
  25383. return $this->branchErrorOccurred;
  25384. }
  25385. public function getEmptyReferences()
  25386. {
  25387. return $this->emptyReferences;
  25388. }
  25389. public function getVersionTransportExceptions()
  25390. {
  25391. return $this->versionTransportExceptions;
  25392. }
  25393. protected function initialize()
  25394. {
  25395. parent::initialize();
  25396. $isVerbose = $this->isVerbose;
  25397. $isVeryVerbose = $this->isVeryVerbose;
  25398. $driver = $this->getDriver();
  25399. if (!$driver) {
  25400. throw new \InvalidArgumentException('No driver found to handle VCS repository '.$this->url);
  25401. }
  25402. $this->versionParser = new VersionParser;
  25403. if (!$this->loader) {
  25404. $this->loader = new ArrayLoader($this->versionParser);
  25405. }
  25406. try {
  25407. if ($driver->hasComposerFile($driver->getRootIdentifier())) {
  25408. $data = $driver->getComposerInformation($driver->getRootIdentifier());
  25409. $this->packageName = !empty($data['name']) ? $data['name'] : null;
  25410. }
  25411. } catch (\Exception $e) {
  25412. if ($isVeryVerbose) {
  25413. $this->io->writeError('<error>Skipped parsing '.$driver->getRootIdentifier().', '.$e->getMessage().'</error>');
  25414. }
  25415. }
  25416. foreach ($driver->getTags() as $tag => $identifier) {
  25417. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $tag . '</comment>)';
  25418. if ($isVeryVerbose) {
  25419. $this->io->writeError($msg);
  25420. } elseif ($isVerbose) {
  25421. $this->io->overwriteError($msg, false);
  25422. }
  25423. $tag = str_replace('release-', '', $tag);
  25424. $cachedPackage = $this->getCachedPackageVersion($tag, $identifier, $isVerbose, $isVeryVerbose);
  25425. if ($cachedPackage) {
  25426. $this->addPackage($cachedPackage);
  25427. continue;
  25428. } elseif ($cachedPackage === false) {
  25429. $this->emptyReferences[] = $identifier;
  25430. continue;
  25431. }
  25432. if (!$parsedTag = $this->validateTag($tag)) {
  25433. if ($isVeryVerbose) {
  25434. $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name</warning>');
  25435. }
  25436. continue;
  25437. }
  25438. try {
  25439. if (!$data = $driver->getComposerInformation($identifier)) {
  25440. if ($isVeryVerbose) {
  25441. $this->io->writeError('<warning>Skipped tag '.$tag.', no composer file</warning>');
  25442. }
  25443. $this->emptyReferences[] = $identifier;
  25444. continue;
  25445. }
  25446. if (isset($data['version'])) {
  25447. $data['version_normalized'] = $this->versionParser->normalize($data['version']);
  25448. } else {
  25449. $data['version'] = $tag;
  25450. $data['version_normalized'] = $parsedTag;
  25451. }
  25452. $data['version'] = preg_replace('{[.-]?dev$}i', '', $data['version']);
  25453. $data['version_normalized'] = preg_replace('{(^dev-|[.-]?dev$)}i', '', $data['version_normalized']);
  25454. if ($data['version_normalized'] !== $parsedTag) {
  25455. if ($isVeryVerbose) {
  25456. if (preg_match('{(^dev-|[.-]?dev$)}i', $parsedTag)) {
  25457. $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name, tags can not use dev prefixes or suffixes</warning>');
  25458. } else {
  25459. $this->io->writeError('<warning>Skipped tag '.$tag.', tag ('.$parsedTag.') does not match version ('.$data['version_normalized'].') in composer.json</warning>');
  25460. }
  25461. }
  25462. continue;
  25463. }
  25464. $tagPackageName = isset($data['name']) ? $data['name'] : $this->packageName;
  25465. if ($existingPackage = $this->findPackage($tagPackageName, $data['version_normalized'])) {
  25466. if ($isVeryVerbose) {
  25467. $this->io->writeError('<warning>Skipped tag '.$tag.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$data['version_normalized'].' internally</warning>');
  25468. }
  25469. continue;
  25470. }
  25471. if ($isVeryVerbose) {
  25472. $this->io->writeError('Importing tag '.$tag.' ('.$data['version_normalized'].')');
  25473. }
  25474. $this->addPackage($this->loader->load($this->preProcess($driver, $data, $identifier)));
  25475. } catch (\Exception $e) {
  25476. if ($e instanceof TransportException) {
  25477. $this->versionTransportExceptions['tags'][$tag] = $e;
  25478. if ($e->getCode() === 404) {
  25479. $this->emptyReferences[] = $identifier;
  25480. }
  25481. }
  25482. if ($isVeryVerbose) {
  25483. $this->io->writeError('<warning>Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found (' . $e->getCode() . ' HTTP status code)' : $e->getMessage()).'</warning>');
  25484. }
  25485. continue;
  25486. }
  25487. }
  25488. if (!$isVeryVerbose) {
  25489. $this->io->overwriteError('', false);
  25490. }
  25491. $branches = $driver->getBranches();
  25492. foreach ($branches as $branch => $identifier) {
  25493. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $branch . '</comment>)';
  25494. if ($isVeryVerbose) {
  25495. $this->io->writeError($msg);
  25496. } elseif ($isVerbose) {
  25497. $this->io->overwriteError($msg, false);
  25498. }
  25499. if ($branch === 'trunk' && isset($branches['master'])) {
  25500. if ($isVeryVerbose) {
  25501. $this->io->writeError('<warning>Skipped branch '.$branch.', can not parse both master and trunk branches as they both resolve to 9999999-dev internally</warning>');
  25502. }
  25503. continue;
  25504. }
  25505. if (!$parsedBranch = $this->validateBranch($branch)) {
  25506. if ($isVeryVerbose) {
  25507. $this->io->writeError('<warning>Skipped branch '.$branch.', invalid name</warning>');
  25508. }
  25509. continue;
  25510. }
  25511. if ('dev-' === substr($parsedBranch, 0, 4) || '9999999-dev' === $parsedBranch) {
  25512. $version = 'dev-' . $branch;
  25513. } else {
  25514. $prefix = substr($branch, 0, 1) === 'v' ? 'v' : '';
  25515. $version = $prefix . preg_replace('{(\.9{7})+}', '.x', $parsedBranch);
  25516. }
  25517. $cachedPackage = $this->getCachedPackageVersion($version, $identifier, $isVerbose, $isVeryVerbose);
  25518. if ($cachedPackage) {
  25519. $this->addPackage($cachedPackage);
  25520. continue;
  25521. } elseif ($cachedPackage === false) {
  25522. $this->emptyReferences[] = $identifier;
  25523. continue;
  25524. }
  25525. try {
  25526. if (!$data = $driver->getComposerInformation($identifier)) {
  25527. if ($isVeryVerbose) {
  25528. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file</warning>');
  25529. }
  25530. $this->emptyReferences[] = $identifier;
  25531. continue;
  25532. }
  25533. $data['version'] = $version;
  25534. $data['version_normalized'] = $parsedBranch;
  25535. if ($isVeryVerbose) {
  25536. $this->io->writeError('Importing branch '.$branch.' ('.$data['version'].')');
  25537. }
  25538. $packageData = $this->preProcess($driver, $data, $identifier);
  25539. $package = $this->loader->load($packageData);
  25540. if ($this->loader instanceof ValidatingArrayLoader && $this->loader->getWarnings()) {
  25541. throw new InvalidPackageException($this->loader->getErrors(), $this->loader->getWarnings(), $packageData);
  25542. }
  25543. $this->addPackage($package);
  25544. } catch (TransportException $e) {
  25545. $this->versionTransportExceptions['branches'][$branch] = $e;
  25546. if ($e->getCode() === 404) {
  25547. $this->emptyReferences[] = $identifier;
  25548. }
  25549. if ($isVeryVerbose) {
  25550. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file was found (' . $e->getCode() . ' HTTP status code)</warning>');
  25551. }
  25552. continue;
  25553. } catch (\Exception $e) {
  25554. if (!$isVeryVerbose) {
  25555. $this->io->writeError('');
  25556. }
  25557. $this->branchErrorOccurred = true;
  25558. $this->io->writeError('<error>Skipped branch '.$branch.', '.$e->getMessage().'</error>');
  25559. $this->io->writeError('');
  25560. continue;
  25561. }
  25562. }
  25563. $driver->cleanup();
  25564. if (!$isVeryVerbose) {
  25565. $this->io->overwriteError('', false);
  25566. }
  25567. if (!$this->getPackages()) {
  25568. throw new InvalidRepositoryException('No valid composer.json was found in any branch or tag of '.$this->url.', could not load a package from it.');
  25569. }
  25570. }
  25571. protected function preProcess(VcsDriverInterface $driver, array $data, $identifier)
  25572. {
  25573. $dataPackageName = isset($data['name']) ? $data['name'] : null;
  25574. $data['name'] = $this->packageName ?: $dataPackageName;
  25575. if (!isset($data['dist'])) {
  25576. $data['dist'] = $driver->getDist($identifier);
  25577. }
  25578. if (!isset($data['source'])) {
  25579. $data['source'] = $driver->getSource($identifier);
  25580. }
  25581. return $data;
  25582. }
  25583. private function validateBranch($branch)
  25584. {
  25585. try {
  25586. $normalizedBranch = $this->versionParser->normalizeBranch($branch);
  25587. $this->versionParser->parseConstraints($normalizedBranch);
  25588. return $normalizedBranch;
  25589. } catch (\Exception $e) {
  25590. }
  25591. return false;
  25592. }
  25593. private function validateTag($version)
  25594. {
  25595. try {
  25596. return $this->versionParser->normalize($version);
  25597. } catch (\Exception $e) {
  25598. }
  25599. return false;
  25600. }
  25601. private function getCachedPackageVersion($version, $identifier, $isVerbose, $isVeryVerbose)
  25602. {
  25603. if (!$this->versionCache) {
  25604. return;
  25605. }
  25606. $cachedPackage = $this->versionCache->getVersionPackage($version, $identifier);
  25607. if ($cachedPackage === false) {
  25608. if ($isVeryVerbose) {
  25609. $this->io->writeError('<warning>Skipped '.$version.', no composer file (cached from ref '.$identifier.')</warning>');
  25610. }
  25611. return false;
  25612. }
  25613. if ($cachedPackage) {
  25614. $msg = 'Found cached composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $version . '</comment>)';
  25615. if ($isVeryVerbose) {
  25616. $this->io->writeError($msg);
  25617. } elseif ($isVerbose) {
  25618. $this->io->overwriteError($msg, false);
  25619. }
  25620. if ($existingPackage = $this->findPackage($cachedPackage['name'], new Constraint('=', $cachedPackage['version_normalized']))) {
  25621. if ($isVeryVerbose) {
  25622. $this->io->writeError('<warning>Skipped cached version '.$version.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$cachedPackage['version_normalized'].' internally</warning>');
  25623. }
  25624. $cachedPackage = null;
  25625. }
  25626. }
  25627. if ($cachedPackage) {
  25628. return $this->loader->load($cachedPackage);
  25629. }
  25630. return null;
  25631. }
  25632. }
  25633. <?php
  25634. namespace Composer\Repository;
  25635. interface VersionCacheInterface
  25636. {
  25637. public function getVersionPackage($version, $identifier);
  25638. }
  25639. <?php
  25640. namespace Composer\Repository;
  25641. use Composer\Package\AliasPackage;
  25642. class WritableArrayRepository extends ArrayRepository implements WritableRepositoryInterface
  25643. {
  25644. public function write()
  25645. {
  25646. }
  25647. public function reload()
  25648. {
  25649. }
  25650. public function getCanonicalPackages()
  25651. {
  25652. $packages = $this->getPackages();
  25653. $packagesByName = array();
  25654. foreach ($packages as $package) {
  25655. if (!isset($packagesByName[$package->getName()]) || $packagesByName[$package->getName()] instanceof AliasPackage) {
  25656. $packagesByName[$package->getName()] = $package;
  25657. }
  25658. }
  25659. $canonicalPackages = array();
  25660. foreach ($packagesByName as $package) {
  25661. while ($package instanceof AliasPackage) {
  25662. $package = $package->getAliasOf();
  25663. }
  25664. $canonicalPackages[] = $package;
  25665. }
  25666. return $canonicalPackages;
  25667. }
  25668. }
  25669. <?php
  25670. namespace Composer\Repository;
  25671. use Composer\Package\PackageInterface;
  25672. interface WritableRepositoryInterface extends RepositoryInterface
  25673. {
  25674. public function write();
  25675. public function addPackage(PackageInterface $package);
  25676. public function removePackage(PackageInterface $package);
  25677. public function getCanonicalPackages();
  25678. public function reload();
  25679. }
  25680. <?php
  25681. namespace Composer\Script;
  25682. class CommandEvent extends Event
  25683. {
  25684. }
  25685. <?php
  25686. namespace Composer\Script;
  25687. use Composer\Composer;
  25688. use Composer\IO\IOInterface;
  25689. use Composer\EventDispatcher\Event as BaseEvent;
  25690. class Event extends BaseEvent
  25691. {
  25692. private $composer;
  25693. private $io;
  25694. private $devMode;
  25695. private $originatingEvent;
  25696. public function __construct($name, Composer $composer, IOInterface $io, $devMode = false, array $args = array(), array $flags = array())
  25697. {
  25698. parent::__construct($name, $args, $flags);
  25699. $this->composer = $composer;
  25700. $this->io = $io;
  25701. $this->devMode = $devMode;
  25702. $this->originatingEvent = null;
  25703. }
  25704. public function getComposer()
  25705. {
  25706. return $this->composer;
  25707. }
  25708. public function getIO()
  25709. {
  25710. return $this->io;
  25711. }
  25712. public function isDevMode()
  25713. {
  25714. return $this->devMode;
  25715. }
  25716. public function getOriginatingEvent()
  25717. {
  25718. return $this->originatingEvent;
  25719. }
  25720. public function setOriginatingEvent(BaseEvent $event)
  25721. {
  25722. $this->originatingEvent = $this->calculateOriginatingEvent($event);
  25723. return $this;
  25724. }
  25725. private function calculateOriginatingEvent(BaseEvent $event)
  25726. {
  25727. if ($event instanceof Event && $event->getOriginatingEvent()) {
  25728. return $this->calculateOriginatingEvent($event->getOriginatingEvent());
  25729. }
  25730. return $event;
  25731. }
  25732. }
  25733. <?php
  25734. namespace Composer\Script;
  25735. use Composer\Installer\PackageEvent as BasePackageEvent;
  25736. class PackageEvent extends BasePackageEvent
  25737. {
  25738. }
  25739. <?php
  25740. namespace Composer\Script;
  25741. class ScriptEvents
  25742. {
  25743. const PRE_INSTALL_CMD = 'pre-install-cmd';
  25744. const POST_INSTALL_CMD = 'post-install-cmd';
  25745. const PRE_UPDATE_CMD = 'pre-update-cmd';
  25746. const POST_UPDATE_CMD = 'post-update-cmd';
  25747. const PRE_STATUS_CMD = 'pre-status-cmd';
  25748. const POST_STATUS_CMD = 'post-status-cmd';
  25749. const PRE_AUTOLOAD_DUMP = 'pre-autoload-dump';
  25750. const POST_AUTOLOAD_DUMP = 'post-autoload-dump';
  25751. const POST_ROOT_PACKAGE_INSTALL = 'post-root-package-install';
  25752. const POST_CREATE_PROJECT_CMD = 'post-create-project-cmd';
  25753. const PRE_ARCHIVE_CMD = 'pre-archive-cmd';
  25754. const POST_ARCHIVE_CMD = 'post-archive-cmd';
  25755. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  25756. const POST_PACKAGE_INSTALL = 'post-package-install';
  25757. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  25758. const POST_PACKAGE_UPDATE = 'post-package-update';
  25759. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  25760. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  25761. }
  25762. <?php
  25763. namespace Composer\SelfUpdate;
  25764. class Keys
  25765. {
  25766. public static function fingerprint($path)
  25767. {
  25768. $hash = strtoupper(hash('sha256', preg_replace('{\s}', '', file_get_contents($path))));
  25769. return implode(' ', array(
  25770. substr($hash, 0, 8),
  25771. substr($hash, 8, 8),
  25772. substr($hash, 16, 8),
  25773. substr($hash, 24, 8),
  25774. '',
  25775. substr($hash, 32, 8),
  25776. substr($hash, 40, 8),
  25777. substr($hash, 48, 8),
  25778. substr($hash, 56, 8),
  25779. ));
  25780. }
  25781. }
  25782. <?php
  25783. namespace Composer\SelfUpdate;
  25784. use Composer\Util\RemoteFilesystem;
  25785. use Composer\Config;
  25786. use Composer\Json\JsonFile;
  25787. class Versions
  25788. {
  25789. public static $channels = array('stable', 'preview', 'snapshot', '1', '2');
  25790. private $rfs;
  25791. private $config;
  25792. private $channel;
  25793. public function __construct(Config $config, RemoteFilesystem $rfs)
  25794. {
  25795. $this->rfs = $rfs;
  25796. $this->config = $config;
  25797. }
  25798. public function getChannel()
  25799. {
  25800. if ($this->channel) {
  25801. return $this->channel;
  25802. }
  25803. $channelFile = $this->config->get('home').'/update-channel';
  25804. if (file_exists($channelFile)) {
  25805. $channel = trim(file_get_contents($channelFile));
  25806. if (in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  25807. return $this->channel = $channel;
  25808. }
  25809. }
  25810. return $this->channel = 'stable';
  25811. }
  25812. public function setChannel($channel)
  25813. {
  25814. if (!in_array($channel, self::$channels, true)) {
  25815. throw new \InvalidArgumentException('Invalid channel '.$channel.', must be one of: ' . implode(', ', self::$channels));
  25816. }
  25817. $channelFile = $this->config->get('home').'/update-channel';
  25818. $this->channel = $channel;
  25819. file_put_contents($channelFile, (is_numeric($channel) ? 'stable' : $channel).PHP_EOL);
  25820. }
  25821. public function getLatest($channel = null)
  25822. {
  25823. if ($this->config->get('disable-tls') === true) {
  25824. $protocol = 'http';
  25825. } else {
  25826. $protocol = 'https';
  25827. }
  25828. $versions = JsonFile::parseJson($this->rfs->getContents('getcomposer.org', $protocol . '://getcomposer.org/versions', false));
  25829. foreach ($versions[$channel ?: $this->getChannel()] as $version) {
  25830. if ($version['min-php'] <= PHP_VERSION_ID) {
  25831. return $version;
  25832. }
  25833. }
  25834. throw new \LogicException('There is no version of Composer available for your PHP version ('.PHP_VERSION.')');
  25835. }
  25836. }
  25837. <?php
  25838. namespace Composer\Util;
  25839. use Composer\Config;
  25840. use Composer\IO\IOInterface;
  25841. class AuthHelper
  25842. {
  25843. protected $io;
  25844. protected $config;
  25845. public function __construct(IOInterface $io, Config $config)
  25846. {
  25847. $this->io = $io;
  25848. $this->config = $config;
  25849. }
  25850. public function storeAuth($originUrl, $storeAuth)
  25851. {
  25852. $store = false;
  25853. $configSource = $this->config->getAuthConfigSource();
  25854. if ($storeAuth === true) {
  25855. $store = $configSource;
  25856. } elseif ($storeAuth === 'prompt') {
  25857. $answer = $this->io->askAndValidate(
  25858. 'Do you want to store credentials for '.$originUrl.' in '.$configSource->getName().' ? [Yn] ',
  25859. function ($value) {
  25860. $input = strtolower(substr(trim($value), 0, 1));
  25861. if (in_array($input, array('y','n'))) {
  25862. return $input;
  25863. }
  25864. throw new \RuntimeException('Please answer (y)es or (n)o');
  25865. },
  25866. null,
  25867. 'y'
  25868. );
  25869. if ($answer === 'y') {
  25870. $store = $configSource;
  25871. }
  25872. }
  25873. if ($store) {
  25874. $store->addConfigSetting(
  25875. 'http-basic.'.$originUrl,
  25876. $this->io->getAuthentication($originUrl)
  25877. );
  25878. }
  25879. }
  25880. }
  25881. <?php
  25882. namespace Composer\Util;
  25883. use Composer\Factory;
  25884. use Composer\IO\IOInterface;
  25885. use Composer\Config;
  25886. use Composer\Downloader\TransportException;
  25887. class Bitbucket
  25888. {
  25889. private $io;
  25890. private $config;
  25891. private $process;
  25892. private $remoteFilesystem;
  25893. private $token = array();
  25894. private $time;
  25895. const OAUTH2_ACCESS_TOKEN_URL = 'https://bitbucket.org/site/oauth2/access_token';
  25896. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null, $time = null)
  25897. {
  25898. $this->io = $io;
  25899. $this->config = $config;
  25900. $this->process = $process ?: new ProcessExecutor($io);
  25901. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  25902. $this->time = $time;
  25903. }
  25904. public function getToken()
  25905. {
  25906. if (!isset($this->token['access_token'])) {
  25907. return '';
  25908. }
  25909. return $this->token['access_token'];
  25910. }
  25911. public function authorizeOAuth($originUrl)
  25912. {
  25913. if ($originUrl !== 'bitbucket.org') {
  25914. return false;
  25915. }
  25916. if (0 === $this->process->execute('git config bitbucket.accesstoken', $output)) {
  25917. $this->io->setAuthentication($originUrl, 'x-token-auth', trim($output));
  25918. return true;
  25919. }
  25920. return false;
  25921. }
  25922. private function requestAccessToken($originUrl)
  25923. {
  25924. try {
  25925. $json = $this->remoteFilesystem->getContents($originUrl, self::OAUTH2_ACCESS_TOKEN_URL, false, array(
  25926. 'retry-auth-failure' => false,
  25927. 'http' => array(
  25928. 'method' => 'POST',
  25929. 'content' => 'grant_type=client_credentials',
  25930. ),
  25931. ));
  25932. $this->token = json_decode($json, true);
  25933. } catch (TransportException $e) {
  25934. if ($e->getCode() === 400) {
  25935. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  25936. $this->io->writeError('This can have two reasons:');
  25937. $this->io->writeError('1. You are authenticating with a bitbucket username/password combination');
  25938. $this->io->writeError('2. You are using an OAuth consumer, but didn\'t configure a (dummy) callback url');
  25939. return false;
  25940. } elseif (in_array($e->getCode(), array(403, 401))) {
  25941. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  25942. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  25943. return false;
  25944. }
  25945. throw $e;
  25946. }
  25947. return true;
  25948. }
  25949. public function authorizeOAuthInteractively($originUrl, $message = null)
  25950. {
  25951. if ($message) {
  25952. $this->io->writeError($message);
  25953. }
  25954. $url = 'https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html';
  25955. $this->io->writeError(sprintf('Follow the instructions on %s', $url));
  25956. $this->io->writeError(sprintf('to create a consumer. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  25957. $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)');
  25958. $consumerKey = trim($this->io->askAndHideAnswer('Consumer Key (hidden): '));
  25959. if (!$consumerKey) {
  25960. $this->io->writeError('<warning>No consumer key given, aborting.</warning>');
  25961. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  25962. return false;
  25963. }
  25964. $consumerSecret = trim($this->io->askAndHideAnswer('Consumer Secret (hidden): '));
  25965. if (!$consumerSecret) {
  25966. $this->io->writeError('<warning>No consumer secret given, aborting.</warning>');
  25967. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  25968. return false;
  25969. }
  25970. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  25971. if (!$this->requestAccessToken($originUrl)) {
  25972. return false;
  25973. }
  25974. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  25975. $this->config->getAuthConfigSource()->removeConfigSetting('http-basic.' . $originUrl);
  25976. $this->io->writeError('<info>Consumer stored successfully.</info>');
  25977. return true;
  25978. }
  25979. public function requestToken($originUrl, $consumerKey, $consumerSecret)
  25980. {
  25981. if (!empty($this->token) || $this->getTokenFromConfig($originUrl)) {
  25982. return $this->token['access_token'];
  25983. }
  25984. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  25985. if (!$this->requestAccessToken($originUrl)) {
  25986. return '';
  25987. }
  25988. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  25989. return $this->token['access_token'];
  25990. }
  25991. private function storeInAuthConfig($originUrl, $consumerKey, $consumerSecret)
  25992. {
  25993. $this->config->getConfigSource()->removeConfigSetting('bitbucket-oauth.'.$originUrl);
  25994. $time = null === $this->time ? time() : $this->time;
  25995. $consumer = array(
  25996. "consumer-key" => $consumerKey,
  25997. "consumer-secret" => $consumerSecret,
  25998. "access-token" => $this->token['access_token'],
  25999. "access-token-expiration" => $time + $this->token['expires_in'],
  26000. );
  26001. $this->config->getAuthConfigSource()->addConfigSetting('bitbucket-oauth.'.$originUrl, $consumer);
  26002. }
  26003. private function getTokenFromConfig($originUrl)
  26004. {
  26005. $authConfig = $this->config->get('bitbucket-oauth');
  26006. if (
  26007. !isset($authConfig[$originUrl]['access-token'])
  26008. || !isset($authConfig[$originUrl]['access-token-expiration'])
  26009. || time() > $authConfig[$originUrl]['access-token-expiration']
  26010. ) {
  26011. return false;
  26012. }
  26013. $this->token = array(
  26014. 'access_token' => $authConfig[$originUrl]['access-token'],
  26015. );
  26016. return true;
  26017. }
  26018. }
  26019. <?php
  26020. namespace Composer\Util;
  26021. class ComposerMirror
  26022. {
  26023. public static function processUrl($mirrorUrl, $packageName, $version, $reference, $type)
  26024. {
  26025. if ($reference) {
  26026. $reference = preg_match('{^([a-f0-9]*|%reference%)$}', $reference) ? $reference : md5($reference);
  26027. }
  26028. $version = strpos($version, '/') === false ? $version : md5($version);
  26029. return str_replace(
  26030. array('%package%', '%version%', '%reference%', '%type%'),
  26031. array($packageName, $version, $reference, $type),
  26032. $mirrorUrl
  26033. );
  26034. }
  26035. public static function processGitUrl($mirrorUrl, $packageName, $url, $type)
  26036. {
  26037. if (preg_match('#^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#', $url, $match)) {
  26038. $url = 'gh-'.$match[1].'/'.$match[2];
  26039. } elseif (preg_match('#^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$#', $url, $match)) {
  26040. $url = 'bb-'.$match[1].'/'.$match[2];
  26041. } else {
  26042. $url = preg_replace('{[^a-z0-9_.-]}i', '-', trim($url, '/'));
  26043. }
  26044. return str_replace(
  26045. array('%package%', '%normalizedUrl%', '%type%'),
  26046. array($packageName, $url, $type),
  26047. $mirrorUrl
  26048. );
  26049. }
  26050. public static function processHgUrl($mirrorUrl, $packageName, $url, $type)
  26051. {
  26052. return self::processGitUrl($mirrorUrl, $packageName, $url, $type);
  26053. }
  26054. }
  26055. <?php
  26056. namespace Composer\Util;
  26057. use Composer\Package\Loader\ArrayLoader;
  26058. use Composer\Package\Loader\ValidatingArrayLoader;
  26059. use Composer\Package\Loader\InvalidPackageException;
  26060. use Composer\Json\JsonValidationException;
  26061. use Composer\IO\IOInterface;
  26062. use Composer\Json\JsonFile;
  26063. use Composer\Spdx\SpdxLicenses;
  26064. class ConfigValidator
  26065. {
  26066. private $io;
  26067. public function __construct(IOInterface $io)
  26068. {
  26069. $this->io = $io;
  26070. }
  26071. public function validate($file, $arrayLoaderValidationFlags = ValidatingArrayLoader::CHECK_ALL)
  26072. {
  26073. $errors = array();
  26074. $publishErrors = array();
  26075. $warnings = array();
  26076. $laxValid = false;
  26077. try {
  26078. $json = new JsonFile($file, null, $this->io);
  26079. $manifest = $json->read();
  26080. $json->validateSchema(JsonFile::LAX_SCHEMA);
  26081. $laxValid = true;
  26082. $json->validateSchema();
  26083. } catch (JsonValidationException $e) {
  26084. foreach ($e->getErrors() as $message) {
  26085. if ($laxValid) {
  26086. $publishErrors[] = $message;
  26087. } else {
  26088. $errors[] = $message;
  26089. }
  26090. }
  26091. } catch (\Exception $e) {
  26092. $errors[] = $e->getMessage();
  26093. return array($errors, $publishErrors, $warnings);
  26094. }
  26095. if (empty($manifest['license'])) {
  26096. $warnings[] = 'No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.';
  26097. } else {
  26098. $licenses = (array) $manifest['license'];
  26099. foreach ($licenses as $key => $license) {
  26100. if ('proprietary' === $license) {
  26101. unset($licenses[$key]);
  26102. }
  26103. }
  26104. $licenseValidator = new SpdxLicenses();
  26105. foreach ($licenses as $license) {
  26106. $spdxLicense = $licenseValidator->getLicenseByIdentifier($license);
  26107. if ($spdxLicense && $spdxLicense[3]) {
  26108. if (preg_match('{^[AL]?GPL-[123](\.[01])?\+$}i', $license)) {
  26109. $warnings[] = sprintf(
  26110. 'License "%s" is a deprecated SPDX license identifier, use "'.str_replace('+', '', $license).'-or-later" instead',
  26111. $license
  26112. );
  26113. } elseif (preg_match('{^[AL]?GPL-[123](\.[01])?$}i', $license)) {
  26114. $warnings[] = sprintf(
  26115. 'License "%s" is a deprecated SPDX license identifier, use "'.$license.'-only" or "'.$license.'-or-later" instead',
  26116. $license
  26117. );
  26118. } else {
  26119. $warnings[] = sprintf(
  26120. 'License "%s" is a deprecated SPDX license identifier, see https://spdx.org/licenses/',
  26121. $license
  26122. );
  26123. }
  26124. }
  26125. }
  26126. }
  26127. if (isset($manifest['version'])) {
  26128. $warnings[] = 'The version field is present, it is recommended to leave it out if the package is published on Packagist.';
  26129. }
  26130. if (!empty($manifest['name']) && preg_match('{[A-Z]}', $manifest['name'])) {
  26131. $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $manifest['name']);
  26132. $suggestName = strtolower($suggestName);
  26133. $publishErrors[] = sprintf(
  26134. '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.',
  26135. $manifest['name'],
  26136. $suggestName
  26137. );
  26138. }
  26139. if (!empty($manifest['type']) && $manifest['type'] == 'composer-installer') {
  26140. $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.";
  26141. }
  26142. if (isset($manifest['require']) && isset($manifest['require-dev'])) {
  26143. $requireOverrides = array_intersect_key($manifest['require'], $manifest['require-dev']);
  26144. if (!empty($requireOverrides)) {
  26145. $plural = (count($requireOverrides) > 1) ? 'are' : 'is';
  26146. $warnings[] = implode(', ', array_keys($requireOverrides)). " {$plural} required both in require and require-dev, this can lead to unexpected behavior";
  26147. }
  26148. }
  26149. $require = isset($manifest['require']) ? $manifest['require'] : array();
  26150. $requireDev = isset($manifest['require-dev']) ? $manifest['require-dev'] : array();
  26151. $packages = array_merge($require, $requireDev);
  26152. foreach ($packages as $package => $version) {
  26153. if (preg_match('/#/', $version) === 1) {
  26154. $warnings[] = sprintf(
  26155. 'The package "%s" is pointing to a commit-ref, this is bad practice and can cause unforeseen issues.',
  26156. $package
  26157. );
  26158. }
  26159. }
  26160. $scriptsDescriptions = isset($manifest['scripts-descriptions']) ? $manifest['scripts-descriptions'] : array();
  26161. $scripts = isset($manifest['scripts']) ? $manifest['scripts'] : array();
  26162. foreach ($scriptsDescriptions as $scriptName => $scriptDescription) {
  26163. if (!array_key_exists($scriptName, $scripts)) {
  26164. $warnings[] = sprintf(
  26165. 'Description for non-existent script "%s" found in "scripts-descriptions"',
  26166. $scriptName
  26167. );
  26168. }
  26169. }
  26170. if (isset($manifest['autoload']['psr-0'][''])) {
  26171. $warnings[] = "Defining autoload.psr-0 with an empty namespace prefix is a bad idea for performance";
  26172. }
  26173. if (isset($manifest['autoload']['psr-4'][''])) {
  26174. $warnings[] = "Defining autoload.psr-4 with an empty namespace prefix is a bad idea for performance";
  26175. }
  26176. try {
  26177. $loader = new ValidatingArrayLoader(new ArrayLoader(), true, null, $arrayLoaderValidationFlags);
  26178. if (!isset($manifest['version'])) {
  26179. $manifest['version'] = '1.0.0';
  26180. }
  26181. if (!isset($manifest['name'])) {
  26182. $manifest['name'] = 'dummy/dummy';
  26183. }
  26184. $loader->load($manifest);
  26185. } catch (InvalidPackageException $e) {
  26186. $errors = array_merge($errors, $e->getErrors());
  26187. }
  26188. $warnings = array_merge($warnings, $loader->getWarnings());
  26189. return array($errors, $publishErrors, $warnings);
  26190. }
  26191. }
  26192. <?php
  26193. namespace Composer\Util;
  26194. use Composer\IO\IOInterface;
  26195. class ErrorHandler
  26196. {
  26197. private static $io;
  26198. public static function handle($level, $message, $file, $line)
  26199. {
  26200. if (!(error_reporting() & $level)) {
  26201. return;
  26202. }
  26203. if (filter_var(ini_get('xdebug.scream'), FILTER_VALIDATE_BOOLEAN)) {
  26204. $message .= "\n\nWarning: You have xdebug.scream enabled, the warning above may be".
  26205. "\na legitimately suppressed error that you were not supposed to see.";
  26206. }
  26207. if ($level !== E_DEPRECATED && $level !== E_USER_DEPRECATED) {
  26208. throw new \ErrorException($message, 0, $level, $file, $line);
  26209. }
  26210. if (self::$io) {
  26211. self::$io->writeError('<warning>Deprecation Notice: '.$message.' in '.$file.':'.$line.'</warning>');
  26212. if (self::$io->isVerbose()) {
  26213. self::$io->writeError('<warning>Stack trace:</warning>');
  26214. self::$io->writeError(array_filter(array_map(function ($a) {
  26215. if (isset($a['line'], $a['file'])) {
  26216. return '<warning> '.$a['file'].':'.$a['line'].'</warning>';
  26217. }
  26218. return null;
  26219. }, array_slice(debug_backtrace(), 2))));
  26220. }
  26221. }
  26222. return true;
  26223. }
  26224. public static function register(IOInterface $io = null)
  26225. {
  26226. set_error_handler(array(__CLASS__, 'handle'));
  26227. error_reporting(E_ALL | E_STRICT);
  26228. self::$io = $io;
  26229. }
  26230. }
  26231. <?php
  26232. namespace Composer\Util;
  26233. use RecursiveDirectoryIterator;
  26234. use RecursiveIteratorIterator;
  26235. use Symfony\Component\Filesystem\Exception\IOException;
  26236. use Symfony\Component\Finder\Finder;
  26237. class Filesystem
  26238. {
  26239. private $processExecutor;
  26240. public function __construct(ProcessExecutor $executor = null)
  26241. {
  26242. $this->processExecutor = $executor ?: new ProcessExecutor();
  26243. }
  26244. public function remove($file)
  26245. {
  26246. if (is_dir($file)) {
  26247. return $this->removeDirectory($file);
  26248. }
  26249. if (file_exists($file)) {
  26250. return $this->unlink($file);
  26251. }
  26252. return false;
  26253. }
  26254. public function isDirEmpty($dir)
  26255. {
  26256. $finder = Finder::create()
  26257. ->ignoreVCS(false)
  26258. ->ignoreDotFiles(false)
  26259. ->depth(0)
  26260. ->in($dir);
  26261. return count($finder) === 0;
  26262. }
  26263. public function emptyDirectory($dir, $ensureDirectoryExists = true)
  26264. {
  26265. if (file_exists($dir) && is_link($dir)) {
  26266. $this->unlink($dir);
  26267. }
  26268. if ($ensureDirectoryExists) {
  26269. $this->ensureDirectoryExists($dir);
  26270. }
  26271. if (is_dir($dir)) {
  26272. $finder = Finder::create()
  26273. ->ignoreVCS(false)
  26274. ->ignoreDotFiles(false)
  26275. ->depth(0)
  26276. ->in($dir);
  26277. foreach ($finder as $path) {
  26278. $this->remove((string) $path);
  26279. }
  26280. }
  26281. }
  26282. public function removeDirectory($directory)
  26283. {
  26284. if ($this->isSymlinkedDirectory($directory)) {
  26285. return $this->unlinkSymlinkedDirectory($directory);
  26286. }
  26287. if ($this->isJunction($directory)) {
  26288. return $this->removeJunction($directory);
  26289. }
  26290. if (is_link($directory)) {
  26291. return unlink($directory);
  26292. }
  26293. if (!file_exists($directory) || !is_dir($directory)) {
  26294. return true;
  26295. }
  26296. if (preg_match('{^(?:[a-z]:)?[/\\\\]+$}i', $directory)) {
  26297. throw new \RuntimeException('Aborting an attempted deletion of '.$directory.', this was probably not intended, if it is a real use case please report it.');
  26298. }
  26299. if (!function_exists('proc_open')) {
  26300. return $this->removeDirectoryPhp($directory);
  26301. }
  26302. if (Platform::isWindows()) {
  26303. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape(realpath($directory)));
  26304. } else {
  26305. $cmd = sprintf('rm -rf %s', ProcessExecutor::escape($directory));
  26306. }
  26307. $result = $this->getProcess()->execute($cmd, $output) === 0;
  26308. clearstatcache();
  26309. if ($result && !file_exists($directory)) {
  26310. return true;
  26311. }
  26312. return $this->removeDirectoryPhp($directory);
  26313. }
  26314. public function removeDirectoryPhp($directory)
  26315. {
  26316. try {
  26317. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  26318. } catch (\UnexpectedValueException $e) {
  26319. clearstatcache();
  26320. usleep(100000);
  26321. if (!is_dir($directory)) {
  26322. return true;
  26323. }
  26324. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  26325. }
  26326. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  26327. foreach ($ri as $file) {
  26328. if ($file->isDir()) {
  26329. $this->rmdir($file->getPathname());
  26330. } else {
  26331. $this->unlink($file->getPathname());
  26332. }
  26333. }
  26334. return $this->rmdir($directory);
  26335. }
  26336. public function ensureDirectoryExists($directory)
  26337. {
  26338. if (!is_dir($directory)) {
  26339. if (file_exists($directory)) {
  26340. throw new \RuntimeException(
  26341. $directory.' exists and is not a directory.'
  26342. );
  26343. }
  26344. if (!@mkdir($directory, 0777, true)) {
  26345. throw new \RuntimeException(
  26346. $directory.' does not exist and could not be created.'
  26347. );
  26348. }
  26349. }
  26350. }
  26351. public function unlink($path)
  26352. {
  26353. $unlinked = @$this->unlinkImplementation($path);
  26354. if (!$unlinked) {
  26355. if (Platform::isWindows()) {
  26356. usleep(350000);
  26357. $unlinked = @$this->unlinkImplementation($path);
  26358. }
  26359. if (!$unlinked) {
  26360. $error = error_get_last();
  26361. $message = 'Could not delete '.$path.': ' . @$error['message'];
  26362. if (Platform::isWindows()) {
  26363. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  26364. }
  26365. throw new \RuntimeException($message);
  26366. }
  26367. }
  26368. return true;
  26369. }
  26370. public function rmdir($path)
  26371. {
  26372. $deleted = @rmdir($path);
  26373. if (!$deleted) {
  26374. if (Platform::isWindows()) {
  26375. usleep(350000);
  26376. $deleted = @rmdir($path);
  26377. }
  26378. if (!$deleted) {
  26379. $error = error_get_last();
  26380. $message = 'Could not delete '.$path.': ' . @$error['message'];
  26381. if (Platform::isWindows()) {
  26382. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  26383. }
  26384. throw new \RuntimeException($message);
  26385. }
  26386. }
  26387. return true;
  26388. }
  26389. public function copyThenRemove($source, $target)
  26390. {
  26391. $this->copy($source, $target);
  26392. if (!is_dir($source)) {
  26393. $this->unlink($source);
  26394. return;
  26395. }
  26396. $this->removeDirectoryPhp($source);
  26397. }
  26398. public function copy($source, $target)
  26399. {
  26400. if (!is_dir($source)) {
  26401. return copy($source, $target);
  26402. }
  26403. $it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
  26404. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
  26405. $this->ensureDirectoryExists($target);
  26406. $result = true;
  26407. foreach ($ri as $file) {
  26408. $targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathName();
  26409. if ($file->isDir()) {
  26410. $this->ensureDirectoryExists($targetPath);
  26411. } else {
  26412. $result = $result && copy($file->getPathname(), $targetPath);
  26413. }
  26414. }
  26415. return $result;
  26416. }
  26417. public function rename($source, $target)
  26418. {
  26419. if (true === @rename($source, $target)) {
  26420. return;
  26421. }
  26422. if (!function_exists('proc_open')) {
  26423. $this->copyThenRemove($source, $target);
  26424. return;
  26425. }
  26426. if (Platform::isWindows()) {
  26427. $command = sprintf('xcopy %s %s /E /I /Q /Y', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  26428. $result = $this->processExecutor->execute($command, $output);
  26429. clearstatcache();
  26430. if (0 === $result) {
  26431. $this->remove($source);
  26432. return;
  26433. }
  26434. } else {
  26435. $command = sprintf('mv %s %s', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  26436. $result = $this->processExecutor->execute($command, $output);
  26437. clearstatcache();
  26438. if (0 === $result) {
  26439. return;
  26440. }
  26441. }
  26442. $this->copyThenRemove($source, $target);
  26443. }
  26444. public function findShortestPath($from, $to, $directories = false)
  26445. {
  26446. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  26447. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  26448. }
  26449. $from = lcfirst($this->normalizePath($from));
  26450. $to = lcfirst($this->normalizePath($to));
  26451. if ($directories) {
  26452. $from = rtrim($from, '/') . '/dummy_file';
  26453. }
  26454. if (dirname($from) === dirname($to)) {
  26455. return './'.basename($to);
  26456. }
  26457. $commonPath = $to;
  26458. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath)) {
  26459. $commonPath = strtr(dirname($commonPath), '\\', '/');
  26460. }
  26461. if (0 !== strpos($from, $commonPath) || '/' === $commonPath) {
  26462. return $to;
  26463. }
  26464. $commonPath = rtrim($commonPath, '/') . '/';
  26465. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/');
  26466. $commonPathCode = str_repeat('../', $sourcePathDepth);
  26467. return ($commonPathCode . substr($to, strlen($commonPath))) ?: './';
  26468. }
  26469. public function findShortestPathCode($from, $to, $directories = false, $staticCode = false)
  26470. {
  26471. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  26472. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  26473. }
  26474. $from = lcfirst($this->normalizePath($from));
  26475. $to = lcfirst($this->normalizePath($to));
  26476. if ($from === $to) {
  26477. return $directories ? '__DIR__' : '__FILE__';
  26478. }
  26479. $commonPath = $to;
  26480. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath) && '.' !== $commonPath) {
  26481. $commonPath = strtr(dirname($commonPath), '\\', '/');
  26482. }
  26483. if (0 !== strpos($from, $commonPath) || '/' === $commonPath || '.' === $commonPath) {
  26484. return var_export($to, true);
  26485. }
  26486. $commonPath = rtrim($commonPath, '/') . '/';
  26487. if (strpos($to, $from.'/') === 0) {
  26488. return '__DIR__ . '.var_export(substr($to, strlen($from)), true);
  26489. }
  26490. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/') + $directories;
  26491. if ($staticCode) {
  26492. $commonPathCode = "__DIR__ . '".str_repeat('/..', $sourcePathDepth)."'";
  26493. } else {
  26494. $commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
  26495. }
  26496. $relTarget = substr($to, strlen($commonPath));
  26497. return $commonPathCode . (strlen($relTarget) ? '.' . var_export('/' . $relTarget, true) : '');
  26498. }
  26499. public function isAbsolutePath($path)
  26500. {
  26501. return substr($path, 0, 1) === '/' || substr($path, 1, 1) === ':' || substr($path, 0, 2) === '\\\\';
  26502. }
  26503. public function size($path)
  26504. {
  26505. if (!file_exists($path)) {
  26506. throw new \RuntimeException("$path does not exist.");
  26507. }
  26508. if (is_dir($path)) {
  26509. return $this->directorySize($path);
  26510. }
  26511. return filesize($path);
  26512. }
  26513. public function normalizePath($path)
  26514. {
  26515. $parts = array();
  26516. $path = strtr($path, '\\', '/');
  26517. $prefix = '';
  26518. $absolute = false;
  26519. if (preg_match('{^( [0-9a-z]{2,}+: (?: // (?: [a-z]: )? )? | [a-z]: )}ix', $path, $match)) {
  26520. $prefix = $match[1];
  26521. $path = substr($path, strlen($prefix));
  26522. }
  26523. if (substr($path, 0, 1) === '/') {
  26524. $absolute = true;
  26525. $path = substr($path, 1);
  26526. }
  26527. $up = false;
  26528. foreach (explode('/', $path) as $chunk) {
  26529. if ('..' === $chunk && ($absolute || $up)) {
  26530. array_pop($parts);
  26531. $up = !(empty($parts) || '..' === end($parts));
  26532. } elseif ('.' !== $chunk && '' !== $chunk) {
  26533. $parts[] = $chunk;
  26534. $up = '..' !== $chunk;
  26535. }
  26536. }
  26537. return $prefix.($absolute ? '/' : '').implode('/', $parts);
  26538. }
  26539. public static function isLocalPath($path)
  26540. {
  26541. return (bool) preg_match('{^(file://(?!//)|/(?!/)|/?[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
  26542. }
  26543. public static function getPlatformPath($path)
  26544. {
  26545. if (Platform::isWindows()) {
  26546. $path = preg_replace('{^(?:file:///([a-z]):?/)}i', 'file://$1:/', $path);
  26547. }
  26548. return preg_replace('{^file://}i', '', $path);
  26549. }
  26550. protected function directorySize($directory)
  26551. {
  26552. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  26553. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  26554. $size = 0;
  26555. foreach ($ri as $file) {
  26556. if ($file->isFile()) {
  26557. $size += $file->getSize();
  26558. }
  26559. }
  26560. return $size;
  26561. }
  26562. protected function getProcess()
  26563. {
  26564. return $this->processExecutor;
  26565. }
  26566. private function unlinkImplementation($path)
  26567. {
  26568. if (Platform::isWindows() && is_dir($path) && is_link($path)) {
  26569. return rmdir($path);
  26570. }
  26571. return unlink($path);
  26572. }
  26573. public function relativeSymlink($target, $link)
  26574. {
  26575. $cwd = getcwd();
  26576. $relativePath = $this->findShortestPath($link, $target);
  26577. chdir(dirname($link));
  26578. $result = @symlink($relativePath, $link);
  26579. chdir($cwd);
  26580. return $result;
  26581. }
  26582. public function isSymlinkedDirectory($directory)
  26583. {
  26584. if (!is_dir($directory)) {
  26585. return false;
  26586. }
  26587. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  26588. return is_link($resolved);
  26589. }
  26590. private function unlinkSymlinkedDirectory($directory)
  26591. {
  26592. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  26593. return $this->unlink($resolved);
  26594. }
  26595. private function resolveSymlinkedDirectorySymlink($pathname)
  26596. {
  26597. if (!is_dir($pathname)) {
  26598. return $pathname;
  26599. }
  26600. $resolved = rtrim($pathname, '/');
  26601. if (!strlen($resolved)) {
  26602. return $pathname;
  26603. }
  26604. return $resolved;
  26605. }
  26606. public function junction($target, $junction)
  26607. {
  26608. if (!Platform::isWindows()) {
  26609. throw new \LogicException(sprintf('Function %s is not available on non-Windows platform', __CLASS__));
  26610. }
  26611. if (!is_dir($target)) {
  26612. throw new IOException(sprintf('Cannot junction to "%s" as it is not a directory.', $target), 0, null, $target);
  26613. }
  26614. $cmd = sprintf(
  26615. 'mklink /J %s %s',
  26616. ProcessExecutor::escape(str_replace('/', DIRECTORY_SEPARATOR, $junction)),
  26617. ProcessExecutor::escape(realpath($target))
  26618. );
  26619. if ($this->getProcess()->execute($cmd, $output) !== 0) {
  26620. throw new IOException(sprintf('Failed to create junction to "%s" at "%s".', $target, $junction), 0, null, $target);
  26621. }
  26622. clearstatcache(true, $junction);
  26623. }
  26624. public function isJunction($junction)
  26625. {
  26626. if (!Platform::isWindows()) {
  26627. return false;
  26628. }
  26629. clearstatcache(true, $junction);
  26630. if (!is_dir($junction) || is_link($junction)) {
  26631. return false;
  26632. }
  26633. $stat = lstat($junction);
  26634. return $stat ? 0x4000 !== ($stat['mode'] & 0xF000) : false;
  26635. }
  26636. public function removeJunction($junction)
  26637. {
  26638. if (!Platform::isWindows()) {
  26639. return false;
  26640. }
  26641. $junction = rtrim(str_replace('/', DIRECTORY_SEPARATOR, $junction), DIRECTORY_SEPARATOR);
  26642. if (!$this->isJunction($junction)) {
  26643. throw new IOException(sprintf('%s is not a junction and thus cannot be removed as one', $junction));
  26644. }
  26645. return $this->rmdir($junction);
  26646. }
  26647. }
  26648. <?php
  26649. namespace Composer\Util;
  26650. use Composer\Config;
  26651. use Composer\IO\IOInterface;
  26652. class Git
  26653. {
  26654. private static $version = false;
  26655. protected $io;
  26656. protected $config;
  26657. protected $process;
  26658. protected $filesystem;
  26659. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process, Filesystem $fs)
  26660. {
  26661. $this->io = $io;
  26662. $this->config = $config;
  26663. $this->process = $process;
  26664. $this->filesystem = $fs;
  26665. }
  26666. public function runCommand($commandCallable, $url, $cwd, $initialClone = false)
  26667. {
  26668. $this->config->prohibitUrlByConfig($url, $this->io);
  26669. if ($initialClone) {
  26670. $origCwd = $cwd;
  26671. $cwd = null;
  26672. }
  26673. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $url)) {
  26674. 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.');
  26675. }
  26676. if (!$initialClone) {
  26677. $this->process->execute('git remote -v', $output, $cwd);
  26678. if (preg_match('{^(?:composer|origin)\s+https?://(.+):(.+)@([^/]+)}im', $output, $match) && !$this->io->hasAuthentication($match[3])) {
  26679. $this->io->setAuthentication($match[3], rawurldecode($match[1]), rawurldecode($match[2]));
  26680. }
  26681. }
  26682. $protocols = $this->config->get('github-protocols');
  26683. if (!is_array($protocols)) {
  26684. throw new \RuntimeException('Config value "github-protocols" must be an array, got ' . gettype($protocols));
  26685. }
  26686. if (preg_match('{^(?:https?|git)://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)) {
  26687. $messages = array();
  26688. foreach ($protocols as $protocol) {
  26689. if ('ssh' === $protocol) {
  26690. $protoUrl = "git@" . $match[1] . ":" . $match[2];
  26691. } else {
  26692. $protoUrl = $protocol . "://" . $match[1] . "/" . $match[2];
  26693. }
  26694. if (0 === $this->process->execute(call_user_func($commandCallable, $protoUrl), $ignoredOutput, $cwd)) {
  26695. return;
  26696. }
  26697. $messages[] = '- ' . $protoUrl . "\n" . preg_replace('#^#m', ' ', $this->process->getErrorOutput());
  26698. if ($initialClone) {
  26699. $this->filesystem->removeDirectory($origCwd);
  26700. }
  26701. }
  26702. if (!$this->io->hasAuthentication($match[1]) && !$this->io->isInteractive()) {
  26703. $this->throwException('Failed to clone ' . $url . ' via ' . implode(', ', $protocols) . ' protocols, aborting.' . "\n\n" . implode("\n", $messages), $url);
  26704. }
  26705. }
  26706. $bypassSshForGitHub = preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url) && !in_array('ssh', $protocols, true);
  26707. $command = call_user_func($commandCallable, $url);
  26708. $auth = null;
  26709. if ($bypassSshForGitHub || 0 !== $this->process->execute($command, $ignoredOutput, $cwd)) {
  26710. $errorMsg = $this->process->getErrorOutput();
  26711. if (preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url, $match)
  26712. || preg_match('{^https?://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)
  26713. ) {
  26714. if (!$this->io->hasAuthentication($match[1])) {
  26715. $gitHubUtil = new GitHub($this->io, $this->config, $this->process);
  26716. $message = 'Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos';
  26717. if (!$gitHubUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  26718. $gitHubUtil->authorizeOAuthInteractively($match[1], $message);
  26719. }
  26720. }
  26721. if ($this->io->hasAuthentication($match[1])) {
  26722. $auth = $this->io->getAuthentication($match[1]);
  26723. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  26724. $command = call_user_func($commandCallable, $authUrl);
  26725. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  26726. return;
  26727. }
  26728. $errorMsg = $this->process->getErrorOutput();
  26729. }
  26730. } elseif (preg_match('{^https://(bitbucket\.org)/(.*)(\.git)?$}U', $url, $match)) {
  26731. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process);
  26732. if (!$this->io->hasAuthentication($match[1])) {
  26733. $message = 'Enter your Bitbucket credentials to access private repos';
  26734. if (!$bitbucketUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  26735. $bitbucketUtil->authorizeOAuthInteractively($match[1], $message);
  26736. $accessToken = $bitbucketUtil->getToken();
  26737. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  26738. }
  26739. } else {
  26740. $auth = $this->io->getAuthentication($match[1]);
  26741. if ($auth['username'] !== 'x-token-auth') {
  26742. $accessToken = $bitbucketUtil->requestToken($match[1], $auth['username'], $auth['password']);
  26743. if (! empty($accessToken)) {
  26744. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  26745. }
  26746. }
  26747. }
  26748. if ($this->io->hasAuthentication($match[1])) {
  26749. $auth = $this->io->getAuthentication($match[1]);
  26750. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  26751. $command = call_user_func($commandCallable, $authUrl);
  26752. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  26753. return;
  26754. }
  26755. $errorMsg = $this->process->getErrorOutput();
  26756. } else {
  26757. $sshUrl = 'git@bitbucket.org:' . $match[2] . '.git';
  26758. $this->io->writeError(' No bitbucket authentication configured. Falling back to ssh.');
  26759. $command = call_user_func($commandCallable, $sshUrl);
  26760. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  26761. return;
  26762. }
  26763. $errorMsg = $this->process->getErrorOutput();
  26764. }
  26765. } elseif (
  26766. preg_match('{^(git)@' . self::getGitLabDomainsRegex($this->config) . ':(.+?\.git)$}i', $url, $match)
  26767. || preg_match('{^(https?)://' . self::getGitLabDomainsRegex($this->config) . '/(.*)}', $url, $match)
  26768. ) {
  26769. if ($match[1] === 'git') {
  26770. $match[1] = 'https';
  26771. }
  26772. if (!$this->io->hasAuthentication($match[2])) {
  26773. $gitLabUtil = new GitLab($this->io, $this->config, $this->process);
  26774. $message = 'Cloning failed, enter your GitLab credentials to access private repos';
  26775. if (!$gitLabUtil->authorizeOAuth($match[2]) && $this->io->isInteractive()) {
  26776. $gitLabUtil->authorizeOAuthInteractively($match[1], $match[2], $message);
  26777. }
  26778. }
  26779. if ($this->io->hasAuthentication($match[2])) {
  26780. $auth = $this->io->getAuthentication($match[2]);
  26781. if ($auth['password'] === 'private-token' || $auth['password'] === 'oauth2' || $auth['password'] === 'gitlab-ci-token') {
  26782. $authUrl = $match[1] . '://' . rawurlencode($auth['password']) . ':' . rawurlencode($auth['username']) . '@' . $match[2] . '/' . $match[3];
  26783. } else {
  26784. $authUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . '/' . $match[3];
  26785. }
  26786. $command = call_user_func($commandCallable, $authUrl);
  26787. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  26788. return;
  26789. }
  26790. $errorMsg = $this->process->getErrorOutput();
  26791. }
  26792. } elseif ($this->isAuthenticationFailure($url, $match)) {
  26793. if (strpos($match[2], '@')) {
  26794. list($authParts, $match[2]) = explode('@', $match[2], 2);
  26795. }
  26796. $storeAuth = false;
  26797. if ($this->io->hasAuthentication($match[2])) {
  26798. $auth = $this->io->getAuthentication($match[2]);
  26799. } elseif ($this->io->isInteractive()) {
  26800. $defaultUsername = null;
  26801. if (isset($authParts) && $authParts) {
  26802. if (false !== strpos($authParts, ':')) {
  26803. list($defaultUsername, ) = explode(':', $authParts, 2);
  26804. } else {
  26805. $defaultUsername = $authParts;
  26806. }
  26807. }
  26808. $this->io->writeError(' Authentication required (<info>' . $match[2] . '</info>):');
  26809. $auth = array(
  26810. 'username' => $this->io->ask(' Username: ', $defaultUsername),
  26811. 'password' => $this->io->askAndHideAnswer(' Password: '),
  26812. );
  26813. $storeAuth = $this->config->get('store-auths');
  26814. }
  26815. if ($auth) {
  26816. $authUrl = $match[1] . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . $match[3];
  26817. $command = call_user_func($commandCallable, $authUrl);
  26818. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  26819. $this->io->setAuthentication($match[2], $auth['username'], $auth['password']);
  26820. $authHelper = new AuthHelper($this->io, $this->config);
  26821. $authHelper->storeAuth($match[2], $storeAuth);
  26822. return;
  26823. }
  26824. $errorMsg = $this->process->getErrorOutput();
  26825. }
  26826. }
  26827. if ($initialClone) {
  26828. $this->filesystem->removeDirectory($origCwd);
  26829. }
  26830. $this->throwException('Failed to execute ' . $command . "\n\n" . $errorMsg, $url);
  26831. }
  26832. }
  26833. public function syncMirror($url, $dir)
  26834. {
  26835. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  26836. try {
  26837. $commandCallable = function ($url) {
  26838. $sanitizedUrl = preg_replace('{://([^@]+?):(.+?)@}', '://', $url);
  26839. return sprintf('git remote set-url origin %s && git remote update --prune origin && git remote set-url origin %s', ProcessExecutor::escape($url), ProcessExecutor::escape($sanitizedUrl));
  26840. };
  26841. $this->runCommand($commandCallable, $url, $dir);
  26842. } catch (\Exception $e) {
  26843. $this->io->writeError('<error>Sync mirror failed: ' . $e->getMessage() . '</error>', true, IOInterface::DEBUG);
  26844. return false;
  26845. }
  26846. return true;
  26847. }
  26848. $this->filesystem->removeDirectory($dir);
  26849. $commandCallable = function ($url) use ($dir) {
  26850. return sprintf('git clone --mirror %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($dir));
  26851. };
  26852. $this->runCommand($commandCallable, $url, $dir, true);
  26853. return true;
  26854. }
  26855. public function fetchRefOrSyncMirror($url, $dir, $ref)
  26856. {
  26857. if ($this->checkRefIsInMirror($url, $dir, $ref)) {
  26858. return true;
  26859. }
  26860. if ($this->syncMirror($url, $dir)) {
  26861. return $this->checkRefIsInMirror($url, $dir, $ref);
  26862. }
  26863. return false;
  26864. }
  26865. public static function getNoShowSignatureFlag(ProcessExecutor $process)
  26866. {
  26867. $gitVersion = self::getVersion($process);
  26868. if ($gitVersion && version_compare($gitVersion, '2.10.0-rc0', '>=')) {
  26869. return ' --no-show-signature';
  26870. }
  26871. return '';
  26872. }
  26873. private function checkRefIsInMirror($url, $dir, $ref)
  26874. {
  26875. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  26876. $escapedRef = ProcessExecutor::escape($ref.'^{commit}');
  26877. $exitCode = $this->process->execute(sprintf('git rev-parse --quiet --verify %s', $escapedRef), $ignoredOutput, $dir);
  26878. if ($exitCode === 0) {
  26879. return true;
  26880. }
  26881. }
  26882. return false;
  26883. }
  26884. private function isAuthenticationFailure($url, &$match)
  26885. {
  26886. if (!preg_match('{^(https?://)([^/]+)(.*)$}i', $url, $match)) {
  26887. return false;
  26888. }
  26889. $authFailures = array(
  26890. 'fatal: Authentication failed',
  26891. 'remote error: Invalid username or password.',
  26892. 'error: 401 Unauthorized',
  26893. 'fatal: unable to access',
  26894. 'fatal: could not read Username',
  26895. );
  26896. $errorOutput = $this->process->getErrorOutput();
  26897. foreach ($authFailures as $authFailure) {
  26898. if (strpos($errorOutput, $authFailure) !== false) {
  26899. return true;
  26900. }
  26901. }
  26902. return false;
  26903. }
  26904. public static function cleanEnv()
  26905. {
  26906. if (PHP_VERSION_ID < 50400 && ini_get('safe_mode') && false === strpos(ini_get('safe_mode_allowed_env_vars'), 'GIT_ASKPASS')) {
  26907. 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');
  26908. }
  26909. if (getenv('GIT_ASKPASS') !== 'echo') {
  26910. putenv('GIT_ASKPASS=echo');
  26911. unset($_SERVER['GIT_ASKPASS']);
  26912. }
  26913. if (getenv('GIT_DIR')) {
  26914. putenv('GIT_DIR');
  26915. unset($_SERVER['GIT_DIR']);
  26916. }
  26917. if (getenv('GIT_WORK_TREE')) {
  26918. putenv('GIT_WORK_TREE');
  26919. unset($_SERVER['GIT_WORK_TREE']);
  26920. }
  26921. if (getenv('LANGUAGE') !== 'C') {
  26922. putenv('LANGUAGE=C');
  26923. }
  26924. putenv("DYLD_LIBRARY_PATH");
  26925. unset($_SERVER['DYLD_LIBRARY_PATH']);
  26926. }
  26927. public static function getGitHubDomainsRegex(Config $config)
  26928. {
  26929. return '(' . implode('|', array_map('preg_quote', $config->get('github-domains'))) . ')';
  26930. }
  26931. public static function getGitLabDomainsRegex(Config $config)
  26932. {
  26933. return '(' . implode('|', array_map('preg_quote', $config->get('gitlab-domains'))) . ')';
  26934. }
  26935. public static function sanitizeUrl($message)
  26936. {
  26937. return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
  26938. if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
  26939. return '://***:***@';
  26940. }
  26941. return '://' . $m[1] . ':***@';
  26942. }, $message);
  26943. }
  26944. private function throwException($message, $url)
  26945. {
  26946. clearstatcache();
  26947. if (0 !== $this->process->execute('git --version', $ignoredOutput)) {
  26948. 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()));
  26949. }
  26950. throw new \RuntimeException(self::sanitizeUrl($message));
  26951. }
  26952. public static function getVersion(ProcessExecutor $process = null)
  26953. {
  26954. if (false === self::$version) {
  26955. self::$version = null;
  26956. if (!$process) {
  26957. $process = new ProcessExecutor;
  26958. }
  26959. if (0 === $process->execute('git --version', $output) && preg_match('/^git version (\d+(?:\.\d+)+)/m', $output, $matches)) {
  26960. self::$version = $matches[1];
  26961. }
  26962. }
  26963. return self::$version;
  26964. }
  26965. }
  26966. <?php
  26967. namespace Composer\Util;
  26968. use Composer\Factory;
  26969. use Composer\IO\IOInterface;
  26970. use Composer\Config;
  26971. use Composer\Downloader\TransportException;
  26972. class GitHub
  26973. {
  26974. protected $io;
  26975. protected $config;
  26976. protected $process;
  26977. protected $remoteFilesystem;
  26978. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  26979. {
  26980. $this->io = $io;
  26981. $this->config = $config;
  26982. $this->process = $process ?: new ProcessExecutor($io);
  26983. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  26984. }
  26985. public function authorizeOAuth($originUrl)
  26986. {
  26987. if (!in_array($originUrl, $this->config->get('github-domains'))) {
  26988. return false;
  26989. }
  26990. if (0 === $this->process->execute('git config github.accesstoken', $output)) {
  26991. $this->io->setAuthentication($originUrl, trim($output), 'x-oauth-basic');
  26992. return true;
  26993. }
  26994. return false;
  26995. }
  26996. public function authorizeOAuthInteractively($originUrl, $message = null)
  26997. {
  26998. if ($message) {
  26999. $this->io->writeError($message);
  27000. }
  27001. $note = 'Composer';
  27002. if ($this->config->get('github-expose-hostname') === true && 0 === $this->process->execute('hostname', $output)) {
  27003. $note .= ' on ' . trim($output);
  27004. }
  27005. $note .= ' ' . date('Y-m-d Hi');
  27006. $url = 'https://'.$originUrl.'/settings/tokens/new?scopes=repo&description=' . str_replace('%20', '+', rawurlencode($note));
  27007. $this->io->writeError(sprintf('Head to %s', $url));
  27008. $this->io->writeError(sprintf('to retrieve a token. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  27009. $token = trim($this->io->askAndHideAnswer('Token (hidden): '));
  27010. if (!$token) {
  27011. $this->io->writeError('<warning>No token given, aborting.</warning>');
  27012. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  27013. return false;
  27014. }
  27015. $this->io->setAuthentication($originUrl, $token, 'x-oauth-basic');
  27016. try {
  27017. $apiUrl = ('github.com' === $originUrl) ? 'api.github.com/' : $originUrl . '/api/v3/';
  27018. $this->remoteFilesystem->getContents($originUrl, 'https://'. $apiUrl, false, array(
  27019. 'retry-auth-failure' => false,
  27020. ));
  27021. } catch (TransportException $e) {
  27022. if (in_array($e->getCode(), array(403, 401))) {
  27023. $this->io->writeError('<error>Invalid token provided.</error>');
  27024. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  27025. return false;
  27026. }
  27027. throw $e;
  27028. }
  27029. $this->config->getConfigSource()->removeConfigSetting('github-oauth.'.$originUrl);
  27030. $this->config->getAuthConfigSource()->addConfigSetting('github-oauth.'.$originUrl, $token);
  27031. $this->io->writeError('<info>Token stored successfully.</info>');
  27032. return true;
  27033. }
  27034. public function getRateLimit(array $headers)
  27035. {
  27036. $rateLimit = array(
  27037. 'limit' => '?',
  27038. 'reset' => '?',
  27039. );
  27040. foreach ($headers as $header) {
  27041. $header = trim($header);
  27042. if (false === strpos($header, 'X-RateLimit-')) {
  27043. continue;
  27044. }
  27045. list($type, $value) = explode(':', $header, 2);
  27046. switch ($type) {
  27047. case 'X-RateLimit-Limit':
  27048. $rateLimit['limit'] = (int) trim($value);
  27049. break;
  27050. case 'X-RateLimit-Reset':
  27051. $rateLimit['reset'] = date('Y-m-d H:i:s', (int) trim($value));
  27052. break;
  27053. }
  27054. }
  27055. return $rateLimit;
  27056. }
  27057. public function isRateLimited(array $headers)
  27058. {
  27059. foreach ($headers as $header) {
  27060. if (preg_match('{^X-RateLimit-Remaining: *0$}i', trim($header))) {
  27061. return true;
  27062. }
  27063. }
  27064. return false;
  27065. }
  27066. }
  27067. <?php
  27068. namespace Composer\Util;
  27069. use Composer\IO\IOInterface;
  27070. use Composer\Config;
  27071. use Composer\Factory;
  27072. use Composer\Downloader\TransportException;
  27073. use Composer\Json\JsonFile;
  27074. class GitLab
  27075. {
  27076. protected $io;
  27077. protected $config;
  27078. protected $process;
  27079. protected $remoteFilesystem;
  27080. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  27081. {
  27082. $this->io = $io;
  27083. $this->config = $config;
  27084. $this->process = $process ?: new ProcessExecutor($io);
  27085. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  27086. }
  27087. public function authorizeOAuth($originUrl)
  27088. {
  27089. $bcOriginUrl = preg_replace('{:\d+}', '', $originUrl);
  27090. if (!in_array($originUrl, $this->config->get('gitlab-domains'), true) && !in_array($bcOriginUrl, $this->config->get('gitlab-domains'), true)) {
  27091. return false;
  27092. }
  27093. if (0 === $this->process->execute('git config gitlab.accesstoken', $output)) {
  27094. $this->io->setAuthentication($originUrl, trim($output), 'oauth2');
  27095. return true;
  27096. }
  27097. $authTokens = $this->config->get('gitlab-token');
  27098. if (isset($authTokens[$originUrl])) {
  27099. $this->io->setAuthentication($originUrl, $authTokens[$originUrl], 'private-token');
  27100. return true;
  27101. }
  27102. if (isset($authTokens[$bcOriginUrl])) {
  27103. $this->io->setAuthentication($originUrl, $authTokens[$bcOriginUrl], 'private-token');
  27104. return true;
  27105. }
  27106. return false;
  27107. }
  27108. public function authorizeOAuthInteractively($scheme, $originUrl, $message = null)
  27109. {
  27110. if ($message) {
  27111. $this->io->writeError($message);
  27112. }
  27113. $this->io->writeError(sprintf('A token will be created and stored in "%s", your password will never be stored', $this->config->getAuthConfigSource()->getName()));
  27114. $this->io->writeError('To revoke access to this token you can visit '.$scheme.'://'.$originUrl.'/profile/applications');
  27115. $attemptCounter = 0;
  27116. while ($attemptCounter++ < 5) {
  27117. try {
  27118. $response = $this->createToken($scheme, $originUrl);
  27119. } catch (TransportException $e) {
  27120. if (in_array($e->getCode(), array(403, 401))) {
  27121. if (401 === $e->getCode()) {
  27122. $response = json_decode($e->getResponse(), true);
  27123. if (isset($response['error']) && $response['error'] === 'invalid_grant') {
  27124. $this->io->writeError('Bad credentials. If you have two factor authentication enabled you will have to manually create a personal access token');
  27125. } else {
  27126. $this->io->writeError('Bad credentials.');
  27127. }
  27128. } else {
  27129. $this->io->writeError('Maximum number of login attempts exceeded. Please try again later.');
  27130. }
  27131. $this->io->writeError('You can also manually create a personal access token enabling the "read_api" scope at '.$scheme.'://'.$originUrl.'/profile/personal_access_tokens');
  27132. $this->io->writeError('Add it using "composer config --global --auth gitlab-token.'.$originUrl.' <token>"');
  27133. continue;
  27134. }
  27135. throw $e;
  27136. }
  27137. $this->io->setAuthentication($originUrl, $response['access_token'], 'oauth2');
  27138. $this->config->getAuthConfigSource()->addConfigSetting('gitlab-oauth.'.$originUrl, $response['access_token']);
  27139. return true;
  27140. }
  27141. throw new \RuntimeException('Invalid GitLab credentials 5 times in a row, aborting.');
  27142. }
  27143. private function createToken($scheme, $originUrl)
  27144. {
  27145. $username = $this->io->ask('Username: ');
  27146. $password = $this->io->askAndHideAnswer('Password: ');
  27147. $headers = array('Content-Type: application/x-www-form-urlencoded');
  27148. $apiUrl = $originUrl;
  27149. $data = http_build_query(array(
  27150. 'username' => $username,
  27151. 'password' => $password,
  27152. 'grant_type' => 'password',
  27153. ), null, '&');
  27154. $options = array(
  27155. 'retry-auth-failure' => false,
  27156. 'http' => array(
  27157. 'method' => 'POST',
  27158. 'header' => $headers,
  27159. 'content' => $data,
  27160. ),
  27161. );
  27162. $json = $this->remoteFilesystem->getContents($originUrl, $scheme.'://'.$apiUrl.'/oauth/token', false, $options);
  27163. $this->io->writeError('Token successfully created');
  27164. return JsonFile::parseJson($json);
  27165. }
  27166. }
  27167. <?php
  27168. namespace Composer\Util;
  27169. use Composer\Config;
  27170. use Composer\IO\IOInterface;
  27171. class Hg
  27172. {
  27173. private $io;
  27174. private $config;
  27175. private $process;
  27176. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process)
  27177. {
  27178. $this->io = $io;
  27179. $this->config = $config;
  27180. $this->process = $process;
  27181. }
  27182. public function runCommand($commandCallable, $url, $cwd)
  27183. {
  27184. $this->config->prohibitUrlByConfig($url, $this->io);
  27185. $command = call_user_func($commandCallable, $url);
  27186. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  27187. return;
  27188. }
  27189. if (preg_match('{^(https?)://((.+)(?:\:(.+))?@)?([^/]+)(/.*)?}mi', $url, $match) && $this->io->hasAuthentication($match[5])) {
  27190. $auth = $this->io->getAuthentication($match[5]);
  27191. $authenticatedUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[5] . (!empty($match[6]) ? $match[6] : null);
  27192. $command = call_user_func($commandCallable, $authenticatedUrl);
  27193. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  27194. return;
  27195. }
  27196. $error = $this->process->getErrorOutput();
  27197. } else {
  27198. $error = 'The given URL (' . $url . ') does not match the required format (http(s)://(username:password@)example.com/path-to-repository)';
  27199. }
  27200. $this->throwException('Failed to clone ' . $url . ', ' . "\n\n" . $error, $url);
  27201. }
  27202. public static function sanitizeUrl($message)
  27203. {
  27204. return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
  27205. if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
  27206. return '://***:***@';
  27207. }
  27208. return '://' . $m[1] . ':***@';
  27209. }, $message);
  27210. }
  27211. private function throwException($message, $url)
  27212. {
  27213. if (0 !== $this->process->execute('hg --version', $ignoredOutput)) {
  27214. throw new \RuntimeException(self::sanitizeUrl('Failed to clone ' . $url . ', hg was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()));
  27215. }
  27216. throw new \RuntimeException(self::sanitizeUrl($message));
  27217. }
  27218. }
  27219. <?php
  27220. namespace Composer\Util;
  27221. use Composer\XdebugHandler\XdebugHandler;
  27222. class IniHelper
  27223. {
  27224. public static function getAll()
  27225. {
  27226. return XdebugHandler::getAllIniFiles();
  27227. }
  27228. public static function getMessage()
  27229. {
  27230. $paths = self::getAll();
  27231. if (empty($paths[0])) {
  27232. array_shift($paths);
  27233. }
  27234. $ini = array_shift($paths);
  27235. if (empty($ini)) {
  27236. return 'A php.ini file does not exist. You will have to create one.';
  27237. }
  27238. if (!empty($paths)) {
  27239. return 'Your command-line PHP is using multiple ini files. Run `php --ini` to show them.';
  27240. }
  27241. return 'The php.ini used by your command-line PHP is: '.$ini;
  27242. }
  27243. }
  27244. <?php
  27245. namespace Composer\Util;
  27246. use stdClass;
  27247. class NoProxyPattern
  27248. {
  27249. protected $hostNames = array();
  27250. protected $rules = array();
  27251. protected $noproxy;
  27252. public function __construct($pattern)
  27253. {
  27254. $this->hostNames = preg_split('{[\s,]+}', $pattern, null, PREG_SPLIT_NO_EMPTY);
  27255. $this->noproxy = empty($this->hostNames) || '*' === $this->hostNames[0];
  27256. }
  27257. public function test($url)
  27258. {
  27259. if ($this->noproxy) {
  27260. return true;
  27261. }
  27262. if (!$urlData = $this->getUrlData($url)) {
  27263. return false;
  27264. }
  27265. foreach ($this->hostNames as $index => $hostName) {
  27266. if ($this->match($index, $hostName, $urlData)) {
  27267. return true;
  27268. }
  27269. }
  27270. return false;
  27271. }
  27272. protected function getUrlData($url)
  27273. {
  27274. if (!$host = parse_url($url, PHP_URL_HOST)) {
  27275. return false;
  27276. }
  27277. $port = parse_url($url, PHP_URL_PORT);
  27278. if (empty($port)) {
  27279. switch (parse_url($url, PHP_URL_SCHEME)) {
  27280. case 'http':
  27281. $port = 80;
  27282. break;
  27283. case 'https':
  27284. $port = 443;
  27285. break;
  27286. }
  27287. }
  27288. $hostName = $host . ($port ? ':' . $port : '');
  27289. list($host, $port, $err) = $this->splitHostPort($hostName);
  27290. if ($err || !$this->ipCheckData($host, $ipdata)) {
  27291. return false;
  27292. }
  27293. return $this->makeData($host, $port, $ipdata);
  27294. }
  27295. protected function match($index, $hostName, $url)
  27296. {
  27297. if (!$rule = $this->getRule($index, $hostName)) {
  27298. return false;
  27299. }
  27300. if ($rule->ipdata) {
  27301. if (!$url->ipdata) {
  27302. return false;
  27303. }
  27304. if ($rule->ipdata->netmask) {
  27305. return $this->matchRange($rule->ipdata, $url->ipdata);
  27306. }
  27307. $match = $rule->ipdata->ip === $url->ipdata->ip;
  27308. } else {
  27309. $haystack = substr($url->name, - strlen($rule->name));
  27310. $match = stripos($haystack, $rule->name) === 0;
  27311. }
  27312. if ($match && $rule->port) {
  27313. $match = $rule->port === $url->port;
  27314. }
  27315. return $match;
  27316. }
  27317. protected function matchRange(stdClass $network, stdClass $target)
  27318. {
  27319. $net = unpack('C*', $network->ip);
  27320. $mask = unpack('C*', $network->netmask);
  27321. $ip = unpack('C*', $target->ip);
  27322. for ($i = 1; $i < 17; ++$i) {
  27323. if (($net[$i] & $mask[$i]) !== ($ip[$i] & $mask[$i])) {
  27324. return false;
  27325. }
  27326. }
  27327. return true;
  27328. }
  27329. private function getRule($index, $hostName)
  27330. {
  27331. if (array_key_exists($index, $this->rules)) {
  27332. return $this->rules[$index];
  27333. }
  27334. $this->rules[$index] = null;
  27335. list($host, $port, $err) = $this->splitHostPort($hostName);
  27336. if ($err || !$this->ipCheckData($host, $ipdata, true)) {
  27337. return null;
  27338. }
  27339. $this->rules[$index] = $this->makeData($host, $port, $ipdata);
  27340. return $this->rules[$index];
  27341. }
  27342. private function ipCheckData($host, &$ipdata, $allowPrefix = false)
  27343. {
  27344. $ipdata = null;
  27345. $netmask = null;
  27346. $prefix = null;
  27347. $modified = false;
  27348. if (strpos($host, '/') !== false) {
  27349. list($host, $prefix) = explode('/', $host);
  27350. if (!$allowPrefix || !$this->validateInt($prefix, 0, 128)) {
  27351. return false;
  27352. }
  27353. $prefix = (int) $prefix;
  27354. $modified = true;
  27355. }
  27356. if (!filter_var($host, FILTER_VALIDATE_IP)) {
  27357. return !$modified;
  27358. }
  27359. list($ip, $size) = $this->ipGetAddr($host);
  27360. if ($prefix !== null) {
  27361. if ($prefix > $size * 8) {
  27362. return false;
  27363. }
  27364. list($ip, $netmask) = $this->ipGetNetwork($ip, $size, $prefix);
  27365. }
  27366. $ipdata = $this->makeIpData($ip, $size, $netmask);
  27367. return true;
  27368. }
  27369. private function ipGetAddr($host)
  27370. {
  27371. $ip = inet_pton($host);
  27372. $size = strlen($ip);
  27373. $mapped = $this->ipMapTo6($ip, $size);
  27374. return array($mapped, $size);
  27375. }
  27376. private function ipGetMask($prefix, $size)
  27377. {
  27378. $mask = '';
  27379. if ($ones = floor($prefix / 8)) {
  27380. $mask = str_repeat(chr(255), $ones);
  27381. }
  27382. if ($remainder = $prefix % 8) {
  27383. $mask .= chr(0xff ^ (0xff >> $remainder));
  27384. }
  27385. $mask = str_pad($mask, $size, chr(0));
  27386. return $this->ipMapTo6($mask, $size);
  27387. }
  27388. private function ipGetNetwork($rangeIp, $size, $prefix)
  27389. {
  27390. $netmask = $this->ipGetMask($prefix, $size);
  27391. $mask = unpack('C*', $netmask);
  27392. $ip = unpack('C*', $rangeIp);
  27393. $net = '';
  27394. for ($i = 1; $i < 17; ++$i) {
  27395. $net .= chr($ip[$i] & $mask[$i]);
  27396. }
  27397. return array($net, $netmask);
  27398. }
  27399. private function ipMapTo6($binary, $size)
  27400. {
  27401. if ($size === 4) {
  27402. $prefix = str_repeat(chr(0), 10) . str_repeat(chr(255), 2);
  27403. $binary = $prefix . $binary;
  27404. }
  27405. return $binary;
  27406. }
  27407. private function makeData($host, $port, $ipdata)
  27408. {
  27409. return (object) array(
  27410. 'host' => $host,
  27411. 'name' => '.' . ltrim($host, '.'),
  27412. 'port' => $port,
  27413. 'ipdata' => $ipdata,
  27414. );
  27415. }
  27416. private function makeIpData($ip, $size, $netmask)
  27417. {
  27418. return (object) array(
  27419. 'ip' => $ip,
  27420. 'size' => $size,
  27421. 'netmask' => $netmask,
  27422. );
  27423. }
  27424. private function splitHostPort($hostName)
  27425. {
  27426. $error = array('', '', true);
  27427. $port = 0;
  27428. $ip6 = '';
  27429. if ($hostName[0] === '[') {
  27430. $index = strpos($hostName, ']');
  27431. if (false === $index || $index < 3) {
  27432. return $error;
  27433. }
  27434. $ip6 = substr($hostName, 1, $index - 1);
  27435. $hostName = substr($hostName, $index + 1);
  27436. if (strpbrk($hostName, '[]') !== false
  27437. || substr_count($hostName, ':') > 1) {
  27438. return $error;
  27439. }
  27440. }
  27441. if (substr_count($hostName, ':') === 1) {
  27442. $index = strpos($hostName, ':');
  27443. $port = substr($hostName, $index + 1);
  27444. $hostName = substr($hostName, 0, $index);
  27445. if (!$this->validateInt($port, 1, 65535)) {
  27446. return $error;
  27447. }
  27448. $port = (int) $port;
  27449. }
  27450. $host = $ip6 . $hostName;
  27451. return array($host, $port, false);
  27452. }
  27453. private function validateInt($int, $min, $max)
  27454. {
  27455. $options = array(
  27456. 'options' => array(
  27457. 'min_range' => $min,
  27458. 'max_range' => $max)
  27459. );
  27460. return false !== filter_var($int, FILTER_VALIDATE_INT, $options);
  27461. }
  27462. }
  27463. <?php
  27464. namespace Composer\Util;
  27465. use Composer\Package\Link;
  27466. use Composer\Package\PackageInterface;
  27467. class PackageSorter
  27468. {
  27469. public static function sortPackages(array $packages) {
  27470. $usageList = array();
  27471. foreach ($packages as $package) {
  27472. foreach (array_merge($package->getRequires(), $package->getDevRequires()) as $link) {
  27473. $target = $link->getTarget();
  27474. $usageList[$target][] = $package->getName();
  27475. }
  27476. }
  27477. $computing = array();
  27478. $computed = array();
  27479. $computeImportance = function ($name) use (&$computeImportance, &$computing, &$computed, $usageList) {
  27480. if (isset($computed[$name])) {
  27481. return $computed[$name];
  27482. }
  27483. if (isset($computing[$name])) {
  27484. return 0;
  27485. }
  27486. $computing[$name] = true;
  27487. $weight = 0;
  27488. if (isset($usageList[$name])) {
  27489. foreach ($usageList[$name] as $user) {
  27490. $weight -= 1 - $computeImportance($user);
  27491. }
  27492. }
  27493. unset($computing[$name]);
  27494. $computed[$name] = $weight;
  27495. return $weight;
  27496. };
  27497. $weightList = array();
  27498. foreach ($packages as $name => $package) {
  27499. $weight = $computeImportance($name);
  27500. $weightList[$name] = $weight;
  27501. }
  27502. $stable_sort = function (&$array) {
  27503. static $transform, $restore;
  27504. $i = 0;
  27505. if (!$transform) {
  27506. $transform = function (&$v, $k) use (&$i) {
  27507. $v = array($v, ++$i, $k, $v);
  27508. };
  27509. $restore = function (&$v) {
  27510. $v = $v[3];
  27511. };
  27512. }
  27513. array_walk($array, $transform);
  27514. asort($array);
  27515. array_walk($array, $restore);
  27516. };
  27517. $stable_sort($weightList);
  27518. $sortedPackages = array();
  27519. foreach (array_keys($weightList) as $name) {
  27520. $sortedPackages[] = $packages[$name];
  27521. }
  27522. return $sortedPackages;
  27523. }
  27524. }
  27525. <?php
  27526. namespace Composer\Util;
  27527. use Composer\IO\IOInterface;
  27528. use Symfony\Component\Process\Process;
  27529. class Perforce
  27530. {
  27531. protected $path;
  27532. protected $p4Depot;
  27533. protected $p4Client;
  27534. protected $p4User;
  27535. protected $p4Password;
  27536. protected $p4Port;
  27537. protected $p4Stream;
  27538. protected $p4ClientSpec;
  27539. protected $p4DepotType;
  27540. protected $p4Branch;
  27541. protected $process;
  27542. protected $uniquePerforceClientName;
  27543. protected $windowsFlag;
  27544. protected $commandResult;
  27545. protected $io;
  27546. protected $filesystem;
  27547. public function __construct($repoConfig, $port, $path, ProcessExecutor $process, $isWindows, IOInterface $io)
  27548. {
  27549. $this->windowsFlag = $isWindows;
  27550. $this->p4Port = $port;
  27551. $this->initializePath($path);
  27552. $this->process = $process;
  27553. $this->initialize($repoConfig);
  27554. $this->io = $io;
  27555. }
  27556. public static function create($repoConfig, $port, $path, ProcessExecutor $process, IOInterface $io)
  27557. {
  27558. return new Perforce($repoConfig, $port, $path, $process, Platform::isWindows(), $io);
  27559. }
  27560. public static function checkServerExists($url, ProcessExecutor $processExecutor)
  27561. {
  27562. $output = null;
  27563. return 0 === $processExecutor->execute('p4 -p ' . ProcessExecutor::escape($url) . ' info -s', $output);
  27564. }
  27565. public function initialize($repoConfig)
  27566. {
  27567. $this->uniquePerforceClientName = $this->generateUniquePerforceClientName();
  27568. if (!$repoConfig) {
  27569. return;
  27570. }
  27571. if (isset($repoConfig['unique_perforce_client_name'])) {
  27572. $this->uniquePerforceClientName = $repoConfig['unique_perforce_client_name'];
  27573. }
  27574. if (isset($repoConfig['depot'])) {
  27575. $this->p4Depot = $repoConfig['depot'];
  27576. }
  27577. if (isset($repoConfig['branch'])) {
  27578. $this->p4Branch = $repoConfig['branch'];
  27579. }
  27580. if (isset($repoConfig['p4user'])) {
  27581. $this->p4User = $repoConfig['p4user'];
  27582. } else {
  27583. $this->p4User = $this->getP4variable('P4USER');
  27584. }
  27585. if (isset($repoConfig['p4password'])) {
  27586. $this->p4Password = $repoConfig['p4password'];
  27587. }
  27588. }
  27589. public function initializeDepotAndBranch($depot, $branch)
  27590. {
  27591. if (isset($depot)) {
  27592. $this->p4Depot = $depot;
  27593. }
  27594. if (isset($branch)) {
  27595. $this->p4Branch = $branch;
  27596. }
  27597. }
  27598. public function generateUniquePerforceClientName()
  27599. {
  27600. return gethostname() . "_" . time();
  27601. }
  27602. public function cleanupClientSpec()
  27603. {
  27604. $client = $this->getClient();
  27605. $task = 'client -d ' . ProcessExecutor::escape($client);
  27606. $useP4Client = false;
  27607. $command = $this->generateP4Command($task, $useP4Client);
  27608. $this->executeCommand($command);
  27609. $clientSpec = $this->getP4ClientSpec();
  27610. $fileSystem = $this->getFilesystem();
  27611. $fileSystem->remove($clientSpec);
  27612. }
  27613. protected function executeCommand($command)
  27614. {
  27615. $this->commandResult = '';
  27616. return $this->process->execute($command, $this->commandResult);
  27617. }
  27618. public function getClient()
  27619. {
  27620. if (!isset($this->p4Client)) {
  27621. $cleanStreamName = str_replace(array('//', '/', '@'), array('', '_', ''), $this->getStream());
  27622. $this->p4Client = 'composer_perforce_' . $this->uniquePerforceClientName . '_' . $cleanStreamName;
  27623. }
  27624. return $this->p4Client;
  27625. }
  27626. protected function getPath()
  27627. {
  27628. return $this->path;
  27629. }
  27630. public function initializePath($path)
  27631. {
  27632. $this->path = $path;
  27633. $fs = $this->getFilesystem();
  27634. $fs->ensureDirectoryExists($path);
  27635. }
  27636. protected function getPort()
  27637. {
  27638. return $this->p4Port;
  27639. }
  27640. public function setStream($stream)
  27641. {
  27642. $this->p4Stream = $stream;
  27643. $index = strrpos($stream, '/');
  27644. if ($index > 2) {
  27645. $this->p4DepotType = 'stream';
  27646. }
  27647. }
  27648. public function isStream()
  27649. {
  27650. return (strcmp($this->p4DepotType, 'stream') === 0);
  27651. }
  27652. public function getStream()
  27653. {
  27654. if (!isset($this->p4Stream)) {
  27655. if ($this->isStream()) {
  27656. $this->p4Stream = '//' . $this->p4Depot . '/' . $this->p4Branch;
  27657. } else {
  27658. $this->p4Stream = '//' . $this->p4Depot;
  27659. }
  27660. }
  27661. return $this->p4Stream;
  27662. }
  27663. public function getStreamWithoutLabel($stream)
  27664. {
  27665. $index = strpos($stream, '@');
  27666. if ($index === false) {
  27667. return $stream;
  27668. }
  27669. return substr($stream, 0, $index);
  27670. }
  27671. public function getP4ClientSpec()
  27672. {
  27673. return $this->path . '/' . $this->getClient() . '.p4.spec';
  27674. }
  27675. public function getUser()
  27676. {
  27677. return $this->p4User;
  27678. }
  27679. public function setUser($user)
  27680. {
  27681. $this->p4User = $user;
  27682. }
  27683. public function queryP4User()
  27684. {
  27685. $this->getUser();
  27686. if (strlen($this->p4User) > 0) {
  27687. return;
  27688. }
  27689. $this->p4User = $this->getP4variable('P4USER');
  27690. if (strlen($this->p4User) > 0) {
  27691. return;
  27692. }
  27693. $this->p4User = $this->io->ask('Enter P4 User:');
  27694. if ($this->windowsFlag) {
  27695. $command = 'p4 set P4USER=' . $this->p4User;
  27696. } else {
  27697. $command = 'export P4USER=' . $this->p4User;
  27698. }
  27699. $this->executeCommand($command);
  27700. }
  27701. protected function getP4variable($name)
  27702. {
  27703. if ($this->windowsFlag) {
  27704. $command = 'p4 set';
  27705. $this->executeCommand($command);
  27706. $result = trim($this->commandResult);
  27707. $resArray = explode(PHP_EOL, $result);
  27708. foreach ($resArray as $line) {
  27709. $fields = explode('=', $line);
  27710. if (strcmp($name, $fields[0]) == 0) {
  27711. $index = strpos($fields[1], ' ');
  27712. if ($index === false) {
  27713. $value = $fields[1];
  27714. } else {
  27715. $value = substr($fields[1], 0, $index);
  27716. }
  27717. $value = trim($value);
  27718. return $value;
  27719. }
  27720. }
  27721. return null;
  27722. }
  27723. $command = 'echo $' . $name;
  27724. $this->executeCommand($command);
  27725. $result = trim($this->commandResult);
  27726. return $result;
  27727. }
  27728. public function queryP4Password()
  27729. {
  27730. if (isset($this->p4Password)) {
  27731. return $this->p4Password;
  27732. }
  27733. $password = $this->getP4variable('P4PASSWD');
  27734. if (strlen($password) <= 0) {
  27735. $password = $this->io->askAndHideAnswer('Enter password for Perforce user ' . $this->getUser() . ': ');
  27736. }
  27737. $this->p4Password = $password;
  27738. return $password;
  27739. }
  27740. public function generateP4Command($command, $useClient = true)
  27741. {
  27742. $p4Command = 'p4 ';
  27743. $p4Command .= '-u ' . $this->getUser() . ' ';
  27744. if ($useClient) {
  27745. $p4Command .= '-c ' . $this->getClient() . ' ';
  27746. }
  27747. $p4Command = $p4Command . '-p ' . $this->getPort() . ' ' . $command;
  27748. return $p4Command;
  27749. }
  27750. public function isLoggedIn()
  27751. {
  27752. $command = $this->generateP4Command('login -s', false);
  27753. $exitCode = $this->executeCommand($command);
  27754. if ($exitCode) {
  27755. $errorOutput = $this->process->getErrorOutput();
  27756. $index = strpos($errorOutput, $this->getUser());
  27757. if ($index === false) {
  27758. $index = strpos($errorOutput, 'p4');
  27759. if ($index === false) {
  27760. return false;
  27761. }
  27762. throw new \Exception('p4 command not found in path: ' . $errorOutput);
  27763. }
  27764. throw new \Exception('Invalid user name: ' . $this->getUser());
  27765. }
  27766. return true;
  27767. }
  27768. public function connectClient()
  27769. {
  27770. $p4CreateClientCommand = $this->generateP4Command(
  27771. 'client -i < ' . str_replace(" ", "\\ ", $this->getP4ClientSpec())
  27772. );
  27773. $this->executeCommand($p4CreateClientCommand);
  27774. }
  27775. public function syncCodeBase($sourceReference)
  27776. {
  27777. $prevDir = getcwd();
  27778. chdir($this->path);
  27779. $p4SyncCommand = $this->generateP4Command('sync -f ');
  27780. if (null !== $sourceReference) {
  27781. $p4SyncCommand .= '@' . $sourceReference;
  27782. }
  27783. $this->executeCommand($p4SyncCommand);
  27784. chdir($prevDir);
  27785. }
  27786. public function writeClientSpecToFile($spec)
  27787. {
  27788. fwrite($spec, 'Client: ' . $this->getClient() . PHP_EOL . PHP_EOL);
  27789. fwrite($spec, 'Update: ' . date('Y/m/d H:i:s') . PHP_EOL . PHP_EOL);
  27790. fwrite($spec, 'Access: ' . date('Y/m/d H:i:s') . PHP_EOL);
  27791. fwrite($spec, 'Owner: ' . $this->getUser() . PHP_EOL . PHP_EOL);
  27792. fwrite($spec, 'Description:' . PHP_EOL);
  27793. fwrite($spec, ' Created by ' . $this->getUser() . ' from composer.' . PHP_EOL . PHP_EOL);
  27794. fwrite($spec, 'Root: ' . $this->getPath() . PHP_EOL . PHP_EOL);
  27795. fwrite($spec, 'Options: noallwrite noclobber nocompress unlocked modtime rmdir' . PHP_EOL . PHP_EOL);
  27796. fwrite($spec, 'SubmitOptions: revertunchanged' . PHP_EOL . PHP_EOL);
  27797. fwrite($spec, 'LineEnd: local' . PHP_EOL . PHP_EOL);
  27798. if ($this->isStream()) {
  27799. fwrite($spec, 'Stream:' . PHP_EOL);
  27800. fwrite($spec, ' ' . $this->getStreamWithoutLabel($this->p4Stream) . PHP_EOL);
  27801. } else {
  27802. fwrite(
  27803. $spec,
  27804. 'View: ' . $this->getStream() . '/... //' . $this->getClient() . '/... ' . PHP_EOL
  27805. );
  27806. }
  27807. }
  27808. public function writeP4ClientSpec()
  27809. {
  27810. $clientSpec = $this->getP4ClientSpec();
  27811. $spec = fopen($clientSpec, 'w');
  27812. try {
  27813. $this->writeClientSpecToFile($spec);
  27814. } catch (\Exception $e) {
  27815. fclose($spec);
  27816. throw $e;
  27817. }
  27818. fclose($spec);
  27819. }
  27820. protected function read($pipe, $name)
  27821. {
  27822. if (feof($pipe)) {
  27823. return;
  27824. }
  27825. $line = fgets($pipe);
  27826. while ($line !== false) {
  27827. $line = fgets($pipe);
  27828. }
  27829. }
  27830. public function windowsLogin($password)
  27831. {
  27832. $command = $this->generateP4Command(' login -a');
  27833. if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
  27834. $process = Process::fromShellCommandline($command, null, null, $password);
  27835. } else {
  27836. $process = new Process($command, null, null, $password);
  27837. }
  27838. return $process->run();
  27839. }
  27840. public function p4Login()
  27841. {
  27842. $this->queryP4User();
  27843. if (!$this->isLoggedIn()) {
  27844. $password = $this->queryP4Password();
  27845. if ($this->windowsFlag) {
  27846. $this->windowsLogin($password);
  27847. } else {
  27848. $command = 'echo ' . ProcessExecutor::escape($password) . ' | ' . $this->generateP4Command(' login -a', false);
  27849. $exitCode = $this->executeCommand($command);
  27850. $result = trim($this->commandResult);
  27851. if ($exitCode) {
  27852. throw new \Exception("Error logging in:" . $this->process->getErrorOutput());
  27853. }
  27854. }
  27855. }
  27856. }
  27857. public function getComposerInformation($identifier)
  27858. {
  27859. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  27860. if (!$composerFileContent) {
  27861. return;
  27862. }
  27863. return json_decode($composerFileContent, true);
  27864. }
  27865. public function getFileContent($file, $identifier)
  27866. {
  27867. $path = $this->getFilePath($file, $identifier);
  27868. $command = $this->generateP4Command(' print ' . ProcessExecutor::escape($path));
  27869. $this->executeCommand($command);
  27870. $result = $this->commandResult;
  27871. if (!trim($result)) {
  27872. return null;
  27873. }
  27874. return $result;
  27875. }
  27876. public function getFilePath($file, $identifier)
  27877. {
  27878. $index = strpos($identifier, '@');
  27879. if ($index === false) {
  27880. $path = $identifier. '/' . $file;
  27881. return $path;
  27882. }
  27883. $path = substr($identifier, 0, $index) . '/' . $file . substr($identifier, $index);
  27884. $command = $this->generateP4Command(' files ' . ProcessExecutor::escape($path), false);
  27885. $this->executeCommand($command);
  27886. $result = $this->commandResult;
  27887. $index2 = strpos($result, 'no such file(s).');
  27888. if ($index2 === false) {
  27889. $index3 = strpos($result, 'change');
  27890. if ($index3 !== false) {
  27891. $phrase = trim(substr($result, $index3));
  27892. $fields = explode(' ', $phrase);
  27893. return substr($identifier, 0, $index) . '/' . $file . '@' . $fields[1];
  27894. }
  27895. }
  27896. return null;
  27897. }
  27898. public function getBranches()
  27899. {
  27900. $possibleBranches = array();
  27901. if (!$this->isStream()) {
  27902. $possibleBranches[$this->p4Branch] = $this->getStream();
  27903. } else {
  27904. $command = $this->generateP4Command('streams '.ProcessExecutor::escape('//' . $this->p4Depot . '/...'));
  27905. $this->executeCommand($command);
  27906. $result = $this->commandResult;
  27907. $resArray = explode(PHP_EOL, $result);
  27908. foreach ($resArray as $line) {
  27909. $resBits = explode(' ', $line);
  27910. if (count($resBits) > 4) {
  27911. $branch = preg_replace('/[^A-Za-z0-9 ]/', '', $resBits[4]);
  27912. $possibleBranches[$branch] = $resBits[1];
  27913. }
  27914. }
  27915. }
  27916. $command = $this->generateP4Command('changes '. ProcessExecutor::escape($this->getStream() . '/...'), false);
  27917. $this->executeCommand($command);
  27918. $result = $this->commandResult;
  27919. $resArray = explode(PHP_EOL, $result);
  27920. $lastCommit = $resArray[0];
  27921. $lastCommitArr = explode(' ', $lastCommit);
  27922. $lastCommitNum = $lastCommitArr[1];
  27923. $branches = array('master' => $possibleBranches[$this->p4Branch] . '@'. $lastCommitNum);
  27924. return $branches;
  27925. }
  27926. public function getTags()
  27927. {
  27928. $command = $this->generateP4Command('labels');
  27929. $this->executeCommand($command);
  27930. $result = $this->commandResult;
  27931. $resArray = explode(PHP_EOL, $result);
  27932. $tags = array();
  27933. foreach ($resArray as $line) {
  27934. if (strpos($line, 'Label') !== false) {
  27935. $fields = explode(' ', $line);
  27936. $tags[$fields[1]] = $this->getStream() . '@' . $fields[1];
  27937. }
  27938. }
  27939. return $tags;
  27940. }
  27941. public function checkStream()
  27942. {
  27943. $command = $this->generateP4Command('depots', false);
  27944. $this->executeCommand($command);
  27945. $result = $this->commandResult;
  27946. $resArray = explode(PHP_EOL, $result);
  27947. foreach ($resArray as $line) {
  27948. if (strpos($line, 'Depot') !== false) {
  27949. $fields = explode(' ', $line);
  27950. if (strcmp($this->p4Depot, $fields[1]) === 0) {
  27951. $this->p4DepotType = $fields[3];
  27952. return $this->isStream();
  27953. }
  27954. }
  27955. }
  27956. return false;
  27957. }
  27958. protected function getChangeList($reference)
  27959. {
  27960. $index = strpos($reference, '@');
  27961. if ($index === false) {
  27962. return null;
  27963. }
  27964. $label = substr($reference, $index);
  27965. $command = $this->generateP4Command(' changes -m1 ' . ProcessExecutor::escape($label));
  27966. $this->executeCommand($command);
  27967. $changes = $this->commandResult;
  27968. if (strpos($changes, 'Change') !== 0) {
  27969. return null;
  27970. }
  27971. $fields = explode(' ', $changes);
  27972. return $fields[1];
  27973. }
  27974. public function getCommitLogs($fromReference, $toReference)
  27975. {
  27976. $fromChangeList = $this->getChangeList($fromReference);
  27977. if ($fromChangeList === null) {
  27978. return null;
  27979. }
  27980. $toChangeList = $this->getChangeList($toReference);
  27981. if ($toChangeList === null) {
  27982. return null;
  27983. }
  27984. $index = strpos($fromReference, '@');
  27985. $main = substr($fromReference, 0, $index) . '/...';
  27986. $command = $this->generateP4Command('filelog ' . ProcessExecutor::escape($main . '@' . $fromChangeList. ',' . $toChangeList));
  27987. $this->executeCommand($command);
  27988. return $this->commandResult;
  27989. }
  27990. public function getFilesystem()
  27991. {
  27992. if (empty($this->filesystem)) {
  27993. $this->filesystem = new Filesystem($this->process);
  27994. }
  27995. return $this->filesystem;
  27996. }
  27997. public function setFilesystem(Filesystem $fs)
  27998. {
  27999. $this->filesystem = $fs;
  28000. }
  28001. }
  28002. <?php
  28003. namespace Composer\Util;
  28004. class Platform
  28005. {
  28006. public static function expandPath($path)
  28007. {
  28008. if (preg_match('#^~[\\/]#', $path)) {
  28009. return self::getUserDirectory() . substr($path, 1);
  28010. }
  28011. return preg_replace_callback('#^(\$|(?P<percent>%))(?P<var>\w++)(?(percent)%)(?P<path>.*)#', function ($matches) {
  28012. if (Platform::isWindows() && $matches['var'] == 'HOME') {
  28013. return (getenv('HOME') ?: getenv('USERPROFILE')) . $matches['path'];
  28014. }
  28015. return getenv($matches['var']) . $matches['path'];
  28016. }, $path);
  28017. }
  28018. public static function getUserDirectory()
  28019. {
  28020. if (false !== ($home = getenv('HOME'))) {
  28021. return $home;
  28022. }
  28023. if (self::isWindows() && false !== ($home = getenv('USERPROFILE'))) {
  28024. return $home;
  28025. }
  28026. if (function_exists('posix_getuid') && function_exists('posix_getpwuid')) {
  28027. $info = posix_getpwuid(posix_getuid());
  28028. return $info['dir'];
  28029. }
  28030. throw new \RuntimeException('Could not determine user directory');
  28031. }
  28032. public static function isWindows()
  28033. {
  28034. return defined('PHP_WINDOWS_VERSION_BUILD');
  28035. }
  28036. public static function strlen($str)
  28037. {
  28038. static $useMbString = null;
  28039. if (null === $useMbString) {
  28040. $useMbString = function_exists('mb_strlen') && ini_get('mbstring.func_overload');
  28041. }
  28042. if ($useMbString) {
  28043. return mb_strlen($str, '8bit');
  28044. }
  28045. return strlen($str);
  28046. }
  28047. }
  28048. <?php
  28049. namespace Composer\Util;
  28050. use Composer\IO\IOInterface;
  28051. use Symfony\Component\Process\Process;
  28052. use Symfony\Component\Process\ProcessUtils;
  28053. class ProcessExecutor
  28054. {
  28055. protected static $timeout = 300;
  28056. protected $captureOutput;
  28057. protected $errorOutput;
  28058. protected $io;
  28059. public function __construct(IOInterface $io = null)
  28060. {
  28061. $this->io = $io;
  28062. }
  28063. public function execute($command, &$output = null, $cwd = null)
  28064. {
  28065. if ($this->io && $this->io->isDebug()) {
  28066. $safeCommand = preg_replace_callback('{://(?P<user>[^:/\s]+):(?P<password>[^@\s/]+)@}i', function ($m) {
  28067. if (preg_match('{^[a-f0-9]{12,}$}', $m['user'])) {
  28068. return '://***:***@';
  28069. }
  28070. return '://'.$m['user'].':***@';
  28071. }, $command);
  28072. $safeCommand = preg_replace("{--password (.*[^\\\\]\') }", '--password \'***\' ', $safeCommand);
  28073. $this->io->writeError('Executing command ('.($cwd ?: 'CWD').'): '.$safeCommand);
  28074. }
  28075. if (null === $cwd && Platform::isWindows() && false !== strpos($command, 'git') && getcwd()) {
  28076. $cwd = realpath(getcwd());
  28077. }
  28078. $this->captureOutput = func_num_args() > 1;
  28079. $this->errorOutput = null;
  28080. if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
  28081. $process = Process::fromShellCommandline($command, $cwd, null, null, static::getTimeout());
  28082. } else {
  28083. $process = new Process($command, $cwd, null, null, static::getTimeout());
  28084. }
  28085. $callback = is_callable($output) ? $output : array($this, 'outputHandler');
  28086. $process->run($callback);
  28087. if ($this->captureOutput && !is_callable($output)) {
  28088. $output = $process->getOutput();
  28089. }
  28090. $this->errorOutput = $process->getErrorOutput();
  28091. return $process->getExitCode();
  28092. }
  28093. public function splitLines($output)
  28094. {
  28095. $output = trim($output);
  28096. return ((string) $output === '') ? array() : preg_split('{\r?\n}', $output);
  28097. }
  28098. public function getErrorOutput()
  28099. {
  28100. return $this->errorOutput;
  28101. }
  28102. public function outputHandler($type, $buffer)
  28103. {
  28104. if ($this->captureOutput) {
  28105. return;
  28106. }
  28107. if (null === $this->io) {
  28108. echo $buffer;
  28109. return;
  28110. }
  28111. if (method_exists($this->io, 'writeRaw')) {
  28112. if (Process::ERR === $type) {
  28113. $this->io->writeErrorRaw($buffer, false);
  28114. } else {
  28115. $this->io->writeRaw($buffer, false);
  28116. }
  28117. } else {
  28118. if (Process::ERR === $type) {
  28119. $this->io->writeError($buffer, false);
  28120. } else {
  28121. $this->io->write($buffer, false);
  28122. }
  28123. }
  28124. }
  28125. public static function getTimeout()
  28126. {
  28127. return static::$timeout;
  28128. }
  28129. public static function setTimeout($timeout)
  28130. {
  28131. static::$timeout = $timeout;
  28132. }
  28133. public static function escape($argument)
  28134. {
  28135. return self::escapeArgument($argument);
  28136. }
  28137. private static function escapeArgument($argument)
  28138. {
  28139. if ('\\' === DIRECTORY_SEPARATOR) {
  28140. if ((string) $argument === '') {
  28141. return escapeshellarg($argument);
  28142. }
  28143. $escapedArgument = '';
  28144. $quote = false;
  28145. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  28146. if ('"' === $part) {
  28147. $escapedArgument .= '\\"';
  28148. } elseif (self::isSurroundedBy($part, '%')) {
  28149. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  28150. } else {
  28151. if ('\\' === substr($part, -1)) {
  28152. $part .= '\\';
  28153. }
  28154. $quote = true;
  28155. $escapedArgument .= $part;
  28156. }
  28157. }
  28158. if ($quote) {
  28159. $escapedArgument = '"'.$escapedArgument.'"';
  28160. }
  28161. return $escapedArgument;
  28162. }
  28163. return "'".str_replace("'", "'\\''", $argument)."'";
  28164. }
  28165. private static function isSurroundedBy($arg, $char)
  28166. {
  28167. return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
  28168. }
  28169. }
  28170. <?php
  28171. namespace Composer\Util;
  28172. use Composer\Config;
  28173. use Composer\Composer;
  28174. use Composer\Semver\Constraint\Constraint;
  28175. use Composer\Package\Version\VersionParser;
  28176. use Composer\IO\IOInterface;
  28177. use Composer\Downloader\TransportException;
  28178. use Composer\CaBundle\CaBundle;
  28179. use Psr\Log\LoggerInterface;
  28180. class RemoteFilesystem
  28181. {
  28182. private $io;
  28183. private $config;
  28184. private $scheme;
  28185. private $bytesMax;
  28186. private $originUrl;
  28187. private $fileUrl;
  28188. private $fileName;
  28189. private $retry;
  28190. private $progress;
  28191. private $lastProgress;
  28192. private $options = array();
  28193. private $peerCertificateMap = array();
  28194. private $disableTls = false;
  28195. private $retryAuthFailure;
  28196. private $lastHeaders;
  28197. private $storeAuth;
  28198. private $degradedMode = false;
  28199. private $redirects;
  28200. private $maxRedirects = 20;
  28201. private $displayedOriginAuthentications = array();
  28202. public function __construct(IOInterface $io, Config $config = null, array $options = array(), $disableTls = false)
  28203. {
  28204. $this->io = $io;
  28205. if ($disableTls === false) {
  28206. $this->options = $this->getTlsDefaults($options);
  28207. } else {
  28208. $this->disableTls = true;
  28209. }
  28210. $this->options = array_replace_recursive($this->options, $options);
  28211. $this->config = $config;
  28212. }
  28213. public function copy($originUrl, $fileUrl, $fileName, $progress = true, $options = array())
  28214. {
  28215. return $this->get($originUrl, $fileUrl, $options, $fileName, $progress);
  28216. }
  28217. public function getContents($originUrl, $fileUrl, $progress = true, $options = array())
  28218. {
  28219. return $this->get($originUrl, $fileUrl, $options, null, $progress);
  28220. }
  28221. public function getOptions()
  28222. {
  28223. return $this->options;
  28224. }
  28225. public function setOptions(array $options)
  28226. {
  28227. $this->options = array_replace_recursive($this->options, $options);
  28228. }
  28229. public function isTlsDisabled()
  28230. {
  28231. return $this->disableTls === true;
  28232. }
  28233. public function getLastHeaders()
  28234. {
  28235. return $this->lastHeaders;
  28236. }
  28237. public function findHeaderValue(array $headers, $name)
  28238. {
  28239. $value = null;
  28240. foreach ($headers as $header) {
  28241. if (preg_match('{^'.$name.':\s*(.+?)\s*$}i', $header, $match)) {
  28242. $value = $match[1];
  28243. } elseif (preg_match('{^HTTP/}i', $header)) {
  28244. $value = null;
  28245. }
  28246. }
  28247. return $value;
  28248. }
  28249. public function findStatusCode(array $headers)
  28250. {
  28251. $value = null;
  28252. foreach ($headers as $header) {
  28253. if (preg_match('{^HTTP/\S+ (\d+)}i', $header, $match)) {
  28254. $value = (int) $match[1];
  28255. }
  28256. }
  28257. return $value;
  28258. }
  28259. public function findStatusMessage(array $headers)
  28260. {
  28261. $value = null;
  28262. foreach ($headers as $header) {
  28263. if (preg_match('{^HTTP/\S+ \d+}i', $header)) {
  28264. $value = $header;
  28265. }
  28266. }
  28267. return $value;
  28268. }
  28269. protected function get($originUrl, $fileUrl, $additionalOptions = array(), $fileName = null, $progress = true)
  28270. {
  28271. if (strpos($originUrl, '.github.com') === (strlen($originUrl) - 11)) {
  28272. $originUrl = 'github.com';
  28273. }
  28274. if (
  28275. $this->config
  28276. && is_array($this->config->get('gitlab-domains'))
  28277. && false === strpos($originUrl, '/')
  28278. && !in_array($originUrl, $this->config->get('gitlab-domains'))
  28279. ) {
  28280. foreach ($this->config->get('gitlab-domains') as $gitlabDomain) {
  28281. if (0 === strpos($gitlabDomain, $originUrl)) {
  28282. $originUrl = $gitlabDomain;
  28283. break;
  28284. }
  28285. }
  28286. unset($gitlabDomain);
  28287. }
  28288. $this->scheme = parse_url($fileUrl, PHP_URL_SCHEME);
  28289. $this->bytesMax = 0;
  28290. $this->originUrl = $originUrl;
  28291. $this->fileUrl = $fileUrl;
  28292. $this->fileName = $fileName;
  28293. $this->progress = $progress;
  28294. $this->lastProgress = null;
  28295. $this->retryAuthFailure = true;
  28296. $this->lastHeaders = array();
  28297. $this->redirects = 1;
  28298. if (preg_match('{^https?://([^:/]+):([^@/]+)@([^/]+)}i', $fileUrl, $match)) {
  28299. $this->io->setAuthentication($originUrl, rawurldecode($match[1]), rawurldecode($match[2]));
  28300. }
  28301. $tempAdditionalOptions = $additionalOptions;
  28302. if (isset($tempAdditionalOptions['retry-auth-failure'])) {
  28303. $this->retryAuthFailure = (bool) $tempAdditionalOptions['retry-auth-failure'];
  28304. unset($tempAdditionalOptions['retry-auth-failure']);
  28305. }
  28306. $isRedirect = false;
  28307. if (isset($tempAdditionalOptions['redirects'])) {
  28308. $this->redirects = $tempAdditionalOptions['redirects'];
  28309. $isRedirect = true;
  28310. unset($tempAdditionalOptions['redirects']);
  28311. }
  28312. $options = $this->getOptionsForUrl($originUrl, $tempAdditionalOptions);
  28313. unset($tempAdditionalOptions);
  28314. $origFileUrl = $fileUrl;
  28315. if (isset($options['github-token'])) {
  28316. if (preg_match('{^https?://api\.github\.com/}', $fileUrl)) {
  28317. $options['http']['header'][] = 'Authorization: token '.$options['github-token'];
  28318. }
  28319. unset($options['github-token']);
  28320. }
  28321. if (isset($options['gitlab-token'])) {
  28322. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['gitlab-token'];
  28323. unset($options['gitlab-token']);
  28324. }
  28325. if (isset($options['http'])) {
  28326. $options['http']['ignore_errors'] = true;
  28327. }
  28328. if ($this->degradedMode && substr($fileUrl, 0, 26) === 'http://repo.packagist.org/') {
  28329. $fileUrl = 'http://' . gethostbyname('repo.packagist.org') . substr($fileUrl, 20);
  28330. $degradedPackagist = true;
  28331. }
  28332. $ctx = StreamContextFactory::getContext($fileUrl, $options, array('notification' => array($this, 'callbackGet')));
  28333. $actualContextOptions = stream_context_get_options($ctx);
  28334. $usingProxy = !empty($actualContextOptions['http']['proxy']) ? ' using proxy ' . $actualContextOptions['http']['proxy'] : '';
  28335. $this->io->writeError((substr($origFileUrl, 0, 4) === 'http' ? 'Downloading ' : 'Reading ') . $this->stripCredentialsFromUrl($origFileUrl) . $usingProxy, true, IOInterface::DEBUG);
  28336. unset($origFileUrl, $actualContextOptions);
  28337. if ((!preg_match('{^http://(repo\.)?packagist\.org/p/}', $fileUrl) || (false === strpos($fileUrl, '$') && false === strpos($fileUrl, '%24'))) && empty($degradedPackagist) && $this->config) {
  28338. $this->config->prohibitUrlByConfig($fileUrl, $this->io);
  28339. }
  28340. if ($this->progress && !$isRedirect) {
  28341. $this->io->writeError("Downloading (<comment>connecting...</comment>)", false);
  28342. }
  28343. $errorMessage = '';
  28344. $errorCode = 0;
  28345. $result = false;
  28346. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  28347. if ($errorMessage) {
  28348. $errorMessage .= "\n";
  28349. }
  28350. $errorMessage .= preg_replace('{^file_get_contents\(.*?\): }', '', $msg);
  28351. return true;
  28352. });
  28353. try {
  28354. $result = $this->getRemoteContents($originUrl, $fileUrl, $ctx, $http_response_header);
  28355. if (!empty($http_response_header[0])) {
  28356. $statusCode = $this->findStatusCode($http_response_header);
  28357. if ($statusCode >= 400 && $this->findHeaderValue($http_response_header, 'content-type') === 'application/json') {
  28358. self::outputWarnings($this->io, $originUrl, json_decode($result, true));
  28359. }
  28360. if (in_array($statusCode, array(401, 403)) && $this->retryAuthFailure) {
  28361. $this->promptAuthAndRetry($statusCode, $this->findStatusMessage($http_response_header), null, $http_response_header);
  28362. }
  28363. }
  28364. $contentLength = !empty($http_response_header[0]) ? $this->findHeaderValue($http_response_header, 'content-length') : null;
  28365. if ($contentLength && Platform::strlen($result) < $contentLength) {
  28366. $e = new TransportException('Content-Length mismatch, received '.Platform::strlen($result).' bytes out of the expected '.$contentLength);
  28367. $e->setHeaders($http_response_header);
  28368. $e->setStatusCode($this->findStatusCode($http_response_header));
  28369. $e->setResponse($result);
  28370. $this->io->writeError('Content-Length mismatch, received '.Platform::strlen($result).' out of '.$contentLength.' bytes: (' . base64_encode($result).')', true, IOInterface::DEBUG);
  28371. throw $e;
  28372. }
  28373. if (PHP_VERSION_ID < 50600 && !empty($options['ssl']['peer_fingerprint'])) {
  28374. $params = stream_context_get_params($ctx);
  28375. $expectedPeerFingerprint = $options['ssl']['peer_fingerprint'];
  28376. $peerFingerprint = TlsHelper::getCertificateFingerprint($params['options']['ssl']['peer_certificate']);
  28377. if ($expectedPeerFingerprint !== $peerFingerprint) {
  28378. throw new TransportException('Peer fingerprint did not match');
  28379. }
  28380. }
  28381. } catch (\Exception $e) {
  28382. if ($e instanceof TransportException && !empty($http_response_header[0])) {
  28383. $e->setHeaders($http_response_header);
  28384. $e->setStatusCode($this->findStatusCode($http_response_header));
  28385. }
  28386. if ($e instanceof TransportException && $result !== false) {
  28387. $e->setResponse($result);
  28388. }
  28389. $result = false;
  28390. }
  28391. if ($errorMessage && !filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
  28392. $errorMessage = 'allow_url_fopen must be enabled in php.ini ('.$errorMessage.')';
  28393. }
  28394. restore_error_handler();
  28395. if (isset($e) && !$this->retry) {
  28396. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  28397. $this->degradedMode = true;
  28398. $this->io->writeError('');
  28399. $this->io->writeError(array(
  28400. '<error>'.$e->getMessage().'</error>',
  28401. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  28402. ));
  28403. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  28404. }
  28405. throw $e;
  28406. }
  28407. $statusCode = null;
  28408. $contentType = null;
  28409. $locationHeader = null;
  28410. if (!empty($http_response_header[0])) {
  28411. $statusCode = $this->findStatusCode($http_response_header);
  28412. $contentType = $this->findHeaderValue($http_response_header, 'content-type');
  28413. $locationHeader = $this->findHeaderValue($http_response_header, 'location');
  28414. }
  28415. if ($originUrl === 'bitbucket.org'
  28416. && !$this->isPublicBitBucketDownload($fileUrl)
  28417. && substr($fileUrl, -4) === '.zip'
  28418. && (!$locationHeader || substr(parse_url($locationHeader, PHP_URL_PATH), -4) !== '.zip')
  28419. && $contentType && preg_match('{^text/html\b}i', $contentType)
  28420. ) {
  28421. $result = false;
  28422. if ($this->retryAuthFailure) {
  28423. $this->promptAuthAndRetry(401);
  28424. }
  28425. }
  28426. if ($statusCode === 404
  28427. && $this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)
  28428. && false !== strpos($fileUrl, 'archive.zip')
  28429. ) {
  28430. $result = false;
  28431. if ($this->retryAuthFailure) {
  28432. $this->promptAuthAndRetry(401);
  28433. }
  28434. }
  28435. $hasFollowedRedirect = false;
  28436. if ($statusCode >= 300 && $statusCode <= 399 && $statusCode !== 304 && $this->redirects < $this->maxRedirects) {
  28437. $hasFollowedRedirect = true;
  28438. $result = $this->handleRedirect($http_response_header, $additionalOptions, $result);
  28439. }
  28440. if ($statusCode && $statusCode >= 400 && $statusCode <= 599) {
  28441. if (!$this->retry) {
  28442. if ($this->progress && !$this->retry && !$isRedirect) {
  28443. $this->io->overwriteError("Downloading (<error>failed</error>)", false);
  28444. }
  28445. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded ('.$http_response_header[0].')', $statusCode);
  28446. $e->setHeaders($http_response_header);
  28447. $e->setResponse($result);
  28448. $e->setStatusCode($statusCode);
  28449. throw $e;
  28450. }
  28451. $result = false;
  28452. }
  28453. if ($this->progress && !$this->retry && !$isRedirect) {
  28454. $this->io->overwriteError("Downloading (".($result === false ? '<error>failed</error>' : '<comment>100%</comment>').")", false);
  28455. }
  28456. if ($result && extension_loaded('zlib') && substr($fileUrl, 0, 4) === 'http' && !$hasFollowedRedirect) {
  28457. $contentEncoding = $this->findHeaderValue($http_response_header, 'content-encoding');
  28458. $decode = $contentEncoding && 'gzip' === strtolower($contentEncoding);
  28459. if ($decode) {
  28460. try {
  28461. if (PHP_VERSION_ID >= 50400) {
  28462. $result = zlib_decode($result);
  28463. } else {
  28464. $result = file_get_contents('compress.zlib://data:application/octet-stream;base64,'.base64_encode($result));
  28465. }
  28466. if (!$result) {
  28467. throw new TransportException('Failed to decode zlib stream');
  28468. }
  28469. } catch (\Exception $e) {
  28470. if ($this->degradedMode) {
  28471. throw $e;
  28472. }
  28473. $this->degradedMode = true;
  28474. $this->io->writeError(array(
  28475. '',
  28476. '<error>Failed to decode response: '.$e->getMessage().'</error>',
  28477. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  28478. ));
  28479. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  28480. }
  28481. }
  28482. }
  28483. if (false !== $result && null !== $fileName && !$isRedirect) {
  28484. if ('' === $result) {
  28485. throw new TransportException('"'.$this->fileUrl.'" appears broken, and returned an empty 200 response');
  28486. }
  28487. $errorMessage = '';
  28488. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  28489. if ($errorMessage) {
  28490. $errorMessage .= "\n";
  28491. }
  28492. $errorMessage .= preg_replace('{^file_put_contents\(.*?\): }', '', $msg);
  28493. return true;
  28494. });
  28495. $result = (bool) file_put_contents($fileName, $result);
  28496. restore_error_handler();
  28497. if (false === $result) {
  28498. throw new TransportException('The "'.$this->fileUrl.'" file could not be written to '.$fileName.': '.$errorMessage);
  28499. }
  28500. }
  28501. if (false === $result && false !== strpos($errorMessage, 'Peer certificate') && PHP_VERSION_ID < 50600) {
  28502. if (CaBundle::isOpensslParseSafe()) {
  28503. $certDetails = $this->getCertificateCnAndFp($this->fileUrl, $options);
  28504. if ($certDetails) {
  28505. $this->peerCertificateMap[$this->getUrlAuthority($this->fileUrl)] = $certDetails;
  28506. $this->retry = true;
  28507. }
  28508. } else {
  28509. $this->io->writeError('');
  28510. $this->io->writeError(sprintf(
  28511. '<error>Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.</error>',
  28512. PHP_VERSION
  28513. ));
  28514. }
  28515. }
  28516. if ($this->retry) {
  28517. $this->retry = false;
  28518. $result = $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  28519. if ($this->storeAuth && $this->config) {
  28520. $authHelper = new AuthHelper($this->io, $this->config);
  28521. $authHelper->storeAuth($this->originUrl, $this->storeAuth);
  28522. $this->storeAuth = false;
  28523. }
  28524. return $result;
  28525. }
  28526. if (false === $result) {
  28527. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded: '.$errorMessage, $errorCode);
  28528. if (!empty($http_response_header[0])) {
  28529. $e->setHeaders($http_response_header);
  28530. }
  28531. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  28532. $this->degradedMode = true;
  28533. $this->io->writeError('');
  28534. $this->io->writeError(array(
  28535. '<error>'.$e->getMessage().'</error>',
  28536. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  28537. ));
  28538. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  28539. }
  28540. throw $e;
  28541. }
  28542. if (!empty($http_response_header[0])) {
  28543. $this->lastHeaders = $http_response_header;
  28544. }
  28545. return $result;
  28546. }
  28547. protected function getRemoteContents($originUrl, $fileUrl, $context, array &$responseHeaders = null)
  28548. {
  28549. try {
  28550. $e = null;
  28551. $result = file_get_contents($fileUrl, false, $context);
  28552. } catch (\Throwable $e) {
  28553. } catch (\Exception $e) {
  28554. }
  28555. $responseHeaders = isset($http_response_header) ? $http_response_header : array();
  28556. if (null !== $e) {
  28557. throw $e;
  28558. }
  28559. return $result;
  28560. }
  28561. protected function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax)
  28562. {
  28563. switch ($notificationCode) {
  28564. case STREAM_NOTIFY_FAILURE:
  28565. if (400 === $messageCode) {
  28566. throw new TransportException("The '" . $this->fileUrl . "' URL could not be accessed: " . $message, $messageCode);
  28567. }
  28568. break;
  28569. case STREAM_NOTIFY_FILE_SIZE_IS:
  28570. $this->bytesMax = $bytesMax;
  28571. break;
  28572. case STREAM_NOTIFY_PROGRESS:
  28573. if ($this->bytesMax > 0 && $this->progress) {
  28574. $progression = min(100, round($bytesTransferred / $this->bytesMax * 100));
  28575. if ((0 === $progression % 5) && 100 !== $progression && $progression !== $this->lastProgress) {
  28576. $this->lastProgress = $progression;
  28577. $this->io->overwriteError("Downloading (<comment>$progression%</comment>)", false);
  28578. }
  28579. }
  28580. break;
  28581. default:
  28582. break;
  28583. }
  28584. }
  28585. protected function promptAuthAndRetry($httpStatus, $reason = null, $warning = null, $headers = array())
  28586. {
  28587. if ($this->config && in_array($this->originUrl, $this->config->get('github-domains'), true)) {
  28588. $gitHubUtil = new GitHub($this->io, $this->config, null);
  28589. $message = "\n";
  28590. $rateLimited = $gitHubUtil->isRateLimited($headers);
  28591. if ($rateLimited) {
  28592. $rateLimit = $gitHubUtil->getRateLimit($headers);
  28593. if ($this->io->hasAuthentication($this->originUrl)) {
  28594. $message = 'Review your configured GitHub OAuth token or enter a new one to go over the API rate limit.';
  28595. } else {
  28596. $message = 'Create a GitHub OAuth token to go over the API rate limit.';
  28597. }
  28598. $message = sprintf(
  28599. 'GitHub API limit (%d calls/hr) is exhausted, could not fetch '.$this->fileUrl.'. '.$message.' You can also wait until %s for the rate limit to reset.',
  28600. $rateLimit['limit'],
  28601. $rateLimit['reset']
  28602. )."\n";
  28603. } else {
  28604. $message .= 'Could not fetch '.$this->fileUrl.', please ';
  28605. if ($this->io->hasAuthentication($this->originUrl)) {
  28606. $message .= 'review your configured GitHub OAuth token or enter a new one to access private repos';
  28607. } else {
  28608. $message .= 'create a GitHub OAuth token to access private repos';
  28609. }
  28610. }
  28611. if (!$gitHubUtil->authorizeOAuth($this->originUrl)
  28612. && (!$this->io->isInteractive() || !$gitHubUtil->authorizeOAuthInteractively($this->originUrl, $message))
  28613. ) {
  28614. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  28615. }
  28616. } elseif ($this->config && in_array($this->originUrl, $this->config->get('gitlab-domains'), true)) {
  28617. $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');
  28618. $gitLabUtil = new GitLab($this->io, $this->config, null);
  28619. if ($this->io->hasAuthentication($this->originUrl) && ($auth = $this->io->getAuthentication($this->originUrl)) && in_array($auth['password'], array('gitlab-ci-token', 'private-token', 'oauth2'), true)) {
  28620. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  28621. }
  28622. if (!$gitLabUtil->authorizeOAuth($this->originUrl)
  28623. && (!$this->io->isInteractive() || !$gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, $message))
  28624. ) {
  28625. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  28626. }
  28627. } elseif ($this->config && $this->originUrl === 'bitbucket.org') {
  28628. $askForOAuthToken = true;
  28629. if ($this->io->hasAuthentication($this->originUrl)) {
  28630. $auth = $this->io->getAuthentication($this->originUrl);
  28631. if ($auth['username'] !== 'x-token-auth') {
  28632. $bitbucketUtil = new Bitbucket($this->io, $this->config);
  28633. $accessToken = $bitbucketUtil->requestToken($this->originUrl, $auth['username'], $auth['password']);
  28634. if (!empty($accessToken)) {
  28635. $this->io->setAuthentication($this->originUrl, 'x-token-auth', $accessToken);
  28636. $askForOAuthToken = false;
  28637. }
  28638. } else {
  28639. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  28640. }
  28641. }
  28642. if ($askForOAuthToken) {
  28643. $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');
  28644. $bitBucketUtil = new Bitbucket($this->io, $this->config);
  28645. if (! $bitBucketUtil->authorizeOAuth($this->originUrl)
  28646. && (! $this->io->isInteractive() || !$bitBucketUtil->authorizeOAuthInteractively($this->originUrl, $message))
  28647. ) {
  28648. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  28649. }
  28650. }
  28651. } else {
  28652. if ($httpStatus === 404) {
  28653. return;
  28654. }
  28655. if (!$this->io->isInteractive()) {
  28656. if ($httpStatus === 401) {
  28657. $message = "The '" . $this->fileUrl . "' URL required authentication.\nYou must be using the interactive console to authenticate";
  28658. }
  28659. if ($httpStatus === 403) {
  28660. $message = "The '" . $this->fileUrl . "' URL could not be accessed: " . $reason;
  28661. }
  28662. throw new TransportException($message, $httpStatus);
  28663. }
  28664. if ($this->io->hasAuthentication($this->originUrl)) {
  28665. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  28666. }
  28667. $this->io->writeError(' Authentication required (<info>'.$this->originUrl.'</info>):');
  28668. $username = $this->io->ask(' Username: ');
  28669. $password = $this->io->askAndHideAnswer(' Password: ');
  28670. $this->io->setAuthentication($this->originUrl, $username, $password);
  28671. $this->storeAuth = $this->config->get('store-auths');
  28672. }
  28673. $this->retry = true;
  28674. throw new TransportException('RETRY');
  28675. }
  28676. protected function getOptionsForUrl($originUrl, $additionalOptions)
  28677. {
  28678. $tlsOptions = array();
  28679. if ($this->disableTls === false && PHP_VERSION_ID < 50600 && !stream_is_local($this->fileUrl)) {
  28680. $host = parse_url($this->fileUrl, PHP_URL_HOST);
  28681. if (PHP_VERSION_ID < 50304) {
  28682. if ($host === 'github.com' || $host === 'api.github.com') {
  28683. $host = '*.github.com';
  28684. }
  28685. }
  28686. $tlsOptions['ssl']['CN_match'] = $host;
  28687. $tlsOptions['ssl']['SNI_server_name'] = $host;
  28688. $urlAuthority = $this->getUrlAuthority($this->fileUrl);
  28689. if (isset($this->peerCertificateMap[$urlAuthority])) {
  28690. $certMap = $this->peerCertificateMap[$urlAuthority];
  28691. $this->io->writeError('', true, IOInterface::DEBUG);
  28692. $this->io->writeError(sprintf(
  28693. 'Using <info>%s</info> as CN for subjectAltName enabled host <info>%s</info>',
  28694. $certMap['cn'],
  28695. $urlAuthority
  28696. ), true, IOInterface::DEBUG);
  28697. $tlsOptions['ssl']['CN_match'] = $certMap['cn'];
  28698. $tlsOptions['ssl']['peer_fingerprint'] = $certMap['fp'];
  28699. } elseif (!CaBundle::isOpensslParseSafe() && $host === 'repo.packagist.org') {
  28700. $tlsOptions['ssl']['CN_match'] = 'packagist.org';
  28701. }
  28702. }
  28703. $headers = array();
  28704. if (extension_loaded('zlib')) {
  28705. $headers[] = 'Accept-Encoding: gzip';
  28706. }
  28707. $options = array_replace_recursive($this->options, $tlsOptions, $additionalOptions);
  28708. if (!$this->degradedMode) {
  28709. $options['http']['protocol_version'] = 1.1;
  28710. $headers[] = 'Connection: close';
  28711. }
  28712. if ($this->io->hasAuthentication($originUrl)) {
  28713. $authenticationDisplayMessage = null;
  28714. $auth = $this->io->getAuthentication($originUrl);
  28715. if ($auth['password'] === 'bearer') {
  28716. $headers[] = 'Authorization: Bearer '.$auth['username'];
  28717. } elseif ('github.com' === $originUrl && 'x-oauth-basic' === $auth['password']) {
  28718. $options['github-token'] = $auth['username'];
  28719. $authenticationDisplayMessage = 'Using GitHub token authentication';
  28720. } elseif ($this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  28721. if ($auth['password'] === 'oauth2') {
  28722. $headers[] = 'Authorization: Bearer '.$auth['username'];
  28723. $authenticationDisplayMessage = 'Using GitLab OAuth token authentication';
  28724. } elseif ($auth['password'] === 'private-token' || $auth['password'] === 'gitlab-ci-token') {
  28725. $headers[] = 'PRIVATE-TOKEN: '.$auth['username'];
  28726. $authenticationDisplayMessage = 'Using GitLab private token authentication';
  28727. }
  28728. } elseif ('bitbucket.org' === $originUrl
  28729. && $this->fileUrl !== Bitbucket::OAUTH2_ACCESS_TOKEN_URL && 'x-token-auth' === $auth['username']
  28730. ) {
  28731. if (!$this->isPublicBitBucketDownload($this->fileUrl)) {
  28732. $headers[] = 'Authorization: Bearer ' . $auth['password'];
  28733. $authenticationDisplayMessage = 'Using Bitbucket OAuth token authentication';
  28734. }
  28735. } else {
  28736. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  28737. $headers[] = 'Authorization: Basic '.$authStr;
  28738. $authenticationDisplayMessage = 'Using HTTP basic authentication with username "' . $auth['username'] . '"';
  28739. }
  28740. if ($authenticationDisplayMessage && !in_array($originUrl, $this->displayedOriginAuthentications, true)) {
  28741. $this->io->writeError($authenticationDisplayMessage, true, IOInterface::DEBUG);
  28742. $this->displayedOriginAuthentications[] = $originUrl;
  28743. }
  28744. }
  28745. $options['http']['follow_location'] = 0;
  28746. if (isset($options['http']['header']) && !is_array($options['http']['header'])) {
  28747. $options['http']['header'] = explode("\r\n", trim($options['http']['header'], "\r\n"));
  28748. }
  28749. foreach ($headers as $header) {
  28750. $options['http']['header'][] = $header;
  28751. }
  28752. return $options;
  28753. }
  28754. private function handleRedirect(array $http_response_header, array $additionalOptions, $result)
  28755. {
  28756. if ($locationHeader = $this->findHeaderValue($http_response_header, 'location')) {
  28757. if (parse_url($locationHeader, PHP_URL_SCHEME)) {
  28758. $targetUrl = $locationHeader;
  28759. } elseif (parse_url($locationHeader, PHP_URL_HOST)) {
  28760. $targetUrl = $this->scheme.':'.$locationHeader;
  28761. } elseif ('/' === $locationHeader[0]) {
  28762. $urlHost = parse_url($this->fileUrl, PHP_URL_HOST);
  28763. $targetUrl = preg_replace('{^(.+(?://|@)'.preg_quote($urlHost).'(?::\d+)?)(?:[/\?].*)?$}', '\1'.$locationHeader, $this->fileUrl);
  28764. } else {
  28765. $targetUrl = preg_replace('{^(.+/)[^/?]*(?:\?.*)?$}', '\1'.$locationHeader, $this->fileUrl);
  28766. }
  28767. }
  28768. if (!empty($targetUrl)) {
  28769. $this->redirects++;
  28770. $this->io->writeError('', true, IOInterface::DEBUG);
  28771. $this->io->writeError(sprintf('Following redirect (%u) %s', $this->redirects, $this->stripCredentialsFromUrl($targetUrl)), true, IOInterface::DEBUG);
  28772. $additionalOptions['redirects'] = $this->redirects;
  28773. return $this->get(parse_url($targetUrl, PHP_URL_HOST), $targetUrl, $additionalOptions, $this->fileName, $this->progress);
  28774. }
  28775. if (!$this->retry) {
  28776. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded, got redirect without Location ('.$http_response_header[0].')');
  28777. $e->setHeaders($http_response_header);
  28778. $e->setResponse($result);
  28779. throw $e;
  28780. }
  28781. return false;
  28782. }
  28783. private function getTlsDefaults(array $options)
  28784. {
  28785. $ciphers = implode(':', array(
  28786. 'ECDHE-RSA-AES128-GCM-SHA256',
  28787. 'ECDHE-ECDSA-AES128-GCM-SHA256',
  28788. 'ECDHE-RSA-AES256-GCM-SHA384',
  28789. 'ECDHE-ECDSA-AES256-GCM-SHA384',
  28790. 'DHE-RSA-AES128-GCM-SHA256',
  28791. 'DHE-DSS-AES128-GCM-SHA256',
  28792. 'kEDH+AESGCM',
  28793. 'ECDHE-RSA-AES128-SHA256',
  28794. 'ECDHE-ECDSA-AES128-SHA256',
  28795. 'ECDHE-RSA-AES128-SHA',
  28796. 'ECDHE-ECDSA-AES128-SHA',
  28797. 'ECDHE-RSA-AES256-SHA384',
  28798. 'ECDHE-ECDSA-AES256-SHA384',
  28799. 'ECDHE-RSA-AES256-SHA',
  28800. 'ECDHE-ECDSA-AES256-SHA',
  28801. 'DHE-RSA-AES128-SHA256',
  28802. 'DHE-RSA-AES128-SHA',
  28803. 'DHE-DSS-AES128-SHA256',
  28804. 'DHE-RSA-AES256-SHA256',
  28805. 'DHE-DSS-AES256-SHA',
  28806. 'DHE-RSA-AES256-SHA',
  28807. 'AES128-GCM-SHA256',
  28808. 'AES256-GCM-SHA384',
  28809. 'AES128-SHA256',
  28810. 'AES256-SHA256',
  28811. 'AES128-SHA',
  28812. 'AES256-SHA',
  28813. 'AES',
  28814. 'CAMELLIA',
  28815. 'DES-CBC3-SHA',
  28816. '!aNULL',
  28817. '!eNULL',
  28818. '!EXPORT',
  28819. '!DES',
  28820. '!RC4',
  28821. '!MD5',
  28822. '!PSK',
  28823. '!aECDH',
  28824. '!EDH-DSS-DES-CBC3-SHA',
  28825. '!EDH-RSA-DES-CBC3-SHA',
  28826. '!KRB5-DES-CBC3-SHA',
  28827. ));
  28828. $defaults = array(
  28829. 'ssl' => array(
  28830. 'ciphers' => $ciphers,
  28831. 'verify_peer' => true,
  28832. 'verify_depth' => 7,
  28833. 'SNI_enabled' => true,
  28834. 'capture_peer_cert' => true,
  28835. ),
  28836. );
  28837. if (isset($options['ssl'])) {
  28838. $defaults['ssl'] = array_replace_recursive($defaults['ssl'], $options['ssl']);
  28839. }
  28840. $caBundleLogger = $this->io instanceof LoggerInterface ? $this->io : null;
  28841. if (!isset($defaults['ssl']['cafile']) && !isset($defaults['ssl']['capath'])) {
  28842. $result = CaBundle::getSystemCaRootBundlePath($caBundleLogger);
  28843. if (is_dir($result)) {
  28844. $defaults['ssl']['capath'] = $result;
  28845. } else {
  28846. $defaults['ssl']['cafile'] = $result;
  28847. }
  28848. }
  28849. if (isset($defaults['ssl']['cafile']) && (!is_readable($defaults['ssl']['cafile']) || !CaBundle::validateCaFile($defaults['ssl']['cafile'], $caBundleLogger))) {
  28850. throw new TransportException('The configured cafile was not valid or could not be read.');
  28851. }
  28852. if (isset($defaults['ssl']['capath']) && (!is_dir($defaults['ssl']['capath']) || !is_readable($defaults['ssl']['capath']))) {
  28853. throw new TransportException('The configured capath was not valid or could not be read.');
  28854. }
  28855. if (PHP_VERSION_ID >= 50413) {
  28856. $defaults['ssl']['disable_compression'] = true;
  28857. }
  28858. return $defaults;
  28859. }
  28860. private function getCertificateCnAndFp($url, $options)
  28861. {
  28862. if (PHP_VERSION_ID >= 50600) {
  28863. throw new \BadMethodCallException(sprintf(
  28864. '%s must not be used on PHP >= 5.6',
  28865. __METHOD__
  28866. ));
  28867. }
  28868. $context = StreamContextFactory::getContext($url, $options, array('options' => array(
  28869. 'ssl' => array(
  28870. 'capture_peer_cert' => true,
  28871. 'verify_peer' => false,
  28872. ), ),
  28873. ));
  28874. if (false === $handle = @fopen($url, 'rb', false, $context)) {
  28875. return;
  28876. }
  28877. fclose($handle);
  28878. $handle = null;
  28879. $params = stream_context_get_params($context);
  28880. if (!empty($params['options']['ssl']['peer_certificate'])) {
  28881. $peerCertificate = $params['options']['ssl']['peer_certificate'];
  28882. if (TlsHelper::checkCertificateHost($peerCertificate, parse_url($url, PHP_URL_HOST), $commonName)) {
  28883. return array(
  28884. 'cn' => $commonName,
  28885. 'fp' => TlsHelper::getCertificateFingerprint($peerCertificate),
  28886. );
  28887. }
  28888. }
  28889. }
  28890. private function getUrlAuthority($url)
  28891. {
  28892. $defaultPorts = array(
  28893. 'ftp' => 21,
  28894. 'http' => 80,
  28895. 'https' => 443,
  28896. 'ssh2.sftp' => 22,
  28897. 'ssh2.scp' => 22,
  28898. );
  28899. $scheme = parse_url($url, PHP_URL_SCHEME);
  28900. if (!isset($defaultPorts[$scheme])) {
  28901. throw new \InvalidArgumentException(sprintf(
  28902. 'Could not get default port for unknown scheme: %s',
  28903. $scheme
  28904. ));
  28905. }
  28906. $defaultPort = $defaultPorts[$scheme];
  28907. $port = parse_url($url, PHP_URL_PORT) ?: $defaultPort;
  28908. return parse_url($url, PHP_URL_HOST).':'.$port;
  28909. }
  28910. private function isPublicBitBucketDownload($urlToBitBucketFile)
  28911. {
  28912. $domain = parse_url($urlToBitBucketFile, PHP_URL_HOST);
  28913. if (strpos($domain, 'bitbucket.org') === false) {
  28914. return true;
  28915. }
  28916. $path = parse_url($urlToBitBucketFile, PHP_URL_PATH);
  28917. $pathParts = explode('/', $path);
  28918. return count($pathParts) >= 4 && $pathParts[3] == 'downloads';
  28919. }
  28920. public static function outputWarnings(IOInterface $io, $url, $data)
  28921. {
  28922. foreach (array('warning', 'info') as $type) {
  28923. if (empty($data[$type])) {
  28924. continue;
  28925. }
  28926. if (!empty($data[$type . '-versions'])) {
  28927. $versionParser = new VersionParser();
  28928. $constraint = $versionParser->parseConstraints($data[$type . '-versions']);
  28929. $composer = new Constraint('==', $versionParser->normalize(Composer::getVersion()));
  28930. if (!$constraint->matches($composer)) {
  28931. continue;
  28932. }
  28933. }
  28934. $io->writeError('<'.$type.'>'.ucfirst($type).' from '.$url.': '.$data[$type].'</'.$type.'>');
  28935. }
  28936. }
  28937. public static function getOrigin($urlOrPath)
  28938. {
  28939. $hostPort = parse_url($urlOrPath, PHP_URL_HOST);
  28940. if (!$hostPort) {
  28941. return $urlOrPath;
  28942. }
  28943. if (parse_url($urlOrPath, PHP_URL_PORT)) {
  28944. $hostPort .= ':'.parse_url($urlOrPath, PHP_URL_PORT);
  28945. }
  28946. return $hostPort;
  28947. }
  28948. private function stripCredentialsFromUrl($url)
  28949. {
  28950. return preg_replace('{([&?]access_token=)[^&]+}', '$1***', $url);
  28951. }
  28952. }
  28953. <?php
  28954. namespace Composer\Util;
  28955. class Silencer
  28956. {
  28957. private static $stack = array();
  28958. public static function suppress($mask = null)
  28959. {
  28960. if (!isset($mask)) {
  28961. $mask = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT;
  28962. }
  28963. $old = error_reporting();
  28964. self::$stack[] = $old;
  28965. error_reporting($old & ~$mask);
  28966. return $old;
  28967. }
  28968. public static function restore()
  28969. {
  28970. if (!empty(self::$stack)) {
  28971. error_reporting(array_pop(self::$stack));
  28972. }
  28973. }
  28974. public static function call($callable )
  28975. {
  28976. try {
  28977. self::suppress();
  28978. $result = call_user_func_array($callable, array_slice(func_get_args(), 1));
  28979. self::restore();
  28980. return $result;
  28981. } catch (\Exception $e) {
  28982. self::restore();
  28983. throw $e;
  28984. }
  28985. }
  28986. }
  28987. <?php
  28988. namespace Composer\Util;
  28989. use Composer\Spdx\SpdxLicenses;
  28990. trigger_error('The ' . __NAMESPACE__ . '\SpdxLicense class is deprecated, use Composer\Spdx\SpdxLicenses instead.', E_USER_DEPRECATED);
  28991. class SpdxLicense extends SpdxLicenses
  28992. {
  28993. }
  28994. <?php
  28995. namespace Composer\Util;
  28996. use Composer\Composer;
  28997. final class StreamContextFactory
  28998. {
  28999. public static function getContext($url, array $defaultOptions = array(), array $defaultParams = array())
  29000. {
  29001. $options = array('http' => array(
  29002. 'follow_location' => 1,
  29003. 'max_redirects' => 20,
  29004. ));
  29005. if ((PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') && (!empty($_SERVER['HTTP_PROXY']) || !empty($_SERVER['http_proxy']))) {
  29006. $proxy = parse_url(!empty($_SERVER['http_proxy']) ? $_SERVER['http_proxy'] : $_SERVER['HTTP_PROXY']);
  29007. }
  29008. if (!empty($_SERVER['CGI_HTTP_PROXY'])) {
  29009. $proxy = parse_url($_SERVER['CGI_HTTP_PROXY']);
  29010. }
  29011. if (preg_match('{^https://}i', $url) && (!empty($_SERVER['HTTPS_PROXY']) || !empty($_SERVER['https_proxy']))) {
  29012. $proxy = parse_url(!empty($_SERVER['https_proxy']) ? $_SERVER['https_proxy'] : $_SERVER['HTTPS_PROXY']);
  29013. }
  29014. if (!empty($_SERVER['NO_PROXY']) || !empty($_SERVER['no_proxy']) && parse_url($url, PHP_URL_HOST)) {
  29015. $pattern = new NoProxyPattern(!empty($_SERVER['no_proxy']) ? $_SERVER['no_proxy'] : $_SERVER['NO_PROXY']);
  29016. if ($pattern->test($url)) {
  29017. unset($proxy);
  29018. }
  29019. }
  29020. if (!empty($proxy)) {
  29021. $proxyURL = isset($proxy['scheme']) ? $proxy['scheme'] . '://' : '';
  29022. $proxyURL .= isset($proxy['host']) ? $proxy['host'] : '';
  29023. if (isset($proxy['port'])) {
  29024. $proxyURL .= ":" . $proxy['port'];
  29025. } elseif ('http://' == substr($proxyURL, 0, 7)) {
  29026. $proxyURL .= ":80";
  29027. } elseif ('https://' == substr($proxyURL, 0, 8)) {
  29028. $proxyURL .= ":443";
  29029. }
  29030. $proxyURL = str_replace(array('http://', 'https://'), array('tcp://', 'ssl://'), $proxyURL);
  29031. if (0 === strpos($proxyURL, 'ssl:') && !extension_loaded('openssl')) {
  29032. throw new \RuntimeException('You must enable the openssl extension to use a proxy over https');
  29033. }
  29034. $options['http']['proxy'] = $proxyURL;
  29035. switch (parse_url($url, PHP_URL_SCHEME)) {
  29036. case 'http':
  29037. $reqFullUriEnv = getenv('HTTP_PROXY_REQUEST_FULLURI');
  29038. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  29039. $options['http']['request_fulluri'] = true;
  29040. }
  29041. break;
  29042. case 'https':
  29043. $reqFullUriEnv = getenv('HTTPS_PROXY_REQUEST_FULLURI');
  29044. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  29045. $options['http']['request_fulluri'] = true;
  29046. }
  29047. break;
  29048. }
  29049. if ('https' === parse_url($url, PHP_URL_SCHEME)) {
  29050. $options['ssl']['SNI_enabled'] = true;
  29051. if (PHP_VERSION_ID < 50600) {
  29052. $options['ssl']['SNI_server_name'] = parse_url($url, PHP_URL_HOST);
  29053. }
  29054. }
  29055. if (isset($proxy['user'])) {
  29056. $auth = rawurldecode($proxy['user']);
  29057. if (isset($proxy['pass'])) {
  29058. $auth .= ':' . rawurldecode($proxy['pass']);
  29059. }
  29060. $auth = base64_encode($auth);
  29061. if (isset($defaultOptions['http']['header'])) {
  29062. if (is_string($defaultOptions['http']['header'])) {
  29063. $defaultOptions['http']['header'] = array($defaultOptions['http']['header']);
  29064. }
  29065. $defaultOptions['http']['header'][] = "Proxy-Authorization: Basic {$auth}";
  29066. } else {
  29067. $options['http']['header'] = array("Proxy-Authorization: Basic {$auth}");
  29068. }
  29069. }
  29070. }
  29071. $options = array_replace_recursive($options, $defaultOptions);
  29072. if (isset($options['http']['header'])) {
  29073. $options['http']['header'] = self::fixHttpHeaderField($options['http']['header']);
  29074. }
  29075. if (defined('HHVM_VERSION')) {
  29076. $phpVersion = 'HHVM ' . HHVM_VERSION;
  29077. } else {
  29078. $phpVersion = 'PHP ' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
  29079. }
  29080. if (!isset($options['http']['header']) || false === stripos(implode('', $options['http']['header']), 'user-agent')) {
  29081. $options['http']['header'][] = sprintf(
  29082. 'User-Agent: Composer/%s (%s; %s; %s%s)',
  29083. Composer::getVersion(),
  29084. function_exists('php_uname') ? php_uname('s') : 'Unknown',
  29085. function_exists('php_uname') ? php_uname('r') : 'Unknown',
  29086. $phpVersion,
  29087. getenv('CI') ? '; CI' : ''
  29088. );
  29089. }
  29090. return stream_context_create($options, $defaultParams);
  29091. }
  29092. private static function fixHttpHeaderField($header)
  29093. {
  29094. if (!is_array($header)) {
  29095. $header = explode("\r\n", $header);
  29096. }
  29097. uasort($header, function ($el) {
  29098. return stripos($el, 'content-type') === 0 ? 1 : -1;
  29099. });
  29100. return $header;
  29101. }
  29102. }
  29103. <?php
  29104. namespace Composer\Util;
  29105. use Composer\Config;
  29106. use Composer\IO\IOInterface;
  29107. class Svn
  29108. {
  29109. const MAX_QTY_AUTH_TRIES = 5;
  29110. protected $credentials;
  29111. protected $hasAuth;
  29112. protected $io;
  29113. protected $url;
  29114. protected $cacheCredentials = true;
  29115. protected $process;
  29116. protected $qtyAuthTries = 0;
  29117. protected $config;
  29118. private static $version;
  29119. public function __construct($url, IOInterface $io, Config $config, ProcessExecutor $process = null)
  29120. {
  29121. $this->url = $url;
  29122. $this->io = $io;
  29123. $this->config = $config;
  29124. $this->process = $process ?: new ProcessExecutor($io);
  29125. }
  29126. public static function cleanEnv()
  29127. {
  29128. putenv("DYLD_LIBRARY_PATH");
  29129. unset($_SERVER['DYLD_LIBRARY_PATH']);
  29130. }
  29131. public function execute($command, $url, $cwd = null, $path = null, $verbose = false)
  29132. {
  29133. $this->config->prohibitUrlByConfig($url, $this->io);
  29134. return $this->executeWithAuthRetry($command, $cwd, $url, $path, $verbose);
  29135. }
  29136. public function executeLocal($command, $path, $cwd = null, $verbose = false)
  29137. {
  29138. return $this->executeWithAuthRetry($command, $cwd, '', $path, $verbose);
  29139. }
  29140. private function executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose)
  29141. {
  29142. $command = $this->getCommand($svnCommand, $url, $path);
  29143. $output = null;
  29144. $io = $this->io;
  29145. $handler = function ($type, $buffer) use (&$output, $io, $verbose) {
  29146. if ($type !== 'out') {
  29147. return;
  29148. }
  29149. if ('Redirecting to URL ' === substr($buffer, 0, 19)) {
  29150. return;
  29151. }
  29152. $output .= $buffer;
  29153. if ($verbose) {
  29154. $io->writeError($buffer, false);
  29155. }
  29156. };
  29157. $status = $this->process->execute($command, $handler, $cwd);
  29158. if (0 === $status) {
  29159. return $output;
  29160. }
  29161. $errorOutput = $this->process->getErrorOutput();
  29162. $fullOutput = implode("\n", array($output, $errorOutput));
  29163. if (false === stripos($fullOutput, 'Could not authenticate to server:')
  29164. && false === stripos($fullOutput, 'authorization failed')
  29165. && false === stripos($fullOutput, 'svn: E170001:')
  29166. && false === stripos($fullOutput, 'svn: E215004:')) {
  29167. throw new \RuntimeException($fullOutput);
  29168. }
  29169. if (!$this->hasAuth()) {
  29170. $this->doAuthDance();
  29171. }
  29172. if ($this->qtyAuthTries++ < self::MAX_QTY_AUTH_TRIES) {
  29173. return $this->executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose);
  29174. }
  29175. throw new \RuntimeException(
  29176. 'wrong credentials provided ('.$fullOutput.')'
  29177. );
  29178. }
  29179. public function setCacheCredentials($cacheCredentials)
  29180. {
  29181. $this->cacheCredentials = $cacheCredentials;
  29182. }
  29183. protected function doAuthDance()
  29184. {
  29185. if (!$this->io->isInteractive()) {
  29186. throw new \RuntimeException(
  29187. 'can not ask for authentication in non interactive mode'
  29188. );
  29189. }
  29190. $this->io->writeError("The Subversion server ({$this->url}) requested credentials:");
  29191. $this->hasAuth = true;
  29192. $this->credentials['username'] = $this->io->ask("Username: ");
  29193. $this->credentials['password'] = $this->io->askAndHideAnswer("Password: ");
  29194. $this->cacheCredentials = $this->io->askConfirmation("Should Subversion cache these credentials? (yes/no) ", true);
  29195. return $this;
  29196. }
  29197. protected function getCommand($cmd, $url, $path = null)
  29198. {
  29199. $cmd = sprintf(
  29200. '%s %s%s %s',
  29201. $cmd,
  29202. '--non-interactive ',
  29203. $this->getCredentialString(),
  29204. ProcessExecutor::escape($url)
  29205. );
  29206. if ($path) {
  29207. $cmd .= ' ' . ProcessExecutor::escape($path);
  29208. }
  29209. return $cmd;
  29210. }
  29211. protected function getCredentialString()
  29212. {
  29213. if (!$this->hasAuth()) {
  29214. return '';
  29215. }
  29216. return sprintf(
  29217. ' %s--username %s --password %s ',
  29218. $this->getAuthCache(),
  29219. ProcessExecutor::escape($this->getUsername()),
  29220. ProcessExecutor::escape($this->getPassword())
  29221. );
  29222. }
  29223. protected function getPassword()
  29224. {
  29225. if ($this->credentials === null) {
  29226. throw new \LogicException("No svn auth detected.");
  29227. }
  29228. return isset($this->credentials['password']) ? $this->credentials['password'] : '';
  29229. }
  29230. protected function getUsername()
  29231. {
  29232. if ($this->credentials === null) {
  29233. throw new \LogicException("No svn auth detected.");
  29234. }
  29235. return $this->credentials['username'];
  29236. }
  29237. protected function hasAuth()
  29238. {
  29239. if (null !== $this->hasAuth) {
  29240. return $this->hasAuth;
  29241. }
  29242. if (false === $this->createAuthFromConfig()) {
  29243. $this->createAuthFromUrl();
  29244. }
  29245. return $this->hasAuth;
  29246. }
  29247. protected function getAuthCache()
  29248. {
  29249. return $this->cacheCredentials ? '' : '--no-auth-cache ';
  29250. }
  29251. private function createAuthFromConfig()
  29252. {
  29253. if (!$this->config->has('http-basic')) {
  29254. return $this->hasAuth = false;
  29255. }
  29256. $authConfig = $this->config->get('http-basic');
  29257. $host = parse_url($this->url, PHP_URL_HOST);
  29258. if (isset($authConfig[$host])) {
  29259. $this->credentials['username'] = $authConfig[$host]['username'];
  29260. $this->credentials['password'] = $authConfig[$host]['password'];
  29261. return $this->hasAuth = true;
  29262. }
  29263. return $this->hasAuth = false;
  29264. }
  29265. private function createAuthFromUrl()
  29266. {
  29267. $uri = parse_url($this->url);
  29268. if (empty($uri['user'])) {
  29269. return $this->hasAuth = false;
  29270. }
  29271. $this->credentials['username'] = $uri['user'];
  29272. if (!empty($uri['pass'])) {
  29273. $this->credentials['password'] = $uri['pass'];
  29274. }
  29275. return $this->hasAuth = true;
  29276. }
  29277. public function binaryVersion()
  29278. {
  29279. if (!self::$version) {
  29280. if (0 === $this->process->execute('svn --version', $output)) {
  29281. if (preg_match('{(\d+(?:\.\d+)+)}', $output, $match)) {
  29282. self::$version = $match[1];
  29283. }
  29284. }
  29285. }
  29286. return self::$version;
  29287. }
  29288. }
  29289. <?php
  29290. namespace Composer\Util;
  29291. use Composer\CaBundle\CaBundle;
  29292. final class TlsHelper
  29293. {
  29294. public static function checkCertificateHost($certificate, $hostname, &$cn = null)
  29295. {
  29296. $names = self::getCertificateNames($certificate);
  29297. if (empty($names)) {
  29298. return false;
  29299. }
  29300. $combinedNames = array_merge($names['san'], array($names['cn']));
  29301. $hostname = strtolower($hostname);
  29302. foreach ($combinedNames as $certName) {
  29303. $matcher = self::certNameMatcher($certName);
  29304. if ($matcher && $matcher($hostname)) {
  29305. $cn = $names['cn'];
  29306. return true;
  29307. }
  29308. }
  29309. return false;
  29310. }
  29311. public static function getCertificateNames($certificate)
  29312. {
  29313. if (is_array($certificate)) {
  29314. $info = $certificate;
  29315. } elseif (CaBundle::isOpensslParseSafe()) {
  29316. $info = openssl_x509_parse($certificate, false);
  29317. }
  29318. if (!isset($info['subject']['commonName'])) {
  29319. return null;
  29320. }
  29321. $commonName = strtolower($info['subject']['commonName']);
  29322. $subjectAltNames = array();
  29323. if (isset($info['extensions']['subjectAltName'])) {
  29324. $subjectAltNames = preg_split('{\s*,\s*}', $info['extensions']['subjectAltName']);
  29325. $subjectAltNames = array_filter(array_map(function ($name) {
  29326. if (0 === strpos($name, 'DNS:')) {
  29327. return strtolower(ltrim(substr($name, 4)));
  29328. }
  29329. return null;
  29330. }, $subjectAltNames));
  29331. $subjectAltNames = array_values($subjectAltNames);
  29332. }
  29333. return array(
  29334. 'cn' => $commonName,
  29335. 'san' => $subjectAltNames,
  29336. );
  29337. }
  29338. public static function getCertificateFingerprint($certificate)
  29339. {
  29340. $pubkeydetails = openssl_pkey_get_details(openssl_get_publickey($certificate));
  29341. $pubkeypem = $pubkeydetails['key'];
  29342. $start = '-----BEGIN PUBLIC KEY-----';
  29343. $end = '-----END PUBLIC KEY-----';
  29344. $pemtrim = substr($pubkeypem, strpos($pubkeypem, $start) + strlen($start), (strlen($pubkeypem) - strpos($pubkeypem, $end)) * (-1));
  29345. $der = base64_decode($pemtrim);
  29346. return sha1($der);
  29347. }
  29348. public static function isOpensslParseSafe()
  29349. {
  29350. return CaBundle::isOpensslParseSafe();
  29351. }
  29352. private static function certNameMatcher($certName)
  29353. {
  29354. $wildcards = substr_count($certName, '*');
  29355. if (0 === $wildcards) {
  29356. return function ($hostname) use ($certName) {
  29357. return $hostname === $certName;
  29358. };
  29359. }
  29360. if (1 === $wildcards) {
  29361. $components = explode('.', $certName);
  29362. if (3 > count($components)) {
  29363. return;
  29364. }
  29365. $firstComponent = $components[0];
  29366. if ('*' !== $firstComponent[strlen($firstComponent) - 1]) {
  29367. return;
  29368. }
  29369. $wildcardRegex = preg_quote($certName);
  29370. $wildcardRegex = str_replace('\\*', '[a-z0-9-]+', $wildcardRegex);
  29371. $wildcardRegex = "{^{$wildcardRegex}$}";
  29372. return function ($hostname) use ($wildcardRegex) {
  29373. return 1 === preg_match($wildcardRegex, $hostname);
  29374. };
  29375. }
  29376. }
  29377. }
  29378. <?php
  29379. namespace Composer\Util;
  29380. use Composer\Config;
  29381. class Url
  29382. {
  29383. public static function updateDistReference(Config $config, $url, $ref)
  29384. {
  29385. $host = parse_url($url, PHP_URL_HOST);
  29386. if ($host === 'api.github.com' || $host === 'github.com' || $host === 'www.github.com') {
  29387. if (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/(zip|tar)ball/(.+)$}i', $url, $match)) {
  29388. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  29389. } elseif (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/archive/.+\.(zip|tar)(?:\.gz)?$}i', $url, $match)) {
  29390. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  29391. } elseif (preg_match('{^https?://api\.github\.com/repos/([^/]+)/([^/]+)/(zip|tar)ball(?:/.+)?$}i', $url, $match)) {
  29392. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  29393. }
  29394. } elseif ($host === 'bitbucket.org' || $host === 'www.bitbucket.org') {
  29395. if (preg_match('{^https?://(?:www\.)?bitbucket\.org/([^/]+)/([^/]+)/get/(.+)\.(zip|tar\.gz|tar\.bz2)$}i', $url, $match)) {
  29396. $url = 'https://bitbucket.org/' . $match[1] . '/'. $match[2] . '/get/' . $ref . '.' . $match[4];
  29397. }
  29398. } elseif ($host === 'gitlab.com' || $host === 'www.gitlab.com') {
  29399. if (preg_match('{^https?://(?:www\.)?gitlab\.com/api/v[34]/projects/([^/]+)/repository/archive\.(zip|tar\.gz|tar\.bz2|tar)\?sha=.+$}i', $url, $match)) {
  29400. $url = 'https://gitlab.com/api/v4/projects/' . $match[1] . '/repository/archive.' . $match[2] . '?sha=' . $ref;
  29401. }
  29402. } elseif (in_array($host, $config->get('github-domains'), true)) {
  29403. $url = preg_replace('{(/repos/[^/]+/[^/]+/(zip|tar)ball)(?:/.+)?$}i', '$1/'.$ref, $url);
  29404. } elseif (in_array($host, $config->get('gitlab-domains'), true)) {
  29405. $url = preg_replace('{(/api/v[34]/projects/[^/]+/repository/archive\.(?:zip|tar\.gz|tar\.bz2|tar)\?sha=).+$}i', '${1}'.$ref, $url);
  29406. }
  29407. return $url;
  29408. }
  29409. }
  29410. <?php
  29411. namespace Composer\Util;
  29412. class Zip
  29413. {
  29414. public static function getComposerJson($pathToZip)
  29415. {
  29416. if (!extension_loaded('zip')) {
  29417. throw new \RuntimeException('The Zip Util requires PHP\'s zip extension');
  29418. }
  29419. $zip = new \ZipArchive();
  29420. if ($zip->open($pathToZip) !== true) {
  29421. return null;
  29422. }
  29423. if (0 == $zip->numFiles) {
  29424. $zip->close();
  29425. return null;
  29426. }
  29427. $foundFileIndex = self::locateFile($zip, 'composer.json');
  29428. if (false === $foundFileIndex) {
  29429. $zip->close();
  29430. return null;
  29431. }
  29432. $content = null;
  29433. $configurationFileName = $zip->getNameIndex($foundFileIndex);
  29434. $stream = $zip->getStream($configurationFileName);
  29435. if (false !== $stream) {
  29436. $content = stream_get_contents($stream);
  29437. }
  29438. $zip->close();
  29439. return $content;
  29440. }
  29441. private static function locateFile(\ZipArchive $zip, $filename)
  29442. {
  29443. $indexOfShortestMatch = false;
  29444. $lengthOfShortestMatch = -1;
  29445. for ($i = 0; $i < $zip->numFiles; $i++) {
  29446. $stat = $zip->statIndex($i);
  29447. if (strcmp(basename($stat['name']), $filename) === 0) {
  29448. $directoryName = dirname($stat['name']);
  29449. if ($directoryName === '.') {
  29450. return $i;
  29451. }
  29452. if (strpos($directoryName, '\\') !== false ||
  29453. strpos($directoryName, '/') !== false) {
  29454. continue;
  29455. }
  29456. $length = strlen($stat['name']);
  29457. if ($indexOfShortestMatch === false || $length < $lengthOfShortestMatch) {
  29458. $contents = $zip->getFromIndex($i);
  29459. if ($contents !== false) {
  29460. $indexOfShortestMatch = $i;
  29461. $lengthOfShortestMatch = $length;
  29462. }
  29463. }
  29464. }
  29465. }
  29466. return $indexOfShortestMatch;
  29467. }
  29468. }
  29469. <?php
  29470. namespace Composer;
  29471. use Symfony\Component\Console\Output\OutputInterface;
  29472. trigger_error('The ' . __NAMESPACE__ . '\XdebugHandler class is deprecated, use Composer\XdebugHandler\XdebugHandler instead,', E_USER_DEPRECATED);
  29473. class XdebugHandler extends XdebugHandler\XdebugHandler
  29474. {
  29475. const ENV_ALLOW = 'COMPOSER_ALLOW_XDEBUG';
  29476. const ENV_VERSION = 'COMPOSER_XDEBUG_VERSION';
  29477. public function __construct(OutputInterface $output)
  29478. {
  29479. parent::__construct('composer', '--ansi');
  29480. }
  29481. }
  29482. <?php
  29483. function includeIfExists($file)
  29484. {
  29485. return file_exists($file) ? include $file : false;
  29486. }
  29487. if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
  29488. echo 'You must set up the project dependencies using `composer install`'.PHP_EOL.
  29489. 'See https://getcomposer.org/download/ for instructions on installing Composer'.PHP_EOL;
  29490. exit(1);
  29491. }
  29492. return $loader;
  29493. <?php
  29494. /*
  29495. * This file is part of Composer.
  29496. *
  29497. * (c) Nils Adermann <naderman@naderman.de>
  29498. * Jordi Boggiano <j.boggiano@seld.be>
  29499. *
  29500. * For the full copyright and license information, please view the LICENSE
  29501. * file that was distributed with this source code.
  29502. */
  29503. namespace Composer\Autoload;
  29504. /**
  29505. * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
  29506. *
  29507. * $loader = new \Composer\Autoload\ClassLoader();
  29508. *
  29509. * // register classes with namespaces
  29510. * $loader->add('Symfony\Component', __DIR__.'/component');
  29511. * $loader->add('Symfony', __DIR__.'/framework');
  29512. *
  29513. * // activate the autoloader
  29514. * $loader->register();
  29515. *
  29516. * // to enable searching the include path (eg. for PEAR packages)
  29517. * $loader->setUseIncludePath(true);
  29518. *
  29519. * In this example, if you try to use a class in the Symfony\Component
  29520. * namespace or one of its children (Symfony\Component\Console for instance),
  29521. * the autoloader will first look for the class under the component/
  29522. * directory, and it will then fallback to the framework/ directory if not
  29523. * found before giving up.
  29524. *
  29525. * This class is loosely based on the Symfony UniversalClassLoader.
  29526. *
  29527. * @author Fabien Potencier <fabien@symfony.com>
  29528. * @author Jordi Boggiano <j.boggiano@seld.be>
  29529. * @see http://www.php-fig.org/psr/psr-0/
  29530. * @see http://www.php-fig.org/psr/psr-4/
  29531. */
  29532. class ClassLoader
  29533. {
  29534. // PSR-4
  29535. private $prefixLengthsPsr4 = array();
  29536. private $prefixDirsPsr4 = array();
  29537. private $fallbackDirsPsr4 = array();
  29538. // PSR-0
  29539. private $prefixesPsr0 = array();
  29540. private $fallbackDirsPsr0 = array();
  29541. private $useIncludePath = false;
  29542. private $classMap = array();
  29543. private $classMapAuthoritative = false;
  29544. private $missingClasses = array();
  29545. private $apcuPrefix;
  29546. public function getPrefixes()
  29547. {
  29548. if (!empty($this->prefixesPsr0)) {
  29549. return call_user_func_array('array_merge', $this->prefixesPsr0);
  29550. }
  29551. return array();
  29552. }
  29553. public function getPrefixesPsr4()
  29554. {
  29555. return $this->prefixDirsPsr4;
  29556. }
  29557. public function getFallbackDirs()
  29558. {
  29559. return $this->fallbackDirsPsr0;
  29560. }
  29561. public function getFallbackDirsPsr4()
  29562. {
  29563. return $this->fallbackDirsPsr4;
  29564. }
  29565. public function getClassMap()
  29566. {
  29567. return $this->classMap;
  29568. }
  29569. /**
  29570. * @param array $classMap Class to filename map
  29571. */
  29572. public function addClassMap(array $classMap)
  29573. {
  29574. if ($this->classMap) {
  29575. $this->classMap = array_merge($this->classMap, $classMap);
  29576. } else {
  29577. $this->classMap = $classMap;
  29578. }
  29579. }
  29580. /**
  29581. * Registers a set of PSR-0 directories for a given prefix, either
  29582. * appending or prepending to the ones previously set for this prefix.
  29583. *
  29584. * @param string $prefix The prefix
  29585. * @param array|string $paths The PSR-0 root directories
  29586. * @param bool $prepend Whether to prepend the directories
  29587. */
  29588. public function add($prefix, $paths, $prepend = false)
  29589. {
  29590. if (!$prefix) {
  29591. if ($prepend) {
  29592. $this->fallbackDirsPsr0 = array_merge(
  29593. (array) $paths,
  29594. $this->fallbackDirsPsr0
  29595. );
  29596. } else {
  29597. $this->fallbackDirsPsr0 = array_merge(
  29598. $this->fallbackDirsPsr0,
  29599. (array) $paths
  29600. );
  29601. }
  29602. return;
  29603. }
  29604. $first = $prefix[0];
  29605. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  29606. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  29607. return;
  29608. }
  29609. if ($prepend) {
  29610. $this->prefixesPsr0[$first][$prefix] = array_merge(
  29611. (array) $paths,
  29612. $this->prefixesPsr0[$first][$prefix]
  29613. );
  29614. } else {
  29615. $this->prefixesPsr0[$first][$prefix] = array_merge(
  29616. $this->prefixesPsr0[$first][$prefix],
  29617. (array) $paths
  29618. );
  29619. }
  29620. }
  29621. /**
  29622. * Registers a set of PSR-4 directories for a given namespace, either
  29623. * appending or prepending to the ones previously set for this namespace.
  29624. *
  29625. * @param string $prefix The prefix/namespace, with trailing '\\'
  29626. * @param array|string $paths The PSR-4 base directories
  29627. * @param bool $prepend Whether to prepend the directories
  29628. *
  29629. * @throws \InvalidArgumentException
  29630. */
  29631. public function addPsr4($prefix, $paths, $prepend = false)
  29632. {
  29633. if (!$prefix) {
  29634. // Register directories for the root namespace.
  29635. if ($prepend) {
  29636. $this->fallbackDirsPsr4 = array_merge(
  29637. (array) $paths,
  29638. $this->fallbackDirsPsr4
  29639. );
  29640. } else {
  29641. $this->fallbackDirsPsr4 = array_merge(
  29642. $this->fallbackDirsPsr4,
  29643. (array) $paths
  29644. );
  29645. }
  29646. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  29647. // Register directories for a new namespace.
  29648. $length = strlen($prefix);
  29649. if ('\\' !== $prefix[$length - 1]) {
  29650. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  29651. }
  29652. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  29653. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  29654. } elseif ($prepend) {
  29655. // Prepend directories for an already registered namespace.
  29656. $this->prefixDirsPsr4[$prefix] = array_merge(
  29657. (array) $paths,
  29658. $this->prefixDirsPsr4[$prefix]
  29659. );
  29660. } else {
  29661. // Append directories for an already registered namespace.
  29662. $this->prefixDirsPsr4[$prefix] = array_merge(
  29663. $this->prefixDirsPsr4[$prefix],
  29664. (array) $paths
  29665. );
  29666. }
  29667. }
  29668. /**
  29669. * Registers a set of PSR-0 directories for a given prefix,
  29670. * replacing any others previously set for this prefix.
  29671. *
  29672. * @param string $prefix The prefix
  29673. * @param array|string $paths The PSR-0 base directories
  29674. */
  29675. public function set($prefix, $paths)
  29676. {
  29677. if (!$prefix) {
  29678. $this->fallbackDirsPsr0 = (array) $paths;
  29679. } else {
  29680. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  29681. }
  29682. }
  29683. /**
  29684. * Registers a set of PSR-4 directories for a given namespace,
  29685. * replacing any others previously set for this namespace.
  29686. *
  29687. * @param string $prefix The prefix/namespace, with trailing '\\'
  29688. * @param array|string $paths The PSR-4 base directories
  29689. *
  29690. * @throws \InvalidArgumentException
  29691. */
  29692. public function setPsr4($prefix, $paths)
  29693. {
  29694. if (!$prefix) {
  29695. $this->fallbackDirsPsr4 = (array) $paths;
  29696. } else {
  29697. $length = strlen($prefix);
  29698. if ('\\' !== $prefix[$length - 1]) {
  29699. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  29700. }
  29701. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  29702. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  29703. }
  29704. }
  29705. /**
  29706. * Turns on searching the include path for class files.
  29707. *
  29708. * @param bool $useIncludePath
  29709. */
  29710. public function setUseIncludePath($useIncludePath)
  29711. {
  29712. $this->useIncludePath = $useIncludePath;
  29713. }
  29714. /**
  29715. * Can be used to check if the autoloader uses the include path to check
  29716. * for classes.
  29717. *
  29718. * @return bool
  29719. */
  29720. public function getUseIncludePath()
  29721. {
  29722. return $this->useIncludePath;
  29723. }
  29724. /**
  29725. * Turns off searching the prefix and fallback directories for classes
  29726. * that have not been registered with the class map.
  29727. *
  29728. * @param bool $classMapAuthoritative
  29729. */
  29730. public function setClassMapAuthoritative($classMapAuthoritative)
  29731. {
  29732. $this->classMapAuthoritative = $classMapAuthoritative;
  29733. }
  29734. /**
  29735. * Should class lookup fail if not found in the current class map?
  29736. *
  29737. * @return bool
  29738. */
  29739. public function isClassMapAuthoritative()
  29740. {
  29741. return $this->classMapAuthoritative;
  29742. }
  29743. /**
  29744. * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
  29745. *
  29746. * @param string|null $apcuPrefix
  29747. */
  29748. public function setApcuPrefix($apcuPrefix)
  29749. {
  29750. $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
  29751. }
  29752. /**
  29753. * The APCu prefix in use, or null if APCu caching is not enabled.
  29754. *
  29755. * @return string|null
  29756. */
  29757. public function getApcuPrefix()
  29758. {
  29759. return $this->apcuPrefix;
  29760. }
  29761. /**
  29762. * Registers this instance as an autoloader.
  29763. *
  29764. * @param bool $prepend Whether to prepend the autoloader or not
  29765. */
  29766. public function register($prepend = false)
  29767. {
  29768. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  29769. }
  29770. /**
  29771. * Unregisters this instance as an autoloader.
  29772. */
  29773. public function unregister()
  29774. {
  29775. spl_autoload_unregister(array($this, 'loadClass'));
  29776. }
  29777. /**
  29778. * Loads the given class or interface.
  29779. *
  29780. * @param string $class The name of the class
  29781. * @return bool|null True if loaded, null otherwise
  29782. */
  29783. public function loadClass($class)
  29784. {
  29785. if ($file = $this->findFile($class)) {
  29786. includeFile($file);
  29787. return true;
  29788. }
  29789. }
  29790. /**
  29791. * Finds the path to the file where the class is defined.
  29792. *
  29793. * @param string $class The name of the class
  29794. *
  29795. * @return string|false The path if found, false otherwise
  29796. */
  29797. public function findFile($class)
  29798. {
  29799. // class map lookup
  29800. if (isset($this->classMap[$class])) {
  29801. return $this->classMap[$class];
  29802. }
  29803. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  29804. return false;
  29805. }
  29806. if (null !== $this->apcuPrefix) {
  29807. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  29808. if ($hit) {
  29809. return $file;
  29810. }
  29811. }
  29812. $file = $this->findFileWithExtension($class, '.php');
  29813. // Search for Hack files if we are running on HHVM
  29814. if (false === $file && defined('HHVM_VERSION')) {
  29815. $file = $this->findFileWithExtension($class, '.hh');
  29816. }
  29817. if (null !== $this->apcuPrefix) {
  29818. apcu_add($this->apcuPrefix.$class, $file);
  29819. }
  29820. if (false === $file) {
  29821. // Remember that this class does not exist.
  29822. $this->missingClasses[$class] = true;
  29823. }
  29824. return $file;
  29825. }
  29826. private function findFileWithExtension($class, $ext)
  29827. {
  29828. // PSR-4 lookup
  29829. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  29830. $first = $class[0];
  29831. if (isset($this->prefixLengthsPsr4[$first])) {
  29832. $subPath = $class;
  29833. while (false !== $lastPos = strrpos($subPath, '\\')) {
  29834. $subPath = substr($subPath, 0, $lastPos);
  29835. $search = $subPath . '\\';
  29836. if (isset($this->prefixDirsPsr4[$search])) {
  29837. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  29838. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  29839. if (file_exists($file = $dir . $pathEnd)) {
  29840. return $file;
  29841. }
  29842. }
  29843. }
  29844. }
  29845. }
  29846. // PSR-4 fallback dirs
  29847. foreach ($this->fallbackDirsPsr4 as $dir) {
  29848. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  29849. return $file;
  29850. }
  29851. }
  29852. // PSR-0 lookup
  29853. if (false !== $pos = strrpos($class, '\\')) {
  29854. // namespaced class name
  29855. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  29856. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  29857. } else {
  29858. // PEAR-like class name
  29859. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  29860. }
  29861. if (isset($this->prefixesPsr0[$first])) {
  29862. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  29863. if (0 === strpos($class, $prefix)) {
  29864. foreach ($dirs as $dir) {
  29865. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  29866. return $file;
  29867. }
  29868. }
  29869. }
  29870. }
  29871. }
  29872. // PSR-0 fallback dirs
  29873. foreach ($this->fallbackDirsPsr0 as $dir) {
  29874. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  29875. return $file;
  29876. }
  29877. }
  29878. // PSR-0 include paths.
  29879. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  29880. return $file;
  29881. }
  29882. return false;
  29883. }
  29884. }
  29885. /**
  29886. * Scope isolated include.
  29887. *
  29888. * Prevents access to $this/self from included files.
  29889. */
  29890. function includeFile($file)
  29891. {
  29892. include $file;
  29893. }
  29894. {
  29895. "$schema": "http://json-schema.org/draft-04/schema#",
  29896. "description": "A representation of packages metadata.",
  29897. "type": "object",
  29898. "oneOf": [
  29899. { "required": [ "packages" ] },
  29900. { "required": [ "providers" ] },
  29901. { "required": [ "provider-includes", "providers-url" ] }
  29902. ],
  29903. "properties": {
  29904. "packages": {
  29905. "type": ["object", "array"],
  29906. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  29907. "additionalProperties": { "$ref": "#/definitions/versions" }
  29908. },
  29909. "providers-url": {
  29910. "type": "string",
  29911. "description": "Endpoint to retrieve provider data from, e.g. '/p/%package%$%hash%.json'."
  29912. },
  29913. "provider-includes": {
  29914. "type": "object",
  29915. "description": "A hashmap of provider listings.",
  29916. "additionalProperties": { "$ref": "#/definitions/provider" }
  29917. },
  29918. "providers": {
  29919. "type": "object",
  29920. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  29921. "additionalProperties": { "$ref": "#/definitions/provider" }
  29922. },
  29923. "notify-batch": {
  29924. "type": "string",
  29925. "description": "Endpoint to call after multiple packages have been installed, e.g. '/downloads/'."
  29926. },
  29927. "search": {
  29928. "type": "string",
  29929. "description": "Endpoint that provides search capabilities, e.g. '/search.json?q=%query%&type=%type%'."
  29930. },
  29931. "warning": {
  29932. "type": "string",
  29933. "description": "A message that will be output by Composer as a warning when this source is consulted."
  29934. }
  29935. },
  29936. "definitions": {
  29937. "versions": {
  29938. "type": "object",
  29939. "description": "A hashmap of versions and their metadata.",
  29940. "additionalProperties": { "$ref": "#/definitions/version" }
  29941. },
  29942. "version": {
  29943. "type": "object",
  29944. "oneOf": [
  29945. { "$ref": "#/definitions/package" },
  29946. { "$ref": "#/definitions/metapackage" }
  29947. ]
  29948. },
  29949. "package-base": {
  29950. "properties": {
  29951. "name": { "type": "string" },
  29952. "type": { "type": "string" },
  29953. "version": { "type": "string" },
  29954. "version_normalized": {
  29955. "type": "string",
  29956. "description": "Normalized version, optional but can save computational time on client side."
  29957. },
  29958. "autoload": { "type": "object" },
  29959. "require": { "type": "object" },
  29960. "replace": { "type": "object" },
  29961. "conflict": { "type": "object" },
  29962. "provide": { "type": "object" },
  29963. "time": { "type": "string" }
  29964. },
  29965. "additionalProperties": true
  29966. },
  29967. "package": {
  29968. "allOf": [
  29969. { "$ref": "#/definitions/package-base" },
  29970. {
  29971. "properties": {
  29972. "dist": { "type": "object" },
  29973. "source": { "type": "object" }
  29974. }
  29975. },
  29976. { "oneOf": [
  29977. { "required": [ "name", "version", "source" ] },
  29978. { "required": [ "name", "version", "dist" ] }
  29979. ] }
  29980. ]
  29981. },
  29982. "metapackage": {
  29983. "allOf": [
  29984. { "$ref": "#/definitions/package-base" },
  29985. {
  29986. "properties": {
  29987. "type": { "type": "string", "enum": [ "metapackage" ] }
  29988. },
  29989. "required": [ "name", "version", "type" ]
  29990. }
  29991. ]
  29992. },
  29993. "provider": {
  29994. "type": "object",
  29995. "properties": {
  29996. "sha256": {
  29997. "type": "string",
  29998. "description": "Hash value that can be used to validate the resource."
  29999. }
  30000. }
  30001. }
  30002. }
  30003. }
  30004. {
  30005. "$schema": "http://json-schema.org/draft-04/schema#",
  30006. "name": "Package",
  30007. "type": "object",
  30008. "additionalProperties": false,
  30009. "required": [ "name", "description" ],
  30010. "properties": {
  30011. "name": {
  30012. "type": "string",
  30013. "description": "Package name, including 'vendor-name/' prefix."
  30014. },
  30015. "type": {
  30016. "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.",
  30017. "type": "string",
  30018. "pattern": "^[a-z0-9-]+$"
  30019. },
  30020. "target-dir": {
  30021. "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.",
  30022. "type": "string"
  30023. },
  30024. "description": {
  30025. "type": "string",
  30026. "description": "Short package description."
  30027. },
  30028. "keywords": {
  30029. "type": "array",
  30030. "items": {
  30031. "type": "string",
  30032. "description": "A tag/keyword that this package relates to."
  30033. }
  30034. },
  30035. "homepage": {
  30036. "type": "string",
  30037. "description": "Homepage URL for the project.",
  30038. "format": "uri"
  30039. },
  30040. "readme": {
  30041. "type": "string",
  30042. "description": "Relative path to the readme document."
  30043. },
  30044. "version": {
  30045. "type": "string",
  30046. "description": "Package version, see https://getcomposer.org/doc/04-schema.md#version for more info on valid schemes.",
  30047. "pattern": "^v?\\d+(((\\.\\d+)?\\.\\d+)?\\.\\d+)?|^dev-"
  30048. },
  30049. "time": {
  30050. "type": "string",
  30051. "description": "Package release date, in 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM:SS' or 'YYYY-MM-DDTHH:MM:SSZ' format."
  30052. },
  30053. "license": {
  30054. "type": ["string", "array"],
  30055. "description": "License name. Or an array of license names."
  30056. },
  30057. "authors": {
  30058. "$ref": "#/definitions/authors"
  30059. },
  30060. "require": {
  30061. "type": "object",
  30062. "description": "This is a hash of package name (keys) and version constraints (values) that are required to run this package.",
  30063. "additionalProperties": {
  30064. "type": "string"
  30065. }
  30066. },
  30067. "replace": {
  30068. "type": "object",
  30069. "description": "This is a hash of package name (keys) and version constraints (values) that can be replaced by this package.",
  30070. "additionalProperties": {
  30071. "type": "string"
  30072. }
  30073. },
  30074. "conflict": {
  30075. "type": "object",
  30076. "description": "This is a hash of package name (keys) and version constraints (values) that conflict with this package.",
  30077. "additionalProperties": {
  30078. "type": "string"
  30079. }
  30080. },
  30081. "provide": {
  30082. "type": "object",
  30083. "description": "This is a hash of package name (keys) and version constraints (values) that this package provides in addition to this package's name.",
  30084. "additionalProperties": {
  30085. "type": "string"
  30086. }
  30087. },
  30088. "require-dev": {
  30089. "type": "object",
  30090. "description": "This is a hash of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).",
  30091. "additionalProperties": {
  30092. "type": "string"
  30093. }
  30094. },
  30095. "suggest": {
  30096. "type": "object",
  30097. "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).",
  30098. "additionalProperties": {
  30099. "type": "string"
  30100. }
  30101. },
  30102. "config": {
  30103. "type": "object",
  30104. "description": "Composer options.",
  30105. "properties": {
  30106. "process-timeout": {
  30107. "type": "integer",
  30108. "description": "The timeout in seconds for process executions, defaults to 300 (5mins)."
  30109. },
  30110. "use-include-path": {
  30111. "type": "boolean",
  30112. "description": "If true, the Composer autoloader will also look for classes in the PHP include path."
  30113. },
  30114. "preferred-install": {
  30115. "type": ["string", "object"],
  30116. "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\"}."
  30117. },
  30118. "notify-on-install": {
  30119. "type": "boolean",
  30120. "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."
  30121. },
  30122. "github-protocols": {
  30123. "type": "array",
  30124. "description": "A list of protocols to use for github.com clones, in priority order, defaults to [\"git\", \"https\", \"http\"].",
  30125. "items": {
  30126. "type": "string"
  30127. }
  30128. },
  30129. "github-oauth": {
  30130. "type": "object",
  30131. "description": "A hash of domain name => github API oauth tokens, typically {\"github.com\":\"<token>\"}.",
  30132. "additionalProperties": {
  30133. "type": "string"
  30134. }
  30135. },
  30136. "gitlab-oauth": {
  30137. "type": "object",
  30138. "description": "A hash of domain name => gitlab API oauth tokens, typically {\"gitlab.com\":\"<token>\"}.",
  30139. "additionalProperties": {
  30140. "type": "string"
  30141. }
  30142. },
  30143. "gitlab-token": {
  30144. "type": "object",
  30145. "description": "A hash of domain name => gitlab private tokens, typically {\"gitlab.com\":\"<token>\"}.",
  30146. "additionalProperties": {
  30147. "type": "string"
  30148. }
  30149. },
  30150. "bearer": {
  30151. "type": "object",
  30152. "description": "A hash of domain name => bearer authentication token, for example {\"example.com\":\"<token>\"}.",
  30153. "additionalProperties": {
  30154. "type": "string"
  30155. }
  30156. },
  30157. "disable-tls": {
  30158. "type": "boolean",
  30159. "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."
  30160. },
  30161. "secure-http": {
  30162. "type": "boolean",
  30163. "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."
  30164. },
  30165. "cafile": {
  30166. "type": "string",
  30167. "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."
  30168. },
  30169. "capath": {
  30170. "type": "string",
  30171. "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."
  30172. },
  30173. "http-basic": {
  30174. "type": "object",
  30175. "description": "A hash of domain name => {\"username\": \"...\", \"password\": \"...\"}.",
  30176. "additionalProperties": {
  30177. "type": "object",
  30178. "required": ["username", "password"],
  30179. "properties": {
  30180. "username": {
  30181. "type": "string",
  30182. "description": "The username used for HTTP Basic authentication"
  30183. },
  30184. "password": {
  30185. "type": "string",
  30186. "description": "The password used for HTTP Basic authentication"
  30187. }
  30188. }
  30189. }
  30190. },
  30191. "store-auths": {
  30192. "type": ["string", "boolean"],
  30193. "description": "What to do after prompting for authentication, one of: true (store), false (do not store) or \"prompt\" (ask every time), defaults to prompt."
  30194. },
  30195. "platform": {
  30196. "type": "object",
  30197. "description": "This is a hash of package name (keys) and version (values) that will be used to mock the platform packages on this machine.",
  30198. "additionalProperties": {
  30199. "type": "string"
  30200. }
  30201. },
  30202. "vendor-dir": {
  30203. "type": "string",
  30204. "description": "The location where all packages are installed, defaults to \"vendor\"."
  30205. },
  30206. "bin-dir": {
  30207. "type": "string",
  30208. "description": "The location where all binaries are linked, defaults to \"vendor/bin\"."
  30209. },
  30210. "data-dir": {
  30211. "type": "string",
  30212. "description": "The location where old phar files are stored, defaults to \"$home\" except on XDG Base Directory compliant unixes."
  30213. },
  30214. "cache-dir": {
  30215. "type": "string",
  30216. "description": "The location where all caches are located, defaults to \"~/.composer/cache\" on *nix and \"%LOCALAPPDATA%\\Composer\" on windows."
  30217. },
  30218. "cache-files-dir": {
  30219. "type": "string",
  30220. "description": "The location where files (zip downloads) are cached, defaults to \"{$cache-dir}/files\"."
  30221. },
  30222. "cache-repo-dir": {
  30223. "type": "string",
  30224. "description": "The location where repo (git/hg repo clones) are cached, defaults to \"{$cache-dir}/repo\"."
  30225. },
  30226. "cache-vcs-dir": {
  30227. "type": "string",
  30228. "description": "The location where vcs infos (git clones, github api calls, etc. when reading vcs repos) are cached, defaults to \"{$cache-dir}/vcs\"."
  30229. },
  30230. "cache-ttl": {
  30231. "type": "integer",
  30232. "description": "The default cache time-to-live, defaults to 15552000 (6 months)."
  30233. },
  30234. "cache-files-ttl": {
  30235. "type": "integer",
  30236. "description": "The cache time-to-live for files, defaults to the value of cache-ttl."
  30237. },
  30238. "cache-files-maxsize": {
  30239. "type": ["string", "integer"],
  30240. "description": "The cache max size for the files cache, defaults to \"300MiB\"."
  30241. },
  30242. "bin-compat": {
  30243. "enum": ["auto", "full"],
  30244. "description": "The compatibility of the binaries, defaults to \"auto\" (automatically guessed) and can be \"full\" (compatible with both Windows and Unix-based systems)."
  30245. },
  30246. "discard-changes": {
  30247. "type": ["string", "boolean"],
  30248. "description": "The default style of handling dirty updates, defaults to false and can be any of true, false or \"stash\"."
  30249. },
  30250. "autoloader-suffix": {
  30251. "type": "string",
  30252. "description": "Optional string to be used as a suffix for the generated Composer autoloader. When null a random one will be generated."
  30253. },
  30254. "optimize-autoloader": {
  30255. "type": "boolean",
  30256. "description": "Always optimize when dumping the autoloader."
  30257. },
  30258. "prepend-autoloader": {
  30259. "type": "boolean",
  30260. "description": "If false, the composer autoloader will not be prepended to existing autoloaders, defaults to true."
  30261. },
  30262. "classmap-authoritative": {
  30263. "type": "boolean",
  30264. "description": "If true, the composer autoloader will not scan the filesystem for classes that are not found in the class map, defaults to false."
  30265. },
  30266. "apcu-autoloader": {
  30267. "type": "boolean",
  30268. "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."
  30269. },
  30270. "github-domains": {
  30271. "type": "array",
  30272. "description": "A list of domains to use in github mode. This is used for GitHub Enterprise setups, defaults to [\"github.com\"].",
  30273. "items": {
  30274. "type": "string"
  30275. }
  30276. },
  30277. "github-expose-hostname": {
  30278. "type": "boolean",
  30279. "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."
  30280. },
  30281. "gitlab-domains": {
  30282. "type": "array",
  30283. "description": "A list of domains to use in gitlab mode. This is used for custom GitLab setups, defaults to [\"gitlab.com\"].",
  30284. "items": {
  30285. "type": "string"
  30286. }
  30287. },
  30288. "use-github-api": {
  30289. "type": "boolean",
  30290. "description": "Defaults to true. If set to false, globally disables the use of the GitHub API for all GitHub repositories and clones the repository as it would for any other repository."
  30291. },
  30292. "archive-format": {
  30293. "type": "string",
  30294. "description": "The default archiving format when not provided on cli, defaults to \"tar\"."
  30295. },
  30296. "archive-dir": {
  30297. "type": "string",
  30298. "description": "The default archive path when not provided on cli, defaults to \".\"."
  30299. },
  30300. "htaccess-protect": {
  30301. "type": "boolean",
  30302. "description": "Defaults to true. If set to false, Composer will not create .htaccess files in the composer home, cache, and data directories."
  30303. },
  30304. "sort-packages": {
  30305. "type": "boolean",
  30306. "description": "Defaults to false. If set to true, Composer will sort packages when adding/updating a new dependency."
  30307. },
  30308. "lock": {
  30309. "type": "boolean",
  30310. "description": "Defaults to true. If set to false, Composer will not create a composer.lock file."
  30311. }
  30312. }
  30313. },
  30314. "extra": {
  30315. "type": ["object", "array"],
  30316. "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.",
  30317. "additionalProperties": true
  30318. },
  30319. "autoload": {
  30320. "$ref": "#/definitions/autoload"
  30321. },
  30322. "autoload-dev": {
  30323. "type": "object",
  30324. "description": "Description of additional autoload rules for development purpose (eg. a test suite).",
  30325. "properties": {
  30326. "psr-0": {
  30327. "type": "object",
  30328. "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.",
  30329. "additionalProperties": {
  30330. "type": ["string", "array"],
  30331. "items": {
  30332. "type": "string"
  30333. }
  30334. }
  30335. },
  30336. "psr-4": {
  30337. "type": "object",
  30338. "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.",
  30339. "additionalProperties": {
  30340. "type": ["string", "array"],
  30341. "items": {
  30342. "type": "string"
  30343. }
  30344. }
  30345. },
  30346. "classmap": {
  30347. "type": "array",
  30348. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  30349. },
  30350. "files": {
  30351. "type": "array",
  30352. "description": "This is an array of files that are always required on every request."
  30353. }
  30354. }
  30355. },
  30356. "archive": {
  30357. "type": ["object"],
  30358. "description": "Options for creating package archives for distribution.",
  30359. "properties": {
  30360. "exclude": {
  30361. "type": "array",
  30362. "description": "A list of patterns for paths to exclude or include if prefixed with an exclamation mark."
  30363. }
  30364. }
  30365. },
  30366. "repositories": {
  30367. "type": ["object", "array"],
  30368. "description": "A set of additional repositories where packages can be found.",
  30369. "additionalProperties": {
  30370. "oneOf": [
  30371. { "$ref": "#/definitions/repository" },
  30372. { "type": "boolean", "enum": [false] }
  30373. ]
  30374. },
  30375. "items": {
  30376. "oneOf": [
  30377. { "$ref": "#/definitions/repository" },
  30378. {
  30379. "type": "object",
  30380. "additionalProperties": { "type": "boolean", "enum": [false] },
  30381. "minProperties": 1,
  30382. "maxProperties": 1
  30383. }
  30384. ]
  30385. }
  30386. },
  30387. "minimum-stability": {
  30388. "type": ["string"],
  30389. "description": "The minimum stability the packages must have to be install-able. Possible values are: dev, alpha, beta, RC, stable.",
  30390. "pattern": "^dev|alpha|beta|rc|RC|stable$"
  30391. },
  30392. "prefer-stable": {
  30393. "type": ["boolean"],
  30394. "description": "If set to true, stable packages will be preferred to dev packages when possible, even if the minimum-stability allows unstable packages."
  30395. },
  30396. "bin": {
  30397. "type": ["string", "array"],
  30398. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  30399. "items": {
  30400. "type": "string"
  30401. }
  30402. },
  30403. "include-path": {
  30404. "type": ["array"],
  30405. "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.",
  30406. "items": {
  30407. "type": "string"
  30408. }
  30409. },
  30410. "scripts": {
  30411. "type": ["object"],
  30412. "description": "Script listeners that will be executed before/after some events.",
  30413. "properties": {
  30414. "pre-install-cmd": {
  30415. "type": ["array", "string"],
  30416. "description": "Occurs before the install command is executed, contains one or more Class::method callables or shell commands."
  30417. },
  30418. "post-install-cmd": {
  30419. "type": ["array", "string"],
  30420. "description": "Occurs after the install command is executed, contains one or more Class::method callables or shell commands."
  30421. },
  30422. "pre-update-cmd": {
  30423. "type": ["array", "string"],
  30424. "description": "Occurs before the update command is executed, contains one or more Class::method callables or shell commands."
  30425. },
  30426. "post-update-cmd": {
  30427. "type": ["array", "string"],
  30428. "description": "Occurs after the update command is executed, contains one or more Class::method callables or shell commands."
  30429. },
  30430. "pre-status-cmd": {
  30431. "type": ["array", "string"],
  30432. "description": "Occurs before the status command is executed, contains one or more Class::method callables or shell commands."
  30433. },
  30434. "post-status-cmd": {
  30435. "type": ["array", "string"],
  30436. "description": "Occurs after the status command is executed, contains one or more Class::method callables or shell commands."
  30437. },
  30438. "pre-package-install": {
  30439. "type": ["array", "string"],
  30440. "description": "Occurs before a package is installed, contains one or more Class::method callables or shell commands."
  30441. },
  30442. "post-package-install": {
  30443. "type": ["array", "string"],
  30444. "description": "Occurs after a package is installed, contains one or more Class::method callables or shell commands."
  30445. },
  30446. "pre-package-update": {
  30447. "type": ["array", "string"],
  30448. "description": "Occurs before a package is updated, contains one or more Class::method callables or shell commands."
  30449. },
  30450. "post-package-update": {
  30451. "type": ["array", "string"],
  30452. "description": "Occurs after a package is updated, contains one or more Class::method callables or shell commands."
  30453. },
  30454. "pre-package-uninstall": {
  30455. "type": ["array", "string"],
  30456. "description": "Occurs before a package has been uninstalled, contains one or more Class::method callables or shell commands."
  30457. },
  30458. "post-package-uninstall": {
  30459. "type": ["array", "string"],
  30460. "description": "Occurs after a package has been uninstalled, contains one or more Class::method callables or shell commands."
  30461. },
  30462. "pre-autoload-dump": {
  30463. "type": ["array", "string"],
  30464. "description": "Occurs before the autoloader is dumped, contains one or more Class::method callables or shell commands."
  30465. },
  30466. "post-autoload-dump": {
  30467. "type": ["array", "string"],
  30468. "description": "Occurs after the autoloader is dumped, contains one or more Class::method callables or shell commands."
  30469. },
  30470. "post-root-package-install": {
  30471. "type": ["array", "string"],
  30472. "description": "Occurs after the root-package is installed, contains one or more Class::method callables or shell commands."
  30473. },
  30474. "post-create-project-cmd": {
  30475. "type": ["array", "string"],
  30476. "description": "Occurs after the create-project command is executed, contains one or more Class::method callables or shell commands."
  30477. }
  30478. }
  30479. },
  30480. "scripts-descriptions": {
  30481. "type": ["object"],
  30482. "description": "Descriptions for custom commands, shown in console help.",
  30483. "additionalProperties": {
  30484. "type": "string"
  30485. }
  30486. },
  30487. "support": {
  30488. "type": "object",
  30489. "properties": {
  30490. "email": {
  30491. "type": "string",
  30492. "description": "Email address for support.",
  30493. "format": "email"
  30494. },
  30495. "issues": {
  30496. "type": "string",
  30497. "description": "URL to the issue tracker.",
  30498. "format": "uri"
  30499. },
  30500. "forum": {
  30501. "type": "string",
  30502. "description": "URL to the forum.",
  30503. "format": "uri"
  30504. },
  30505. "wiki": {
  30506. "type": "string",
  30507. "description": "URL to the wiki.",
  30508. "format": "uri"
  30509. },
  30510. "irc": {
  30511. "type": "string",
  30512. "description": "IRC channel for support, as irc://server/channel.",
  30513. "format": "uri"
  30514. },
  30515. "chat": {
  30516. "type": "string",
  30517. "description": "URL to the support chat.",
  30518. "format": "uri"
  30519. },
  30520. "source": {
  30521. "type": "string",
  30522. "description": "URL to browse or download the sources.",
  30523. "format": "uri"
  30524. },
  30525. "docs": {
  30526. "type": "string",
  30527. "description": "URL to the documentation.",
  30528. "format": "uri"
  30529. },
  30530. "rss": {
  30531. "type": "string",
  30532. "description": "URL to the RSS feed.",
  30533. "format": "uri"
  30534. }
  30535. }
  30536. },
  30537. "funding": {
  30538. "type": "array",
  30539. "description": "A list of options to fund the development and maintenance of the package.",
  30540. "items": {
  30541. "type": "object",
  30542. "properties": {
  30543. "type": {
  30544. "type": "string",
  30545. "description": "Type of funding or platform through which funding is possible."
  30546. },
  30547. "url": {
  30548. "type": "string",
  30549. "description": "URL to a website with details on funding and a way to fund the package.",
  30550. "format": "uri"
  30551. }
  30552. }
  30553. }
  30554. },
  30555. "non-feature-branches": {
  30556. "type": ["array"],
  30557. "description": "A set of string or regex patterns for non-numeric branch names that will not be handled as feature branches.",
  30558. "items": {
  30559. "type": "string"
  30560. }
  30561. },
  30562. "abandoned": {
  30563. "type": ["boolean", "string"],
  30564. "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."
  30565. },
  30566. "_comment": {
  30567. "type": ["array", "string"],
  30568. "description": "A key to store comments in"
  30569. }
  30570. },
  30571. "definitions": {
  30572. "authors": {
  30573. "type": "array",
  30574. "description": "List of authors that contributed to the package. This is typically the main maintainers, not the full list.",
  30575. "items": {
  30576. "type": "object",
  30577. "additionalProperties": false,
  30578. "required": [ "name"],
  30579. "properties": {
  30580. "name": {
  30581. "type": "string",
  30582. "description": "Full name of the author."
  30583. },
  30584. "email": {
  30585. "type": "string",
  30586. "description": "Email address of the author.",
  30587. "format": "email"
  30588. },
  30589. "homepage": {
  30590. "type": "string",
  30591. "description": "Homepage URL for the author.",
  30592. "format": "uri"
  30593. },
  30594. "role": {
  30595. "type": "string",
  30596. "description": "Author's role in the project."
  30597. }
  30598. }
  30599. }
  30600. },
  30601. "autoload": {
  30602. "type": "object",
  30603. "description": "Description of how the package can be autoloaded.",
  30604. "properties": {
  30605. "psr-0": {
  30606. "type": "object",
  30607. "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.",
  30608. "additionalProperties": {
  30609. "type": ["string", "array"],
  30610. "items": {
  30611. "type": "string"
  30612. }
  30613. }
  30614. },
  30615. "psr-4": {
  30616. "type": "object",
  30617. "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.",
  30618. "additionalProperties": {
  30619. "type": ["string", "array"],
  30620. "items": {
  30621. "type": "string"
  30622. }
  30623. }
  30624. },
  30625. "classmap": {
  30626. "type": "array",
  30627. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  30628. },
  30629. "files": {
  30630. "type": "array",
  30631. "description": "This is an array of files that are always required on every request."
  30632. },
  30633. "exclude-from-classmap": {
  30634. "type": "array",
  30635. "description": "This is an array of patterns to exclude from autoload classmap generation. (e.g. \"exclude-from-classmap\": [\"/test/\", \"/tests/\", \"/Tests/\"]"
  30636. }
  30637. }
  30638. },
  30639. "repository": {
  30640. "type": "object",
  30641. "oneOf": [
  30642. { "$ref": "#/definitions/composer-repository" },
  30643. { "$ref": "#/definitions/vcs-repository" },
  30644. { "$ref": "#/definitions/path-repository" },
  30645. { "$ref": "#/definitions/artifact-repository" },
  30646. { "$ref": "#/definitions/pear-repository" },
  30647. { "$ref": "#/definitions/package-repository" }
  30648. ]
  30649. },
  30650. "composer-repository": {
  30651. "type": "object",
  30652. "required": ["type", "url"],
  30653. "properties": {
  30654. "type": { "type": "string", "enum": ["composer"] },
  30655. "url": { "type": "string" },
  30656. "options": {
  30657. "type": "object",
  30658. "additionalProperties": true
  30659. },
  30660. "allow_ssl_downgrade": { "type": "boolean" },
  30661. "force-lazy-providers": { "type": "boolean" }
  30662. }
  30663. },
  30664. "vcs-repository": {
  30665. "type": "object",
  30666. "required": ["type", "url"],
  30667. "properties": {
  30668. "type": { "type": "string", "enum": ["vcs", "github", "git", "gitlab", "git-bitbucket", "hg", "hg-bitbucket", "fossil", "perforce", "svn"] },
  30669. "url": { "type": "string" },
  30670. "no-api": { "type": "boolean" },
  30671. "secure-http": { "type": "boolean" },
  30672. "svn-cache-credentials": { "type": "boolean" },
  30673. "trunk-path": { "type": ["string", "boolean"] },
  30674. "branches-path": { "type": ["string", "boolean"] },
  30675. "tags-path": { "type": ["string", "boolean"] },
  30676. "package-path": { "type": "string" },
  30677. "depot": { "type": "string" },
  30678. "branch": { "type": "string" },
  30679. "unique_perforce_client_name": { "type": "string" },
  30680. "p4user": { "type": "string" },
  30681. "p4password": { "type": "string" }
  30682. }
  30683. },
  30684. "path-repository": {
  30685. "type": "object",
  30686. "required": ["type", "url"],
  30687. "properties": {
  30688. "type": { "type": "string", "enum": ["path"] },
  30689. "url": { "type": "string" },
  30690. "options": {
  30691. "type": "object",
  30692. "properties": {
  30693. "symlink": { "type": ["boolean", "null"] }
  30694. },
  30695. "additionalProperties": true
  30696. }
  30697. }
  30698. },
  30699. "artifact-repository": {
  30700. "type": "object",
  30701. "required": ["type", "url"],
  30702. "properties": {
  30703. "type": { "type": "string", "enum": ["artifact"] },
  30704. "url": { "type": "string" }
  30705. }
  30706. },
  30707. "pear-repository": {
  30708. "type": "object",
  30709. "required": ["type", "url"],
  30710. "properties": {
  30711. "type": { "type": "string", "enum": ["pear"] },
  30712. "url": { "type": "string" },
  30713. "vendor-alias": { "type": "string" }
  30714. }
  30715. },
  30716. "package-repository": {
  30717. "type": "object",
  30718. "required": ["type", "package"],
  30719. "properties": {
  30720. "type": { "type": "string", "enum": ["package"] },
  30721. "package": {
  30722. "oneOf": [
  30723. { "$ref": "#/definitions/inline-package" },
  30724. {
  30725. "type": "array",
  30726. "items": { "$ref": "#/definitions/inline-package" }
  30727. }
  30728. ]
  30729. }
  30730. }
  30731. },
  30732. "inline-package": {
  30733. "type": "object",
  30734. "required": ["name", "version"],
  30735. "properties": {
  30736. "name": {
  30737. "type": "string",
  30738. "description": "Package name, including 'vendor-name/' prefix."
  30739. },
  30740. "type": {
  30741. "type": "string"
  30742. },
  30743. "target-dir": {
  30744. "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.",
  30745. "type": "string"
  30746. },
  30747. "description": {
  30748. "type": "string"
  30749. },
  30750. "keywords": {
  30751. "type": "array",
  30752. "items": {
  30753. "type": "string"
  30754. }
  30755. },
  30756. "homepage": {
  30757. "type": "string",
  30758. "format": "uri"
  30759. },
  30760. "version": {
  30761. "type": "string"
  30762. },
  30763. "time": {
  30764. "type": "string"
  30765. },
  30766. "license": {
  30767. "type": [
  30768. "string",
  30769. "array"
  30770. ]
  30771. },
  30772. "authors": {
  30773. "$ref": "#/definitions/authors"
  30774. },
  30775. "require": {
  30776. "type": "object",
  30777. "additionalProperties": {
  30778. "type": "string"
  30779. }
  30780. },
  30781. "replace": {
  30782. "type": "object",
  30783. "additionalProperties": {
  30784. "type": "string"
  30785. }
  30786. },
  30787. "conflict": {
  30788. "type": "object",
  30789. "additionalProperties": {
  30790. "type": "string"
  30791. }
  30792. },
  30793. "provide": {
  30794. "type": "object",
  30795. "additionalProperties": {
  30796. "type": "string"
  30797. }
  30798. },
  30799. "require-dev": {
  30800. "type": "object",
  30801. "additionalProperties": {
  30802. "type": "string"
  30803. }
  30804. },
  30805. "suggest": {
  30806. "type": "object",
  30807. "additionalProperties": {
  30808. "type": "string"
  30809. }
  30810. },
  30811. "extra": {
  30812. "type": ["object", "array"],
  30813. "additionalProperties": true
  30814. },
  30815. "autoload": {
  30816. "$ref": "#/definitions/autoload"
  30817. },
  30818. "archive": {
  30819. "type": ["object"],
  30820. "properties": {
  30821. "exclude": {
  30822. "type": "array"
  30823. }
  30824. }
  30825. },
  30826. "bin": {
  30827. "type": ["string", "array"],
  30828. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  30829. "items": {
  30830. "type": "string"
  30831. }
  30832. },
  30833. "include-path": {
  30834. "type": ["array"],
  30835. "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.",
  30836. "items": {
  30837. "type": "string"
  30838. }
  30839. },
  30840. "source": {
  30841. "type": "object",
  30842. "required": ["type", "url", "reference"],
  30843. "properties": {
  30844. "type": {
  30845. "type": "string"
  30846. },
  30847. "url": {
  30848. "type": "string"
  30849. },
  30850. "reference": {
  30851. "type": "string"
  30852. },
  30853. "mirrors": {
  30854. "type": "array"
  30855. }
  30856. }
  30857. },
  30858. "dist": {
  30859. "type": "object",
  30860. "required": ["type", "url"],
  30861. "properties": {
  30862. "type": {
  30863. "type": "string"
  30864. },
  30865. "url": {
  30866. "type": "string"
  30867. },
  30868. "reference": {
  30869. "type": "string"
  30870. },
  30871. "shasum": {
  30872. "type": "string"
  30873. },
  30874. "mirrors": {
  30875. "type": "array"
  30876. }
  30877. }
  30878. }
  30879. },
  30880. "additionalProperties": true
  30881. }
  30882. }
  30883. }
  30884. {
  30885. "389-exception": [
  30886. "389 Directory Server Exception"
  30887. ],
  30888. "Autoconf-exception-2.0": [
  30889. "Autoconf exception 2.0"
  30890. ],
  30891. "Autoconf-exception-3.0": [
  30892. "Autoconf exception 3.0"
  30893. ],
  30894. "Bison-exception-2.2": [
  30895. "Bison exception 2.2"
  30896. ],
  30897. "Bootloader-exception": [
  30898. "Bootloader Distribution Exception"
  30899. ],
  30900. "Classpath-exception-2.0": [
  30901. "Classpath exception 2.0"
  30902. ],
  30903. "CLISP-exception-2.0": [
  30904. "CLISP exception 2.0"
  30905. ],
  30906. "DigiRule-FOSS-exception": [
  30907. "DigiRule FOSS License Exception"
  30908. ],
  30909. "eCos-exception-2.0": [
  30910. "eCos exception 2.0"
  30911. ],
  30912. "Fawkes-Runtime-exception": [
  30913. "Fawkes Runtime Exception"
  30914. ],
  30915. "FLTK-exception": [
  30916. "FLTK exception"
  30917. ],
  30918. "Font-exception-2.0": [
  30919. "Font exception 2.0"
  30920. ],
  30921. "freertos-exception-2.0": [
  30922. "FreeRTOS Exception 2.0"
  30923. ],
  30924. "GCC-exception-2.0": [
  30925. "GCC Runtime Library exception 2.0"
  30926. ],
  30927. "GCC-exception-3.1": [
  30928. "GCC Runtime Library exception 3.1"
  30929. ],
  30930. "gnu-javamail-exception": [
  30931. "GNU JavaMail exception"
  30932. ],
  30933. "GPL-3.0-linking-exception": [
  30934. "GPL-3.0 Linking Exception"
  30935. ],
  30936. "GPL-3.0-linking-source-exception": [
  30937. "GPL-3.0 Linking Exception (with Corresponding Source)"
  30938. ],
  30939. "GPL-CC-1.0": [
  30940. "GPL Cooperation Commitment 1.0"
  30941. ],
  30942. "i2p-gpl-java-exception": [
  30943. "i2p GPL+Java Exception"
  30944. ],
  30945. "Libtool-exception": [
  30946. "Libtool Exception"
  30947. ],
  30948. "Linux-syscall-note": [
  30949. "Linux Syscall Note"
  30950. ],
  30951. "LLVM-exception": [
  30952. "LLVM Exception"
  30953. ],
  30954. "LZMA-exception": [
  30955. "LZMA exception"
  30956. ],
  30957. "mif-exception": [
  30958. "Macros and Inline Functions Exception"
  30959. ],
  30960. "Nokia-Qt-exception-1.1": [
  30961. "Nokia Qt LGPL exception 1.1"
  30962. ],
  30963. "OCaml-LGPL-linking-exception": [
  30964. "OCaml LGPL Linking Exception"
  30965. ],
  30966. "OCCT-exception-1.0": [
  30967. "Open CASCADE Exception 1.0"
  30968. ],
  30969. "OpenJDK-assembly-exception-1.0": [
  30970. "OpenJDK Assembly exception 1.0"
  30971. ],
  30972. "openvpn-openssl-exception": [
  30973. "OpenVPN OpenSSL Exception"
  30974. ],
  30975. "PS-or-PDF-font-exception-20170817": [
  30976. "PS/PDF font exception (2017-08-17)"
  30977. ],
  30978. "Qt-GPL-exception-1.0": [
  30979. "Qt GPL exception 1.0"
  30980. ],
  30981. "Qt-LGPL-exception-1.1": [
  30982. "Qt LGPL exception 1.1"
  30983. ],
  30984. "Qwt-exception-1.0": [
  30985. "Qwt exception 1.0"
  30986. ],
  30987. "Swift-exception": [
  30988. "Swift Exception"
  30989. ],
  30990. "u-boot-exception-2.0": [
  30991. "U-Boot exception 2.0"
  30992. ],
  30993. "Universal-FOSS-exception-1.0": [
  30994. "Universal FOSS Exception, Version 1.0"
  30995. ],
  30996. "WxWindows-exception-3.1": [
  30997. "WxWindows Library Exception 3.1"
  30998. ]
  30999. }{
  31000. "0BSD": [
  31001. "BSD Zero Clause License",
  31002. true,
  31003. false
  31004. ],
  31005. "AAL": [
  31006. "Attribution Assurance License",
  31007. true,
  31008. false
  31009. ],
  31010. "Abstyles": [
  31011. "Abstyles License",
  31012. false,
  31013. false
  31014. ],
  31015. "Adobe-2006": [
  31016. "Adobe Systems Incorporated Source Code License Agreement",
  31017. false,
  31018. false
  31019. ],
  31020. "Adobe-Glyph": [
  31021. "Adobe Glyph List License",
  31022. false,
  31023. false
  31024. ],
  31025. "ADSL": [
  31026. "Amazon Digital Services License",
  31027. false,
  31028. false
  31029. ],
  31030. "AFL-1.1": [
  31031. "Academic Free License v1.1",
  31032. true,
  31033. false
  31034. ],
  31035. "AFL-1.2": [
  31036. "Academic Free License v1.2",
  31037. true,
  31038. false
  31039. ],
  31040. "AFL-2.0": [
  31041. "Academic Free License v2.0",
  31042. true,
  31043. false
  31044. ],
  31045. "AFL-2.1": [
  31046. "Academic Free License v2.1",
  31047. true,
  31048. false
  31049. ],
  31050. "AFL-3.0": [
  31051. "Academic Free License v3.0",
  31052. true,
  31053. false
  31054. ],
  31055. "Afmparse": [
  31056. "Afmparse License",
  31057. false,
  31058. false
  31059. ],
  31060. "AGPL-1.0": [
  31061. "Affero General Public License v1.0",
  31062. false,
  31063. true
  31064. ],
  31065. "AGPL-1.0-only": [
  31066. "Affero General Public License v1.0 only",
  31067. false,
  31068. false
  31069. ],
  31070. "AGPL-1.0-or-later": [
  31071. "Affero General Public License v1.0 or later",
  31072. false,
  31073. false
  31074. ],
  31075. "AGPL-3.0": [
  31076. "GNU Affero General Public License v3.0",
  31077. true,
  31078. true
  31079. ],
  31080. "AGPL-3.0-only": [
  31081. "GNU Affero General Public License v3.0 only",
  31082. true,
  31083. false
  31084. ],
  31085. "AGPL-3.0-or-later": [
  31086. "GNU Affero General Public License v3.0 or later",
  31087. true,
  31088. false
  31089. ],
  31090. "Aladdin": [
  31091. "Aladdin Free Public License",
  31092. false,
  31093. false
  31094. ],
  31095. "AMDPLPA": [
  31096. "AMD's plpa_map.c License",
  31097. false,
  31098. false
  31099. ],
  31100. "AML": [
  31101. "Apple MIT License",
  31102. false,
  31103. false
  31104. ],
  31105. "AMPAS": [
  31106. "Academy of Motion Picture Arts and Sciences BSD",
  31107. false,
  31108. false
  31109. ],
  31110. "ANTLR-PD": [
  31111. "ANTLR Software Rights Notice",
  31112. false,
  31113. false
  31114. ],
  31115. "Apache-1.0": [
  31116. "Apache License 1.0",
  31117. false,
  31118. false
  31119. ],
  31120. "Apache-1.1": [
  31121. "Apache License 1.1",
  31122. true,
  31123. false
  31124. ],
  31125. "Apache-2.0": [
  31126. "Apache License 2.0",
  31127. true,
  31128. false
  31129. ],
  31130. "APAFML": [
  31131. "Adobe Postscript AFM License",
  31132. false,
  31133. false
  31134. ],
  31135. "APL-1.0": [
  31136. "Adaptive Public License 1.0",
  31137. true,
  31138. false
  31139. ],
  31140. "APSL-1.0": [
  31141. "Apple Public Source License 1.0",
  31142. true,
  31143. false
  31144. ],
  31145. "APSL-1.1": [
  31146. "Apple Public Source License 1.1",
  31147. true,
  31148. false
  31149. ],
  31150. "APSL-1.2": [
  31151. "Apple Public Source License 1.2",
  31152. true,
  31153. false
  31154. ],
  31155. "APSL-2.0": [
  31156. "Apple Public Source License 2.0",
  31157. true,
  31158. false
  31159. ],
  31160. "Artistic-1.0": [
  31161. "Artistic License 1.0",
  31162. true,
  31163. false
  31164. ],
  31165. "Artistic-1.0-cl8": [
  31166. "Artistic License 1.0 w/clause 8",
  31167. true,
  31168. false
  31169. ],
  31170. "Artistic-1.0-Perl": [
  31171. "Artistic License 1.0 (Perl)",
  31172. true,
  31173. false
  31174. ],
  31175. "Artistic-2.0": [
  31176. "Artistic License 2.0",
  31177. true,
  31178. false
  31179. ],
  31180. "Bahyph": [
  31181. "Bahyph License",
  31182. false,
  31183. false
  31184. ],
  31185. "Barr": [
  31186. "Barr License",
  31187. false,
  31188. false
  31189. ],
  31190. "Beerware": [
  31191. "Beerware License",
  31192. false,
  31193. false
  31194. ],
  31195. "BitTorrent-1.0": [
  31196. "BitTorrent Open Source License v1.0",
  31197. false,
  31198. false
  31199. ],
  31200. "BitTorrent-1.1": [
  31201. "BitTorrent Open Source License v1.1",
  31202. false,
  31203. false
  31204. ],
  31205. "blessing": [
  31206. "SQLite Blessing",
  31207. false,
  31208. false
  31209. ],
  31210. "BlueOak-1.0.0": [
  31211. "Blue Oak Model License 1.0.0",
  31212. false,
  31213. false
  31214. ],
  31215. "Borceux": [
  31216. "Borceux license",
  31217. false,
  31218. false
  31219. ],
  31220. "BSD-1-Clause": [
  31221. "BSD 1-Clause License",
  31222. false,
  31223. false
  31224. ],
  31225. "BSD-2-Clause": [
  31226. "BSD 2-Clause \"Simplified\" License",
  31227. true,
  31228. false
  31229. ],
  31230. "BSD-2-Clause-FreeBSD": [
  31231. "BSD 2-Clause FreeBSD License",
  31232. false,
  31233. false
  31234. ],
  31235. "BSD-2-Clause-NetBSD": [
  31236. "BSD 2-Clause NetBSD License",
  31237. false,
  31238. false
  31239. ],
  31240. "BSD-2-Clause-Patent": [
  31241. "BSD-2-Clause Plus Patent License",
  31242. true,
  31243. false
  31244. ],
  31245. "BSD-3-Clause": [
  31246. "BSD 3-Clause \"New\" or \"Revised\" License",
  31247. true,
  31248. false
  31249. ],
  31250. "BSD-3-Clause-Attribution": [
  31251. "BSD with attribution",
  31252. false,
  31253. false
  31254. ],
  31255. "BSD-3-Clause-Clear": [
  31256. "BSD 3-Clause Clear License",
  31257. false,
  31258. false
  31259. ],
  31260. "BSD-3-Clause-LBNL": [
  31261. "Lawrence Berkeley National Labs BSD variant license",
  31262. true,
  31263. false
  31264. ],
  31265. "BSD-3-Clause-No-Nuclear-License": [
  31266. "BSD 3-Clause No Nuclear License",
  31267. false,
  31268. false
  31269. ],
  31270. "BSD-3-Clause-No-Nuclear-License-2014": [
  31271. "BSD 3-Clause No Nuclear License 2014",
  31272. false,
  31273. false
  31274. ],
  31275. "BSD-3-Clause-No-Nuclear-Warranty": [
  31276. "BSD 3-Clause No Nuclear Warranty",
  31277. false,
  31278. false
  31279. ],
  31280. "BSD-3-Clause-Open-MPI": [
  31281. "BSD 3-Clause Open MPI variant",
  31282. false,
  31283. false
  31284. ],
  31285. "BSD-4-Clause": [
  31286. "BSD 4-Clause \"Original\" or \"Old\" License",
  31287. false,
  31288. false
  31289. ],
  31290. "BSD-4-Clause-UC": [
  31291. "BSD-4-Clause (University of California-Specific)",
  31292. false,
  31293. false
  31294. ],
  31295. "BSD-Protection": [
  31296. "BSD Protection License",
  31297. false,
  31298. false
  31299. ],
  31300. "BSD-Source-Code": [
  31301. "BSD Source Code Attribution",
  31302. false,
  31303. false
  31304. ],
  31305. "BSL-1.0": [
  31306. "Boost Software License 1.0",
  31307. true,
  31308. false
  31309. ],
  31310. "bzip2-1.0.5": [
  31311. "bzip2 and libbzip2 License v1.0.5",
  31312. false,
  31313. false
  31314. ],
  31315. "bzip2-1.0.6": [
  31316. "bzip2 and libbzip2 License v1.0.6",
  31317. false,
  31318. false
  31319. ],
  31320. "Caldera": [
  31321. "Caldera License",
  31322. false,
  31323. false
  31324. ],
  31325. "CATOSL-1.1": [
  31326. "Computer Associates Trusted Open Source License 1.1",
  31327. true,
  31328. false
  31329. ],
  31330. "CC-BY-1.0": [
  31331. "Creative Commons Attribution 1.0 Generic",
  31332. false,
  31333. false
  31334. ],
  31335. "CC-BY-2.0": [
  31336. "Creative Commons Attribution 2.0 Generic",
  31337. false,
  31338. false
  31339. ],
  31340. "CC-BY-2.5": [
  31341. "Creative Commons Attribution 2.5 Generic",
  31342. false,
  31343. false
  31344. ],
  31345. "CC-BY-3.0": [
  31346. "Creative Commons Attribution 3.0 Unported",
  31347. false,
  31348. false
  31349. ],
  31350. "CC-BY-4.0": [
  31351. "Creative Commons Attribution 4.0 International",
  31352. false,
  31353. false
  31354. ],
  31355. "CC-BY-NC-1.0": [
  31356. "Creative Commons Attribution Non Commercial 1.0 Generic",
  31357. false,
  31358. false
  31359. ],
  31360. "CC-BY-NC-2.0": [
  31361. "Creative Commons Attribution Non Commercial 2.0 Generic",
  31362. false,
  31363. false
  31364. ],
  31365. "CC-BY-NC-2.5": [
  31366. "Creative Commons Attribution Non Commercial 2.5 Generic",
  31367. false,
  31368. false
  31369. ],
  31370. "CC-BY-NC-3.0": [
  31371. "Creative Commons Attribution Non Commercial 3.0 Unported",
  31372. false,
  31373. false
  31374. ],
  31375. "CC-BY-NC-4.0": [
  31376. "Creative Commons Attribution Non Commercial 4.0 International",
  31377. false,
  31378. false
  31379. ],
  31380. "CC-BY-NC-ND-1.0": [
  31381. "Creative Commons Attribution Non Commercial No Derivatives 1.0 Generic",
  31382. false,
  31383. false
  31384. ],
  31385. "CC-BY-NC-ND-2.0": [
  31386. "Creative Commons Attribution Non Commercial No Derivatives 2.0 Generic",
  31387. false,
  31388. false
  31389. ],
  31390. "CC-BY-NC-ND-2.5": [
  31391. "Creative Commons Attribution Non Commercial No Derivatives 2.5 Generic",
  31392. false,
  31393. false
  31394. ],
  31395. "CC-BY-NC-ND-3.0": [
  31396. "Creative Commons Attribution Non Commercial No Derivatives 3.0 Unported",
  31397. false,
  31398. false
  31399. ],
  31400. "CC-BY-NC-ND-4.0": [
  31401. "Creative Commons Attribution Non Commercial No Derivatives 4.0 International",
  31402. false,
  31403. false
  31404. ],
  31405. "CC-BY-NC-SA-1.0": [
  31406. "Creative Commons Attribution Non Commercial Share Alike 1.0 Generic",
  31407. false,
  31408. false
  31409. ],
  31410. "CC-BY-NC-SA-2.0": [
  31411. "Creative Commons Attribution Non Commercial Share Alike 2.0 Generic",
  31412. false,
  31413. false
  31414. ],
  31415. "CC-BY-NC-SA-2.5": [
  31416. "Creative Commons Attribution Non Commercial Share Alike 2.5 Generic",
  31417. false,
  31418. false
  31419. ],
  31420. "CC-BY-NC-SA-3.0": [
  31421. "Creative Commons Attribution Non Commercial Share Alike 3.0 Unported",
  31422. false,
  31423. false
  31424. ],
  31425. "CC-BY-NC-SA-4.0": [
  31426. "Creative Commons Attribution Non Commercial Share Alike 4.0 International",
  31427. false,
  31428. false
  31429. ],
  31430. "CC-BY-ND-1.0": [
  31431. "Creative Commons Attribution No Derivatives 1.0 Generic",
  31432. false,
  31433. false
  31434. ],
  31435. "CC-BY-ND-2.0": [
  31436. "Creative Commons Attribution No Derivatives 2.0 Generic",
  31437. false,
  31438. false
  31439. ],
  31440. "CC-BY-ND-2.5": [
  31441. "Creative Commons Attribution No Derivatives 2.5 Generic",
  31442. false,
  31443. false
  31444. ],
  31445. "CC-BY-ND-3.0": [
  31446. "Creative Commons Attribution No Derivatives 3.0 Unported",
  31447. false,
  31448. false
  31449. ],
  31450. "CC-BY-ND-4.0": [
  31451. "Creative Commons Attribution No Derivatives 4.0 International",
  31452. false,
  31453. false
  31454. ],
  31455. "CC-BY-SA-1.0": [
  31456. "Creative Commons Attribution Share Alike 1.0 Generic",
  31457. false,
  31458. false
  31459. ],
  31460. "CC-BY-SA-2.0": [
  31461. "Creative Commons Attribution Share Alike 2.0 Generic",
  31462. false,
  31463. false
  31464. ],
  31465. "CC-BY-SA-2.5": [
  31466. "Creative Commons Attribution Share Alike 2.5 Generic",
  31467. false,
  31468. false
  31469. ],
  31470. "CC-BY-SA-3.0": [
  31471. "Creative Commons Attribution Share Alike 3.0 Unported",
  31472. false,
  31473. false
  31474. ],
  31475. "CC-BY-SA-4.0": [
  31476. "Creative Commons Attribution Share Alike 4.0 International",
  31477. false,
  31478. false
  31479. ],
  31480. "CC-PDDC": [
  31481. "Creative Commons Public Domain Dedication and Certification",
  31482. false,
  31483. false
  31484. ],
  31485. "CC0-1.0": [
  31486. "Creative Commons Zero v1.0 Universal",
  31487. false,
  31488. false
  31489. ],
  31490. "CDDL-1.0": [
  31491. "Common Development and Distribution License 1.0",
  31492. true,
  31493. false
  31494. ],
  31495. "CDDL-1.1": [
  31496. "Common Development and Distribution License 1.1",
  31497. false,
  31498. false
  31499. ],
  31500. "CDLA-Permissive-1.0": [
  31501. "Community Data License Agreement Permissive 1.0",
  31502. false,
  31503. false
  31504. ],
  31505. "CDLA-Sharing-1.0": [
  31506. "Community Data License Agreement Sharing 1.0",
  31507. false,
  31508. false
  31509. ],
  31510. "CECILL-1.0": [
  31511. "CeCILL Free Software License Agreement v1.0",
  31512. false,
  31513. false
  31514. ],
  31515. "CECILL-1.1": [
  31516. "CeCILL Free Software License Agreement v1.1",
  31517. false,
  31518. false
  31519. ],
  31520. "CECILL-2.0": [
  31521. "CeCILL Free Software License Agreement v2.0",
  31522. false,
  31523. false
  31524. ],
  31525. "CECILL-2.1": [
  31526. "CeCILL Free Software License Agreement v2.1",
  31527. true,
  31528. false
  31529. ],
  31530. "CECILL-B": [
  31531. "CeCILL-B Free Software License Agreement",
  31532. false,
  31533. false
  31534. ],
  31535. "CECILL-C": [
  31536. "CeCILL-C Free Software License Agreement",
  31537. false,
  31538. false
  31539. ],
  31540. "CERN-OHL-1.1": [
  31541. "CERN Open Hardware Licence v1.1",
  31542. false,
  31543. false
  31544. ],
  31545. "CERN-OHL-1.2": [
  31546. "CERN Open Hardware Licence v1.2",
  31547. false,
  31548. false
  31549. ],
  31550. "ClArtistic": [
  31551. "Clarified Artistic License",
  31552. false,
  31553. false
  31554. ],
  31555. "CNRI-Jython": [
  31556. "CNRI Jython License",
  31557. false,
  31558. false
  31559. ],
  31560. "CNRI-Python": [
  31561. "CNRI Python License",
  31562. true,
  31563. false
  31564. ],
  31565. "CNRI-Python-GPL-Compatible": [
  31566. "CNRI Python Open Source GPL Compatible License Agreement",
  31567. false,
  31568. false
  31569. ],
  31570. "Condor-1.1": [
  31571. "Condor Public License v1.1",
  31572. false,
  31573. false
  31574. ],
  31575. "copyleft-next-0.3.0": [
  31576. "copyleft-next 0.3.0",
  31577. false,
  31578. false
  31579. ],
  31580. "copyleft-next-0.3.1": [
  31581. "copyleft-next 0.3.1",
  31582. false,
  31583. false
  31584. ],
  31585. "CPAL-1.0": [
  31586. "Common Public Attribution License 1.0",
  31587. true,
  31588. false
  31589. ],
  31590. "CPL-1.0": [
  31591. "Common Public License 1.0",
  31592. true,
  31593. false
  31594. ],
  31595. "CPOL-1.02": [
  31596. "Code Project Open License 1.02",
  31597. false,
  31598. false
  31599. ],
  31600. "Crossword": [
  31601. "Crossword License",
  31602. false,
  31603. false
  31604. ],
  31605. "CrystalStacker": [
  31606. "CrystalStacker License",
  31607. false,
  31608. false
  31609. ],
  31610. "CUA-OPL-1.0": [
  31611. "CUA Office Public License v1.0",
  31612. true,
  31613. false
  31614. ],
  31615. "Cube": [
  31616. "Cube License",
  31617. false,
  31618. false
  31619. ],
  31620. "curl": [
  31621. "curl License",
  31622. false,
  31623. false
  31624. ],
  31625. "D-FSL-1.0": [
  31626. "Deutsche Freie Software Lizenz",
  31627. false,
  31628. false
  31629. ],
  31630. "diffmark": [
  31631. "diffmark license",
  31632. false,
  31633. false
  31634. ],
  31635. "DOC": [
  31636. "DOC License",
  31637. false,
  31638. false
  31639. ],
  31640. "Dotseqn": [
  31641. "Dotseqn License",
  31642. false,
  31643. false
  31644. ],
  31645. "DSDP": [
  31646. "DSDP License",
  31647. false,
  31648. false
  31649. ],
  31650. "dvipdfm": [
  31651. "dvipdfm License",
  31652. false,
  31653. false
  31654. ],
  31655. "ECL-1.0": [
  31656. "Educational Community License v1.0",
  31657. true,
  31658. false
  31659. ],
  31660. "ECL-2.0": [
  31661. "Educational Community License v2.0",
  31662. true,
  31663. false
  31664. ],
  31665. "eCos-2.0": [
  31666. "eCos license version 2.0",
  31667. false,
  31668. true
  31669. ],
  31670. "EFL-1.0": [
  31671. "Eiffel Forum License v1.0",
  31672. true,
  31673. false
  31674. ],
  31675. "EFL-2.0": [
  31676. "Eiffel Forum License v2.0",
  31677. true,
  31678. false
  31679. ],
  31680. "eGenix": [
  31681. "eGenix.com Public License 1.1.0",
  31682. false,
  31683. false
  31684. ],
  31685. "Entessa": [
  31686. "Entessa Public License v1.0",
  31687. true,
  31688. false
  31689. ],
  31690. "EPL-1.0": [
  31691. "Eclipse Public License 1.0",
  31692. true,
  31693. false
  31694. ],
  31695. "EPL-2.0": [
  31696. "Eclipse Public License 2.0",
  31697. true,
  31698. false
  31699. ],
  31700. "ErlPL-1.1": [
  31701. "Erlang Public License v1.1",
  31702. false,
  31703. false
  31704. ],
  31705. "etalab-2.0": [
  31706. "Etalab Open License 2.0",
  31707. false,
  31708. false
  31709. ],
  31710. "EUDatagrid": [
  31711. "EU DataGrid Software License",
  31712. true,
  31713. false
  31714. ],
  31715. "EUPL-1.0": [
  31716. "European Union Public License 1.0",
  31717. false,
  31718. false
  31719. ],
  31720. "EUPL-1.1": [
  31721. "European Union Public License 1.1",
  31722. true,
  31723. false
  31724. ],
  31725. "EUPL-1.2": [
  31726. "European Union Public License 1.2",
  31727. true,
  31728. false
  31729. ],
  31730. "Eurosym": [
  31731. "Eurosym License",
  31732. false,
  31733. false
  31734. ],
  31735. "Fair": [
  31736. "Fair License",
  31737. true,
  31738. false
  31739. ],
  31740. "Frameworx-1.0": [
  31741. "Frameworx Open License 1.0",
  31742. true,
  31743. false
  31744. ],
  31745. "FreeImage": [
  31746. "FreeImage Public License v1.0",
  31747. false,
  31748. false
  31749. ],
  31750. "FSFAP": [
  31751. "FSF All Permissive License",
  31752. false,
  31753. false
  31754. ],
  31755. "FSFUL": [
  31756. "FSF Unlimited License",
  31757. false,
  31758. false
  31759. ],
  31760. "FSFULLR": [
  31761. "FSF Unlimited License (with License Retention)",
  31762. false,
  31763. false
  31764. ],
  31765. "FTL": [
  31766. "Freetype Project License",
  31767. false,
  31768. false
  31769. ],
  31770. "GFDL-1.1": [
  31771. "GNU Free Documentation License v1.1",
  31772. false,
  31773. true
  31774. ],
  31775. "GFDL-1.1-only": [
  31776. "GNU Free Documentation License v1.1 only",
  31777. false,
  31778. false
  31779. ],
  31780. "GFDL-1.1-or-later": [
  31781. "GNU Free Documentation License v1.1 or later",
  31782. false,
  31783. false
  31784. ],
  31785. "GFDL-1.2": [
  31786. "GNU Free Documentation License v1.2",
  31787. false,
  31788. true
  31789. ],
  31790. "GFDL-1.2-only": [
  31791. "GNU Free Documentation License v1.2 only",
  31792. false,
  31793. false
  31794. ],
  31795. "GFDL-1.2-or-later": [
  31796. "GNU Free Documentation License v1.2 or later",
  31797. false,
  31798. false
  31799. ],
  31800. "GFDL-1.3": [
  31801. "GNU Free Documentation License v1.3",
  31802. false,
  31803. true
  31804. ],
  31805. "GFDL-1.3-only": [
  31806. "GNU Free Documentation License v1.3 only",
  31807. false,
  31808. false
  31809. ],
  31810. "GFDL-1.3-or-later": [
  31811. "GNU Free Documentation License v1.3 or later",
  31812. false,
  31813. false
  31814. ],
  31815. "Giftware": [
  31816. "Giftware License",
  31817. false,
  31818. false
  31819. ],
  31820. "GL2PS": [
  31821. "GL2PS License",
  31822. false,
  31823. false
  31824. ],
  31825. "Glide": [
  31826. "3dfx Glide License",
  31827. false,
  31828. false
  31829. ],
  31830. "Glulxe": [
  31831. "Glulxe License",
  31832. false,
  31833. false
  31834. ],
  31835. "gnuplot": [
  31836. "gnuplot License",
  31837. false,
  31838. false
  31839. ],
  31840. "GPL-1.0": [
  31841. "GNU General Public License v1.0 only",
  31842. false,
  31843. true
  31844. ],
  31845. "GPL-1.0+": [
  31846. "GNU General Public License v1.0 or later",
  31847. false,
  31848. true
  31849. ],
  31850. "GPL-1.0-only": [
  31851. "GNU General Public License v1.0 only",
  31852. false,
  31853. false
  31854. ],
  31855. "GPL-1.0-or-later": [
  31856. "GNU General Public License v1.0 or later",
  31857. false,
  31858. false
  31859. ],
  31860. "GPL-2.0": [
  31861. "GNU General Public License v2.0 only",
  31862. true,
  31863. true
  31864. ],
  31865. "GPL-2.0+": [
  31866. "GNU General Public License v2.0 or later",
  31867. true,
  31868. true
  31869. ],
  31870. "GPL-2.0-only": [
  31871. "GNU General Public License v2.0 only",
  31872. true,
  31873. false
  31874. ],
  31875. "GPL-2.0-or-later": [
  31876. "GNU General Public License v2.0 or later",
  31877. true,
  31878. false
  31879. ],
  31880. "GPL-2.0-with-autoconf-exception": [
  31881. "GNU General Public License v2.0 w/Autoconf exception",
  31882. false,
  31883. true
  31884. ],
  31885. "GPL-2.0-with-bison-exception": [
  31886. "GNU General Public License v2.0 w/Bison exception",
  31887. false,
  31888. true
  31889. ],
  31890. "GPL-2.0-with-classpath-exception": [
  31891. "GNU General Public License v2.0 w/Classpath exception",
  31892. false,
  31893. true
  31894. ],
  31895. "GPL-2.0-with-font-exception": [
  31896. "GNU General Public License v2.0 w/Font exception",
  31897. false,
  31898. true
  31899. ],
  31900. "GPL-2.0-with-GCC-exception": [
  31901. "GNU General Public License v2.0 w/GCC Runtime Library exception",
  31902. false,
  31903. true
  31904. ],
  31905. "GPL-3.0": [
  31906. "GNU General Public License v3.0 only",
  31907. true,
  31908. true
  31909. ],
  31910. "GPL-3.0+": [
  31911. "GNU General Public License v3.0 or later",
  31912. true,
  31913. true
  31914. ],
  31915. "GPL-3.0-only": [
  31916. "GNU General Public License v3.0 only",
  31917. true,
  31918. false
  31919. ],
  31920. "GPL-3.0-or-later": [
  31921. "GNU General Public License v3.0 or later",
  31922. true,
  31923. false
  31924. ],
  31925. "GPL-3.0-with-autoconf-exception": [
  31926. "GNU General Public License v3.0 w/Autoconf exception",
  31927. false,
  31928. true
  31929. ],
  31930. "GPL-3.0-with-GCC-exception": [
  31931. "GNU General Public License v3.0 w/GCC Runtime Library exception",
  31932. true,
  31933. true
  31934. ],
  31935. "gSOAP-1.3b": [
  31936. "gSOAP Public License v1.3b",
  31937. false,
  31938. false
  31939. ],
  31940. "HaskellReport": [
  31941. "Haskell Language Report License",
  31942. false,
  31943. false
  31944. ],
  31945. "HPND": [
  31946. "Historical Permission Notice and Disclaimer",
  31947. true,
  31948. false
  31949. ],
  31950. "HPND-sell-variant": [
  31951. "Historical Permission Notice and Disclaimer - sell variant",
  31952. false,
  31953. false
  31954. ],
  31955. "IBM-pibs": [
  31956. "IBM PowerPC Initialization and Boot Software",
  31957. false,
  31958. false
  31959. ],
  31960. "ICU": [
  31961. "ICU License",
  31962. false,
  31963. false
  31964. ],
  31965. "IJG": [
  31966. "Independent JPEG Group License",
  31967. false,
  31968. false
  31969. ],
  31970. "ImageMagick": [
  31971. "ImageMagick License",
  31972. false,
  31973. false
  31974. ],
  31975. "iMatix": [
  31976. "iMatix Standard Function Library Agreement",
  31977. false,
  31978. false
  31979. ],
  31980. "Imlib2": [
  31981. "Imlib2 License",
  31982. false,
  31983. false
  31984. ],
  31985. "Info-ZIP": [
  31986. "Info-ZIP License",
  31987. false,
  31988. false
  31989. ],
  31990. "Intel": [
  31991. "Intel Open Source License",
  31992. true,
  31993. false
  31994. ],
  31995. "Intel-ACPI": [
  31996. "Intel ACPI Software License Agreement",
  31997. false,
  31998. false
  31999. ],
  32000. "Interbase-1.0": [
  32001. "Interbase Public License v1.0",
  32002. false,
  32003. false
  32004. ],
  32005. "IPA": [
  32006. "IPA Font License",
  32007. true,
  32008. false
  32009. ],
  32010. "IPL-1.0": [
  32011. "IBM Public License v1.0",
  32012. true,
  32013. false
  32014. ],
  32015. "ISC": [
  32016. "ISC License",
  32017. true,
  32018. false
  32019. ],
  32020. "JasPer-2.0": [
  32021. "JasPer License",
  32022. false,
  32023. false
  32024. ],
  32025. "JPNIC": [
  32026. "Japan Network Information Center License",
  32027. false,
  32028. false
  32029. ],
  32030. "JSON": [
  32031. "JSON License",
  32032. false,
  32033. false
  32034. ],
  32035. "LAL-1.2": [
  32036. "Licence Art Libre 1.2",
  32037. false,
  32038. false
  32039. ],
  32040. "LAL-1.3": [
  32041. "Licence Art Libre 1.3",
  32042. false,
  32043. false
  32044. ],
  32045. "Latex2e": [
  32046. "Latex2e License",
  32047. false,
  32048. false
  32049. ],
  32050. "Leptonica": [
  32051. "Leptonica License",
  32052. false,
  32053. false
  32054. ],
  32055. "LGPL-2.0": [
  32056. "GNU Library General Public License v2 only",
  32057. true,
  32058. true
  32059. ],
  32060. "LGPL-2.0+": [
  32061. "GNU Library General Public License v2 or later",
  32062. true,
  32063. true
  32064. ],
  32065. "LGPL-2.0-only": [
  32066. "GNU Library General Public License v2 only",
  32067. true,
  32068. false
  32069. ],
  32070. "LGPL-2.0-or-later": [
  32071. "GNU Library General Public License v2 or later",
  32072. true,
  32073. false
  32074. ],
  32075. "LGPL-2.1": [
  32076. "GNU Lesser General Public License v2.1 only",
  32077. true,
  32078. true
  32079. ],
  32080. "LGPL-2.1+": [
  32081. "GNU Library General Public License v2.1 or later",
  32082. true,
  32083. true
  32084. ],
  32085. "LGPL-2.1-only": [
  32086. "GNU Lesser General Public License v2.1 only",
  32087. true,
  32088. false
  32089. ],
  32090. "LGPL-2.1-or-later": [
  32091. "GNU Lesser General Public License v2.1 or later",
  32092. true,
  32093. false
  32094. ],
  32095. "LGPL-3.0": [
  32096. "GNU Lesser General Public License v3.0 only",
  32097. true,
  32098. true
  32099. ],
  32100. "LGPL-3.0+": [
  32101. "GNU Lesser General Public License v3.0 or later",
  32102. true,
  32103. true
  32104. ],
  32105. "LGPL-3.0-only": [
  32106. "GNU Lesser General Public License v3.0 only",
  32107. true,
  32108. false
  32109. ],
  32110. "LGPL-3.0-or-later": [
  32111. "GNU Lesser General Public License v3.0 or later",
  32112. true,
  32113. false
  32114. ],
  32115. "LGPLLR": [
  32116. "Lesser General Public License For Linguistic Resources",
  32117. false,
  32118. false
  32119. ],
  32120. "Libpng": [
  32121. "libpng License",
  32122. false,
  32123. false
  32124. ],
  32125. "libpng-2.0": [
  32126. "PNG Reference Library version 2",
  32127. false,
  32128. false
  32129. ],
  32130. "libselinux-1.0": [
  32131. "libselinux public domain notice",
  32132. false,
  32133. false
  32134. ],
  32135. "libtiff": [
  32136. "libtiff License",
  32137. false,
  32138. false
  32139. ],
  32140. "LiLiQ-P-1.1": [
  32141. "Licence Libre du Qu\u00e9bec \u2013 Permissive version 1.1",
  32142. true,
  32143. false
  32144. ],
  32145. "LiLiQ-R-1.1": [
  32146. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 version 1.1",
  32147. true,
  32148. false
  32149. ],
  32150. "LiLiQ-Rplus-1.1": [
  32151. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 forte version 1.1",
  32152. true,
  32153. false
  32154. ],
  32155. "Linux-OpenIB": [
  32156. "Linux Kernel Variant of OpenIB.org license",
  32157. false,
  32158. false
  32159. ],
  32160. "LPL-1.0": [
  32161. "Lucent Public License Version 1.0",
  32162. true,
  32163. false
  32164. ],
  32165. "LPL-1.02": [
  32166. "Lucent Public License v1.02",
  32167. true,
  32168. false
  32169. ],
  32170. "LPPL-1.0": [
  32171. "LaTeX Project Public License v1.0",
  32172. false,
  32173. false
  32174. ],
  32175. "LPPL-1.1": [
  32176. "LaTeX Project Public License v1.1",
  32177. false,
  32178. false
  32179. ],
  32180. "LPPL-1.2": [
  32181. "LaTeX Project Public License v1.2",
  32182. false,
  32183. false
  32184. ],
  32185. "LPPL-1.3a": [
  32186. "LaTeX Project Public License v1.3a",
  32187. false,
  32188. false
  32189. ],
  32190. "LPPL-1.3c": [
  32191. "LaTeX Project Public License v1.3c",
  32192. true,
  32193. false
  32194. ],
  32195. "MakeIndex": [
  32196. "MakeIndex License",
  32197. false,
  32198. false
  32199. ],
  32200. "MirOS": [
  32201. "The MirOS Licence",
  32202. true,
  32203. false
  32204. ],
  32205. "MIT": [
  32206. "MIT License",
  32207. true,
  32208. false
  32209. ],
  32210. "MIT-0": [
  32211. "MIT No Attribution",
  32212. false,
  32213. false
  32214. ],
  32215. "MIT-advertising": [
  32216. "Enlightenment License (e16)",
  32217. false,
  32218. false
  32219. ],
  32220. "MIT-CMU": [
  32221. "CMU License",
  32222. false,
  32223. false
  32224. ],
  32225. "MIT-enna": [
  32226. "enna License",
  32227. false,
  32228. false
  32229. ],
  32230. "MIT-feh": [
  32231. "feh License",
  32232. false,
  32233. false
  32234. ],
  32235. "MITNFA": [
  32236. "MIT +no-false-attribs license",
  32237. false,
  32238. false
  32239. ],
  32240. "Motosoto": [
  32241. "Motosoto License",
  32242. true,
  32243. false
  32244. ],
  32245. "mpich2": [
  32246. "mpich2 License",
  32247. false,
  32248. false
  32249. ],
  32250. "MPL-1.0": [
  32251. "Mozilla Public License 1.0",
  32252. true,
  32253. false
  32254. ],
  32255. "MPL-1.1": [
  32256. "Mozilla Public License 1.1",
  32257. true,
  32258. false
  32259. ],
  32260. "MPL-2.0": [
  32261. "Mozilla Public License 2.0",
  32262. true,
  32263. false
  32264. ],
  32265. "MPL-2.0-no-copyleft-exception": [
  32266. "Mozilla Public License 2.0 (no copyleft exception)",
  32267. true,
  32268. false
  32269. ],
  32270. "MS-PL": [
  32271. "Microsoft Public License",
  32272. true,
  32273. false
  32274. ],
  32275. "MS-RL": [
  32276. "Microsoft Reciprocal License",
  32277. true,
  32278. false
  32279. ],
  32280. "MTLL": [
  32281. "Matrix Template Library License",
  32282. false,
  32283. false
  32284. ],
  32285. "MulanPSL-1.0": [
  32286. "Mulan Permissive Software License, Version 1",
  32287. false,
  32288. false
  32289. ],
  32290. "Multics": [
  32291. "Multics License",
  32292. true,
  32293. false
  32294. ],
  32295. "Mup": [
  32296. "Mup License",
  32297. false,
  32298. false
  32299. ],
  32300. "NASA-1.3": [
  32301. "NASA Open Source Agreement 1.3",
  32302. true,
  32303. false
  32304. ],
  32305. "Naumen": [
  32306. "Naumen Public License",
  32307. true,
  32308. false
  32309. ],
  32310. "NBPL-1.0": [
  32311. "Net Boolean Public License v1",
  32312. false,
  32313. false
  32314. ],
  32315. "NCSA": [
  32316. "University of Illinois/NCSA Open Source License",
  32317. true,
  32318. false
  32319. ],
  32320. "Net-SNMP": [
  32321. "Net-SNMP License",
  32322. false,
  32323. false
  32324. ],
  32325. "NetCDF": [
  32326. "NetCDF license",
  32327. false,
  32328. false
  32329. ],
  32330. "Newsletr": [
  32331. "Newsletr License",
  32332. false,
  32333. false
  32334. ],
  32335. "NGPL": [
  32336. "Nethack General Public License",
  32337. true,
  32338. false
  32339. ],
  32340. "NLOD-1.0": [
  32341. "Norwegian Licence for Open Government Data",
  32342. false,
  32343. false
  32344. ],
  32345. "NLPL": [
  32346. "No Limit Public License",
  32347. false,
  32348. false
  32349. ],
  32350. "Nokia": [
  32351. "Nokia Open Source License",
  32352. true,
  32353. false
  32354. ],
  32355. "NOSL": [
  32356. "Netizen Open Source License",
  32357. false,
  32358. false
  32359. ],
  32360. "Noweb": [
  32361. "Noweb License",
  32362. false,
  32363. false
  32364. ],
  32365. "NPL-1.0": [
  32366. "Netscape Public License v1.0",
  32367. false,
  32368. false
  32369. ],
  32370. "NPL-1.1": [
  32371. "Netscape Public License v1.1",
  32372. false,
  32373. false
  32374. ],
  32375. "NPOSL-3.0": [
  32376. "Non-Profit Open Software License 3.0",
  32377. true,
  32378. false
  32379. ],
  32380. "NRL": [
  32381. "NRL License",
  32382. false,
  32383. false
  32384. ],
  32385. "NTP": [
  32386. "NTP License",
  32387. true,
  32388. false
  32389. ],
  32390. "NTP-0": [
  32391. "NTP No Attribution",
  32392. false,
  32393. false
  32394. ],
  32395. "Nunit": [
  32396. "Nunit License",
  32397. false,
  32398. true
  32399. ],
  32400. "OCCT-PL": [
  32401. "Open CASCADE Technology Public License",
  32402. false,
  32403. false
  32404. ],
  32405. "OCLC-2.0": [
  32406. "OCLC Research Public License 2.0",
  32407. true,
  32408. false
  32409. ],
  32410. "ODbL-1.0": [
  32411. "ODC Open Database License v1.0",
  32412. false,
  32413. false
  32414. ],
  32415. "ODC-By-1.0": [
  32416. "Open Data Commons Attribution License v1.0",
  32417. false,
  32418. false
  32419. ],
  32420. "OFL-1.0": [
  32421. "SIL Open Font License 1.0",
  32422. false,
  32423. false
  32424. ],
  32425. "OFL-1.0-no-RFN": [
  32426. "SIL Open Font License 1.0 with no Reserved Font Name",
  32427. false,
  32428. false
  32429. ],
  32430. "OFL-1.0-RFN": [
  32431. "SIL Open Font License 1.0 with Reserved Font Name",
  32432. false,
  32433. false
  32434. ],
  32435. "OFL-1.1": [
  32436. "SIL Open Font License 1.1",
  32437. true,
  32438. false
  32439. ],
  32440. "OFL-1.1-no-RFN": [
  32441. "SIL Open Font License 1.1 with no Reserved Font Name",
  32442. true,
  32443. false
  32444. ],
  32445. "OFL-1.1-RFN": [
  32446. "SIL Open Font License 1.1 with Reserved Font Name",
  32447. true,
  32448. false
  32449. ],
  32450. "OGL-Canada-2.0": [
  32451. "Open Government Licence - Canada",
  32452. false,
  32453. false
  32454. ],
  32455. "OGL-UK-1.0": [
  32456. "Open Government Licence v1.0",
  32457. false,
  32458. false
  32459. ],
  32460. "OGL-UK-2.0": [
  32461. "Open Government Licence v2.0",
  32462. false,
  32463. false
  32464. ],
  32465. "OGL-UK-3.0": [
  32466. "Open Government Licence v3.0",
  32467. false,
  32468. false
  32469. ],
  32470. "OGTSL": [
  32471. "Open Group Test Suite License",
  32472. true,
  32473. false
  32474. ],
  32475. "OLDAP-1.1": [
  32476. "Open LDAP Public License v1.1",
  32477. false,
  32478. false
  32479. ],
  32480. "OLDAP-1.2": [
  32481. "Open LDAP Public License v1.2",
  32482. false,
  32483. false
  32484. ],
  32485. "OLDAP-1.3": [
  32486. "Open LDAP Public License v1.3",
  32487. false,
  32488. false
  32489. ],
  32490. "OLDAP-1.4": [
  32491. "Open LDAP Public License v1.4",
  32492. false,
  32493. false
  32494. ],
  32495. "OLDAP-2.0": [
  32496. "Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B)",
  32497. false,
  32498. false
  32499. ],
  32500. "OLDAP-2.0.1": [
  32501. "Open LDAP Public License v2.0.1",
  32502. false,
  32503. false
  32504. ],
  32505. "OLDAP-2.1": [
  32506. "Open LDAP Public License v2.1",
  32507. false,
  32508. false
  32509. ],
  32510. "OLDAP-2.2": [
  32511. "Open LDAP Public License v2.2",
  32512. false,
  32513. false
  32514. ],
  32515. "OLDAP-2.2.1": [
  32516. "Open LDAP Public License v2.2.1",
  32517. false,
  32518. false
  32519. ],
  32520. "OLDAP-2.2.2": [
  32521. "Open LDAP Public License 2.2.2",
  32522. false,
  32523. false
  32524. ],
  32525. "OLDAP-2.3": [
  32526. "Open LDAP Public License v2.3",
  32527. false,
  32528. false
  32529. ],
  32530. "OLDAP-2.4": [
  32531. "Open LDAP Public License v2.4",
  32532. false,
  32533. false
  32534. ],
  32535. "OLDAP-2.5": [
  32536. "Open LDAP Public License v2.5",
  32537. false,
  32538. false
  32539. ],
  32540. "OLDAP-2.6": [
  32541. "Open LDAP Public License v2.6",
  32542. false,
  32543. false
  32544. ],
  32545. "OLDAP-2.7": [
  32546. "Open LDAP Public License v2.7",
  32547. false,
  32548. false
  32549. ],
  32550. "OLDAP-2.8": [
  32551. "Open LDAP Public License v2.8",
  32552. false,
  32553. false
  32554. ],
  32555. "OML": [
  32556. "Open Market License",
  32557. false,
  32558. false
  32559. ],
  32560. "OpenSSL": [
  32561. "OpenSSL License",
  32562. false,
  32563. false
  32564. ],
  32565. "OPL-1.0": [
  32566. "Open Public License v1.0",
  32567. false,
  32568. false
  32569. ],
  32570. "OSET-PL-2.1": [
  32571. "OSET Public License version 2.1",
  32572. true,
  32573. false
  32574. ],
  32575. "OSL-1.0": [
  32576. "Open Software License 1.0",
  32577. true,
  32578. false
  32579. ],
  32580. "OSL-1.1": [
  32581. "Open Software License 1.1",
  32582. false,
  32583. false
  32584. ],
  32585. "OSL-2.0": [
  32586. "Open Software License 2.0",
  32587. true,
  32588. false
  32589. ],
  32590. "OSL-2.1": [
  32591. "Open Software License 2.1",
  32592. true,
  32593. false
  32594. ],
  32595. "OSL-3.0": [
  32596. "Open Software License 3.0",
  32597. true,
  32598. false
  32599. ],
  32600. "Parity-6.0.0": [
  32601. "The Parity Public License 6.0.0",
  32602. false,
  32603. false
  32604. ],
  32605. "PDDL-1.0": [
  32606. "ODC Public Domain Dedication & License 1.0",
  32607. false,
  32608. false
  32609. ],
  32610. "PHP-3.0": [
  32611. "PHP License v3.0",
  32612. true,
  32613. false
  32614. ],
  32615. "PHP-3.01": [
  32616. "PHP License v3.01",
  32617. false,
  32618. false
  32619. ],
  32620. "Plexus": [
  32621. "Plexus Classworlds License",
  32622. false,
  32623. false
  32624. ],
  32625. "PostgreSQL": [
  32626. "PostgreSQL License",
  32627. true,
  32628. false
  32629. ],
  32630. "PSF-2.0": [
  32631. "Python Software Foundation License 2.0",
  32632. false,
  32633. false
  32634. ],
  32635. "psfrag": [
  32636. "psfrag License",
  32637. false,
  32638. false
  32639. ],
  32640. "psutils": [
  32641. "psutils License",
  32642. false,
  32643. false
  32644. ],
  32645. "Python-2.0": [
  32646. "Python License 2.0",
  32647. true,
  32648. false
  32649. ],
  32650. "Qhull": [
  32651. "Qhull License",
  32652. false,
  32653. false
  32654. ],
  32655. "QPL-1.0": [
  32656. "Q Public License 1.0",
  32657. true,
  32658. false
  32659. ],
  32660. "Rdisc": [
  32661. "Rdisc License",
  32662. false,
  32663. false
  32664. ],
  32665. "RHeCos-1.1": [
  32666. "Red Hat eCos Public License v1.1",
  32667. false,
  32668. false
  32669. ],
  32670. "RPL-1.1": [
  32671. "Reciprocal Public License 1.1",
  32672. true,
  32673. false
  32674. ],
  32675. "RPL-1.5": [
  32676. "Reciprocal Public License 1.5",
  32677. true,
  32678. false
  32679. ],
  32680. "RPSL-1.0": [
  32681. "RealNetworks Public Source License v1.0",
  32682. true,
  32683. false
  32684. ],
  32685. "RSA-MD": [
  32686. "RSA Message-Digest License",
  32687. false,
  32688. false
  32689. ],
  32690. "RSCPL": [
  32691. "Ricoh Source Code Public License",
  32692. true,
  32693. false
  32694. ],
  32695. "Ruby": [
  32696. "Ruby License",
  32697. false,
  32698. false
  32699. ],
  32700. "SAX-PD": [
  32701. "Sax Public Domain Notice",
  32702. false,
  32703. false
  32704. ],
  32705. "Saxpath": [
  32706. "Saxpath License",
  32707. false,
  32708. false
  32709. ],
  32710. "SCEA": [
  32711. "SCEA Shared Source License",
  32712. false,
  32713. false
  32714. ],
  32715. "Sendmail": [
  32716. "Sendmail License",
  32717. false,
  32718. false
  32719. ],
  32720. "Sendmail-8.23": [
  32721. "Sendmail License 8.23",
  32722. false,
  32723. false
  32724. ],
  32725. "SGI-B-1.0": [
  32726. "SGI Free Software License B v1.0",
  32727. false,
  32728. false
  32729. ],
  32730. "SGI-B-1.1": [
  32731. "SGI Free Software License B v1.1",
  32732. false,
  32733. false
  32734. ],
  32735. "SGI-B-2.0": [
  32736. "SGI Free Software License B v2.0",
  32737. false,
  32738. false
  32739. ],
  32740. "SHL-0.5": [
  32741. "Solderpad Hardware License v0.5",
  32742. false,
  32743. false
  32744. ],
  32745. "SHL-0.51": [
  32746. "Solderpad Hardware License, Version 0.51",
  32747. false,
  32748. false
  32749. ],
  32750. "SimPL-2.0": [
  32751. "Simple Public License 2.0",
  32752. true,
  32753. false
  32754. ],
  32755. "SISSL": [
  32756. "Sun Industry Standards Source License v1.1",
  32757. true,
  32758. false
  32759. ],
  32760. "SISSL-1.2": [
  32761. "Sun Industry Standards Source License v1.2",
  32762. false,
  32763. false
  32764. ],
  32765. "Sleepycat": [
  32766. "Sleepycat License",
  32767. true,
  32768. false
  32769. ],
  32770. "SMLNJ": [
  32771. "Standard ML of New Jersey License",
  32772. false,
  32773. false
  32774. ],
  32775. "SMPPL": [
  32776. "Secure Messaging Protocol Public License",
  32777. false,
  32778. false
  32779. ],
  32780. "SNIA": [
  32781. "SNIA Public License 1.1",
  32782. false,
  32783. false
  32784. ],
  32785. "Spencer-86": [
  32786. "Spencer License 86",
  32787. false,
  32788. false
  32789. ],
  32790. "Spencer-94": [
  32791. "Spencer License 94",
  32792. false,
  32793. false
  32794. ],
  32795. "Spencer-99": [
  32796. "Spencer License 99",
  32797. false,
  32798. false
  32799. ],
  32800. "SPL-1.0": [
  32801. "Sun Public License v1.0",
  32802. true,
  32803. false
  32804. ],
  32805. "SSH-OpenSSH": [
  32806. "SSH OpenSSH license",
  32807. false,
  32808. false
  32809. ],
  32810. "SSH-short": [
  32811. "SSH short notice",
  32812. false,
  32813. false
  32814. ],
  32815. "SSPL-1.0": [
  32816. "Server Side Public License, v 1",
  32817. false,
  32818. false
  32819. ],
  32820. "StandardML-NJ": [
  32821. "Standard ML of New Jersey License",
  32822. false,
  32823. true
  32824. ],
  32825. "SugarCRM-1.1.3": [
  32826. "SugarCRM Public License v1.1.3",
  32827. false,
  32828. false
  32829. ],
  32830. "SWL": [
  32831. "Scheme Widget Library (SWL) Software License Agreement",
  32832. false,
  32833. false
  32834. ],
  32835. "TAPR-OHL-1.0": [
  32836. "TAPR Open Hardware License v1.0",
  32837. false,
  32838. false
  32839. ],
  32840. "TCL": [
  32841. "TCL/TK License",
  32842. false,
  32843. false
  32844. ],
  32845. "TCP-wrappers": [
  32846. "TCP Wrappers License",
  32847. false,
  32848. false
  32849. ],
  32850. "TMate": [
  32851. "TMate Open Source License",
  32852. false,
  32853. false
  32854. ],
  32855. "TORQUE-1.1": [
  32856. "TORQUE v2.5+ Software License v1.1",
  32857. false,
  32858. false
  32859. ],
  32860. "TOSL": [
  32861. "Trusster Open Source License",
  32862. false,
  32863. false
  32864. ],
  32865. "TU-Berlin-1.0": [
  32866. "Technische Universitaet Berlin License 1.0",
  32867. false,
  32868. false
  32869. ],
  32870. "TU-Berlin-2.0": [
  32871. "Technische Universitaet Berlin License 2.0",
  32872. false,
  32873. false
  32874. ],
  32875. "UCL-1.0": [
  32876. "Upstream Compatibility License v1.0",
  32877. true,
  32878. false
  32879. ],
  32880. "Unicode-DFS-2015": [
  32881. "Unicode License Agreement - Data Files and Software (2015)",
  32882. false,
  32883. false
  32884. ],
  32885. "Unicode-DFS-2016": [
  32886. "Unicode License Agreement - Data Files and Software (2016)",
  32887. false,
  32888. false
  32889. ],
  32890. "Unicode-TOU": [
  32891. "Unicode Terms of Use",
  32892. false,
  32893. false
  32894. ],
  32895. "Unlicense": [
  32896. "The Unlicense",
  32897. false,
  32898. false
  32899. ],
  32900. "UPL-1.0": [
  32901. "Universal Permissive License v1.0",
  32902. true,
  32903. false
  32904. ],
  32905. "Vim": [
  32906. "Vim License",
  32907. false,
  32908. false
  32909. ],
  32910. "VOSTROM": [
  32911. "VOSTROM Public License for Open Source",
  32912. false,
  32913. false
  32914. ],
  32915. "VSL-1.0": [
  32916. "Vovida Software License v1.0",
  32917. true,
  32918. false
  32919. ],
  32920. "W3C": [
  32921. "W3C Software Notice and License (2002-12-31)",
  32922. true,
  32923. false
  32924. ],
  32925. "W3C-19980720": [
  32926. "W3C Software Notice and License (1998-07-20)",
  32927. false,
  32928. false
  32929. ],
  32930. "W3C-20150513": [
  32931. "W3C Software Notice and Document License (2015-05-13)",
  32932. false,
  32933. false
  32934. ],
  32935. "Watcom-1.0": [
  32936. "Sybase Open Watcom Public License 1.0",
  32937. true,
  32938. false
  32939. ],
  32940. "Wsuipa": [
  32941. "Wsuipa License",
  32942. false,
  32943. false
  32944. ],
  32945. "WTFPL": [
  32946. "Do What The F*ck You Want To Public License",
  32947. false,
  32948. false
  32949. ],
  32950. "wxWindows": [
  32951. "wxWindows Library License",
  32952. false,
  32953. true
  32954. ],
  32955. "X11": [
  32956. "X11 License",
  32957. false,
  32958. false
  32959. ],
  32960. "Xerox": [
  32961. "Xerox License",
  32962. false,
  32963. false
  32964. ],
  32965. "XFree86-1.1": [
  32966. "XFree86 License 1.1",
  32967. false,
  32968. false
  32969. ],
  32970. "xinetd": [
  32971. "xinetd License",
  32972. false,
  32973. false
  32974. ],
  32975. "Xnet": [
  32976. "X.Net License",
  32977. true,
  32978. false
  32979. ],
  32980. "xpp": [
  32981. "XPP License",
  32982. false,
  32983. false
  32984. ],
  32985. "XSkat": [
  32986. "XSkat License",
  32987. false,
  32988. false
  32989. ],
  32990. "YPL-1.0": [
  32991. "Yahoo! Public License v1.0",
  32992. false,
  32993. false
  32994. ],
  32995. "YPL-1.1": [
  32996. "Yahoo! Public License v1.1",
  32997. false,
  32998. false
  32999. ],
  33000. "Zed": [
  33001. "Zed License",
  33002. false,
  33003. false
  33004. ],
  33005. "Zend-2.0": [
  33006. "Zend License v2.0",
  33007. false,
  33008. false
  33009. ],
  33010. "Zimbra-1.3": [
  33011. "Zimbra Public License v1.3",
  33012. false,
  33013. false
  33014. ],
  33015. "Zimbra-1.4": [
  33016. "Zimbra Public License v1.4",
  33017. false,
  33018. false
  33019. ],
  33020. "Zlib": [
  33021. "zlib License",
  33022. true,
  33023. false
  33024. ],
  33025. "zlib-acknowledgement": [
  33026. "zlib/libpng License with Acknowledgement",
  33027. false,
  33028. false
  33029. ],
  33030. "ZPL-1.1": [
  33031. "Zope Public License 1.1",
  33032. false,
  33033. false
  33034. ],
  33035. "ZPL-2.0": [
  33036. "Zope Public License 2.0",
  33037. true,
  33038. false
  33039. ],
  33040. "ZPL-2.1": [
  33041. "Zope Public License 2.1",
  33042. false,
  33043. false
  33044. ]
  33045. }MZ��������ÿÿ��¸�������@�����������������������������������è���º�´ Í!¸LÍ!This program cannot be run in DOS mode.
  33046. $�������Æ,Í;§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��������à�  ��
  33047. ���������8������ ����@����������������������`�����?œ���@�����������������������������"��P����@�� �������������������P��p���!�����������������������������8!��@������������ ��Ø���������������������������.text��� ������
  33048. ����������������� ��`.rdata����� ���
  33049. �����������������@��@.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
  33050. 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
  33051. 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
  33052. 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">
  33053. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  33054. <security>
  33055. <requestedPrivileges>
  33056. <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
  33057. </requestedPrivileges>
  33058. </security>
  33059. </trustInfo>
  33060. <dependency>
  33061. <dependentAssembly>
  33062. <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
  33063. </dependentAssembly>
  33064. </dependency>
  33065. </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
  33066. namespace Symfony\Component\Console;
  33067. use Symfony\Component\Console\Command\Command;
  33068. use Symfony\Component\Console\Command\HelpCommand;
  33069. use Symfony\Component\Console\Command\ListCommand;
  33070. use Symfony\Component\Console\Descriptor\TextDescriptor;
  33071. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  33072. use Symfony\Component\Console\Event\ConsoleCommandEvent;
  33073. use Symfony\Component\Console\Event\ConsoleExceptionEvent;
  33074. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  33075. use Symfony\Component\Console\Exception\CommandNotFoundException;
  33076. use Symfony\Component\Console\Exception\ExceptionInterface;
  33077. use Symfony\Component\Console\Exception\LogicException;
  33078. use Symfony\Component\Console\Formatter\OutputFormatter;
  33079. use Symfony\Component\Console\Helper\DebugFormatterHelper;
  33080. use Symfony\Component\Console\Helper\DialogHelper;
  33081. use Symfony\Component\Console\Helper\FormatterHelper;
  33082. use Symfony\Component\Console\Helper\Helper;
  33083. use Symfony\Component\Console\Helper\HelperSet;
  33084. use Symfony\Component\Console\Helper\ProcessHelper;
  33085. use Symfony\Component\Console\Helper\ProgressHelper;
  33086. use Symfony\Component\Console\Helper\QuestionHelper;
  33087. use Symfony\Component\Console\Helper\TableHelper;
  33088. use Symfony\Component\Console\Input\ArgvInput;
  33089. use Symfony\Component\Console\Input\ArrayInput;
  33090. use Symfony\Component\Console\Input\InputArgument;
  33091. use Symfony\Component\Console\Input\InputAwareInterface;
  33092. use Symfony\Component\Console\Input\InputDefinition;
  33093. use Symfony\Component\Console\Input\InputInterface;
  33094. use Symfony\Component\Console\Input\InputOption;
  33095. use Symfony\Component\Console\Output\BufferedOutput;
  33096. use Symfony\Component\Console\Output\ConsoleOutput;
  33097. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  33098. use Symfony\Component\Console\Output\OutputInterface;
  33099. use Symfony\Component\Debug\Exception\FatalThrowableError;
  33100. use Symfony\Component\EventDispatcher\EventDispatcherInterface;
  33101. class Application
  33102. {
  33103. private $commands = array();
  33104. private $wantHelps = false;
  33105. private $runningCommand;
  33106. private $name;
  33107. private $version;
  33108. private $catchExceptions = true;
  33109. private $autoExit = true;
  33110. private $definition;
  33111. private $helperSet;
  33112. private $dispatcher;
  33113. private $terminalDimensions;
  33114. private $defaultCommand;
  33115. private $initialized;
  33116. public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
  33117. {
  33118. $this->name = $name;
  33119. $this->version = $version;
  33120. $this->defaultCommand = 'list';
  33121. }
  33122. public function setDispatcher(EventDispatcherInterface $dispatcher)
  33123. {
  33124. $this->dispatcher = $dispatcher;
  33125. }
  33126. public function run(InputInterface $input = null, OutputInterface $output = null)
  33127. {
  33128. if (null === $input) {
  33129. $input = new ArgvInput();
  33130. }
  33131. if (null === $output) {
  33132. $output = new ConsoleOutput();
  33133. }
  33134. $this->configureIO($input, $output);
  33135. try {
  33136. $e = null;
  33137. $exitCode = $this->doRun($input, $output);
  33138. } catch (\Exception $e) {
  33139. }
  33140. if (null !== $e) {
  33141. if (!$this->catchExceptions) {
  33142. throw $e;
  33143. }
  33144. if ($output instanceof ConsoleOutputInterface) {
  33145. $this->renderException($e, $output->getErrorOutput());
  33146. } else {
  33147. $this->renderException($e, $output);
  33148. }
  33149. $exitCode = $this->getExitCodeForThrowable($e);
  33150. }
  33151. if ($this->autoExit) {
  33152. if ($exitCode > 255) {
  33153. $exitCode = 255;
  33154. }
  33155. exit($exitCode);
  33156. }
  33157. return $exitCode;
  33158. }
  33159. public function doRun(InputInterface $input, OutputInterface $output)
  33160. {
  33161. if (true === $input->hasParameterOption(array('--version', '-V'))) {
  33162. $output->writeln($this->getLongVersion());
  33163. return 0;
  33164. }
  33165. $name = $this->getCommandName($input);
  33166. if (true === $input->hasParameterOption(array('--help', '-h'))) {
  33167. if (!$name) {
  33168. $name = 'help';
  33169. $input = new ArrayInput(array('command' => 'help'));
  33170. } else {
  33171. $this->wantHelps = true;
  33172. }
  33173. }
  33174. if (!$name) {
  33175. $name = $this->defaultCommand;
  33176. $definition = $this->getDefinition();
  33177. $definition->setArguments(array_merge(
  33178. $definition->getArguments(),
  33179. array(
  33180. 'command' => new InputArgument('command', InputArgument::OPTIONAL, $definition->getArgument('command')->getDescription(), $name),
  33181. )
  33182. ));
  33183. }
  33184. $this->runningCommand = null;
  33185. $command = $this->find($name);
  33186. $this->runningCommand = $command;
  33187. $exitCode = $this->doRunCommand($command, $input, $output);
  33188. $this->runningCommand = null;
  33189. return $exitCode;
  33190. }
  33191. public function setHelperSet(HelperSet $helperSet)
  33192. {
  33193. $this->helperSet = $helperSet;
  33194. }
  33195. public function getHelperSet()
  33196. {
  33197. if (!$this->helperSet) {
  33198. $this->helperSet = $this->getDefaultHelperSet();
  33199. }
  33200. return $this->helperSet;
  33201. }
  33202. public function setDefinition(InputDefinition $definition)
  33203. {
  33204. $this->definition = $definition;
  33205. }
  33206. public function getDefinition()
  33207. {
  33208. if (!$this->definition) {
  33209. $this->definition = $this->getDefaultInputDefinition();
  33210. }
  33211. return $this->definition;
  33212. }
  33213. public function getHelp()
  33214. {
  33215. return $this->getLongVersion();
  33216. }
  33217. public function setCatchExceptions($boolean)
  33218. {
  33219. $this->catchExceptions = (bool) $boolean;
  33220. }
  33221. public function setAutoExit($boolean)
  33222. {
  33223. $this->autoExit = (bool) $boolean;
  33224. }
  33225. public function getName()
  33226. {
  33227. return $this->name;
  33228. }
  33229. public function setName($name)
  33230. {
  33231. $this->name = $name;
  33232. }
  33233. public function getVersion()
  33234. {
  33235. return $this->version;
  33236. }
  33237. public function setVersion($version)
  33238. {
  33239. $this->version = $version;
  33240. }
  33241. public function getLongVersion()
  33242. {
  33243. if ('UNKNOWN' !== $this->getName()) {
  33244. if ('UNKNOWN' !== $this->getVersion()) {
  33245. return sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion());
  33246. }
  33247. return sprintf('<info>%s</info>', $this->getName());
  33248. }
  33249. return '<info>Console Tool</info>';
  33250. }
  33251. public function register($name)
  33252. {
  33253. return $this->add(new Command($name));
  33254. }
  33255. public function addCommands(array $commands)
  33256. {
  33257. foreach ($commands as $command) {
  33258. $this->add($command);
  33259. }
  33260. }
  33261. public function add(Command $command)
  33262. {
  33263. $this->init();
  33264. $command->setApplication($this);
  33265. if (!$command->isEnabled()) {
  33266. $command->setApplication(null);
  33267. return;
  33268. }
  33269. if (null === $command->getDefinition()) {
  33270. throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', \get_class($command)));
  33271. }
  33272. $this->commands[$command->getName()] = $command;
  33273. foreach ($command->getAliases() as $alias) {
  33274. $this->commands[$alias] = $command;
  33275. }
  33276. return $command;
  33277. }
  33278. public function get($name)
  33279. {
  33280. $this->init();
  33281. if (!isset($this->commands[$name])) {
  33282. throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
  33283. }
  33284. $command = $this->commands[$name];
  33285. if ($this->wantHelps) {
  33286. $this->wantHelps = false;
  33287. $helpCommand = $this->get('help');
  33288. $helpCommand->setCommand($command);
  33289. return $helpCommand;
  33290. }
  33291. return $command;
  33292. }
  33293. public function has($name)
  33294. {
  33295. $this->init();
  33296. return isset($this->commands[$name]);
  33297. }
  33298. public function getNamespaces()
  33299. {
  33300. $namespaces = array();
  33301. foreach ($this->all() as $command) {
  33302. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName()));
  33303. foreach ($command->getAliases() as $alias) {
  33304. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias));
  33305. }
  33306. }
  33307. return array_values(array_unique(array_filter($namespaces)));
  33308. }
  33309. public function findNamespace($namespace)
  33310. {
  33311. $allNamespaces = $this->getNamespaces();
  33312. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $namespace);
  33313. $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);
  33314. if (empty($namespaces)) {
  33315. $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
  33316. if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
  33317. if (1 == \count($alternatives)) {
  33318. $message .= "\n\nDid you mean this?\n ";
  33319. } else {
  33320. $message .= "\n\nDid you mean one of these?\n ";
  33321. }
  33322. $message .= implode("\n ", $alternatives);
  33323. }
  33324. throw new CommandNotFoundException($message, $alternatives);
  33325. }
  33326. $exact = \in_array($namespace, $namespaces, true);
  33327. if (\count($namespaces) > 1 && !$exact) {
  33328. throw new CommandNotFoundException(sprintf('The namespace "%s" is ambiguous (%s).', $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
  33329. }
  33330. return $exact ? $namespace : reset($namespaces);
  33331. }
  33332. public function find($name)
  33333. {
  33334. $this->init();
  33335. $aliases = array();
  33336. $allCommands = array_keys($this->commands);
  33337. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name);
  33338. $commands = preg_grep('{^'.$expr.'}', $allCommands);
  33339. if (empty($commands) || \count(preg_grep('{^'.$expr.'$}', $commands)) < 1) {
  33340. if (false !== $pos = strrpos($name, ':')) {
  33341. $this->findNamespace(substr($name, 0, $pos));
  33342. }
  33343. $message = sprintf('Command "%s" is not defined.', $name);
  33344. if ($alternatives = $this->findAlternatives($name, $allCommands)) {
  33345. if (1 == \count($alternatives)) {
  33346. $message .= "\n\nDid you mean this?\n ";
  33347. } else {
  33348. $message .= "\n\nDid you mean one of these?\n ";
  33349. }
  33350. $message .= implode("\n ", $alternatives);
  33351. }
  33352. throw new CommandNotFoundException($message, $alternatives);
  33353. }
  33354. if (\count($commands) > 1) {
  33355. $commandList = $this->commands;
  33356. $commands = array_filter($commands, function ($nameOrAlias) use ($commandList, $commands, &$aliases) {
  33357. $commandName = $commandList[$nameOrAlias]->getName();
  33358. $aliases[$nameOrAlias] = $commandName;
  33359. return $commandName === $nameOrAlias || !\in_array($commandName, $commands);
  33360. });
  33361. }
  33362. $exact = \in_array($name, $commands, true) || isset($aliases[$name]);
  33363. if (!$exact && \count($commands) > 1) {
  33364. $suggestions = $this->getAbbreviationSuggestions(array_values($commands));
  33365. throw new CommandNotFoundException(sprintf('Command "%s" is ambiguous (%s).', $name, $suggestions), array_values($commands));
  33366. }
  33367. return $this->get($exact ? $name : reset($commands));
  33368. }
  33369. public function all($namespace = null)
  33370. {
  33371. $this->init();
  33372. if (null === $namespace) {
  33373. return $this->commands;
  33374. }
  33375. $commands = array();
  33376. foreach ($this->commands as $name => $command) {
  33377. if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
  33378. $commands[$name] = $command;
  33379. }
  33380. }
  33381. return $commands;
  33382. }
  33383. public static function getAbbreviations($names)
  33384. {
  33385. $abbrevs = array();
  33386. foreach ($names as $name) {
  33387. for ($len = \strlen($name); $len > 0; --$len) {
  33388. $abbrev = substr($name, 0, $len);
  33389. $abbrevs[$abbrev][] = $name;
  33390. }
  33391. }
  33392. return $abbrevs;
  33393. }
  33394. public function asText($namespace = null, $raw = false)
  33395. {
  33396. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  33397. $descriptor = new TextDescriptor();
  33398. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, !$raw);
  33399. $descriptor->describe($output, $this, array('namespace' => $namespace, 'raw_output' => true));
  33400. return $output->fetch();
  33401. }
  33402. public function asXml($namespace = null, $asDom = false)
  33403. {
  33404. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  33405. $descriptor = new XmlDescriptor();
  33406. if ($asDom) {
  33407. return $descriptor->getApplicationDocument($this, $namespace);
  33408. }
  33409. $output = new BufferedOutput();
  33410. $descriptor->describe($output, $this, array('namespace' => $namespace));
  33411. return $output->fetch();
  33412. }
  33413. public function renderException($e, $output)
  33414. {
  33415. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  33416. do {
  33417. $title = sprintf(' [%s] ', \get_class($e));
  33418. $len = Helper::strlen($title);
  33419. $width = $this->getTerminalWidth() ? $this->getTerminalWidth() - 1 : PHP_INT_MAX;
  33420. if (\defined('HHVM_VERSION') && $width > 1 << 31) {
  33421. $width = 1 << 31;
  33422. }
  33423. $lines = array();
  33424. foreach (preg_split('/\r?\n/', trim($e->getMessage())) as $line) {
  33425. foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
  33426. $lineLength = Helper::strlen($line) + 4;
  33427. $lines[] = array($line, $lineLength);
  33428. $len = max($lineLength, $len);
  33429. }
  33430. }
  33431. $messages = array();
  33432. $messages[] = $emptyLine = sprintf('<error>%s</error>', str_repeat(' ', $len));
  33433. $messages[] = sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - Helper::strlen($title))));
  33434. foreach ($lines as $line) {
  33435. $messages[] = sprintf('<error> %s %s</error>', OutputFormatter::escape($line[0]), str_repeat(' ', $len - $line[1]));
  33436. }
  33437. $messages[] = $emptyLine;
  33438. $messages[] = '';
  33439. $output->writeln($messages, OutputInterface::VERBOSITY_QUIET);
  33440. if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  33441. $output->writeln('<comment>Exception trace:</comment>', OutputInterface::VERBOSITY_QUIET);
  33442. $trace = $e->getTrace();
  33443. array_unshift($trace, array(
  33444. 'function' => '',
  33445. 'file' => null !== $e->getFile() ? $e->getFile() : 'n/a',
  33446. 'line' => null !== $e->getLine() ? $e->getLine() : 'n/a',
  33447. 'args' => array(),
  33448. ));
  33449. for ($i = 0, $count = \count($trace); $i < $count; ++$i) {
  33450. $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
  33451. $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
  33452. $function = $trace[$i]['function'];
  33453. $file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
  33454. $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
  33455. $output->writeln(sprintf(' %s%s%s() at <info>%s:%s</info>', $class, $type, $function, $file, $line), OutputInterface::VERBOSITY_QUIET);
  33456. }
  33457. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  33458. }
  33459. } while ($e = $e->getPrevious());
  33460. if (null !== $this->runningCommand) {
  33461. $output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())), OutputInterface::VERBOSITY_QUIET);
  33462. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  33463. }
  33464. }
  33465. protected function getTerminalWidth()
  33466. {
  33467. $dimensions = $this->getTerminalDimensions();
  33468. return $dimensions[0];
  33469. }
  33470. protected function getTerminalHeight()
  33471. {
  33472. $dimensions = $this->getTerminalDimensions();
  33473. return $dimensions[1];
  33474. }
  33475. public function getTerminalDimensions()
  33476. {
  33477. if ($this->terminalDimensions) {
  33478. return $this->terminalDimensions;
  33479. }
  33480. if ('\\' === \DIRECTORY_SEPARATOR) {
  33481. if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) {
  33482. return array((int) $matches[1], (int) $matches[2]);
  33483. }
  33484. if (preg_match('/^(\d+)x(\d+)$/', $this->getConsoleMode(), $matches)) {
  33485. return array((int) $matches[1], (int) $matches[2]);
  33486. }
  33487. }
  33488. if ($sttyString = $this->getSttyColumns()) {
  33489. if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
  33490. return array((int) $matches[2], (int) $matches[1]);
  33491. }
  33492. if (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {
  33493. return array((int) $matches[2], (int) $matches[1]);
  33494. }
  33495. }
  33496. return array(null, null);
  33497. }
  33498. public function setTerminalDimensions($width, $height)
  33499. {
  33500. $this->terminalDimensions = array($width, $height);
  33501. return $this;
  33502. }
  33503. protected function configureIO(InputInterface $input, OutputInterface $output)
  33504. {
  33505. if (true === $input->hasParameterOption(array('--ansi'))) {
  33506. $output->setDecorated(true);
  33507. } elseif (true === $input->hasParameterOption(array('--no-ansi'))) {
  33508. $output->setDecorated(false);
  33509. }
  33510. if (true === $input->hasParameterOption(array('--no-interaction', '-n'))) {
  33511. $input->setInteractive(false);
  33512. } elseif (\function_exists('posix_isatty') && $this->getHelperSet()->has('question')) {
  33513. $inputStream = $this->getHelperSet()->get('question')->getInputStream();
  33514. if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
  33515. $input->setInteractive(false);
  33516. }
  33517. }
  33518. if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
  33519. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  33520. $input->setInteractive(false);
  33521. } else {
  33522. if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || 3 === $input->getParameterOption('--verbose')) {
  33523. $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
  33524. } elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2') || 2 === $input->getParameterOption('--verbose')) {
  33525. $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
  33526. } elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose') || $input->getParameterOption('--verbose')) {
  33527. $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
  33528. }
  33529. }
  33530. }
  33531. protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
  33532. {
  33533. foreach ($command->getHelperSet() as $helper) {
  33534. if ($helper instanceof InputAwareInterface) {
  33535. $helper->setInput($input);
  33536. }
  33537. }
  33538. if (null === $this->dispatcher) {
  33539. return $command->run($input, $output);
  33540. }
  33541. try {
  33542. $command->mergeApplicationDefinition();
  33543. $input->bind($command->getDefinition());
  33544. } catch (ExceptionInterface $e) {
  33545. }
  33546. $event = new ConsoleCommandEvent($command, $input, $output);
  33547. $e = null;
  33548. try {
  33549. $this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event);
  33550. if ($event->commandShouldRun()) {
  33551. $exitCode = $command->run($input, $output);
  33552. } else {
  33553. $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;
  33554. }
  33555. } catch (\Exception $e) {
  33556. } catch (\Throwable $e) {
  33557. }
  33558. if (null !== $e) {
  33559. $x = $e instanceof \Exception ? $e : new FatalThrowableError($e);
  33560. $event = new ConsoleExceptionEvent($command, $input, $output, $x, $x->getCode());
  33561. $this->dispatcher->dispatch(ConsoleEvents::EXCEPTION, $event);
  33562. if ($x !== $event->getException()) {
  33563. $e = $event->getException();
  33564. }
  33565. $exitCode = $this->getExitCodeForThrowable($e);
  33566. }
  33567. $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode);
  33568. $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event);
  33569. if (null !== $e) {
  33570. throw $e;
  33571. }
  33572. return $event->getExitCode();
  33573. }
  33574. protected function getCommandName(InputInterface $input)
  33575. {
  33576. return $input->getFirstArgument();
  33577. }
  33578. protected function getDefaultInputDefinition()
  33579. {
  33580. return new InputDefinition(array(
  33581. new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
  33582. new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'),
  33583. new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'),
  33584. 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'),
  33585. new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'),
  33586. new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'),
  33587. new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'),
  33588. new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
  33589. ));
  33590. }
  33591. protected function getDefaultCommands()
  33592. {
  33593. return array(new HelpCommand(), new ListCommand());
  33594. }
  33595. protected function getDefaultHelperSet()
  33596. {
  33597. return new HelperSet(array(
  33598. new FormatterHelper(),
  33599. new DialogHelper(false),
  33600. new ProgressHelper(false),
  33601. new TableHelper(false),
  33602. new DebugFormatterHelper(),
  33603. new ProcessHelper(),
  33604. new QuestionHelper(),
  33605. ));
  33606. }
  33607. private function getSttyColumns()
  33608. {
  33609. if (!\function_exists('proc_open')) {
  33610. return;
  33611. }
  33612. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  33613. $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  33614. if (\is_resource($process)) {
  33615. $info = stream_get_contents($pipes[1]);
  33616. fclose($pipes[1]);
  33617. fclose($pipes[2]);
  33618. proc_close($process);
  33619. return $info;
  33620. }
  33621. }
  33622. private function getConsoleMode()
  33623. {
  33624. if (!\function_exists('proc_open')) {
  33625. return;
  33626. }
  33627. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  33628. $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  33629. if (\is_resource($process)) {
  33630. $info = stream_get_contents($pipes[1]);
  33631. fclose($pipes[1]);
  33632. fclose($pipes[2]);
  33633. proc_close($process);
  33634. if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
  33635. return $matches[2].'x'.$matches[1];
  33636. }
  33637. }
  33638. }
  33639. private function getAbbreviationSuggestions($abbrevs)
  33640. {
  33641. return sprintf('%s, %s%s', $abbrevs[0], $abbrevs[1], \count($abbrevs) > 2 ? sprintf(' and %d more', \count($abbrevs) - 2) : '');
  33642. }
  33643. public function extractNamespace($name, $limit = null)
  33644. {
  33645. $parts = explode(':', $name);
  33646. array_pop($parts);
  33647. return implode(':', null === $limit ? $parts : \array_slice($parts, 0, $limit));
  33648. }
  33649. private function findAlternatives($name, $collection)
  33650. {
  33651. $threshold = 1e3;
  33652. $alternatives = array();
  33653. $collectionParts = array();
  33654. foreach ($collection as $item) {
  33655. $collectionParts[$item] = explode(':', $item);
  33656. }
  33657. foreach (explode(':', $name) as $i => $subname) {
  33658. foreach ($collectionParts as $collectionName => $parts) {
  33659. $exists = isset($alternatives[$collectionName]);
  33660. if (!isset($parts[$i]) && $exists) {
  33661. $alternatives[$collectionName] += $threshold;
  33662. continue;
  33663. } elseif (!isset($parts[$i])) {
  33664. continue;
  33665. }
  33666. $lev = levenshtein($subname, $parts[$i]);
  33667. if ($lev <= \strlen($subname) / 3 || '' !== $subname && false !== strpos($parts[$i], $subname)) {
  33668. $alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev;
  33669. } elseif ($exists) {
  33670. $alternatives[$collectionName] += $threshold;
  33671. }
  33672. }
  33673. }
  33674. foreach ($collection as $item) {
  33675. $lev = levenshtein($name, $item);
  33676. if ($lev <= \strlen($name) / 3 || false !== strpos($item, $name)) {
  33677. $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
  33678. }
  33679. }
  33680. $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
  33681. asort($alternatives);
  33682. return array_keys($alternatives);
  33683. }
  33684. public function setDefaultCommand($commandName)
  33685. {
  33686. $this->defaultCommand = $commandName;
  33687. }
  33688. private function splitStringByWidth($string, $width)
  33689. {
  33690. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  33691. return str_split($string, $width);
  33692. }
  33693. $utf8String = mb_convert_encoding($string, 'utf8', $encoding);
  33694. $lines = array();
  33695. $line = '';
  33696. foreach (preg_split('//u', $utf8String) as $char) {
  33697. if (mb_strwidth($line.$char, 'utf8') <= $width) {
  33698. $line .= $char;
  33699. continue;
  33700. }
  33701. $lines[] = str_pad($line, $width);
  33702. $line = $char;
  33703. }
  33704. $lines[] = \count($lines) ? str_pad($line, $width) : $line;
  33705. mb_convert_variables($encoding, 'utf8', $lines);
  33706. return $lines;
  33707. }
  33708. private function extractAllNamespaces($name)
  33709. {
  33710. $parts = explode(':', $name, -1);
  33711. $namespaces = array();
  33712. foreach ($parts as $part) {
  33713. if (\count($namespaces)) {
  33714. $namespaces[] = end($namespaces).':'.$part;
  33715. } else {
  33716. $namespaces[] = $part;
  33717. }
  33718. }
  33719. return $namespaces;
  33720. }
  33721. private function init()
  33722. {
  33723. if ($this->initialized) {
  33724. return;
  33725. }
  33726. $this->initialized = true;
  33727. foreach ($this->getDefaultCommands() as $command) {
  33728. $this->add($command);
  33729. }
  33730. }
  33731. private function getExitCodeForThrowable($throwable)
  33732. {
  33733. $exitCode = $throwable->getCode();
  33734. if (is_numeric($exitCode)) {
  33735. $exitCode = (int) $exitCode;
  33736. if (0 === $exitCode) {
  33737. $exitCode = 1;
  33738. }
  33739. } else {
  33740. $exitCode = 1;
  33741. }
  33742. return $exitCode;
  33743. }
  33744. }
  33745. <?php
  33746. namespace Symfony\Component\Console\Command;
  33747. use Symfony\Component\Console\Application;
  33748. use Symfony\Component\Console\Descriptor\TextDescriptor;
  33749. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  33750. use Symfony\Component\Console\Exception\ExceptionInterface;
  33751. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33752. use Symfony\Component\Console\Exception\LogicException;
  33753. use Symfony\Component\Console\Helper\HelperSet;
  33754. use Symfony\Component\Console\Input\InputArgument;
  33755. use Symfony\Component\Console\Input\InputDefinition;
  33756. use Symfony\Component\Console\Input\InputInterface;
  33757. use Symfony\Component\Console\Input\InputOption;
  33758. use Symfony\Component\Console\Output\BufferedOutput;
  33759. use Symfony\Component\Console\Output\OutputInterface;
  33760. class Command
  33761. {
  33762. private $application;
  33763. private $name;
  33764. private $processTitle;
  33765. private $aliases = array();
  33766. private $definition;
  33767. private $help;
  33768. private $description;
  33769. private $ignoreValidationErrors = false;
  33770. private $applicationDefinitionMerged = false;
  33771. private $applicationDefinitionMergedWithArgs = false;
  33772. private $code;
  33773. private $synopsis = array();
  33774. private $usages = array();
  33775. private $helperSet;
  33776. public function __construct($name = null)
  33777. {
  33778. $this->definition = new InputDefinition();
  33779. if (null !== $name) {
  33780. $this->setName($name);
  33781. }
  33782. $this->configure();
  33783. if (!$this->name) {
  33784. throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', \get_class($this)));
  33785. }
  33786. }
  33787. public function ignoreValidationErrors()
  33788. {
  33789. $this->ignoreValidationErrors = true;
  33790. }
  33791. public function setApplication(Application $application = null)
  33792. {
  33793. $this->application = $application;
  33794. if ($application) {
  33795. $this->setHelperSet($application->getHelperSet());
  33796. } else {
  33797. $this->helperSet = null;
  33798. }
  33799. }
  33800. public function setHelperSet(HelperSet $helperSet)
  33801. {
  33802. $this->helperSet = $helperSet;
  33803. }
  33804. public function getHelperSet()
  33805. {
  33806. return $this->helperSet;
  33807. }
  33808. public function getApplication()
  33809. {
  33810. return $this->application;
  33811. }
  33812. public function isEnabled()
  33813. {
  33814. return true;
  33815. }
  33816. protected function configure()
  33817. {
  33818. }
  33819. protected function execute(InputInterface $input, OutputInterface $output)
  33820. {
  33821. throw new LogicException('You must override the execute() method in the concrete command class.');
  33822. }
  33823. protected function interact(InputInterface $input, OutputInterface $output)
  33824. {
  33825. }
  33826. protected function initialize(InputInterface $input, OutputInterface $output)
  33827. {
  33828. }
  33829. public function run(InputInterface $input, OutputInterface $output)
  33830. {
  33831. $this->getSynopsis(true);
  33832. $this->getSynopsis(false);
  33833. $this->mergeApplicationDefinition();
  33834. try {
  33835. $input->bind($this->definition);
  33836. } catch (ExceptionInterface $e) {
  33837. if (!$this->ignoreValidationErrors) {
  33838. throw $e;
  33839. }
  33840. }
  33841. $this->initialize($input, $output);
  33842. if (null !== $this->processTitle) {
  33843. if (\function_exists('cli_set_process_title')) {
  33844. if (!@cli_set_process_title($this->processTitle)) {
  33845. if ('Darwin' === PHP_OS) {
  33846. $output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
  33847. } else {
  33848. cli_set_process_title($this->processTitle);
  33849. }
  33850. }
  33851. } elseif (\function_exists('setproctitle')) {
  33852. setproctitle($this->processTitle);
  33853. } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
  33854. $output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
  33855. }
  33856. }
  33857. if ($input->isInteractive()) {
  33858. $this->interact($input, $output);
  33859. }
  33860. if ($input->hasArgument('command') && null === $input->getArgument('command')) {
  33861. $input->setArgument('command', $this->getName());
  33862. }
  33863. $input->validate();
  33864. if ($this->code) {
  33865. $statusCode = \call_user_func($this->code, $input, $output);
  33866. } else {
  33867. $statusCode = $this->execute($input, $output);
  33868. }
  33869. return is_numeric($statusCode) ? (int) $statusCode : 0;
  33870. }
  33871. public function setCode($code)
  33872. {
  33873. if (!\is_callable($code)) {
  33874. throw new InvalidArgumentException('Invalid callable provided to Command::setCode.');
  33875. }
  33876. if (\PHP_VERSION_ID >= 50400 && $code instanceof \Closure) {
  33877. $r = new \ReflectionFunction($code);
  33878. if (null === $r->getClosureThis()) {
  33879. if (\PHP_VERSION_ID < 70000) {
  33880. $code = @\Closure::bind($code, $this);
  33881. } else {
  33882. $code = \Closure::bind($code, $this);
  33883. }
  33884. }
  33885. }
  33886. $this->code = $code;
  33887. return $this;
  33888. }
  33889. public function mergeApplicationDefinition($mergeArgs = true)
  33890. {
  33891. if (null === $this->application || (true === $this->applicationDefinitionMerged && ($this->applicationDefinitionMergedWithArgs || !$mergeArgs))) {
  33892. return;
  33893. }
  33894. $this->definition->addOptions($this->application->getDefinition()->getOptions());
  33895. $this->applicationDefinitionMerged = true;
  33896. if ($mergeArgs) {
  33897. $currentArguments = $this->definition->getArguments();
  33898. $this->definition->setArguments($this->application->getDefinition()->getArguments());
  33899. $this->definition->addArguments($currentArguments);
  33900. $this->applicationDefinitionMergedWithArgs = true;
  33901. }
  33902. }
  33903. public function setDefinition($definition)
  33904. {
  33905. if ($definition instanceof InputDefinition) {
  33906. $this->definition = $definition;
  33907. } else {
  33908. $this->definition->setDefinition($definition);
  33909. }
  33910. $this->applicationDefinitionMerged = false;
  33911. return $this;
  33912. }
  33913. public function getDefinition()
  33914. {
  33915. return $this->definition;
  33916. }
  33917. public function getNativeDefinition()
  33918. {
  33919. return $this->getDefinition();
  33920. }
  33921. public function addArgument($name, $mode = null, $description = '', $default = null)
  33922. {
  33923. $this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
  33924. return $this;
  33925. }
  33926. public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
  33927. {
  33928. $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
  33929. return $this;
  33930. }
  33931. public function setName($name)
  33932. {
  33933. $this->validateName($name);
  33934. $this->name = $name;
  33935. return $this;
  33936. }
  33937. public function setProcessTitle($title)
  33938. {
  33939. $this->processTitle = $title;
  33940. return $this;
  33941. }
  33942. public function getName()
  33943. {
  33944. return $this->name;
  33945. }
  33946. public function setDescription($description)
  33947. {
  33948. $this->description = $description;
  33949. return $this;
  33950. }
  33951. public function getDescription()
  33952. {
  33953. return $this->description;
  33954. }
  33955. public function setHelp($help)
  33956. {
  33957. $this->help = $help;
  33958. return $this;
  33959. }
  33960. public function getHelp()
  33961. {
  33962. return $this->help;
  33963. }
  33964. public function getProcessedHelp()
  33965. {
  33966. $name = $this->name;
  33967. $placeholders = array(
  33968. '%command.name%',
  33969. '%command.full_name%',
  33970. );
  33971. $replacements = array(
  33972. $name,
  33973. $_SERVER['PHP_SELF'].' '.$name,
  33974. );
  33975. return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
  33976. }
  33977. public function setAliases($aliases)
  33978. {
  33979. if (!\is_array($aliases) && !$aliases instanceof \Traversable) {
  33980. throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable');
  33981. }
  33982. foreach ($aliases as $alias) {
  33983. $this->validateName($alias);
  33984. }
  33985. $this->aliases = $aliases;
  33986. return $this;
  33987. }
  33988. public function getAliases()
  33989. {
  33990. return $this->aliases;
  33991. }
  33992. public function getSynopsis($short = false)
  33993. {
  33994. $key = $short ? 'short' : 'long';
  33995. if (!isset($this->synopsis[$key])) {
  33996. $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
  33997. }
  33998. return $this->synopsis[$key];
  33999. }
  34000. public function addUsage($usage)
  34001. {
  34002. if (0 !== strpos($usage, $this->name)) {
  34003. $usage = sprintf('%s %s', $this->name, $usage);
  34004. }
  34005. $this->usages[] = $usage;
  34006. return $this;
  34007. }
  34008. public function getUsages()
  34009. {
  34010. return $this->usages;
  34011. }
  34012. public function getHelper($name)
  34013. {
  34014. if (null === $this->helperSet) {
  34015. 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));
  34016. }
  34017. return $this->helperSet->get($name);
  34018. }
  34019. public function asText()
  34020. {
  34021. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  34022. $descriptor = new TextDescriptor();
  34023. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  34024. $descriptor->describe($output, $this, array('raw_output' => true));
  34025. return $output->fetch();
  34026. }
  34027. public function asXml($asDom = false)
  34028. {
  34029. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  34030. $descriptor = new XmlDescriptor();
  34031. if ($asDom) {
  34032. return $descriptor->getCommandDocument($this);
  34033. }
  34034. $output = new BufferedOutput();
  34035. $descriptor->describe($output, $this);
  34036. return $output->fetch();
  34037. }
  34038. private function validateName($name)
  34039. {
  34040. if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
  34041. throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
  34042. }
  34043. }
  34044. }
  34045. <?php
  34046. namespace Symfony\Component\Console\Command;
  34047. use Symfony\Component\Console\Helper\DescriptorHelper;
  34048. use Symfony\Component\Console\Input\InputArgument;
  34049. use Symfony\Component\Console\Input\InputInterface;
  34050. use Symfony\Component\Console\Input\InputOption;
  34051. use Symfony\Component\Console\Output\OutputInterface;
  34052. class HelpCommand extends Command
  34053. {
  34054. private $command;
  34055. protected function configure()
  34056. {
  34057. $this->ignoreValidationErrors();
  34058. $this
  34059. ->setName('help')
  34060. ->setDefinition(array(
  34061. new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
  34062. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
  34063. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  34064. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
  34065. ))
  34066. ->setDescription('Displays help for a command')
  34067. ->setHelp(<<<'EOF'
  34068. The <info>%command.name%</info> command displays help for a given command:
  34069. <info>php %command.full_name% list</info>
  34070. You can also output the help in other formats by using the <comment>--format</comment> option:
  34071. <info>php %command.full_name% --format=xml list</info>
  34072. To display the list of available commands, please use the <info>list</info> command.
  34073. EOF
  34074. )
  34075. ;
  34076. }
  34077. public function setCommand(Command $command)
  34078. {
  34079. $this->command = $command;
  34080. }
  34081. protected function execute(InputInterface $input, OutputInterface $output)
  34082. {
  34083. if (null === $this->command) {
  34084. $this->command = $this->getApplication()->find($input->getArgument('command_name'));
  34085. }
  34086. if ($input->getOption('xml')) {
  34087. @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);
  34088. $input->setOption('format', 'xml');
  34089. }
  34090. $helper = new DescriptorHelper();
  34091. $helper->describe($output, $this->command, array(
  34092. 'format' => $input->getOption('format'),
  34093. 'raw_text' => $input->getOption('raw'),
  34094. ));
  34095. $this->command = null;
  34096. }
  34097. }
  34098. <?php
  34099. namespace Symfony\Component\Console\Command;
  34100. use Symfony\Component\Console\Helper\DescriptorHelper;
  34101. use Symfony\Component\Console\Input\InputArgument;
  34102. use Symfony\Component\Console\Input\InputDefinition;
  34103. use Symfony\Component\Console\Input\InputInterface;
  34104. use Symfony\Component\Console\Input\InputOption;
  34105. use Symfony\Component\Console\Output\OutputInterface;
  34106. class ListCommand extends Command
  34107. {
  34108. protected function configure()
  34109. {
  34110. $this
  34111. ->setName('list')
  34112. ->setDefinition($this->createDefinition())
  34113. ->setDescription('Lists commands')
  34114. ->setHelp(<<<'EOF'
  34115. The <info>%command.name%</info> command lists all commands:
  34116. <info>php %command.full_name%</info>
  34117. You can also display the commands for a specific namespace:
  34118. <info>php %command.full_name% test</info>
  34119. You can also output the information in other formats by using the <comment>--format</comment> option:
  34120. <info>php %command.full_name% --format=xml</info>
  34121. It's also possible to get raw list of commands (useful for embedding command runner):
  34122. <info>php %command.full_name% --raw</info>
  34123. EOF
  34124. )
  34125. ;
  34126. }
  34127. public function getNativeDefinition()
  34128. {
  34129. return $this->createDefinition();
  34130. }
  34131. protected function execute(InputInterface $input, OutputInterface $output)
  34132. {
  34133. if ($input->getOption('xml')) {
  34134. @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);
  34135. $input->setOption('format', 'xml');
  34136. }
  34137. $helper = new DescriptorHelper();
  34138. $helper->describe($output, $this->getApplication(), array(
  34139. 'format' => $input->getOption('format'),
  34140. 'raw_text' => $input->getOption('raw'),
  34141. 'namespace' => $input->getArgument('namespace'),
  34142. ));
  34143. }
  34144. private function createDefinition()
  34145. {
  34146. return new InputDefinition(array(
  34147. new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
  34148. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output list as XML'),
  34149. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
  34150. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  34151. ));
  34152. }
  34153. }
  34154. <?php
  34155. namespace Symfony\Component\Console;
  34156. final class ConsoleEvents
  34157. {
  34158. const COMMAND = 'console.command';
  34159. const TERMINATE = 'console.terminate';
  34160. const EXCEPTION = 'console.exception';
  34161. }
  34162. <?php
  34163. namespace Symfony\Component\Console\Descriptor;
  34164. use Symfony\Component\Console\Application;
  34165. use Symfony\Component\Console\Command\Command;
  34166. use Symfony\Component\Console\Exception\CommandNotFoundException;
  34167. class ApplicationDescription
  34168. {
  34169. const GLOBAL_NAMESPACE = '_global';
  34170. private $application;
  34171. private $namespace;
  34172. private $namespaces;
  34173. private $commands;
  34174. private $aliases;
  34175. public function __construct(Application $application, $namespace = null)
  34176. {
  34177. $this->application = $application;
  34178. $this->namespace = $namespace;
  34179. }
  34180. public function getNamespaces()
  34181. {
  34182. if (null === $this->namespaces) {
  34183. $this->inspectApplication();
  34184. }
  34185. return $this->namespaces;
  34186. }
  34187. public function getCommands()
  34188. {
  34189. if (null === $this->commands) {
  34190. $this->inspectApplication();
  34191. }
  34192. return $this->commands;
  34193. }
  34194. public function getCommand($name)
  34195. {
  34196. if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
  34197. throw new CommandNotFoundException(sprintf('Command %s does not exist.', $name));
  34198. }
  34199. return isset($this->commands[$name]) ? $this->commands[$name] : $this->aliases[$name];
  34200. }
  34201. private function inspectApplication()
  34202. {
  34203. $this->commands = array();
  34204. $this->namespaces = array();
  34205. $all = $this->application->all($this->namespace ? $this->application->findNamespace($this->namespace) : null);
  34206. foreach ($this->sortCommands($all) as $namespace => $commands) {
  34207. $names = array();
  34208. foreach ($commands as $name => $command) {
  34209. if (!$command->getName()) {
  34210. continue;
  34211. }
  34212. if ($command->getName() === $name) {
  34213. $this->commands[$name] = $command;
  34214. } else {
  34215. $this->aliases[$name] = $command;
  34216. }
  34217. $names[] = $name;
  34218. }
  34219. $this->namespaces[$namespace] = array('id' => $namespace, 'commands' => $names);
  34220. }
  34221. }
  34222. private function sortCommands(array $commands)
  34223. {
  34224. $namespacedCommands = array();
  34225. $globalCommands = array();
  34226. foreach ($commands as $name => $command) {
  34227. $key = $this->application->extractNamespace($name, 1);
  34228. if (!$key) {
  34229. $globalCommands['_global'][$name] = $command;
  34230. } else {
  34231. $namespacedCommands[$key][$name] = $command;
  34232. }
  34233. }
  34234. ksort($namespacedCommands);
  34235. $namespacedCommands = array_merge($globalCommands, $namespacedCommands);
  34236. foreach ($namespacedCommands as &$commandsSet) {
  34237. ksort($commandsSet);
  34238. }
  34239. unset($commandsSet);
  34240. return $namespacedCommands;
  34241. }
  34242. }
  34243. <?php
  34244. namespace Symfony\Component\Console\Descriptor;
  34245. use Symfony\Component\Console\Application;
  34246. use Symfony\Component\Console\Command\Command;
  34247. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34248. use Symfony\Component\Console\Input\InputArgument;
  34249. use Symfony\Component\Console\Input\InputDefinition;
  34250. use Symfony\Component\Console\Input\InputOption;
  34251. use Symfony\Component\Console\Output\OutputInterface;
  34252. abstract class Descriptor implements DescriptorInterface
  34253. {
  34254. private $output;
  34255. public function describe(OutputInterface $output, $object, array $options = array())
  34256. {
  34257. $this->output = $output;
  34258. switch (true) {
  34259. case $object instanceof InputArgument:
  34260. $this->describeInputArgument($object, $options);
  34261. break;
  34262. case $object instanceof InputOption:
  34263. $this->describeInputOption($object, $options);
  34264. break;
  34265. case $object instanceof InputDefinition:
  34266. $this->describeInputDefinition($object, $options);
  34267. break;
  34268. case $object instanceof Command:
  34269. $this->describeCommand($object, $options);
  34270. break;
  34271. case $object instanceof Application:
  34272. $this->describeApplication($object, $options);
  34273. break;
  34274. default:
  34275. throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', \get_class($object)));
  34276. }
  34277. }
  34278. protected function write($content, $decorated = false)
  34279. {
  34280. $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
  34281. }
  34282. abstract protected function describeInputArgument(InputArgument $argument, array $options = array());
  34283. abstract protected function describeInputOption(InputOption $option, array $options = array());
  34284. abstract protected function describeInputDefinition(InputDefinition $definition, array $options = array());
  34285. abstract protected function describeCommand(Command $command, array $options = array());
  34286. abstract protected function describeApplication(Application $application, array $options = array());
  34287. }
  34288. <?php
  34289. namespace Symfony\Component\Console\Descriptor;
  34290. use Symfony\Component\Console\Output\OutputInterface;
  34291. interface DescriptorInterface
  34292. {
  34293. public function describe(OutputInterface $output, $object, array $options = array());
  34294. }
  34295. <?php
  34296. namespace Symfony\Component\Console\Descriptor;
  34297. use Symfony\Component\Console\Application;
  34298. use Symfony\Component\Console\Command\Command;
  34299. use Symfony\Component\Console\Input\InputArgument;
  34300. use Symfony\Component\Console\Input\InputDefinition;
  34301. use Symfony\Component\Console\Input\InputOption;
  34302. class JsonDescriptor extends Descriptor
  34303. {
  34304. protected function describeInputArgument(InputArgument $argument, array $options = array())
  34305. {
  34306. $this->writeData($this->getInputArgumentData($argument), $options);
  34307. }
  34308. protected function describeInputOption(InputOption $option, array $options = array())
  34309. {
  34310. $this->writeData($this->getInputOptionData($option), $options);
  34311. }
  34312. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  34313. {
  34314. $this->writeData($this->getInputDefinitionData($definition), $options);
  34315. }
  34316. protected function describeCommand(Command $command, array $options = array())
  34317. {
  34318. $this->writeData($this->getCommandData($command), $options);
  34319. }
  34320. protected function describeApplication(Application $application, array $options = array())
  34321. {
  34322. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  34323. $description = new ApplicationDescription($application, $describedNamespace);
  34324. $commands = array();
  34325. foreach ($description->getCommands() as $command) {
  34326. $commands[] = $this->getCommandData($command);
  34327. }
  34328. $data = $describedNamespace
  34329. ? array('commands' => $commands, 'namespace' => $describedNamespace)
  34330. : array('commands' => $commands, 'namespaces' => array_values($description->getNamespaces()));
  34331. $this->writeData($data, $options);
  34332. }
  34333. private function writeData(array $data, array $options)
  34334. {
  34335. $this->write(json_encode($data, isset($options['json_encoding']) ? $options['json_encoding'] : 0));
  34336. }
  34337. private function getInputArgumentData(InputArgument $argument)
  34338. {
  34339. return array(
  34340. 'name' => $argument->getName(),
  34341. 'is_required' => $argument->isRequired(),
  34342. 'is_array' => $argument->isArray(),
  34343. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
  34344. 'default' => INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
  34345. );
  34346. }
  34347. private function getInputOptionData(InputOption $option)
  34348. {
  34349. return array(
  34350. 'name' => '--'.$option->getName(),
  34351. 'shortcut' => $option->getShortcut() ? '-'.str_replace('|', '|-', $option->getShortcut()) : '',
  34352. 'accept_value' => $option->acceptValue(),
  34353. 'is_value_required' => $option->isValueRequired(),
  34354. 'is_multiple' => $option->isArray(),
  34355. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
  34356. 'default' => INF === $option->getDefault() ? 'INF' : $option->getDefault(),
  34357. );
  34358. }
  34359. private function getInputDefinitionData(InputDefinition $definition)
  34360. {
  34361. $inputArguments = array();
  34362. foreach ($definition->getArguments() as $name => $argument) {
  34363. $inputArguments[$name] = $this->getInputArgumentData($argument);
  34364. }
  34365. $inputOptions = array();
  34366. foreach ($definition->getOptions() as $name => $option) {
  34367. $inputOptions[$name] = $this->getInputOptionData($option);
  34368. }
  34369. return array('arguments' => $inputArguments, 'options' => $inputOptions);
  34370. }
  34371. private function getCommandData(Command $command)
  34372. {
  34373. $command->getSynopsis();
  34374. $command->mergeApplicationDefinition(false);
  34375. return array(
  34376. 'name' => $command->getName(),
  34377. 'usage' => array_merge(array($command->getSynopsis()), $command->getUsages(), $command->getAliases()),
  34378. 'description' => $command->getDescription(),
  34379. 'help' => $command->getProcessedHelp(),
  34380. 'definition' => $this->getInputDefinitionData($command->getNativeDefinition()),
  34381. );
  34382. }
  34383. }
  34384. <?php
  34385. namespace Symfony\Component\Console\Descriptor;
  34386. use Symfony\Component\Console\Application;
  34387. use Symfony\Component\Console\Command\Command;
  34388. use Symfony\Component\Console\Helper\Helper;
  34389. use Symfony\Component\Console\Input\InputArgument;
  34390. use Symfony\Component\Console\Input\InputDefinition;
  34391. use Symfony\Component\Console\Input\InputOption;
  34392. class MarkdownDescriptor extends Descriptor
  34393. {
  34394. protected function describeInputArgument(InputArgument $argument, array $options = array())
  34395. {
  34396. $this->write(
  34397. '**'.$argument->getName().':**'."\n\n"
  34398. .'* Name: '.($argument->getName() ?: '<none>')."\n"
  34399. .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
  34400. .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
  34401. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $argument->getDescription() ?: '<none>')."\n"
  34402. .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
  34403. );
  34404. }
  34405. protected function describeInputOption(InputOption $option, array $options = array())
  34406. {
  34407. $this->write(
  34408. '**'.$option->getName().':**'."\n\n"
  34409. .'* Name: `--'.$option->getName().'`'."\n"
  34410. .'* Shortcut: '.($option->getShortcut() ? '`-'.str_replace('|', '|-', $option->getShortcut()).'`' : '<none>')."\n"
  34411. .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
  34412. .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
  34413. .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
  34414. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $option->getDescription() ?: '<none>')."\n"
  34415. .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
  34416. );
  34417. }
  34418. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  34419. {
  34420. if ($showArguments = \count($definition->getArguments()) > 0) {
  34421. $this->write('### Arguments:');
  34422. foreach ($definition->getArguments() as $argument) {
  34423. $this->write("\n\n");
  34424. $this->write($this->describeInputArgument($argument));
  34425. }
  34426. }
  34427. if (\count($definition->getOptions()) > 0) {
  34428. if ($showArguments) {
  34429. $this->write("\n\n");
  34430. }
  34431. $this->write('### Options:');
  34432. foreach ($definition->getOptions() as $option) {
  34433. $this->write("\n\n");
  34434. $this->write($this->describeInputOption($option));
  34435. }
  34436. }
  34437. }
  34438. protected function describeCommand(Command $command, array $options = array())
  34439. {
  34440. $command->getSynopsis();
  34441. $command->mergeApplicationDefinition(false);
  34442. $this->write(
  34443. $command->getName()."\n"
  34444. .str_repeat('-', Helper::strlen($command->getName()))."\n\n"
  34445. .'* Description: '.($command->getDescription() ?: '<none>')."\n"
  34446. .'* Usage:'."\n\n"
  34447. .array_reduce(array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
  34448. return $carry.' * `'.$usage.'`'."\n";
  34449. })
  34450. );
  34451. if ($help = $command->getProcessedHelp()) {
  34452. $this->write("\n");
  34453. $this->write($help);
  34454. }
  34455. if ($command->getNativeDefinition()) {
  34456. $this->write("\n\n");
  34457. $this->describeInputDefinition($command->getNativeDefinition());
  34458. }
  34459. }
  34460. protected function describeApplication(Application $application, array $options = array())
  34461. {
  34462. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  34463. $description = new ApplicationDescription($application, $describedNamespace);
  34464. $this->write($application->getName()."\n".str_repeat('=', Helper::strlen($application->getName())));
  34465. foreach ($description->getNamespaces() as $namespace) {
  34466. if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  34467. $this->write("\n\n");
  34468. $this->write('**'.$namespace['id'].':**');
  34469. }
  34470. $this->write("\n\n");
  34471. $this->write(implode("\n", array_map(function ($commandName) {
  34472. return '* '.$commandName;
  34473. }, $namespace['commands'])));
  34474. }
  34475. foreach ($description->getCommands() as $command) {
  34476. $this->write("\n\n");
  34477. $this->write($this->describeCommand($command));
  34478. }
  34479. }
  34480. }
  34481. <?php
  34482. namespace Symfony\Component\Console\Descriptor;
  34483. use Symfony\Component\Console\Application;
  34484. use Symfony\Component\Console\Command\Command;
  34485. use Symfony\Component\Console\Formatter\OutputFormatter;
  34486. use Symfony\Component\Console\Helper\Helper;
  34487. use Symfony\Component\Console\Input\InputArgument;
  34488. use Symfony\Component\Console\Input\InputDefinition;
  34489. use Symfony\Component\Console\Input\InputOption;
  34490. class TextDescriptor extends Descriptor
  34491. {
  34492. protected function describeInputArgument(InputArgument $argument, array $options = array())
  34493. {
  34494. if (null !== $argument->getDefault() && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) {
  34495. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
  34496. } else {
  34497. $default = '';
  34498. }
  34499. $totalWidth = isset($options['total_width']) ? $options['total_width'] : Helper::strlen($argument->getName());
  34500. $spacingWidth = $totalWidth - \strlen($argument->getName());
  34501. $this->writeText(sprintf(' <info>%s</info> %s%s%s',
  34502. $argument->getName(),
  34503. str_repeat(' ', $spacingWidth),
  34504. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()),
  34505. $default
  34506. ), $options);
  34507. }
  34508. protected function describeInputOption(InputOption $option, array $options = array())
  34509. {
  34510. if ($option->acceptValue() && null !== $option->getDefault() && (!\is_array($option->getDefault()) || \count($option->getDefault()))) {
  34511. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
  34512. } else {
  34513. $default = '';
  34514. }
  34515. $value = '';
  34516. if ($option->acceptValue()) {
  34517. $value = '='.strtoupper($option->getName());
  34518. if ($option->isValueOptional()) {
  34519. $value = '['.$value.']';
  34520. }
  34521. }
  34522. $totalWidth = isset($options['total_width']) ? $options['total_width'] : $this->calculateTotalWidthForOptions(array($option));
  34523. $synopsis = sprintf('%s%s',
  34524. $option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ',
  34525. sprintf('--%s%s', $option->getName(), $value)
  34526. );
  34527. $spacingWidth = $totalWidth - Helper::strlen($synopsis);
  34528. $this->writeText(sprintf(' <info>%s</info> %s%s%s%s',
  34529. $synopsis,
  34530. str_repeat(' ', $spacingWidth),
  34531. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $option->getDescription()),
  34532. $default,
  34533. $option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
  34534. ), $options);
  34535. }
  34536. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  34537. {
  34538. $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
  34539. foreach ($definition->getArguments() as $argument) {
  34540. $totalWidth = max($totalWidth, Helper::strlen($argument->getName()));
  34541. }
  34542. if ($definition->getArguments()) {
  34543. $this->writeText('<comment>Arguments:</comment>', $options);
  34544. $this->writeText("\n");
  34545. foreach ($definition->getArguments() as $argument) {
  34546. $this->describeInputArgument($argument, array_merge($options, array('total_width' => $totalWidth)));
  34547. $this->writeText("\n");
  34548. }
  34549. }
  34550. if ($definition->getArguments() && $definition->getOptions()) {
  34551. $this->writeText("\n");
  34552. }
  34553. if ($definition->getOptions()) {
  34554. $laterOptions = array();
  34555. $this->writeText('<comment>Options:</comment>', $options);
  34556. foreach ($definition->getOptions() as $option) {
  34557. if (\strlen($option->getShortcut()) > 1) {
  34558. $laterOptions[] = $option;
  34559. continue;
  34560. }
  34561. $this->writeText("\n");
  34562. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  34563. }
  34564. foreach ($laterOptions as $option) {
  34565. $this->writeText("\n");
  34566. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  34567. }
  34568. }
  34569. }
  34570. protected function describeCommand(Command $command, array $options = array())
  34571. {
  34572. $command->getSynopsis(true);
  34573. $command->getSynopsis(false);
  34574. $command->mergeApplicationDefinition(false);
  34575. $this->writeText('<comment>Usage:</comment>', $options);
  34576. foreach (array_merge(array($command->getSynopsis(true)), $command->getAliases(), $command->getUsages()) as $usage) {
  34577. $this->writeText("\n");
  34578. $this->writeText(' '.OutputFormatter::escape($usage), $options);
  34579. }
  34580. $this->writeText("\n");
  34581. $definition = $command->getNativeDefinition();
  34582. if ($definition->getOptions() || $definition->getArguments()) {
  34583. $this->writeText("\n");
  34584. $this->describeInputDefinition($definition, $options);
  34585. $this->writeText("\n");
  34586. }
  34587. if ($help = $command->getProcessedHelp()) {
  34588. $this->writeText("\n");
  34589. $this->writeText('<comment>Help:</comment>', $options);
  34590. $this->writeText("\n");
  34591. $this->writeText(' '.str_replace("\n", "\n ", $help), $options);
  34592. $this->writeText("\n");
  34593. }
  34594. }
  34595. protected function describeApplication(Application $application, array $options = array())
  34596. {
  34597. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  34598. $description = new ApplicationDescription($application, $describedNamespace);
  34599. if (isset($options['raw_text']) && $options['raw_text']) {
  34600. $width = $this->getColumnWidth($description->getCommands());
  34601. foreach ($description->getCommands() as $command) {
  34602. $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
  34603. $this->writeText("\n");
  34604. }
  34605. } else {
  34606. if ('' != $help = $application->getHelp()) {
  34607. $this->writeText("$help\n\n", $options);
  34608. }
  34609. $this->writeText("<comment>Usage:</comment>\n", $options);
  34610. $this->writeText(" command [options] [arguments]\n\n", $options);
  34611. $this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);
  34612. $this->writeText("\n");
  34613. $this->writeText("\n");
  34614. $width = $this->getColumnWidth($description->getCommands());
  34615. if ($describedNamespace) {
  34616. $this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
  34617. } else {
  34618. $this->writeText('<comment>Available commands:</comment>', $options);
  34619. }
  34620. foreach ($description->getNamespaces() as $namespace) {
  34621. if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  34622. $this->writeText("\n");
  34623. $this->writeText(' <comment>'.$namespace['id'].'</comment>', $options);
  34624. }
  34625. foreach ($namespace['commands'] as $name) {
  34626. $this->writeText("\n");
  34627. $spacingWidth = $width - Helper::strlen($name);
  34628. $this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $description->getCommand($name)->getDescription()), $options);
  34629. }
  34630. }
  34631. $this->writeText("\n");
  34632. }
  34633. }
  34634. private function writeText($content, array $options = array())
  34635. {
  34636. $this->write(
  34637. isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
  34638. isset($options['raw_output']) ? !$options['raw_output'] : true
  34639. );
  34640. }
  34641. private function formatDefaultValue($default)
  34642. {
  34643. if (INF === $default) {
  34644. return 'INF';
  34645. }
  34646. if (\is_string($default)) {
  34647. $default = OutputFormatter::escape($default);
  34648. } elseif (\is_array($default)) {
  34649. foreach ($default as $key => $value) {
  34650. if (\is_string($value)) {
  34651. $default[$key] = OutputFormatter::escape($value);
  34652. }
  34653. }
  34654. }
  34655. if (\PHP_VERSION_ID < 50400) {
  34656. return str_replace(array('\/', '\\\\'), array('/', '\\'), json_encode($default));
  34657. }
  34658. return str_replace('\\\\', '\\', json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
  34659. }
  34660. private function getColumnWidth(array $commands)
  34661. {
  34662. $widths = array();
  34663. foreach ($commands as $command) {
  34664. $widths[] = Helper::strlen($command->getName());
  34665. foreach ($command->getAliases() as $alias) {
  34666. $widths[] = Helper::strlen($alias);
  34667. }
  34668. }
  34669. return max($widths) + 2;
  34670. }
  34671. private function calculateTotalWidthForOptions(array $options)
  34672. {
  34673. $totalWidth = 0;
  34674. foreach ($options as $option) {
  34675. $nameLength = 1 + max(\strlen($option->getShortcut()), 1) + 4 + Helper::strlen($option->getName());
  34676. if ($option->acceptValue()) {
  34677. $valueLength = 1 + Helper::strlen($option->getName());
  34678. $valueLength += $option->isValueOptional() ? 2 : 0;
  34679. $nameLength += $valueLength;
  34680. }
  34681. $totalWidth = max($totalWidth, $nameLength);
  34682. }
  34683. return $totalWidth;
  34684. }
  34685. }
  34686. <?php
  34687. namespace Symfony\Component\Console\Descriptor;
  34688. use Symfony\Component\Console\Application;
  34689. use Symfony\Component\Console\Command\Command;
  34690. use Symfony\Component\Console\Input\InputArgument;
  34691. use Symfony\Component\Console\Input\InputDefinition;
  34692. use Symfony\Component\Console\Input\InputOption;
  34693. class XmlDescriptor extends Descriptor
  34694. {
  34695. public function getInputDefinitionDocument(InputDefinition $definition)
  34696. {
  34697. $dom = new \DOMDocument('1.0', 'UTF-8');
  34698. $dom->appendChild($definitionXML = $dom->createElement('definition'));
  34699. $definitionXML->appendChild($argumentsXML = $dom->createElement('arguments'));
  34700. foreach ($definition->getArguments() as $argument) {
  34701. $this->appendDocument($argumentsXML, $this->getInputArgumentDocument($argument));
  34702. }
  34703. $definitionXML->appendChild($optionsXML = $dom->createElement('options'));
  34704. foreach ($definition->getOptions() as $option) {
  34705. $this->appendDocument($optionsXML, $this->getInputOptionDocument($option));
  34706. }
  34707. return $dom;
  34708. }
  34709. public function getCommandDocument(Command $command)
  34710. {
  34711. $dom = new \DOMDocument('1.0', 'UTF-8');
  34712. $dom->appendChild($commandXML = $dom->createElement('command'));
  34713. $command->getSynopsis();
  34714. $command->mergeApplicationDefinition(false);
  34715. $commandXML->setAttribute('id', $command->getName());
  34716. $commandXML->setAttribute('name', $command->getName());
  34717. $commandXML->appendChild($usagesXML = $dom->createElement('usages'));
  34718. foreach (array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()) as $usage) {
  34719. $usagesXML->appendChild($dom->createElement('usage', $usage));
  34720. }
  34721. $commandXML->appendChild($descriptionXML = $dom->createElement('description'));
  34722. $descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription())));
  34723. $commandXML->appendChild($helpXML = $dom->createElement('help'));
  34724. $helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getProcessedHelp())));
  34725. $definitionXML = $this->getInputDefinitionDocument($command->getNativeDefinition());
  34726. $this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0));
  34727. return $dom;
  34728. }
  34729. public function getApplicationDocument(Application $application, $namespace = null)
  34730. {
  34731. $dom = new \DOMDocument('1.0', 'UTF-8');
  34732. $dom->appendChild($rootXml = $dom->createElement('symfony'));
  34733. if ('UNKNOWN' !== $application->getName()) {
  34734. $rootXml->setAttribute('name', $application->getName());
  34735. if ('UNKNOWN' !== $application->getVersion()) {
  34736. $rootXml->setAttribute('version', $application->getVersion());
  34737. }
  34738. }
  34739. $rootXml->appendChild($commandsXML = $dom->createElement('commands'));
  34740. $description = new ApplicationDescription($application, $namespace);
  34741. if ($namespace) {
  34742. $commandsXML->setAttribute('namespace', $namespace);
  34743. }
  34744. foreach ($description->getCommands() as $command) {
  34745. $this->appendDocument($commandsXML, $this->getCommandDocument($command));
  34746. }
  34747. if (!$namespace) {
  34748. $rootXml->appendChild($namespacesXML = $dom->createElement('namespaces'));
  34749. foreach ($description->getNamespaces() as $namespaceDescription) {
  34750. $namespacesXML->appendChild($namespaceArrayXML = $dom->createElement('namespace'));
  34751. $namespaceArrayXML->setAttribute('id', $namespaceDescription['id']);
  34752. foreach ($namespaceDescription['commands'] as $name) {
  34753. $namespaceArrayXML->appendChild($commandXML = $dom->createElement('command'));
  34754. $commandXML->appendChild($dom->createTextNode($name));
  34755. }
  34756. }
  34757. }
  34758. return $dom;
  34759. }
  34760. protected function describeInputArgument(InputArgument $argument, array $options = array())
  34761. {
  34762. $this->writeDocument($this->getInputArgumentDocument($argument));
  34763. }
  34764. protected function describeInputOption(InputOption $option, array $options = array())
  34765. {
  34766. $this->writeDocument($this->getInputOptionDocument($option));
  34767. }
  34768. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  34769. {
  34770. $this->writeDocument($this->getInputDefinitionDocument($definition));
  34771. }
  34772. protected function describeCommand(Command $command, array $options = array())
  34773. {
  34774. $this->writeDocument($this->getCommandDocument($command));
  34775. }
  34776. protected function describeApplication(Application $application, array $options = array())
  34777. {
  34778. $this->writeDocument($this->getApplicationDocument($application, isset($options['namespace']) ? $options['namespace'] : null));
  34779. }
  34780. private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent)
  34781. {
  34782. foreach ($importedParent->childNodes as $childNode) {
  34783. $parentNode->appendChild($parentNode->ownerDocument->importNode($childNode, true));
  34784. }
  34785. }
  34786. private function writeDocument(\DOMDocument $dom)
  34787. {
  34788. $dom->formatOutput = true;
  34789. $this->write($dom->saveXML());
  34790. }
  34791. private function getInputArgumentDocument(InputArgument $argument)
  34792. {
  34793. $dom = new \DOMDocument('1.0', 'UTF-8');
  34794. $dom->appendChild($objectXML = $dom->createElement('argument'));
  34795. $objectXML->setAttribute('name', $argument->getName());
  34796. $objectXML->setAttribute('is_required', $argument->isRequired() ? 1 : 0);
  34797. $objectXML->setAttribute('is_array', $argument->isArray() ? 1 : 0);
  34798. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  34799. $descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));
  34800. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  34801. $defaults = \is_array($argument->getDefault()) ? $argument->getDefault() : (\is_bool($argument->getDefault()) ? array(var_export($argument->getDefault(), true)) : ($argument->getDefault() ? array($argument->getDefault()) : array()));
  34802. foreach ($defaults as $default) {
  34803. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  34804. $defaultXML->appendChild($dom->createTextNode($default));
  34805. }
  34806. return $dom;
  34807. }
  34808. private function getInputOptionDocument(InputOption $option)
  34809. {
  34810. $dom = new \DOMDocument('1.0', 'UTF-8');
  34811. $dom->appendChild($objectXML = $dom->createElement('option'));
  34812. $objectXML->setAttribute('name', '--'.$option->getName());
  34813. $pos = strpos($option->getShortcut(), '|');
  34814. if (false !== $pos) {
  34815. $objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
  34816. $objectXML->setAttribute('shortcuts', '-'.str_replace('|', '|-', $option->getShortcut()));
  34817. } else {
  34818. $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
  34819. }
  34820. $objectXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0);
  34821. $objectXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0);
  34822. $objectXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0);
  34823. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  34824. $descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
  34825. if ($option->acceptValue()) {
  34826. $defaults = \is_array($option->getDefault()) ? $option->getDefault() : (\is_bool($option->getDefault()) ? array(var_export($option->getDefault(), true)) : ($option->getDefault() ? array($option->getDefault()) : array()));
  34827. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  34828. if (!empty($defaults)) {
  34829. foreach ($defaults as $default) {
  34830. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  34831. $defaultXML->appendChild($dom->createTextNode($default));
  34832. }
  34833. }
  34834. }
  34835. return $dom;
  34836. }
  34837. }
  34838. <?php
  34839. namespace Symfony\Component\Console\Event;
  34840. class ConsoleCommandEvent extends ConsoleEvent
  34841. {
  34842. const RETURN_CODE_DISABLED = 113;
  34843. private $commandShouldRun = true;
  34844. public function disableCommand()
  34845. {
  34846. return $this->commandShouldRun = false;
  34847. }
  34848. public function enableCommand()
  34849. {
  34850. return $this->commandShouldRun = true;
  34851. }
  34852. public function commandShouldRun()
  34853. {
  34854. return $this->commandShouldRun;
  34855. }
  34856. }
  34857. <?php
  34858. namespace Symfony\Component\Console\Event;
  34859. use Symfony\Component\Console\Command\Command;
  34860. use Symfony\Component\Console\Input\InputInterface;
  34861. use Symfony\Component\Console\Output\OutputInterface;
  34862. use Symfony\Component\EventDispatcher\Event;
  34863. class ConsoleEvent extends Event
  34864. {
  34865. protected $command;
  34866. private $input;
  34867. private $output;
  34868. public function __construct(Command $command, InputInterface $input, OutputInterface $output)
  34869. {
  34870. $this->command = $command;
  34871. $this->input = $input;
  34872. $this->output = $output;
  34873. }
  34874. public function getCommand()
  34875. {
  34876. return $this->command;
  34877. }
  34878. public function getInput()
  34879. {
  34880. return $this->input;
  34881. }
  34882. public function getOutput()
  34883. {
  34884. return $this->output;
  34885. }
  34886. }
  34887. <?php
  34888. namespace Symfony\Component\Console\Event;
  34889. use Symfony\Component\Console\Command\Command;
  34890. use Symfony\Component\Console\Input\InputInterface;
  34891. use Symfony\Component\Console\Output\OutputInterface;
  34892. class ConsoleExceptionEvent extends ConsoleEvent
  34893. {
  34894. private $exception;
  34895. private $exitCode;
  34896. public function __construct(Command $command, InputInterface $input, OutputInterface $output, \Exception $exception, $exitCode)
  34897. {
  34898. parent::__construct($command, $input, $output);
  34899. $this->setException($exception);
  34900. $this->exitCode = (int) $exitCode;
  34901. }
  34902. public function getException()
  34903. {
  34904. return $this->exception;
  34905. }
  34906. public function setException(\Exception $exception)
  34907. {
  34908. $this->exception = $exception;
  34909. }
  34910. public function getExitCode()
  34911. {
  34912. return $this->exitCode;
  34913. }
  34914. }
  34915. <?php
  34916. namespace Symfony\Component\Console\Event;
  34917. use Symfony\Component\Console\Command\Command;
  34918. use Symfony\Component\Console\Input\InputInterface;
  34919. use Symfony\Component\Console\Output\OutputInterface;
  34920. class ConsoleTerminateEvent extends ConsoleEvent
  34921. {
  34922. private $exitCode;
  34923. public function __construct(Command $command, InputInterface $input, OutputInterface $output, $exitCode)
  34924. {
  34925. parent::__construct($command, $input, $output);
  34926. $this->setExitCode($exitCode);
  34927. }
  34928. public function setExitCode($exitCode)
  34929. {
  34930. $this->exitCode = (int) $exitCode;
  34931. }
  34932. public function getExitCode()
  34933. {
  34934. return $this->exitCode;
  34935. }
  34936. }
  34937. <?php
  34938. namespace Symfony\Component\Console\Exception;
  34939. class CommandNotFoundException extends \InvalidArgumentException implements ExceptionInterface
  34940. {
  34941. private $alternatives;
  34942. public function __construct($message, array $alternatives = array(), $code = 0, \Exception $previous = null)
  34943. {
  34944. parent::__construct($message, $code, $previous);
  34945. $this->alternatives = $alternatives;
  34946. }
  34947. public function getAlternatives()
  34948. {
  34949. return $this->alternatives;
  34950. }
  34951. }
  34952. <?php
  34953. namespace Symfony\Component\Console\Exception;
  34954. interface ExceptionInterface
  34955. {
  34956. }
  34957. <?php
  34958. namespace Symfony\Component\Console\Exception;
  34959. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  34960. {
  34961. }
  34962. <?php
  34963. namespace Symfony\Component\Console\Exception;
  34964. class InvalidOptionException extends \InvalidArgumentException implements ExceptionInterface
  34965. {
  34966. }
  34967. <?php
  34968. namespace Symfony\Component\Console\Exception;
  34969. class LogicException extends \LogicException implements ExceptionInterface
  34970. {
  34971. }
  34972. <?php
  34973. namespace Symfony\Component\Console\Exception;
  34974. class RuntimeException extends \RuntimeException implements ExceptionInterface
  34975. {
  34976. }
  34977. <?php
  34978. namespace Symfony\Component\Console\Formatter;
  34979. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34980. class OutputFormatter implements OutputFormatterInterface
  34981. {
  34982. private $decorated;
  34983. private $styles = array();
  34984. private $styleStack;
  34985. public static function escape($text)
  34986. {
  34987. $text = preg_replace('/([^\\\\]?)</', '$1\\<', $text);
  34988. return self::escapeTrailingBackslash($text);
  34989. }
  34990. public static function escapeTrailingBackslash($text)
  34991. {
  34992. if ('\\' === substr($text, -1)) {
  34993. $len = \strlen($text);
  34994. $text = rtrim($text, '\\');
  34995. $text = str_replace("\0", '', $text);
  34996. $text .= str_repeat("\0", $len - \strlen($text));
  34997. }
  34998. return $text;
  34999. }
  35000. public function __construct($decorated = false, array $styles = array())
  35001. {
  35002. $this->decorated = (bool) $decorated;
  35003. $this->setStyle('error', new OutputFormatterStyle('white', 'red'));
  35004. $this->setStyle('info', new OutputFormatterStyle('green'));
  35005. $this->setStyle('comment', new OutputFormatterStyle('yellow'));
  35006. $this->setStyle('question', new OutputFormatterStyle('black', 'cyan'));
  35007. foreach ($styles as $name => $style) {
  35008. $this->setStyle($name, $style);
  35009. }
  35010. $this->styleStack = new OutputFormatterStyleStack();
  35011. }
  35012. public function setDecorated($decorated)
  35013. {
  35014. $this->decorated = (bool) $decorated;
  35015. }
  35016. public function isDecorated()
  35017. {
  35018. return $this->decorated;
  35019. }
  35020. public function setStyle($name, OutputFormatterStyleInterface $style)
  35021. {
  35022. $this->styles[strtolower($name)] = $style;
  35023. }
  35024. public function hasStyle($name)
  35025. {
  35026. return isset($this->styles[strtolower($name)]);
  35027. }
  35028. public function getStyle($name)
  35029. {
  35030. if (!$this->hasStyle($name)) {
  35031. throw new InvalidArgumentException(sprintf('Undefined style: %s', $name));
  35032. }
  35033. return $this->styles[strtolower($name)];
  35034. }
  35035. public function format($message)
  35036. {
  35037. $message = (string) $message;
  35038. $offset = 0;
  35039. $output = '';
  35040. $tagRegex = '[a-z][a-z0-9_=;-]*+';
  35041. preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, PREG_OFFSET_CAPTURE);
  35042. foreach ($matches[0] as $i => $match) {
  35043. $pos = $match[1];
  35044. $text = $match[0];
  35045. if (0 != $pos && '\\' == $message[$pos - 1]) {
  35046. continue;
  35047. }
  35048. $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset));
  35049. $offset = $pos + \strlen($text);
  35050. if ($open = '/' != $text[1]) {
  35051. $tag = $matches[1][$i][0];
  35052. } else {
  35053. $tag = isset($matches[3][$i][0]) ? $matches[3][$i][0] : '';
  35054. }
  35055. if (!$open && !$tag) {
  35056. $this->styleStack->pop();
  35057. } elseif (false === $style = $this->createStyleFromString(strtolower($tag))) {
  35058. $output .= $this->applyCurrentStyle($text);
  35059. } elseif ($open) {
  35060. $this->styleStack->push($style);
  35061. } else {
  35062. $this->styleStack->pop($style);
  35063. }
  35064. }
  35065. $output .= $this->applyCurrentStyle(substr($message, $offset));
  35066. if (false !== strpos($output, "\0")) {
  35067. return strtr($output, array("\0" => '\\', '\\<' => '<'));
  35068. }
  35069. return str_replace('\\<', '<', $output);
  35070. }
  35071. public function getStyleStack()
  35072. {
  35073. return $this->styleStack;
  35074. }
  35075. private function createStyleFromString($string)
  35076. {
  35077. if (isset($this->styles[$string])) {
  35078. return $this->styles[$string];
  35079. }
  35080. if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', strtolower($string), $matches, PREG_SET_ORDER)) {
  35081. return false;
  35082. }
  35083. $style = new OutputFormatterStyle();
  35084. foreach ($matches as $match) {
  35085. array_shift($match);
  35086. if ('fg' == $match[0]) {
  35087. $style->setForeground($match[1]);
  35088. } elseif ('bg' == $match[0]) {
  35089. $style->setBackground($match[1]);
  35090. } else {
  35091. try {
  35092. $style->setOption($match[1]);
  35093. } catch (\InvalidArgumentException $e) {
  35094. return false;
  35095. }
  35096. }
  35097. }
  35098. return $style;
  35099. }
  35100. private function applyCurrentStyle($text)
  35101. {
  35102. return $this->isDecorated() && \strlen($text) > 0 ? $this->styleStack->getCurrent()->apply($text) : $text;
  35103. }
  35104. }
  35105. <?php
  35106. namespace Symfony\Component\Console\Formatter;
  35107. interface OutputFormatterInterface
  35108. {
  35109. public function setDecorated($decorated);
  35110. public function isDecorated();
  35111. public function setStyle($name, OutputFormatterStyleInterface $style);
  35112. public function hasStyle($name);
  35113. public function getStyle($name);
  35114. public function format($message);
  35115. }
  35116. <?php
  35117. namespace Symfony\Component\Console\Formatter;
  35118. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35119. class OutputFormatterStyle implements OutputFormatterStyleInterface
  35120. {
  35121. private static $availableForegroundColors = array(
  35122. 'black' => array('set' => 30, 'unset' => 39),
  35123. 'red' => array('set' => 31, 'unset' => 39),
  35124. 'green' => array('set' => 32, 'unset' => 39),
  35125. 'yellow' => array('set' => 33, 'unset' => 39),
  35126. 'blue' => array('set' => 34, 'unset' => 39),
  35127. 'magenta' => array('set' => 35, 'unset' => 39),
  35128. 'cyan' => array('set' => 36, 'unset' => 39),
  35129. 'white' => array('set' => 37, 'unset' => 39),
  35130. 'default' => array('set' => 39, 'unset' => 39),
  35131. );
  35132. private static $availableBackgroundColors = array(
  35133. 'black' => array('set' => 40, 'unset' => 49),
  35134. 'red' => array('set' => 41, 'unset' => 49),
  35135. 'green' => array('set' => 42, 'unset' => 49),
  35136. 'yellow' => array('set' => 43, 'unset' => 49),
  35137. 'blue' => array('set' => 44, 'unset' => 49),
  35138. 'magenta' => array('set' => 45, 'unset' => 49),
  35139. 'cyan' => array('set' => 46, 'unset' => 49),
  35140. 'white' => array('set' => 47, 'unset' => 49),
  35141. 'default' => array('set' => 49, 'unset' => 49),
  35142. );
  35143. private static $availableOptions = array(
  35144. 'bold' => array('set' => 1, 'unset' => 22),
  35145. 'underscore' => array('set' => 4, 'unset' => 24),
  35146. 'blink' => array('set' => 5, 'unset' => 25),
  35147. 'reverse' => array('set' => 7, 'unset' => 27),
  35148. 'conceal' => array('set' => 8, 'unset' => 28),
  35149. );
  35150. private $foreground;
  35151. private $background;
  35152. private $options = array();
  35153. public function __construct($foreground = null, $background = null, array $options = array())
  35154. {
  35155. if (null !== $foreground) {
  35156. $this->setForeground($foreground);
  35157. }
  35158. if (null !== $background) {
  35159. $this->setBackground($background);
  35160. }
  35161. if (\count($options)) {
  35162. $this->setOptions($options);
  35163. }
  35164. }
  35165. public function setForeground($color = null)
  35166. {
  35167. if (null === $color) {
  35168. $this->foreground = null;
  35169. return;
  35170. }
  35171. if (!isset(static::$availableForegroundColors[$color])) {
  35172. throw new InvalidArgumentException(sprintf('Invalid foreground color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableForegroundColors))));
  35173. }
  35174. $this->foreground = static::$availableForegroundColors[$color];
  35175. }
  35176. public function setBackground($color = null)
  35177. {
  35178. if (null === $color) {
  35179. $this->background = null;
  35180. return;
  35181. }
  35182. if (!isset(static::$availableBackgroundColors[$color])) {
  35183. throw new InvalidArgumentException(sprintf('Invalid background color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableBackgroundColors))));
  35184. }
  35185. $this->background = static::$availableBackgroundColors[$color];
  35186. }
  35187. public function setOption($option)
  35188. {
  35189. if (!isset(static::$availableOptions[$option])) {
  35190. throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions))));
  35191. }
  35192. if (!\in_array(static::$availableOptions[$option], $this->options)) {
  35193. $this->options[] = static::$availableOptions[$option];
  35194. }
  35195. }
  35196. public function unsetOption($option)
  35197. {
  35198. if (!isset(static::$availableOptions[$option])) {
  35199. throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions))));
  35200. }
  35201. $pos = array_search(static::$availableOptions[$option], $this->options);
  35202. if (false !== $pos) {
  35203. unset($this->options[$pos]);
  35204. }
  35205. }
  35206. public function setOptions(array $options)
  35207. {
  35208. $this->options = array();
  35209. foreach ($options as $option) {
  35210. $this->setOption($option);
  35211. }
  35212. }
  35213. public function apply($text)
  35214. {
  35215. $setCodes = array();
  35216. $unsetCodes = array();
  35217. if (null !== $this->foreground) {
  35218. $setCodes[] = $this->foreground['set'];
  35219. $unsetCodes[] = $this->foreground['unset'];
  35220. }
  35221. if (null !== $this->background) {
  35222. $setCodes[] = $this->background['set'];
  35223. $unsetCodes[] = $this->background['unset'];
  35224. }
  35225. if (\count($this->options)) {
  35226. foreach ($this->options as $option) {
  35227. $setCodes[] = $option['set'];
  35228. $unsetCodes[] = $option['unset'];
  35229. }
  35230. }
  35231. if (0 === \count($setCodes)) {
  35232. return $text;
  35233. }
  35234. return sprintf("\033[%sm%s\033[%sm", implode(';', $setCodes), $text, implode(';', $unsetCodes));
  35235. }
  35236. }
  35237. <?php
  35238. namespace Symfony\Component\Console\Formatter;
  35239. interface OutputFormatterStyleInterface
  35240. {
  35241. public function setForeground($color = null);
  35242. public function setBackground($color = null);
  35243. public function setOption($option);
  35244. public function unsetOption($option);
  35245. public function setOptions(array $options);
  35246. public function apply($text);
  35247. }
  35248. <?php
  35249. namespace Symfony\Component\Console\Formatter;
  35250. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35251. class OutputFormatterStyleStack
  35252. {
  35253. private $styles;
  35254. private $emptyStyle;
  35255. public function __construct(OutputFormatterStyleInterface $emptyStyle = null)
  35256. {
  35257. $this->emptyStyle = $emptyStyle ?: new OutputFormatterStyle();
  35258. $this->reset();
  35259. }
  35260. public function reset()
  35261. {
  35262. $this->styles = array();
  35263. }
  35264. public function push(OutputFormatterStyleInterface $style)
  35265. {
  35266. $this->styles[] = $style;
  35267. }
  35268. public function pop(OutputFormatterStyleInterface $style = null)
  35269. {
  35270. if (empty($this->styles)) {
  35271. return $this->emptyStyle;
  35272. }
  35273. if (null === $style) {
  35274. return array_pop($this->styles);
  35275. }
  35276. foreach (array_reverse($this->styles, true) as $index => $stackedStyle) {
  35277. if ($style->apply('') === $stackedStyle->apply('')) {
  35278. $this->styles = \array_slice($this->styles, 0, $index);
  35279. return $stackedStyle;
  35280. }
  35281. }
  35282. throw new InvalidArgumentException('Incorrectly nested style tag found.');
  35283. }
  35284. public function getCurrent()
  35285. {
  35286. if (empty($this->styles)) {
  35287. return $this->emptyStyle;
  35288. }
  35289. return $this->styles[\count($this->styles) - 1];
  35290. }
  35291. public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle)
  35292. {
  35293. $this->emptyStyle = $emptyStyle;
  35294. return $this;
  35295. }
  35296. public function getEmptyStyle()
  35297. {
  35298. return $this->emptyStyle;
  35299. }
  35300. }
  35301. <?php
  35302. namespace Symfony\Component\Console\Helper;
  35303. class DebugFormatterHelper extends Helper
  35304. {
  35305. private $colors = array('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default');
  35306. private $started = array();
  35307. private $count = -1;
  35308. public function start($id, $message, $prefix = 'RUN')
  35309. {
  35310. $this->started[$id] = array('border' => ++$this->count % \count($this->colors));
  35311. return sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message);
  35312. }
  35313. public function progress($id, $buffer, $error = false, $prefix = 'OUT', $errorPrefix = 'ERR')
  35314. {
  35315. $message = '';
  35316. if ($error) {
  35317. if (isset($this->started[$id]['out'])) {
  35318. $message .= "\n";
  35319. unset($this->started[$id]['out']);
  35320. }
  35321. if (!isset($this->started[$id]['err'])) {
  35322. $message .= sprintf('%s<bg=red;fg=white> %s </> ', $this->getBorder($id), $errorPrefix);
  35323. $this->started[$id]['err'] = true;
  35324. }
  35325. $message .= str_replace("\n", sprintf("\n%s<bg=red;fg=white> %s </> ", $this->getBorder($id), $errorPrefix), $buffer);
  35326. } else {
  35327. if (isset($this->started[$id]['err'])) {
  35328. $message .= "\n";
  35329. unset($this->started[$id]['err']);
  35330. }
  35331. if (!isset($this->started[$id]['out'])) {
  35332. $message .= sprintf('%s<bg=green;fg=white> %s </> ', $this->getBorder($id), $prefix);
  35333. $this->started[$id]['out'] = true;
  35334. }
  35335. $message .= str_replace("\n", sprintf("\n%s<bg=green;fg=white> %s </> ", $this->getBorder($id), $prefix), $buffer);
  35336. }
  35337. return $message;
  35338. }
  35339. public function stop($id, $message, $successful, $prefix = 'RES')
  35340. {
  35341. $trailingEOL = isset($this->started[$id]['out']) || isset($this->started[$id]['err']) ? "\n" : '';
  35342. if ($successful) {
  35343. return sprintf("%s%s<bg=green;fg=white> %s </> <fg=green>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  35344. }
  35345. $message = sprintf("%s%s<bg=red;fg=white> %s </> <fg=red>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  35346. unset($this->started[$id]['out'], $this->started[$id]['err']);
  35347. return $message;
  35348. }
  35349. private function getBorder($id)
  35350. {
  35351. return sprintf('<bg=%s> </>', $this->colors[$this->started[$id]['border']]);
  35352. }
  35353. public function getName()
  35354. {
  35355. return 'debug_formatter';
  35356. }
  35357. }
  35358. <?php
  35359. namespace Symfony\Component\Console\Helper;
  35360. use Symfony\Component\Console\Descriptor\DescriptorInterface;
  35361. use Symfony\Component\Console\Descriptor\JsonDescriptor;
  35362. use Symfony\Component\Console\Descriptor\MarkdownDescriptor;
  35363. use Symfony\Component\Console\Descriptor\TextDescriptor;
  35364. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  35365. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35366. use Symfony\Component\Console\Output\OutputInterface;
  35367. class DescriptorHelper extends Helper
  35368. {
  35369. private $descriptors = array();
  35370. public function __construct()
  35371. {
  35372. $this
  35373. ->register('txt', new TextDescriptor())
  35374. ->register('xml', new XmlDescriptor())
  35375. ->register('json', new JsonDescriptor())
  35376. ->register('md', new MarkdownDescriptor())
  35377. ;
  35378. }
  35379. public function describe(OutputInterface $output, $object, array $options = array())
  35380. {
  35381. $options = array_merge(array(
  35382. 'raw_text' => false,
  35383. 'format' => 'txt',
  35384. ), $options);
  35385. if (!isset($this->descriptors[$options['format']])) {
  35386. throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $options['format']));
  35387. }
  35388. $descriptor = $this->descriptors[$options['format']];
  35389. $descriptor->describe($output, $object, $options);
  35390. }
  35391. public function register($format, DescriptorInterface $descriptor)
  35392. {
  35393. $this->descriptors[$format] = $descriptor;
  35394. return $this;
  35395. }
  35396. public function getName()
  35397. {
  35398. return 'descriptor';
  35399. }
  35400. }
  35401. <?php
  35402. namespace Symfony\Component\Console\Helper;
  35403. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35404. use Symfony\Component\Console\Exception\RuntimeException;
  35405. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  35406. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  35407. use Symfony\Component\Console\Output\OutputInterface;
  35408. class DialogHelper extends InputAwareHelper
  35409. {
  35410. private $inputStream;
  35411. private static $shell;
  35412. private static $stty;
  35413. public function __construct($triggerDeprecationError = true)
  35414. {
  35415. if ($triggerDeprecationError) {
  35416. @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);
  35417. }
  35418. }
  35419. public function select(OutputInterface $output, $question, $choices, $default = null, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  35420. {
  35421. if ($output instanceof ConsoleOutputInterface) {
  35422. $output = $output->getErrorOutput();
  35423. }
  35424. $width = max(array_map('strlen', array_keys($choices)));
  35425. $messages = (array) $question;
  35426. foreach ($choices as $key => $value) {
  35427. $messages[] = sprintf(" [<info>%-{$width}s</info>] %s", $key, $value);
  35428. }
  35429. $output->writeln($messages);
  35430. $result = $this->askAndValidate($output, '> ', function ($picked) use ($choices, $errorMessage, $multiselect) {
  35431. $selectedChoices = str_replace(' ', '', $picked);
  35432. if ($multiselect) {
  35433. if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
  35434. throw new InvalidArgumentException(sprintf($errorMessage, $picked));
  35435. }
  35436. $selectedChoices = explode(',', $selectedChoices);
  35437. } else {
  35438. $selectedChoices = array($picked);
  35439. }
  35440. $multiselectChoices = array();
  35441. foreach ($selectedChoices as $value) {
  35442. if (empty($choices[$value])) {
  35443. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  35444. }
  35445. $multiselectChoices[] = $value;
  35446. }
  35447. if ($multiselect) {
  35448. return $multiselectChoices;
  35449. }
  35450. return $picked;
  35451. }, $attempts, $default);
  35452. return $result;
  35453. }
  35454. public function ask(OutputInterface $output, $question, $default = null, array $autocomplete = null)
  35455. {
  35456. if ($this->input && !$this->input->isInteractive()) {
  35457. return $default;
  35458. }
  35459. if ($output instanceof ConsoleOutputInterface) {
  35460. $output = $output->getErrorOutput();
  35461. }
  35462. $output->write($question);
  35463. $inputStream = $this->inputStream ?: STDIN;
  35464. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  35465. $ret = fgets($inputStream, 4096);
  35466. if (false === $ret) {
  35467. throw new RuntimeException('Aborted');
  35468. }
  35469. $ret = trim($ret);
  35470. } else {
  35471. $ret = '';
  35472. $i = 0;
  35473. $ofs = -1;
  35474. $matches = $autocomplete;
  35475. $numMatches = \count($matches);
  35476. $sttyMode = shell_exec('stty -g');
  35477. shell_exec('stty -icanon -echo');
  35478. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  35479. while (!feof($inputStream)) {
  35480. $c = fread($inputStream, 1);
  35481. if ("\177" === $c) {
  35482. if (0 === $numMatches && 0 !== $i) {
  35483. --$i;
  35484. $output->write("\033[1D");
  35485. }
  35486. if (0 === $i) {
  35487. $ofs = -1;
  35488. $matches = $autocomplete;
  35489. $numMatches = \count($matches);
  35490. } else {
  35491. $numMatches = 0;
  35492. }
  35493. $ret = substr($ret, 0, $i);
  35494. } elseif ("\033" === $c) {
  35495. $c .= fread($inputStream, 2);
  35496. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  35497. if ('A' === $c[2] && -1 === $ofs) {
  35498. $ofs = 0;
  35499. }
  35500. if (0 === $numMatches) {
  35501. continue;
  35502. }
  35503. $ofs += ('A' === $c[2]) ? -1 : 1;
  35504. $ofs = ($numMatches + $ofs) % $numMatches;
  35505. }
  35506. } elseif (\ord($c) < 32) {
  35507. if ("\t" === $c || "\n" === $c) {
  35508. if ($numMatches > 0 && -1 !== $ofs) {
  35509. $ret = $matches[$ofs];
  35510. $output->write(substr($ret, $i));
  35511. $i = \strlen($ret);
  35512. }
  35513. if ("\n" === $c) {
  35514. $output->write($c);
  35515. break;
  35516. }
  35517. $numMatches = 0;
  35518. }
  35519. continue;
  35520. } else {
  35521. $output->write($c);
  35522. $ret .= $c;
  35523. ++$i;
  35524. $numMatches = 0;
  35525. $ofs = 0;
  35526. foreach ($autocomplete as $value) {
  35527. if (0 === strpos($value, $ret) && $i !== \strlen($value)) {
  35528. $matches[$numMatches++] = $value;
  35529. }
  35530. }
  35531. }
  35532. $output->write("\033[K");
  35533. if ($numMatches > 0 && -1 !== $ofs) {
  35534. $output->write("\0337");
  35535. $output->write('<hl>'.substr($matches[$ofs], $i).'</hl>');
  35536. $output->write("\0338");
  35537. }
  35538. }
  35539. shell_exec(sprintf('stty %s', $sttyMode));
  35540. }
  35541. return \strlen($ret) > 0 ? $ret : $default;
  35542. }
  35543. public function askConfirmation(OutputInterface $output, $question, $default = true)
  35544. {
  35545. $answer = 'z';
  35546. while ($answer && !\in_array(strtolower($answer[0]), array('y', 'n'))) {
  35547. $answer = $this->ask($output, $question);
  35548. }
  35549. if (false === $default) {
  35550. return $answer && 'y' == strtolower($answer[0]);
  35551. }
  35552. return !$answer || 'y' == strtolower($answer[0]);
  35553. }
  35554. public function askHiddenResponse(OutputInterface $output, $question, $fallback = true)
  35555. {
  35556. if ($output instanceof ConsoleOutputInterface) {
  35557. $output = $output->getErrorOutput();
  35558. }
  35559. if ('\\' === \DIRECTORY_SEPARATOR) {
  35560. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  35561. if ('phar:' === substr(__FILE__, 0, 5)) {
  35562. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  35563. copy($exe, $tmpExe);
  35564. $exe = $tmpExe;
  35565. }
  35566. $output->write($question);
  35567. $value = rtrim(shell_exec($exe));
  35568. $output->writeln('');
  35569. if (isset($tmpExe)) {
  35570. unlink($tmpExe);
  35571. }
  35572. return $value;
  35573. }
  35574. if ($this->hasSttyAvailable()) {
  35575. $output->write($question);
  35576. $sttyMode = shell_exec('stty -g');
  35577. shell_exec('stty -echo');
  35578. $value = fgets($this->inputStream ?: STDIN, 4096);
  35579. shell_exec(sprintf('stty %s', $sttyMode));
  35580. if (false === $value) {
  35581. throw new RuntimeException('Aborted');
  35582. }
  35583. $value = trim($value);
  35584. $output->writeln('');
  35585. return $value;
  35586. }
  35587. if (false !== $shell = $this->getShell()) {
  35588. $output->write($question);
  35589. $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
  35590. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  35591. $value = rtrim(shell_exec($command));
  35592. $output->writeln('');
  35593. return $value;
  35594. }
  35595. if ($fallback) {
  35596. return $this->ask($output, $question);
  35597. }
  35598. throw new RuntimeException('Unable to hide the response');
  35599. }
  35600. public function askAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $default = null, array $autocomplete = null)
  35601. {
  35602. $that = $this;
  35603. $interviewer = function () use ($output, $question, $default, $autocomplete, $that) {
  35604. return $that->ask($output, $question, $default, $autocomplete);
  35605. };
  35606. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  35607. }
  35608. public function askHiddenResponseAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $fallback = true)
  35609. {
  35610. $that = $this;
  35611. $interviewer = function () use ($output, $question, $fallback, $that) {
  35612. return $that->askHiddenResponse($output, $question, $fallback);
  35613. };
  35614. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  35615. }
  35616. public function setInputStream($stream)
  35617. {
  35618. $this->inputStream = $stream;
  35619. }
  35620. public function getInputStream()
  35621. {
  35622. return $this->inputStream;
  35623. }
  35624. public function getName()
  35625. {
  35626. return 'dialog';
  35627. }
  35628. private function getShell()
  35629. {
  35630. if (null !== self::$shell) {
  35631. return self::$shell;
  35632. }
  35633. self::$shell = false;
  35634. if (file_exists('/usr/bin/env')) {
  35635. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  35636. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  35637. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  35638. self::$shell = $sh;
  35639. break;
  35640. }
  35641. }
  35642. }
  35643. return self::$shell;
  35644. }
  35645. private function hasSttyAvailable()
  35646. {
  35647. if (null !== self::$stty) {
  35648. return self::$stty;
  35649. }
  35650. exec('stty 2>&1', $output, $exitcode);
  35651. return self::$stty = 0 === $exitcode;
  35652. }
  35653. private function validateAttempts($interviewer, OutputInterface $output, $validator, $attempts)
  35654. {
  35655. if ($output instanceof ConsoleOutputInterface) {
  35656. $output = $output->getErrorOutput();
  35657. }
  35658. $e = null;
  35659. while (false === $attempts || $attempts--) {
  35660. if (null !== $e) {
  35661. $output->writeln($this->getHelperSet()->get('formatter')->formatBlock($e->getMessage(), 'error'));
  35662. }
  35663. try {
  35664. return \call_user_func($validator, $interviewer());
  35665. } catch (\Exception $e) {
  35666. }
  35667. }
  35668. throw $e;
  35669. }
  35670. }
  35671. <?php
  35672. namespace Symfony\Component\Console\Helper;
  35673. use Symfony\Component\Console\Formatter\OutputFormatter;
  35674. class FormatterHelper extends Helper
  35675. {
  35676. public function formatSection($section, $message, $style = 'info')
  35677. {
  35678. return sprintf('<%s>[%s]</%s> %s', $style, $section, $style, $message);
  35679. }
  35680. public function formatBlock($messages, $style, $large = false)
  35681. {
  35682. if (!\is_array($messages)) {
  35683. $messages = array($messages);
  35684. }
  35685. $len = 0;
  35686. $lines = array();
  35687. foreach ($messages as $message) {
  35688. $message = OutputFormatter::escape($message);
  35689. $lines[] = sprintf($large ? ' %s ' : ' %s ', $message);
  35690. $len = max($this->strlen($message) + ($large ? 4 : 2), $len);
  35691. }
  35692. $messages = $large ? array(str_repeat(' ', $len)) : array();
  35693. for ($i = 0; isset($lines[$i]); ++$i) {
  35694. $messages[] = $lines[$i].str_repeat(' ', $len - $this->strlen($lines[$i]));
  35695. }
  35696. if ($large) {
  35697. $messages[] = str_repeat(' ', $len);
  35698. }
  35699. for ($i = 0; isset($messages[$i]); ++$i) {
  35700. $messages[$i] = sprintf('<%s>%s</%s>', $style, $messages[$i], $style);
  35701. }
  35702. return implode("\n", $messages);
  35703. }
  35704. public function getName()
  35705. {
  35706. return 'formatter';
  35707. }
  35708. }
  35709. <?php
  35710. namespace Symfony\Component\Console\Helper;
  35711. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  35712. abstract class Helper implements HelperInterface
  35713. {
  35714. protected $helperSet = null;
  35715. public function setHelperSet(HelperSet $helperSet = null)
  35716. {
  35717. $this->helperSet = $helperSet;
  35718. }
  35719. public function getHelperSet()
  35720. {
  35721. return $this->helperSet;
  35722. }
  35723. public static function strlen($string)
  35724. {
  35725. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  35726. return \strlen($string);
  35727. }
  35728. return mb_strwidth($string, $encoding);
  35729. }
  35730. public static function formatTime($secs)
  35731. {
  35732. static $timeFormats = array(
  35733. array(0, '< 1 sec'),
  35734. array(1, '1 sec'),
  35735. array(2, 'secs', 1),
  35736. array(60, '1 min'),
  35737. array(120, 'mins', 60),
  35738. array(3600, '1 hr'),
  35739. array(7200, 'hrs', 3600),
  35740. array(86400, '1 day'),
  35741. array(172800, 'days', 86400),
  35742. );
  35743. foreach ($timeFormats as $index => $format) {
  35744. if ($secs >= $format[0]) {
  35745. if ((isset($timeFormats[$index + 1]) && $secs < $timeFormats[$index + 1][0])
  35746. || $index == \count($timeFormats) - 1
  35747. ) {
  35748. if (2 == \count($format)) {
  35749. return $format[1];
  35750. }
  35751. return floor($secs / $format[2]).' '.$format[1];
  35752. }
  35753. }
  35754. }
  35755. }
  35756. public static function formatMemory($memory)
  35757. {
  35758. if ($memory >= 1024 * 1024 * 1024) {
  35759. return sprintf('%.1f GiB', $memory / 1024 / 1024 / 1024);
  35760. }
  35761. if ($memory >= 1024 * 1024) {
  35762. return sprintf('%.1f MiB', $memory / 1024 / 1024);
  35763. }
  35764. if ($memory >= 1024) {
  35765. return sprintf('%d KiB', $memory / 1024);
  35766. }
  35767. return sprintf('%d B', $memory);
  35768. }
  35769. public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)
  35770. {
  35771. return self::strlen(self::removeDecoration($formatter, $string));
  35772. }
  35773. public static function removeDecoration(OutputFormatterInterface $formatter, $string)
  35774. {
  35775. $isDecorated = $formatter->isDecorated();
  35776. $formatter->setDecorated(false);
  35777. $string = $formatter->format($string);
  35778. $string = preg_replace("/\033\[[^m]*m/", '', $string);
  35779. $formatter->setDecorated($isDecorated);
  35780. return $string;
  35781. }
  35782. }
  35783. <?php
  35784. namespace Symfony\Component\Console\Helper;
  35785. interface HelperInterface
  35786. {
  35787. public function setHelperSet(HelperSet $helperSet = null);
  35788. public function getHelperSet();
  35789. public function getName();
  35790. }
  35791. <?php
  35792. namespace Symfony\Component\Console\Helper;
  35793. use Symfony\Component\Console\Command\Command;
  35794. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35795. class HelperSet implements \IteratorAggregate
  35796. {
  35797. private $helpers = array();
  35798. private $command;
  35799. public function __construct(array $helpers = array())
  35800. {
  35801. foreach ($helpers as $alias => $helper) {
  35802. $this->set($helper, \is_int($alias) ? null : $alias);
  35803. }
  35804. }
  35805. public function set(HelperInterface $helper, $alias = null)
  35806. {
  35807. $this->helpers[$helper->getName()] = $helper;
  35808. if (null !== $alias) {
  35809. $this->helpers[$alias] = $helper;
  35810. }
  35811. $helper->setHelperSet($this);
  35812. }
  35813. public function has($name)
  35814. {
  35815. return isset($this->helpers[$name]);
  35816. }
  35817. public function get($name)
  35818. {
  35819. if (!$this->has($name)) {
  35820. throw new InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name));
  35821. }
  35822. if ('dialog' === $name && $this->helpers[$name] instanceof DialogHelper) {
  35823. @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);
  35824. } elseif ('progress' === $name && $this->helpers[$name] instanceof ProgressHelper) {
  35825. @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);
  35826. } elseif ('table' === $name && $this->helpers[$name] instanceof TableHelper) {
  35827. @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);
  35828. }
  35829. return $this->helpers[$name];
  35830. }
  35831. public function setCommand(Command $command = null)
  35832. {
  35833. $this->command = $command;
  35834. }
  35835. public function getCommand()
  35836. {
  35837. return $this->command;
  35838. }
  35839. public function getIterator()
  35840. {
  35841. return new \ArrayIterator($this->helpers);
  35842. }
  35843. }
  35844. <?php
  35845. namespace Symfony\Component\Console\Helper;
  35846. use Symfony\Component\Console\Input\InputAwareInterface;
  35847. use Symfony\Component\Console\Input\InputInterface;
  35848. abstract class InputAwareHelper extends Helper implements InputAwareInterface
  35849. {
  35850. protected $input;
  35851. public function setInput(InputInterface $input)
  35852. {
  35853. $this->input = $input;
  35854. }
  35855. }
  35856. <?php
  35857. namespace Symfony\Component\Console\Helper;
  35858. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  35859. use Symfony\Component\Console\Output\OutputInterface;
  35860. use Symfony\Component\Process\Exception\ProcessFailedException;
  35861. use Symfony\Component\Process\Process;
  35862. use Symfony\Component\Process\ProcessBuilder;
  35863. class ProcessHelper extends Helper
  35864. {
  35865. public function run(OutputInterface $output, $cmd, $error = null, $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)
  35866. {
  35867. if ($output instanceof ConsoleOutputInterface) {
  35868. $output = $output->getErrorOutput();
  35869. }
  35870. $formatter = $this->getHelperSet()->get('debug_formatter');
  35871. if (\is_array($cmd)) {
  35872. $process = ProcessBuilder::create($cmd)->getProcess();
  35873. } elseif ($cmd instanceof Process) {
  35874. $process = $cmd;
  35875. } else {
  35876. $process = new Process($cmd);
  35877. }
  35878. if ($verbosity <= $output->getVerbosity()) {
  35879. $output->write($formatter->start(spl_object_hash($process), $this->escapeString($process->getCommandLine())));
  35880. }
  35881. if ($output->isDebug()) {
  35882. $callback = $this->wrapCallback($output, $process, $callback);
  35883. }
  35884. $process->run($callback);
  35885. if ($verbosity <= $output->getVerbosity()) {
  35886. $message = $process->isSuccessful() ? 'Command ran successfully' : sprintf('%s Command did not run successfully', $process->getExitCode());
  35887. $output->write($formatter->stop(spl_object_hash($process), $message, $process->isSuccessful()));
  35888. }
  35889. if (!$process->isSuccessful() && null !== $error) {
  35890. $output->writeln(sprintf('<error>%s</error>', $this->escapeString($error)));
  35891. }
  35892. return $process;
  35893. }
  35894. public function mustRun(OutputInterface $output, $cmd, $error = null, $callback = null)
  35895. {
  35896. $process = $this->run($output, $cmd, $error, $callback);
  35897. if (!$process->isSuccessful()) {
  35898. throw new ProcessFailedException($process);
  35899. }
  35900. return $process;
  35901. }
  35902. public function wrapCallback(OutputInterface $output, Process $process, $callback = null)
  35903. {
  35904. if ($output instanceof ConsoleOutputInterface) {
  35905. $output = $output->getErrorOutput();
  35906. }
  35907. $formatter = $this->getHelperSet()->get('debug_formatter');
  35908. $that = $this;
  35909. return function ($type, $buffer) use ($output, $process, $callback, $formatter, $that) {
  35910. $output->write($formatter->progress(spl_object_hash($process), $that->escapeString($buffer), Process::ERR === $type));
  35911. if (null !== $callback) {
  35912. \call_user_func($callback, $type, $buffer);
  35913. }
  35914. };
  35915. }
  35916. public function escapeString($str)
  35917. {
  35918. return str_replace('<', '\\<', $str);
  35919. }
  35920. public function getName()
  35921. {
  35922. return 'process';
  35923. }
  35924. }
  35925. <?php
  35926. namespace Symfony\Component\Console\Helper;
  35927. use Symfony\Component\Console\Exception\LogicException;
  35928. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  35929. use Symfony\Component\Console\Output\OutputInterface;
  35930. class ProgressBar
  35931. {
  35932. private $barWidth = 28;
  35933. private $barChar;
  35934. private $emptyBarChar = '-';
  35935. private $progressChar = '>';
  35936. private $format;
  35937. private $internalFormat;
  35938. private $redrawFreq = 1;
  35939. private $output;
  35940. private $step = 0;
  35941. private $max;
  35942. private $startTime;
  35943. private $stepWidth;
  35944. private $percent = 0.0;
  35945. private $formatLineCount;
  35946. private $messages = array();
  35947. private $overwrite = true;
  35948. private $firstRun = true;
  35949. private static $formatters;
  35950. private static $formats;
  35951. public function __construct(OutputInterface $output, $max = 0)
  35952. {
  35953. if ($output instanceof ConsoleOutputInterface) {
  35954. $output = $output->getErrorOutput();
  35955. }
  35956. $this->output = $output;
  35957. $this->setMaxSteps($max);
  35958. if (!$this->output->isDecorated()) {
  35959. $this->overwrite = false;
  35960. $this->setRedrawFrequency($max / 10);
  35961. }
  35962. $this->startTime = time();
  35963. }
  35964. public static function setPlaceholderFormatterDefinition($name, $callable)
  35965. {
  35966. if (!self::$formatters) {
  35967. self::$formatters = self::initPlaceholderFormatters();
  35968. }
  35969. self::$formatters[$name] = $callable;
  35970. }
  35971. public static function getPlaceholderFormatterDefinition($name)
  35972. {
  35973. if (!self::$formatters) {
  35974. self::$formatters = self::initPlaceholderFormatters();
  35975. }
  35976. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  35977. }
  35978. public static function setFormatDefinition($name, $format)
  35979. {
  35980. if (!self::$formats) {
  35981. self::$formats = self::initFormats();
  35982. }
  35983. self::$formats[$name] = $format;
  35984. }
  35985. public static function getFormatDefinition($name)
  35986. {
  35987. if (!self::$formats) {
  35988. self::$formats = self::initFormats();
  35989. }
  35990. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  35991. }
  35992. public function setMessage($message, $name = 'message')
  35993. {
  35994. $this->messages[$name] = $message;
  35995. }
  35996. public function getMessage($name = 'message')
  35997. {
  35998. return $this->messages[$name];
  35999. }
  36000. public function getStartTime()
  36001. {
  36002. return $this->startTime;
  36003. }
  36004. public function getMaxSteps()
  36005. {
  36006. return $this->max;
  36007. }
  36008. public function getStep()
  36009. {
  36010. @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);
  36011. return $this->getProgress();
  36012. }
  36013. public function getProgress()
  36014. {
  36015. return $this->step;
  36016. }
  36017. public function getStepWidth()
  36018. {
  36019. return $this->stepWidth;
  36020. }
  36021. public function getProgressPercent()
  36022. {
  36023. return $this->percent;
  36024. }
  36025. public function setBarWidth($size)
  36026. {
  36027. $this->barWidth = (int) $size;
  36028. }
  36029. public function getBarWidth()
  36030. {
  36031. return $this->barWidth;
  36032. }
  36033. public function setBarCharacter($char)
  36034. {
  36035. $this->barChar = $char;
  36036. }
  36037. public function getBarCharacter()
  36038. {
  36039. if (null === $this->barChar) {
  36040. return $this->max ? '=' : $this->emptyBarChar;
  36041. }
  36042. return $this->barChar;
  36043. }
  36044. public function setEmptyBarCharacter($char)
  36045. {
  36046. $this->emptyBarChar = $char;
  36047. }
  36048. public function getEmptyBarCharacter()
  36049. {
  36050. return $this->emptyBarChar;
  36051. }
  36052. public function setProgressCharacter($char)
  36053. {
  36054. $this->progressChar = $char;
  36055. }
  36056. public function getProgressCharacter()
  36057. {
  36058. return $this->progressChar;
  36059. }
  36060. public function setFormat($format)
  36061. {
  36062. $this->format = null;
  36063. $this->internalFormat = $format;
  36064. }
  36065. public function setRedrawFrequency($freq)
  36066. {
  36067. $this->redrawFreq = max((int) $freq, 1);
  36068. }
  36069. public function start($max = null)
  36070. {
  36071. $this->startTime = time();
  36072. $this->step = 0;
  36073. $this->percent = 0.0;
  36074. if (null !== $max) {
  36075. $this->setMaxSteps($max);
  36076. }
  36077. $this->display();
  36078. }
  36079. public function advance($step = 1)
  36080. {
  36081. $this->setProgress($this->step + $step);
  36082. }
  36083. public function setCurrent($step)
  36084. {
  36085. @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);
  36086. $this->setProgress($step);
  36087. }
  36088. public function setOverwrite($overwrite)
  36089. {
  36090. $this->overwrite = (bool) $overwrite;
  36091. }
  36092. public function setProgress($step)
  36093. {
  36094. $step = (int) $step;
  36095. if ($step < $this->step) {
  36096. throw new LogicException('You can\'t regress the progress bar.');
  36097. }
  36098. if ($this->max && $step > $this->max) {
  36099. $this->max = $step;
  36100. }
  36101. $prevPeriod = (int) ($this->step / $this->redrawFreq);
  36102. $currPeriod = (int) ($step / $this->redrawFreq);
  36103. $this->step = $step;
  36104. $this->percent = $this->max ? (float) $this->step / $this->max : 0;
  36105. if ($prevPeriod !== $currPeriod || $this->max === $step) {
  36106. $this->display();
  36107. }
  36108. }
  36109. public function finish()
  36110. {
  36111. if (!$this->max) {
  36112. $this->max = $this->step;
  36113. }
  36114. if ($this->step === $this->max && !$this->overwrite) {
  36115. return;
  36116. }
  36117. $this->setProgress($this->max);
  36118. }
  36119. public function display()
  36120. {
  36121. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  36122. return;
  36123. }
  36124. if (null === $this->format) {
  36125. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  36126. }
  36127. $self = $this;
  36128. $output = $this->output;
  36129. $messages = $this->messages;
  36130. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self, $output, $messages) {
  36131. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  36132. $text = \call_user_func($formatter, $self, $output);
  36133. } elseif (isset($messages[$matches[1]])) {
  36134. $text = $messages[$matches[1]];
  36135. } else {
  36136. return $matches[0];
  36137. }
  36138. if (isset($matches[2])) {
  36139. $text = sprintf('%'.$matches[2], $text);
  36140. }
  36141. return $text;
  36142. }, $this->format));
  36143. }
  36144. public function clear()
  36145. {
  36146. if (!$this->overwrite) {
  36147. return;
  36148. }
  36149. if (null === $this->format) {
  36150. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  36151. }
  36152. $this->overwrite('');
  36153. }
  36154. private function setRealFormat($format)
  36155. {
  36156. if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) {
  36157. $this->format = self::getFormatDefinition($format.'_nomax');
  36158. } elseif (null !== self::getFormatDefinition($format)) {
  36159. $this->format = self::getFormatDefinition($format);
  36160. } else {
  36161. $this->format = $format;
  36162. }
  36163. $this->formatLineCount = substr_count($this->format, "\n");
  36164. }
  36165. private function setMaxSteps($max)
  36166. {
  36167. $this->max = max(0, (int) $max);
  36168. $this->stepWidth = $this->max ? Helper::strlen($this->max) : 4;
  36169. }
  36170. private function overwrite($message)
  36171. {
  36172. if ($this->overwrite) {
  36173. if (!$this->firstRun) {
  36174. $this->output->write("\x0D");
  36175. $this->output->write("\x1B[2K");
  36176. if ($this->formatLineCount > 0) {
  36177. $this->output->write(str_repeat("\x1B[1A\x1B[2K", $this->formatLineCount));
  36178. }
  36179. }
  36180. } elseif ($this->step > 0) {
  36181. $this->output->writeln('');
  36182. }
  36183. $this->firstRun = false;
  36184. $this->output->write($message);
  36185. }
  36186. private function determineBestFormat()
  36187. {
  36188. switch ($this->output->getVerbosity()) {
  36189. case OutputInterface::VERBOSITY_VERBOSE:
  36190. return $this->max ? 'verbose' : 'verbose_nomax';
  36191. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  36192. return $this->max ? 'very_verbose' : 'very_verbose_nomax';
  36193. case OutputInterface::VERBOSITY_DEBUG:
  36194. return $this->max ? 'debug' : 'debug_nomax';
  36195. default:
  36196. return $this->max ? 'normal' : 'normal_nomax';
  36197. }
  36198. }
  36199. private static function initPlaceholderFormatters()
  36200. {
  36201. return array(
  36202. 'bar' => function (ProgressBar $bar, OutputInterface $output) {
  36203. $completeBars = floor($bar->getMaxSteps() > 0 ? $bar->getProgressPercent() * $bar->getBarWidth() : $bar->getProgress() % $bar->getBarWidth());
  36204. $display = str_repeat($bar->getBarCharacter(), $completeBars);
  36205. if ($completeBars < $bar->getBarWidth()) {
  36206. $emptyBars = $bar->getBarWidth() - $completeBars - Helper::strlenWithoutDecoration($output->getFormatter(), $bar->getProgressCharacter());
  36207. $display .= $bar->getProgressCharacter().str_repeat($bar->getEmptyBarCharacter(), $emptyBars);
  36208. }
  36209. return $display;
  36210. },
  36211. 'elapsed' => function (ProgressBar $bar) {
  36212. return Helper::formatTime(time() - $bar->getStartTime());
  36213. },
  36214. 'remaining' => function (ProgressBar $bar) {
  36215. if (!$bar->getMaxSteps()) {
  36216. throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.');
  36217. }
  36218. if (!$bar->getProgress()) {
  36219. $remaining = 0;
  36220. } else {
  36221. $remaining = round((time() - $bar->getStartTime()) / $bar->getProgress() * ($bar->getMaxSteps() - $bar->getProgress()));
  36222. }
  36223. return Helper::formatTime($remaining);
  36224. },
  36225. 'estimated' => function (ProgressBar $bar) {
  36226. if (!$bar->getMaxSteps()) {
  36227. throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.');
  36228. }
  36229. if (!$bar->getProgress()) {
  36230. $estimated = 0;
  36231. } else {
  36232. $estimated = round((time() - $bar->getStartTime()) / $bar->getProgress() * $bar->getMaxSteps());
  36233. }
  36234. return Helper::formatTime($estimated);
  36235. },
  36236. 'memory' => function (ProgressBar $bar) {
  36237. return Helper::formatMemory(memory_get_usage(true));
  36238. },
  36239. 'current' => function (ProgressBar $bar) {
  36240. return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', STR_PAD_LEFT);
  36241. },
  36242. 'max' => function (ProgressBar $bar) {
  36243. return $bar->getMaxSteps();
  36244. },
  36245. 'percent' => function (ProgressBar $bar) {
  36246. return floor($bar->getProgressPercent() * 100);
  36247. },
  36248. );
  36249. }
  36250. private static function initFormats()
  36251. {
  36252. return array(
  36253. 'normal' => ' %current%/%max% [%bar%] %percent:3s%%',
  36254. 'normal_nomax' => ' %current% [%bar%]',
  36255. 'verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%',
  36256. 'verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  36257. 'very_verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%',
  36258. 'very_verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  36259. 'debug' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%',
  36260. 'debug_nomax' => ' %current% [%bar%] %elapsed:6s% %memory:6s%',
  36261. );
  36262. }
  36263. }
  36264. <?php
  36265. namespace Symfony\Component\Console\Helper;
  36266. use Symfony\Component\Console\Exception\LogicException;
  36267. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  36268. use Symfony\Component\Console\Output\NullOutput;
  36269. use Symfony\Component\Console\Output\OutputInterface;
  36270. class ProgressHelper extends Helper
  36271. {
  36272. const FORMAT_QUIET = ' %percent%%';
  36273. const FORMAT_NORMAL = ' %current%/%max% [%bar%] %percent%%';
  36274. const FORMAT_VERBOSE = ' %current%/%max% [%bar%] %percent%% Elapsed: %elapsed%';
  36275. const FORMAT_QUIET_NOMAX = ' %current%';
  36276. const FORMAT_NORMAL_NOMAX = ' %current% [%bar%]';
  36277. const FORMAT_VERBOSE_NOMAX = ' %current% [%bar%] Elapsed: %elapsed%';
  36278. private $barWidth = 28;
  36279. private $barChar = '=';
  36280. private $emptyBarChar = '-';
  36281. private $progressChar = '>';
  36282. private $format = null;
  36283. private $redrawFreq = 1;
  36284. private $lastMessagesLength;
  36285. private $barCharOriginal;
  36286. private $output;
  36287. private $current;
  36288. private $max;
  36289. private $startTime;
  36290. private $defaultFormatVars = array(
  36291. 'current',
  36292. 'max',
  36293. 'bar',
  36294. 'percent',
  36295. 'elapsed',
  36296. );
  36297. private $formatVars;
  36298. private $widths = array(
  36299. 'current' => 4,
  36300. 'max' => 4,
  36301. 'percent' => 3,
  36302. 'elapsed' => 6,
  36303. );
  36304. private $timeFormats = array(
  36305. array(0, '???'),
  36306. array(2, '1 sec'),
  36307. array(59, 'secs', 1),
  36308. array(60, '1 min'),
  36309. array(3600, 'mins', 60),
  36310. array(5400, '1 hr'),
  36311. array(86400, 'hrs', 3600),
  36312. array(129600, '1 day'),
  36313. array(604800, 'days', 86400),
  36314. );
  36315. public function __construct($triggerDeprecationError = true)
  36316. {
  36317. if ($triggerDeprecationError) {
  36318. @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);
  36319. }
  36320. }
  36321. public function setBarWidth($size)
  36322. {
  36323. $this->barWidth = (int) $size;
  36324. }
  36325. public function setBarCharacter($char)
  36326. {
  36327. $this->barChar = $char;
  36328. }
  36329. public function setEmptyBarCharacter($char)
  36330. {
  36331. $this->emptyBarChar = $char;
  36332. }
  36333. public function setProgressCharacter($char)
  36334. {
  36335. $this->progressChar = $char;
  36336. }
  36337. public function setFormat($format)
  36338. {
  36339. $this->format = $format;
  36340. }
  36341. public function setRedrawFrequency($freq)
  36342. {
  36343. $this->redrawFreq = (int) $freq;
  36344. }
  36345. public function start(OutputInterface $output, $max = null)
  36346. {
  36347. if ($output instanceof ConsoleOutputInterface) {
  36348. $output = $output->getErrorOutput();
  36349. }
  36350. $this->startTime = time();
  36351. $this->current = 0;
  36352. $this->max = (int) $max;
  36353. $this->output = $output->isDecorated() ? $output : new NullOutput();
  36354. $this->lastMessagesLength = 0;
  36355. $this->barCharOriginal = '';
  36356. if (null === $this->format) {
  36357. switch ($output->getVerbosity()) {
  36358. case OutputInterface::VERBOSITY_QUIET:
  36359. $this->format = self::FORMAT_QUIET_NOMAX;
  36360. if ($this->max > 0) {
  36361. $this->format = self::FORMAT_QUIET;
  36362. }
  36363. break;
  36364. case OutputInterface::VERBOSITY_VERBOSE:
  36365. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  36366. case OutputInterface::VERBOSITY_DEBUG:
  36367. $this->format = self::FORMAT_VERBOSE_NOMAX;
  36368. if ($this->max > 0) {
  36369. $this->format = self::FORMAT_VERBOSE;
  36370. }
  36371. break;
  36372. default:
  36373. $this->format = self::FORMAT_NORMAL_NOMAX;
  36374. if ($this->max > 0) {
  36375. $this->format = self::FORMAT_NORMAL;
  36376. }
  36377. break;
  36378. }
  36379. }
  36380. $this->initialize();
  36381. }
  36382. public function advance($step = 1, $redraw = false)
  36383. {
  36384. $this->setCurrent($this->current + $step, $redraw);
  36385. }
  36386. public function setCurrent($current, $redraw = false)
  36387. {
  36388. if (null === $this->startTime) {
  36389. throw new LogicException('You must start the progress bar before calling setCurrent().');
  36390. }
  36391. $current = (int) $current;
  36392. if ($current < $this->current) {
  36393. throw new LogicException('You can\'t regress the progress bar');
  36394. }
  36395. if (0 === $this->current) {
  36396. $redraw = true;
  36397. }
  36398. $prevPeriod = (int) ($this->current / $this->redrawFreq);
  36399. $this->current = $current;
  36400. $currPeriod = (int) ($this->current / $this->redrawFreq);
  36401. if ($redraw || $prevPeriod !== $currPeriod || $this->max === $this->current) {
  36402. $this->display();
  36403. }
  36404. }
  36405. public function display($finish = false)
  36406. {
  36407. if (null === $this->startTime) {
  36408. throw new LogicException('You must start the progress bar before calling display().');
  36409. }
  36410. $message = $this->format;
  36411. foreach ($this->generate($finish) as $name => $value) {
  36412. $message = str_replace("%{$name}%", $value, $message);
  36413. }
  36414. $this->overwrite($this->output, $message);
  36415. }
  36416. public function clear()
  36417. {
  36418. $this->overwrite($this->output, '');
  36419. }
  36420. public function finish()
  36421. {
  36422. if (null === $this->startTime) {
  36423. throw new LogicException('You must start the progress bar before calling finish().');
  36424. }
  36425. if (null !== $this->startTime) {
  36426. if (!$this->max) {
  36427. $this->barChar = $this->barCharOriginal;
  36428. $this->display(true);
  36429. }
  36430. $this->startTime = null;
  36431. $this->output->writeln('');
  36432. $this->output = null;
  36433. }
  36434. }
  36435. private function initialize()
  36436. {
  36437. $this->formatVars = array();
  36438. foreach ($this->defaultFormatVars as $var) {
  36439. if (false !== strpos($this->format, "%{$var}%")) {
  36440. $this->formatVars[$var] = true;
  36441. }
  36442. }
  36443. if ($this->max > 0) {
  36444. $this->widths['max'] = $this->strlen($this->max);
  36445. $this->widths['current'] = $this->widths['max'];
  36446. } else {
  36447. $this->barCharOriginal = $this->barChar;
  36448. $this->barChar = $this->emptyBarChar;
  36449. }
  36450. }
  36451. private function generate($finish = false)
  36452. {
  36453. $vars = array();
  36454. $percent = 0;
  36455. if ($this->max > 0) {
  36456. $percent = (float) $this->current / $this->max;
  36457. }
  36458. if (isset($this->formatVars['bar'])) {
  36459. if ($this->max > 0) {
  36460. $completeBars = floor($percent * $this->barWidth);
  36461. } else {
  36462. if (!$finish) {
  36463. $completeBars = floor($this->current % $this->barWidth);
  36464. } else {
  36465. $completeBars = $this->barWidth;
  36466. }
  36467. }
  36468. $emptyBars = $this->barWidth - $completeBars - $this->strlen($this->progressChar);
  36469. $bar = str_repeat($this->barChar, $completeBars);
  36470. if ($completeBars < $this->barWidth) {
  36471. $bar .= $this->progressChar;
  36472. $bar .= str_repeat($this->emptyBarChar, $emptyBars);
  36473. }
  36474. $vars['bar'] = $bar;
  36475. }
  36476. if (isset($this->formatVars['elapsed'])) {
  36477. $elapsed = time() - $this->startTime;
  36478. $vars['elapsed'] = str_pad($this->humaneTime($elapsed), $this->widths['elapsed'], ' ', STR_PAD_LEFT);
  36479. }
  36480. if (isset($this->formatVars['current'])) {
  36481. $vars['current'] = str_pad($this->current, $this->widths['current'], ' ', STR_PAD_LEFT);
  36482. }
  36483. if (isset($this->formatVars['max'])) {
  36484. $vars['max'] = $this->max;
  36485. }
  36486. if (isset($this->formatVars['percent'])) {
  36487. $vars['percent'] = str_pad(floor($percent * 100), $this->widths['percent'], ' ', STR_PAD_LEFT);
  36488. }
  36489. return $vars;
  36490. }
  36491. private function humaneTime($secs)
  36492. {
  36493. $text = '';
  36494. foreach ($this->timeFormats as $format) {
  36495. if ($secs < $format[0]) {
  36496. if (2 == \count($format)) {
  36497. $text = $format[1];
  36498. break;
  36499. } else {
  36500. $text = ceil($secs / $format[2]).' '.$format[1];
  36501. break;
  36502. }
  36503. }
  36504. }
  36505. return $text;
  36506. }
  36507. private function overwrite(OutputInterface $output, $message)
  36508. {
  36509. $length = $this->strlen($message);
  36510. if (null !== $this->lastMessagesLength && $this->lastMessagesLength > $length) {
  36511. $message = str_pad($message, $this->lastMessagesLength, "\x20", STR_PAD_RIGHT);
  36512. }
  36513. $output->write("\x0D");
  36514. $output->write($message);
  36515. $this->lastMessagesLength = $this->strlen($message);
  36516. }
  36517. public function getName()
  36518. {
  36519. return 'progress';
  36520. }
  36521. }
  36522. <?php
  36523. namespace Symfony\Component\Console\Helper;
  36524. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36525. use Symfony\Component\Console\Exception\LogicException;
  36526. use Symfony\Component\Console\Output\OutputInterface;
  36527. class ProgressIndicator
  36528. {
  36529. private $output;
  36530. private $startTime;
  36531. private $format;
  36532. private $message;
  36533. private $indicatorValues;
  36534. private $indicatorCurrent;
  36535. private $indicatorChangeInterval;
  36536. private $indicatorUpdateTime;
  36537. private $started = false;
  36538. private static $formatters;
  36539. private static $formats;
  36540. public function __construct(OutputInterface $output, $format = null, $indicatorChangeInterval = 100, $indicatorValues = null)
  36541. {
  36542. $this->output = $output;
  36543. if (null === $format) {
  36544. $format = $this->determineBestFormat();
  36545. }
  36546. if (null === $indicatorValues) {
  36547. $indicatorValues = array('-', '\\', '|', '/');
  36548. }
  36549. $indicatorValues = array_values($indicatorValues);
  36550. if (2 > \count($indicatorValues)) {
  36551. throw new InvalidArgumentException('Must have at least 2 indicator value characters.');
  36552. }
  36553. $this->format = self::getFormatDefinition($format);
  36554. $this->indicatorChangeInterval = $indicatorChangeInterval;
  36555. $this->indicatorValues = $indicatorValues;
  36556. $this->startTime = time();
  36557. }
  36558. public function setMessage($message)
  36559. {
  36560. $this->message = $message;
  36561. $this->display();
  36562. }
  36563. public function getMessage()
  36564. {
  36565. return $this->message;
  36566. }
  36567. public function getStartTime()
  36568. {
  36569. return $this->startTime;
  36570. }
  36571. public function getCurrentValue()
  36572. {
  36573. return $this->indicatorValues[$this->indicatorCurrent % \count($this->indicatorValues)];
  36574. }
  36575. public function start($message)
  36576. {
  36577. if ($this->started) {
  36578. throw new LogicException('Progress indicator already started.');
  36579. }
  36580. $this->message = $message;
  36581. $this->started = true;
  36582. $this->startTime = time();
  36583. $this->indicatorUpdateTime = $this->getCurrentTimeInMilliseconds() + $this->indicatorChangeInterval;
  36584. $this->indicatorCurrent = 0;
  36585. $this->display();
  36586. }
  36587. public function advance()
  36588. {
  36589. if (!$this->started) {
  36590. throw new LogicException('Progress indicator has not yet been started.');
  36591. }
  36592. if (!$this->output->isDecorated()) {
  36593. return;
  36594. }
  36595. $currentTime = $this->getCurrentTimeInMilliseconds();
  36596. if ($currentTime < $this->indicatorUpdateTime) {
  36597. return;
  36598. }
  36599. $this->indicatorUpdateTime = $currentTime + $this->indicatorChangeInterval;
  36600. ++$this->indicatorCurrent;
  36601. $this->display();
  36602. }
  36603. public function finish($message)
  36604. {
  36605. if (!$this->started) {
  36606. throw new LogicException('Progress indicator has not yet been started.');
  36607. }
  36608. $this->message = $message;
  36609. $this->display();
  36610. $this->output->writeln('');
  36611. $this->started = false;
  36612. }
  36613. public static function getFormatDefinition($name)
  36614. {
  36615. if (!self::$formats) {
  36616. self::$formats = self::initFormats();
  36617. }
  36618. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  36619. }
  36620. public static function setPlaceholderFormatterDefinition($name, $callable)
  36621. {
  36622. if (!self::$formatters) {
  36623. self::$formatters = self::initPlaceholderFormatters();
  36624. }
  36625. self::$formatters[$name] = $callable;
  36626. }
  36627. public static function getPlaceholderFormatterDefinition($name)
  36628. {
  36629. if (!self::$formatters) {
  36630. self::$formatters = self::initPlaceholderFormatters();
  36631. }
  36632. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  36633. }
  36634. private function display()
  36635. {
  36636. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  36637. return;
  36638. }
  36639. $self = $this;
  36640. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self) {
  36641. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  36642. return \call_user_func($formatter, $self);
  36643. }
  36644. return $matches[0];
  36645. }, $this->format));
  36646. }
  36647. private function determineBestFormat()
  36648. {
  36649. switch ($this->output->getVerbosity()) {
  36650. case OutputInterface::VERBOSITY_VERBOSE:
  36651. return $this->output->isDecorated() ? 'verbose' : 'verbose_no_ansi';
  36652. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  36653. case OutputInterface::VERBOSITY_DEBUG:
  36654. return $this->output->isDecorated() ? 'very_verbose' : 'very_verbose_no_ansi';
  36655. default:
  36656. return $this->output->isDecorated() ? 'normal' : 'normal_no_ansi';
  36657. }
  36658. }
  36659. private function overwrite($message)
  36660. {
  36661. if ($this->output->isDecorated()) {
  36662. $this->output->write("\x0D\x1B[2K");
  36663. $this->output->write($message);
  36664. } else {
  36665. $this->output->writeln($message);
  36666. }
  36667. }
  36668. private function getCurrentTimeInMilliseconds()
  36669. {
  36670. return round(microtime(true) * 1000);
  36671. }
  36672. private static function initPlaceholderFormatters()
  36673. {
  36674. return array(
  36675. 'indicator' => function (ProgressIndicator $indicator) {
  36676. return $indicator->getCurrentValue();
  36677. },
  36678. 'message' => function (ProgressIndicator $indicator) {
  36679. return $indicator->getMessage();
  36680. },
  36681. 'elapsed' => function (ProgressIndicator $indicator) {
  36682. return Helper::formatTime(time() - $indicator->getStartTime());
  36683. },
  36684. 'memory' => function () {
  36685. return Helper::formatMemory(memory_get_usage(true));
  36686. },
  36687. );
  36688. }
  36689. private static function initFormats()
  36690. {
  36691. return array(
  36692. 'normal' => ' %indicator% %message%',
  36693. 'normal_no_ansi' => ' %message%',
  36694. 'verbose' => ' %indicator% %message% (%elapsed:6s%)',
  36695. 'verbose_no_ansi' => ' %message% (%elapsed:6s%)',
  36696. 'very_verbose' => ' %indicator% %message% (%elapsed:6s%, %memory:6s%)',
  36697. 'very_verbose_no_ansi' => ' %message% (%elapsed:6s%, %memory:6s%)',
  36698. );
  36699. }
  36700. }
  36701. <?php
  36702. namespace Symfony\Component\Console\Helper;
  36703. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36704. use Symfony\Component\Console\Exception\RuntimeException;
  36705. use Symfony\Component\Console\Formatter\OutputFormatter;
  36706. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  36707. use Symfony\Component\Console\Input\InputInterface;
  36708. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  36709. use Symfony\Component\Console\Output\OutputInterface;
  36710. use Symfony\Component\Console\Question\ChoiceQuestion;
  36711. use Symfony\Component\Console\Question\Question;
  36712. class QuestionHelper extends Helper
  36713. {
  36714. private $inputStream;
  36715. private static $shell;
  36716. private static $stty;
  36717. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  36718. {
  36719. if ($output instanceof ConsoleOutputInterface) {
  36720. $output = $output->getErrorOutput();
  36721. }
  36722. if (!$input->isInteractive()) {
  36723. $default = $question->getDefault();
  36724. if (null !== $default && $question instanceof ChoiceQuestion) {
  36725. $choices = $question->getChoices();
  36726. if (!$question->isMultiselect()) {
  36727. return isset($choices[$default]) ? $choices[$default] : $default;
  36728. }
  36729. $default = explode(',', $default);
  36730. foreach ($default as $k => $v) {
  36731. $v = trim($v);
  36732. $default[$k] = isset($choices[$v]) ? $choices[$v] : $v;
  36733. }
  36734. }
  36735. return $default;
  36736. }
  36737. if (!$question->getValidator()) {
  36738. return $this->doAsk($output, $question);
  36739. }
  36740. $that = $this;
  36741. $interviewer = function () use ($output, $question, $that) {
  36742. return $that->doAsk($output, $question);
  36743. };
  36744. return $this->validateAttempts($interviewer, $output, $question);
  36745. }
  36746. public function setInputStream($stream)
  36747. {
  36748. if (!\is_resource($stream)) {
  36749. throw new InvalidArgumentException('Input stream must be a valid resource.');
  36750. }
  36751. $this->inputStream = $stream;
  36752. }
  36753. public function getInputStream()
  36754. {
  36755. return $this->inputStream;
  36756. }
  36757. public function getName()
  36758. {
  36759. return 'question';
  36760. }
  36761. public function doAsk(OutputInterface $output, Question $question)
  36762. {
  36763. $this->writePrompt($output, $question);
  36764. $inputStream = $this->inputStream ?: STDIN;
  36765. $autocomplete = $question->getAutocompleterValues();
  36766. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  36767. $ret = false;
  36768. if ($question->isHidden()) {
  36769. try {
  36770. $ret = trim($this->getHiddenResponse($output, $inputStream));
  36771. } catch (RuntimeException $e) {
  36772. if (!$question->isHiddenFallback()) {
  36773. throw $e;
  36774. }
  36775. }
  36776. }
  36777. if (false === $ret) {
  36778. $ret = fgets($inputStream, 4096);
  36779. if (false === $ret) {
  36780. throw new RuntimeException('Aborted');
  36781. }
  36782. $ret = trim($ret);
  36783. }
  36784. } else {
  36785. $ret = trim($this->autocomplete($output, $question, $inputStream, \is_array($autocomplete) ? $autocomplete : iterator_to_array($autocomplete, false)));
  36786. }
  36787. $ret = \strlen($ret) > 0 ? $ret : $question->getDefault();
  36788. if ($normalizer = $question->getNormalizer()) {
  36789. return $normalizer($ret);
  36790. }
  36791. return $ret;
  36792. }
  36793. protected function writePrompt(OutputInterface $output, Question $question)
  36794. {
  36795. $message = $question->getQuestion();
  36796. if ($question instanceof ChoiceQuestion) {
  36797. $maxWidth = max(array_map(array($this, 'strlen'), array_keys($question->getChoices())));
  36798. $messages = (array) $question->getQuestion();
  36799. foreach ($question->getChoices() as $key => $value) {
  36800. $width = $maxWidth - $this->strlen($key);
  36801. $messages[] = ' [<info>'.$key.str_repeat(' ', $width).'</info>] '.$value;
  36802. }
  36803. $output->writeln($messages);
  36804. $message = $question->getPrompt();
  36805. }
  36806. $output->write($message);
  36807. }
  36808. protected function writeError(OutputInterface $output, \Exception $error)
  36809. {
  36810. if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) {
  36811. $message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error');
  36812. } else {
  36813. $message = '<error>'.$error->getMessage().'</error>';
  36814. }
  36815. $output->writeln($message);
  36816. }
  36817. private function autocomplete(OutputInterface $output, Question $question, $inputStream, array $autocomplete)
  36818. {
  36819. $ret = '';
  36820. $i = 0;
  36821. $ofs = -1;
  36822. $matches = $autocomplete;
  36823. $numMatches = \count($matches);
  36824. $sttyMode = shell_exec('stty -g');
  36825. shell_exec('stty -icanon -echo');
  36826. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  36827. while (!feof($inputStream)) {
  36828. $c = fread($inputStream, 1);
  36829. if ("\177" === $c) {
  36830. if (0 === $numMatches && 0 !== $i) {
  36831. --$i;
  36832. $output->write("\033[1D");
  36833. }
  36834. if (0 === $i) {
  36835. $ofs = -1;
  36836. $matches = $autocomplete;
  36837. $numMatches = \count($matches);
  36838. } else {
  36839. $numMatches = 0;
  36840. }
  36841. $ret = substr($ret, 0, $i);
  36842. } elseif ("\033" === $c) {
  36843. $c .= fread($inputStream, 2);
  36844. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  36845. if ('A' === $c[2] && -1 === $ofs) {
  36846. $ofs = 0;
  36847. }
  36848. if (0 === $numMatches) {
  36849. continue;
  36850. }
  36851. $ofs += ('A' === $c[2]) ? -1 : 1;
  36852. $ofs = ($numMatches + $ofs) % $numMatches;
  36853. }
  36854. } elseif (\ord($c) < 32) {
  36855. if ("\t" === $c || "\n" === $c) {
  36856. if ($numMatches > 0 && -1 !== $ofs) {
  36857. $ret = $matches[$ofs];
  36858. $output->write(substr($ret, $i));
  36859. $i = \strlen($ret);
  36860. }
  36861. if ("\n" === $c) {
  36862. $output->write($c);
  36863. break;
  36864. }
  36865. $numMatches = 0;
  36866. }
  36867. continue;
  36868. } else {
  36869. $output->write($c);
  36870. $ret .= $c;
  36871. ++$i;
  36872. $numMatches = 0;
  36873. $ofs = 0;
  36874. foreach ($autocomplete as $value) {
  36875. if (0 === strpos($value, $ret)) {
  36876. $matches[$numMatches++] = $value;
  36877. }
  36878. }
  36879. }
  36880. $output->write("\033[K");
  36881. if ($numMatches > 0 && -1 !== $ofs) {
  36882. $output->write("\0337");
  36883. $output->write('<hl>'.OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs], $i)).'</hl>');
  36884. $output->write("\0338");
  36885. }
  36886. }
  36887. shell_exec(sprintf('stty %s', $sttyMode));
  36888. return $ret;
  36889. }
  36890. private function getHiddenResponse(OutputInterface $output, $inputStream)
  36891. {
  36892. if ('\\' === \DIRECTORY_SEPARATOR) {
  36893. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  36894. if ('phar:' === substr(__FILE__, 0, 5)) {
  36895. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  36896. copy($exe, $tmpExe);
  36897. $exe = $tmpExe;
  36898. }
  36899. $value = rtrim(shell_exec($exe));
  36900. $output->writeln('');
  36901. if (isset($tmpExe)) {
  36902. unlink($tmpExe);
  36903. }
  36904. return $value;
  36905. }
  36906. if ($this->hasSttyAvailable()) {
  36907. $sttyMode = shell_exec('stty -g');
  36908. shell_exec('stty -echo');
  36909. $value = fgets($inputStream, 4096);
  36910. shell_exec(sprintf('stty %s', $sttyMode));
  36911. if (false === $value) {
  36912. throw new RuntimeException('Aborted');
  36913. }
  36914. $value = trim($value);
  36915. $output->writeln('');
  36916. return $value;
  36917. }
  36918. if (false !== $shell = $this->getShell()) {
  36919. $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
  36920. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  36921. $value = rtrim(shell_exec($command));
  36922. $output->writeln('');
  36923. return $value;
  36924. }
  36925. throw new RuntimeException('Unable to hide the response.');
  36926. }
  36927. private function validateAttempts($interviewer, OutputInterface $output, Question $question)
  36928. {
  36929. $error = null;
  36930. $attempts = $question->getMaxAttempts();
  36931. while (null === $attempts || $attempts--) {
  36932. if (null !== $error) {
  36933. $this->writeError($output, $error);
  36934. }
  36935. try {
  36936. return \call_user_func($question->getValidator(), $interviewer());
  36937. } catch (RuntimeException $e) {
  36938. throw $e;
  36939. } catch (\Exception $error) {
  36940. }
  36941. }
  36942. throw $error;
  36943. }
  36944. private function getShell()
  36945. {
  36946. if (null !== self::$shell) {
  36947. return self::$shell;
  36948. }
  36949. self::$shell = false;
  36950. if (file_exists('/usr/bin/env')) {
  36951. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  36952. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  36953. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  36954. self::$shell = $sh;
  36955. break;
  36956. }
  36957. }
  36958. }
  36959. return self::$shell;
  36960. }
  36961. private function hasSttyAvailable()
  36962. {
  36963. if (null !== self::$stty) {
  36964. return self::$stty;
  36965. }
  36966. exec('stty 2>&1', $output, $exitcode);
  36967. return self::$stty = 0 === $exitcode;
  36968. }
  36969. }
  36970. <?php
  36971. namespace Symfony\Component\Console\Helper;
  36972. use Symfony\Component\Console\Exception\LogicException;
  36973. use Symfony\Component\Console\Formatter\OutputFormatter;
  36974. use Symfony\Component\Console\Input\InputInterface;
  36975. use Symfony\Component\Console\Output\OutputInterface;
  36976. use Symfony\Component\Console\Question\ChoiceQuestion;
  36977. use Symfony\Component\Console\Question\ConfirmationQuestion;
  36978. use Symfony\Component\Console\Question\Question;
  36979. use Symfony\Component\Console\Style\SymfonyStyle;
  36980. class SymfonyQuestionHelper extends QuestionHelper
  36981. {
  36982. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  36983. {
  36984. $validator = $question->getValidator();
  36985. $question->setValidator(function ($value) use ($validator) {
  36986. if (null !== $validator) {
  36987. $value = $validator($value);
  36988. } else {
  36989. if (!\is_array($value) && !\is_bool($value) && 0 === \strlen($value)) {
  36990. throw new LogicException('A value is required.');
  36991. }
  36992. }
  36993. return $value;
  36994. });
  36995. return parent::ask($input, $output, $question);
  36996. }
  36997. protected function writePrompt(OutputInterface $output, Question $question)
  36998. {
  36999. $text = OutputFormatter::escapeTrailingBackslash($question->getQuestion());
  37000. $default = $question->getDefault();
  37001. switch (true) {
  37002. case null === $default:
  37003. $text = sprintf(' <info>%s</info>:', $text);
  37004. break;
  37005. case $question instanceof ConfirmationQuestion:
  37006. $text = sprintf(' <info>%s (yes/no)</info> [<comment>%s</comment>]:', $text, $default ? 'yes' : 'no');
  37007. break;
  37008. case $question instanceof ChoiceQuestion && $question->isMultiselect():
  37009. $choices = $question->getChoices();
  37010. $default = explode(',', $default);
  37011. foreach ($default as $key => $value) {
  37012. $default[$key] = $choices[trim($value)];
  37013. }
  37014. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(implode(', ', $default)));
  37015. break;
  37016. case $question instanceof ChoiceQuestion:
  37017. $choices = $question->getChoices();
  37018. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(isset($choices[$default]) ? $choices[$default] : $default));
  37019. break;
  37020. default:
  37021. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($default));
  37022. }
  37023. $output->writeln($text);
  37024. if ($question instanceof ChoiceQuestion) {
  37025. $width = max(array_map('strlen', array_keys($question->getChoices())));
  37026. foreach ($question->getChoices() as $key => $value) {
  37027. $output->writeln(sprintf(" [<comment>%-${width}s</comment>] %s", $key, $value));
  37028. }
  37029. }
  37030. $output->write(' > ');
  37031. }
  37032. protected function writeError(OutputInterface $output, \Exception $error)
  37033. {
  37034. if ($output instanceof SymfonyStyle) {
  37035. $output->newLine();
  37036. $output->error($error->getMessage());
  37037. return;
  37038. }
  37039. parent::writeError($output, $error);
  37040. }
  37041. }
  37042. <?php
  37043. namespace Symfony\Component\Console\Helper;
  37044. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37045. use Symfony\Component\Console\Output\OutputInterface;
  37046. class Table
  37047. {
  37048. private $headers = array();
  37049. private $rows = array();
  37050. private $columnWidths = array();
  37051. private $numberOfColumns;
  37052. private $output;
  37053. private $style;
  37054. private $columnStyles = array();
  37055. private static $styles;
  37056. public function __construct(OutputInterface $output)
  37057. {
  37058. $this->output = $output;
  37059. if (!self::$styles) {
  37060. self::$styles = self::initStyles();
  37061. }
  37062. $this->setStyle('default');
  37063. }
  37064. public static function setStyleDefinition($name, TableStyle $style)
  37065. {
  37066. if (!self::$styles) {
  37067. self::$styles = self::initStyles();
  37068. }
  37069. self::$styles[$name] = $style;
  37070. }
  37071. public static function getStyleDefinition($name)
  37072. {
  37073. if (!self::$styles) {
  37074. self::$styles = self::initStyles();
  37075. }
  37076. if (isset(self::$styles[$name])) {
  37077. return self::$styles[$name];
  37078. }
  37079. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  37080. }
  37081. public function setStyle($name)
  37082. {
  37083. $this->style = $this->resolveStyle($name);
  37084. return $this;
  37085. }
  37086. public function getStyle()
  37087. {
  37088. return $this->style;
  37089. }
  37090. public function setColumnStyle($columnIndex, $name)
  37091. {
  37092. $columnIndex = (int) $columnIndex;
  37093. $this->columnStyles[$columnIndex] = $this->resolveStyle($name);
  37094. return $this;
  37095. }
  37096. public function getColumnStyle($columnIndex)
  37097. {
  37098. if (isset($this->columnStyles[$columnIndex])) {
  37099. return $this->columnStyles[$columnIndex];
  37100. }
  37101. return $this->getStyle();
  37102. }
  37103. public function setHeaders(array $headers)
  37104. {
  37105. $headers = array_values($headers);
  37106. if (!empty($headers) && !\is_array($headers[0])) {
  37107. $headers = array($headers);
  37108. }
  37109. $this->headers = $headers;
  37110. return $this;
  37111. }
  37112. public function setRows(array $rows)
  37113. {
  37114. $this->rows = array();
  37115. return $this->addRows($rows);
  37116. }
  37117. public function addRows(array $rows)
  37118. {
  37119. foreach ($rows as $row) {
  37120. $this->addRow($row);
  37121. }
  37122. return $this;
  37123. }
  37124. public function addRow($row)
  37125. {
  37126. if ($row instanceof TableSeparator) {
  37127. $this->rows[] = $row;
  37128. return $this;
  37129. }
  37130. if (!\is_array($row)) {
  37131. throw new InvalidArgumentException('A row must be an array or a TableSeparator instance.');
  37132. }
  37133. $this->rows[] = array_values($row);
  37134. return $this;
  37135. }
  37136. public function setRow($column, array $row)
  37137. {
  37138. $this->rows[$column] = $row;
  37139. return $this;
  37140. }
  37141. public function render()
  37142. {
  37143. $this->calculateNumberOfColumns();
  37144. $rows = $this->buildTableRows($this->rows);
  37145. $headers = $this->buildTableRows($this->headers);
  37146. $this->calculateColumnsWidth(array_merge($headers, $rows));
  37147. $this->renderRowSeparator();
  37148. if (!empty($headers)) {
  37149. foreach ($headers as $header) {
  37150. $this->renderRow($header, $this->style->getCellHeaderFormat());
  37151. $this->renderRowSeparator();
  37152. }
  37153. }
  37154. foreach ($rows as $row) {
  37155. if ($row instanceof TableSeparator) {
  37156. $this->renderRowSeparator();
  37157. } else {
  37158. $this->renderRow($row, $this->style->getCellRowFormat());
  37159. }
  37160. }
  37161. if (!empty($rows)) {
  37162. $this->renderRowSeparator();
  37163. }
  37164. $this->cleanup();
  37165. }
  37166. private function renderRowSeparator()
  37167. {
  37168. if (0 === $count = $this->numberOfColumns) {
  37169. return;
  37170. }
  37171. if (!$this->style->getHorizontalBorderChar() && !$this->style->getCrossingChar()) {
  37172. return;
  37173. }
  37174. $markup = $this->style->getCrossingChar();
  37175. for ($column = 0; $column < $count; ++$column) {
  37176. $markup .= str_repeat($this->style->getHorizontalBorderChar(), $this->columnWidths[$column]).$this->style->getCrossingChar();
  37177. }
  37178. $this->output->writeln(sprintf($this->style->getBorderFormat(), $markup));
  37179. }
  37180. private function renderColumnSeparator()
  37181. {
  37182. return sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar());
  37183. }
  37184. private function renderRow(array $row, $cellFormat)
  37185. {
  37186. if (empty($row)) {
  37187. return;
  37188. }
  37189. $rowContent = $this->renderColumnSeparator();
  37190. foreach ($this->getRowColumns($row) as $column) {
  37191. $rowContent .= $this->renderCell($row, $column, $cellFormat);
  37192. $rowContent .= $this->renderColumnSeparator();
  37193. }
  37194. $this->output->writeln($rowContent);
  37195. }
  37196. private function renderCell(array $row, $column, $cellFormat)
  37197. {
  37198. $cell = isset($row[$column]) ? $row[$column] : '';
  37199. $width = $this->columnWidths[$column];
  37200. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  37201. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $nextColumn) {
  37202. $width += $this->getColumnSeparatorWidth() + $this->columnWidths[$nextColumn];
  37203. }
  37204. }
  37205. if (false !== $encoding = mb_detect_encoding($cell, null, true)) {
  37206. $width += \strlen($cell) - mb_strwidth($cell, $encoding);
  37207. }
  37208. $style = $this->getColumnStyle($column);
  37209. if ($cell instanceof TableSeparator) {
  37210. return sprintf($style->getBorderFormat(), str_repeat($style->getHorizontalBorderChar(), $width));
  37211. }
  37212. $width += Helper::strlen($cell) - Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  37213. $content = sprintf($style->getCellRowContentFormat(), $cell);
  37214. return sprintf($cellFormat, str_pad($content, $width, $style->getPaddingChar(), $style->getPadType()));
  37215. }
  37216. private function calculateNumberOfColumns()
  37217. {
  37218. if (null !== $this->numberOfColumns) {
  37219. return;
  37220. }
  37221. $columns = array(0);
  37222. foreach (array_merge($this->headers, $this->rows) as $row) {
  37223. if ($row instanceof TableSeparator) {
  37224. continue;
  37225. }
  37226. $columns[] = $this->getNumberOfColumns($row);
  37227. }
  37228. $this->numberOfColumns = max($columns);
  37229. }
  37230. private function buildTableRows($rows)
  37231. {
  37232. $unmergedRows = array();
  37233. for ($rowKey = 0; $rowKey < \count($rows); ++$rowKey) {
  37234. $rows = $this->fillNextRows($rows, $rowKey);
  37235. foreach ($rows[$rowKey] as $column => $cell) {
  37236. if (!strstr($cell, "\n")) {
  37237. continue;
  37238. }
  37239. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  37240. foreach ($lines as $lineKey => $line) {
  37241. if ($cell instanceof TableCell) {
  37242. $line = new TableCell($line, array('colspan' => $cell->getColspan()));
  37243. }
  37244. if (0 === $lineKey) {
  37245. $rows[$rowKey][$column] = $line;
  37246. } else {
  37247. $unmergedRows[$rowKey][$lineKey][$column] = $line;
  37248. }
  37249. }
  37250. }
  37251. }
  37252. $tableRows = array();
  37253. foreach ($rows as $rowKey => $row) {
  37254. $tableRows[] = $this->fillCells($row);
  37255. if (isset($unmergedRows[$rowKey])) {
  37256. $tableRows = array_merge($tableRows, $unmergedRows[$rowKey]);
  37257. }
  37258. }
  37259. return $tableRows;
  37260. }
  37261. private function fillNextRows(array $rows, $line)
  37262. {
  37263. $unmergedRows = array();
  37264. foreach ($rows[$line] as $column => $cell) {
  37265. if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
  37266. $nbLines = $cell->getRowspan() - 1;
  37267. $lines = array($cell);
  37268. if (strstr($cell, "\n")) {
  37269. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  37270. $nbLines = \count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines;
  37271. $rows[$line][$column] = new TableCell($lines[0], array('colspan' => $cell->getColspan()));
  37272. unset($lines[0]);
  37273. }
  37274. $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, array()), $unmergedRows);
  37275. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  37276. $value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : '';
  37277. $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, array('colspan' => $cell->getColspan()));
  37278. if ($nbLines === $unmergedRowKey - $line) {
  37279. break;
  37280. }
  37281. }
  37282. }
  37283. }
  37284. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  37285. if (isset($rows[$unmergedRowKey]) && \is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) {
  37286. foreach ($unmergedRow as $cellKey => $cell) {
  37287. array_splice($rows[$unmergedRowKey], $cellKey, 0, array($cell));
  37288. }
  37289. } else {
  37290. $row = $this->copyRow($rows, $unmergedRowKey - 1);
  37291. foreach ($unmergedRow as $column => $cell) {
  37292. if (!empty($cell)) {
  37293. $row[$column] = $unmergedRow[$column];
  37294. }
  37295. }
  37296. array_splice($rows, $unmergedRowKey, 0, array($row));
  37297. }
  37298. }
  37299. return $rows;
  37300. }
  37301. private function fillCells($row)
  37302. {
  37303. $newRow = array();
  37304. foreach ($row as $column => $cell) {
  37305. $newRow[] = $cell;
  37306. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  37307. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $position) {
  37308. $newRow[] = '';
  37309. }
  37310. }
  37311. }
  37312. return $newRow ?: $row;
  37313. }
  37314. private function copyRow(array $rows, $line)
  37315. {
  37316. $row = $rows[$line];
  37317. foreach ($row as $cellKey => $cellValue) {
  37318. $row[$cellKey] = '';
  37319. if ($cellValue instanceof TableCell) {
  37320. $row[$cellKey] = new TableCell('', array('colspan' => $cellValue->getColspan()));
  37321. }
  37322. }
  37323. return $row;
  37324. }
  37325. private function getNumberOfColumns(array $row)
  37326. {
  37327. $columns = \count($row);
  37328. foreach ($row as $column) {
  37329. $columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0;
  37330. }
  37331. return $columns;
  37332. }
  37333. private function getRowColumns(array $row)
  37334. {
  37335. $columns = range(0, $this->numberOfColumns - 1);
  37336. foreach ($row as $cellKey => $cell) {
  37337. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  37338. $columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1));
  37339. }
  37340. }
  37341. return $columns;
  37342. }
  37343. private function calculateColumnsWidth($rows)
  37344. {
  37345. for ($column = 0; $column < $this->numberOfColumns; ++$column) {
  37346. $lengths = array();
  37347. foreach ($rows as $row) {
  37348. if ($row instanceof TableSeparator) {
  37349. continue;
  37350. }
  37351. foreach ($row as $i => $cell) {
  37352. if ($cell instanceof TableCell) {
  37353. $textContent = Helper::removeDecoration($this->output->getFormatter(), $cell);
  37354. $textLength = Helper::strlen($textContent);
  37355. if ($textLength > 0) {
  37356. $contentColumns = str_split($textContent, ceil($textLength / $cell->getColspan()));
  37357. foreach ($contentColumns as $position => $content) {
  37358. $row[$i + $position] = $content;
  37359. }
  37360. }
  37361. }
  37362. }
  37363. $lengths[] = $this->getCellWidth($row, $column);
  37364. }
  37365. $this->columnWidths[$column] = max($lengths) + Helper::strlen($this->style->getCellRowContentFormat()) - 2;
  37366. }
  37367. }
  37368. private function getColumnSeparatorWidth()
  37369. {
  37370. return Helper::strlen(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar()));
  37371. }
  37372. private function getCellWidth(array $row, $column)
  37373. {
  37374. if (isset($row[$column])) {
  37375. $cell = $row[$column];
  37376. $cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  37377. return $cellWidth;
  37378. }
  37379. return 0;
  37380. }
  37381. private function cleanup()
  37382. {
  37383. $this->columnWidths = array();
  37384. $this->numberOfColumns = null;
  37385. }
  37386. private static function initStyles()
  37387. {
  37388. $borderless = new TableStyle();
  37389. $borderless
  37390. ->setHorizontalBorderChar('=')
  37391. ->setVerticalBorderChar(' ')
  37392. ->setCrossingChar(' ')
  37393. ;
  37394. $compact = new TableStyle();
  37395. $compact
  37396. ->setHorizontalBorderChar('')
  37397. ->setVerticalBorderChar(' ')
  37398. ->setCrossingChar('')
  37399. ->setCellRowContentFormat('%s')
  37400. ;
  37401. $styleGuide = new TableStyle();
  37402. $styleGuide
  37403. ->setHorizontalBorderChar('-')
  37404. ->setVerticalBorderChar(' ')
  37405. ->setCrossingChar(' ')
  37406. ->setCellHeaderFormat('%s')
  37407. ;
  37408. return array(
  37409. 'default' => new TableStyle(),
  37410. 'borderless' => $borderless,
  37411. 'compact' => $compact,
  37412. 'symfony-style-guide' => $styleGuide,
  37413. );
  37414. }
  37415. private function resolveStyle($name)
  37416. {
  37417. if ($name instanceof TableStyle) {
  37418. return $name;
  37419. }
  37420. if (isset(self::$styles[$name])) {
  37421. return self::$styles[$name];
  37422. }
  37423. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  37424. }
  37425. }
  37426. <?php
  37427. namespace Symfony\Component\Console\Helper;
  37428. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37429. class TableCell
  37430. {
  37431. private $value;
  37432. private $options = array(
  37433. 'rowspan' => 1,
  37434. 'colspan' => 1,
  37435. );
  37436. public function __construct($value = '', array $options = array())
  37437. {
  37438. if (is_numeric($value) && !\is_string($value)) {
  37439. $value = (string) $value;
  37440. }
  37441. $this->value = $value;
  37442. if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
  37443. throw new InvalidArgumentException(sprintf('The TableCell does not support the following options: \'%s\'.', implode('\', \'', $diff)));
  37444. }
  37445. $this->options = array_merge($this->options, $options);
  37446. }
  37447. public function __toString()
  37448. {
  37449. return $this->value;
  37450. }
  37451. public function getColspan()
  37452. {
  37453. return (int) $this->options['colspan'];
  37454. }
  37455. public function getRowspan()
  37456. {
  37457. return (int) $this->options['rowspan'];
  37458. }
  37459. }
  37460. <?php
  37461. namespace Symfony\Component\Console\Helper;
  37462. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37463. use Symfony\Component\Console\Output\NullOutput;
  37464. use Symfony\Component\Console\Output\OutputInterface;
  37465. class TableHelper extends Helper
  37466. {
  37467. const LAYOUT_DEFAULT = 0;
  37468. const LAYOUT_BORDERLESS = 1;
  37469. const LAYOUT_COMPACT = 2;
  37470. private $table;
  37471. public function __construct($triggerDeprecationError = true)
  37472. {
  37473. if ($triggerDeprecationError) {
  37474. @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);
  37475. }
  37476. $this->table = new Table(new NullOutput());
  37477. }
  37478. public function setLayout($layout)
  37479. {
  37480. switch ($layout) {
  37481. case self::LAYOUT_BORDERLESS:
  37482. $this->table->setStyle('borderless');
  37483. break;
  37484. case self::LAYOUT_COMPACT:
  37485. $this->table->setStyle('compact');
  37486. break;
  37487. case self::LAYOUT_DEFAULT:
  37488. $this->table->setStyle('default');
  37489. break;
  37490. default:
  37491. throw new InvalidArgumentException(sprintf('Invalid table layout "%s".', $layout));
  37492. }
  37493. return $this;
  37494. }
  37495. public function setHeaders(array $headers)
  37496. {
  37497. $this->table->setHeaders($headers);
  37498. return $this;
  37499. }
  37500. public function setRows(array $rows)
  37501. {
  37502. $this->table->setRows($rows);
  37503. return $this;
  37504. }
  37505. public function addRows(array $rows)
  37506. {
  37507. $this->table->addRows($rows);
  37508. return $this;
  37509. }
  37510. public function addRow(array $row)
  37511. {
  37512. $this->table->addRow($row);
  37513. return $this;
  37514. }
  37515. public function setRow($column, array $row)
  37516. {
  37517. $this->table->setRow($column, $row);
  37518. return $this;
  37519. }
  37520. public function setPaddingChar($paddingChar)
  37521. {
  37522. $this->table->getStyle()->setPaddingChar($paddingChar);
  37523. return $this;
  37524. }
  37525. public function setHorizontalBorderChar($horizontalBorderChar)
  37526. {
  37527. $this->table->getStyle()->setHorizontalBorderChar($horizontalBorderChar);
  37528. return $this;
  37529. }
  37530. public function setVerticalBorderChar($verticalBorderChar)
  37531. {
  37532. $this->table->getStyle()->setVerticalBorderChar($verticalBorderChar);
  37533. return $this;
  37534. }
  37535. public function setCrossingChar($crossingChar)
  37536. {
  37537. $this->table->getStyle()->setCrossingChar($crossingChar);
  37538. return $this;
  37539. }
  37540. public function setCellHeaderFormat($cellHeaderFormat)
  37541. {
  37542. $this->table->getStyle()->setCellHeaderFormat($cellHeaderFormat);
  37543. return $this;
  37544. }
  37545. public function setCellRowFormat($cellRowFormat)
  37546. {
  37547. $this->table->getStyle()->setCellHeaderFormat($cellRowFormat);
  37548. return $this;
  37549. }
  37550. public function setCellRowContentFormat($cellRowContentFormat)
  37551. {
  37552. $this->table->getStyle()->setCellRowContentFormat($cellRowContentFormat);
  37553. return $this;
  37554. }
  37555. public function setBorderFormat($borderFormat)
  37556. {
  37557. $this->table->getStyle()->setBorderFormat($borderFormat);
  37558. return $this;
  37559. }
  37560. public function setPadType($padType)
  37561. {
  37562. $this->table->getStyle()->setPadType($padType);
  37563. return $this;
  37564. }
  37565. public function render(OutputInterface $output)
  37566. {
  37567. $p = new \ReflectionProperty($this->table, 'output');
  37568. $p->setAccessible(true);
  37569. $p->setValue($this->table, $output);
  37570. $this->table->render();
  37571. }
  37572. public function getName()
  37573. {
  37574. return 'table';
  37575. }
  37576. }
  37577. <?php
  37578. namespace Symfony\Component\Console\Helper;
  37579. class TableSeparator extends TableCell
  37580. {
  37581. public function __construct(array $options = array())
  37582. {
  37583. parent::__construct('', $options);
  37584. }
  37585. }
  37586. <?php
  37587. namespace Symfony\Component\Console\Helper;
  37588. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37589. use Symfony\Component\Console\Exception\LogicException;
  37590. class TableStyle
  37591. {
  37592. private $paddingChar = ' ';
  37593. private $horizontalBorderChar = '-';
  37594. private $verticalBorderChar = '|';
  37595. private $crossingChar = '+';
  37596. private $cellHeaderFormat = '<info>%s</info>';
  37597. private $cellRowFormat = '%s';
  37598. private $cellRowContentFormat = ' %s ';
  37599. private $borderFormat = '%s';
  37600. private $padType = STR_PAD_RIGHT;
  37601. public function setPaddingChar($paddingChar)
  37602. {
  37603. if (!$paddingChar) {
  37604. throw new LogicException('The padding char must not be empty');
  37605. }
  37606. $this->paddingChar = $paddingChar;
  37607. return $this;
  37608. }
  37609. public function getPaddingChar()
  37610. {
  37611. return $this->paddingChar;
  37612. }
  37613. public function setHorizontalBorderChar($horizontalBorderChar)
  37614. {
  37615. $this->horizontalBorderChar = $horizontalBorderChar;
  37616. return $this;
  37617. }
  37618. public function getHorizontalBorderChar()
  37619. {
  37620. return $this->horizontalBorderChar;
  37621. }
  37622. public function setVerticalBorderChar($verticalBorderChar)
  37623. {
  37624. $this->verticalBorderChar = $verticalBorderChar;
  37625. return $this;
  37626. }
  37627. public function getVerticalBorderChar()
  37628. {
  37629. return $this->verticalBorderChar;
  37630. }
  37631. public function setCrossingChar($crossingChar)
  37632. {
  37633. $this->crossingChar = $crossingChar;
  37634. return $this;
  37635. }
  37636. public function getCrossingChar()
  37637. {
  37638. return $this->crossingChar;
  37639. }
  37640. public function setCellHeaderFormat($cellHeaderFormat)
  37641. {
  37642. $this->cellHeaderFormat = $cellHeaderFormat;
  37643. return $this;
  37644. }
  37645. public function getCellHeaderFormat()
  37646. {
  37647. return $this->cellHeaderFormat;
  37648. }
  37649. public function setCellRowFormat($cellRowFormat)
  37650. {
  37651. $this->cellRowFormat = $cellRowFormat;
  37652. return $this;
  37653. }
  37654. public function getCellRowFormat()
  37655. {
  37656. return $this->cellRowFormat;
  37657. }
  37658. public function setCellRowContentFormat($cellRowContentFormat)
  37659. {
  37660. $this->cellRowContentFormat = $cellRowContentFormat;
  37661. return $this;
  37662. }
  37663. public function getCellRowContentFormat()
  37664. {
  37665. return $this->cellRowContentFormat;
  37666. }
  37667. public function setBorderFormat($borderFormat)
  37668. {
  37669. $this->borderFormat = $borderFormat;
  37670. return $this;
  37671. }
  37672. public function getBorderFormat()
  37673. {
  37674. return $this->borderFormat;
  37675. }
  37676. public function setPadType($padType)
  37677. {
  37678. if (!\in_array($padType, array(STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH), true)) {
  37679. throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
  37680. }
  37681. $this->padType = $padType;
  37682. return $this;
  37683. }
  37684. public function getPadType()
  37685. {
  37686. return $this->padType;
  37687. }
  37688. }
  37689. <?php
  37690. namespace Symfony\Component\Console\Input;
  37691. use Symfony\Component\Console\Exception\RuntimeException;
  37692. class ArgvInput extends Input
  37693. {
  37694. private $tokens;
  37695. private $parsed;
  37696. public function __construct(array $argv = null, InputDefinition $definition = null)
  37697. {
  37698. if (null === $argv) {
  37699. $argv = $_SERVER['argv'];
  37700. }
  37701. array_shift($argv);
  37702. $this->tokens = $argv;
  37703. parent::__construct($definition);
  37704. }
  37705. protected function setTokens(array $tokens)
  37706. {
  37707. $this->tokens = $tokens;
  37708. }
  37709. protected function parse()
  37710. {
  37711. $parseOptions = true;
  37712. $this->parsed = $this->tokens;
  37713. while (null !== $token = array_shift($this->parsed)) {
  37714. if ($parseOptions && '' == $token) {
  37715. $this->parseArgument($token);
  37716. } elseif ($parseOptions && '--' == $token) {
  37717. $parseOptions = false;
  37718. } elseif ($parseOptions && 0 === strpos($token, '--')) {
  37719. $this->parseLongOption($token);
  37720. } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
  37721. $this->parseShortOption($token);
  37722. } else {
  37723. $this->parseArgument($token);
  37724. }
  37725. }
  37726. }
  37727. private function parseShortOption($token)
  37728. {
  37729. $name = substr($token, 1);
  37730. if (\strlen($name) > 1) {
  37731. if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptValue()) {
  37732. $this->addShortOption($name[0], substr($name, 1));
  37733. } else {
  37734. $this->parseShortOptionSet($name);
  37735. }
  37736. } else {
  37737. $this->addShortOption($name, null);
  37738. }
  37739. }
  37740. private function parseShortOptionSet($name)
  37741. {
  37742. $len = \strlen($name);
  37743. for ($i = 0; $i < $len; ++$i) {
  37744. if (!$this->definition->hasShortcut($name[$i])) {
  37745. $encoding = mb_detect_encoding($name, null, true);
  37746. throw new RuntimeException(sprintf('The "-%s" option does not exist.', false === $encoding ? $name[$i] : mb_substr($name, $i, 1, $encoding)));
  37747. }
  37748. $option = $this->definition->getOptionForShortcut($name[$i]);
  37749. if ($option->acceptValue()) {
  37750. $this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1));
  37751. break;
  37752. } else {
  37753. $this->addLongOption($option->getName(), null);
  37754. }
  37755. }
  37756. }
  37757. private function parseLongOption($token)
  37758. {
  37759. $name = substr($token, 2);
  37760. if (false !== $pos = strpos($name, '=')) {
  37761. if (0 === \strlen($value = substr($name, $pos + 1))) {
  37762. array_unshift($this->parsed, null);
  37763. }
  37764. $this->addLongOption(substr($name, 0, $pos), $value);
  37765. } else {
  37766. $this->addLongOption($name, null);
  37767. }
  37768. }
  37769. private function parseArgument($token)
  37770. {
  37771. $c = \count($this->arguments);
  37772. if ($this->definition->hasArgument($c)) {
  37773. $arg = $this->definition->getArgument($c);
  37774. $this->arguments[$arg->getName()] = $arg->isArray() ? array($token) : $token;
  37775. } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
  37776. $arg = $this->definition->getArgument($c - 1);
  37777. $this->arguments[$arg->getName()][] = $token;
  37778. } else {
  37779. $all = $this->definition->getArguments();
  37780. if (\count($all)) {
  37781. throw new RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all))));
  37782. }
  37783. throw new RuntimeException(sprintf('No arguments expected, got "%s".', $token));
  37784. }
  37785. }
  37786. private function addShortOption($shortcut, $value)
  37787. {
  37788. if (!$this->definition->hasShortcut($shortcut)) {
  37789. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
  37790. }
  37791. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  37792. }
  37793. private function addLongOption($name, $value)
  37794. {
  37795. if (!$this->definition->hasOption($name)) {
  37796. throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name));
  37797. }
  37798. $option = $this->definition->getOption($name);
  37799. if (!isset($value[0])) {
  37800. $value = null;
  37801. }
  37802. if (null !== $value && !$option->acceptValue()) {
  37803. throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
  37804. }
  37805. if (null === $value && $option->acceptValue() && \count($this->parsed)) {
  37806. $next = array_shift($this->parsed);
  37807. if (isset($next[0]) && '-' !== $next[0]) {
  37808. $value = $next;
  37809. } elseif (empty($next)) {
  37810. $value = null;
  37811. } else {
  37812. array_unshift($this->parsed, $next);
  37813. }
  37814. }
  37815. if (null === $value) {
  37816. if ($option->isValueRequired()) {
  37817. throw new RuntimeException(sprintf('The "--%s" option requires a value.', $name));
  37818. }
  37819. if (!$option->isArray()) {
  37820. $value = $option->isValueOptional() ? $option->getDefault() : true;
  37821. }
  37822. }
  37823. if ($option->isArray()) {
  37824. $this->options[$name][] = $value;
  37825. } else {
  37826. $this->options[$name] = $value;
  37827. }
  37828. }
  37829. public function getFirstArgument()
  37830. {
  37831. foreach ($this->tokens as $token) {
  37832. if ($token && '-' === $token[0]) {
  37833. continue;
  37834. }
  37835. return $token;
  37836. }
  37837. }
  37838. public function hasParameterOption($values)
  37839. {
  37840. $values = (array) $values;
  37841. foreach ($this->tokens as $token) {
  37842. foreach ($values as $value) {
  37843. $leading = 0 === strpos($value, '--') ? $value.'=' : $value;
  37844. if ($token === $value || '' !== $leading && 0 === strpos($token, $leading)) {
  37845. return true;
  37846. }
  37847. }
  37848. }
  37849. return false;
  37850. }
  37851. public function getParameterOption($values, $default = false)
  37852. {
  37853. $values = (array) $values;
  37854. $tokens = $this->tokens;
  37855. while (0 < \count($tokens)) {
  37856. $token = array_shift($tokens);
  37857. foreach ($values as $value) {
  37858. if ($token === $value) {
  37859. return array_shift($tokens);
  37860. }
  37861. $leading = 0 === strpos($value, '--') ? $value.'=' : $value;
  37862. if ('' !== $leading && 0 === strpos($token, $leading)) {
  37863. return substr($token, \strlen($leading));
  37864. }
  37865. }
  37866. }
  37867. return $default;
  37868. }
  37869. public function __toString()
  37870. {
  37871. $self = $this;
  37872. $tokens = array_map(function ($token) use ($self) {
  37873. if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
  37874. return $match[1].$self->escapeToken($match[2]);
  37875. }
  37876. if ($token && '-' !== $token[0]) {
  37877. return $self->escapeToken($token);
  37878. }
  37879. return $token;
  37880. }, $this->tokens);
  37881. return implode(' ', $tokens);
  37882. }
  37883. }
  37884. <?php
  37885. namespace Symfony\Component\Console\Input;
  37886. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37887. use Symfony\Component\Console\Exception\InvalidOptionException;
  37888. class ArrayInput extends Input
  37889. {
  37890. private $parameters;
  37891. public function __construct(array $parameters, InputDefinition $definition = null)
  37892. {
  37893. $this->parameters = $parameters;
  37894. parent::__construct($definition);
  37895. }
  37896. public function getFirstArgument()
  37897. {
  37898. foreach ($this->parameters as $key => $value) {
  37899. if ($key && '-' === $key[0]) {
  37900. continue;
  37901. }
  37902. return $value;
  37903. }
  37904. }
  37905. public function hasParameterOption($values)
  37906. {
  37907. $values = (array) $values;
  37908. foreach ($this->parameters as $k => $v) {
  37909. if (!\is_int($k)) {
  37910. $v = $k;
  37911. }
  37912. if (\in_array($v, $values)) {
  37913. return true;
  37914. }
  37915. }
  37916. return false;
  37917. }
  37918. public function getParameterOption($values, $default = false)
  37919. {
  37920. $values = (array) $values;
  37921. foreach ($this->parameters as $k => $v) {
  37922. if (\is_int($k)) {
  37923. if (\in_array($v, $values)) {
  37924. return true;
  37925. }
  37926. } elseif (\in_array($k, $values)) {
  37927. return $v;
  37928. }
  37929. }
  37930. return $default;
  37931. }
  37932. public function __toString()
  37933. {
  37934. $params = array();
  37935. foreach ($this->parameters as $param => $val) {
  37936. if ($param && '-' === $param[0]) {
  37937. if (\is_array($val)) {
  37938. foreach ($val as $v) {
  37939. $params[] = $param.('' != $v ? '='.$this->escapeToken($v) : '');
  37940. }
  37941. } else {
  37942. $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : '');
  37943. }
  37944. } else {
  37945. $params[] = \is_array($val) ? implode(' ', array_map(array($this, 'escapeToken'), $val)) : $this->escapeToken($val);
  37946. }
  37947. }
  37948. return implode(' ', $params);
  37949. }
  37950. protected function parse()
  37951. {
  37952. foreach ($this->parameters as $key => $value) {
  37953. if (0 === strpos($key, '--')) {
  37954. $this->addLongOption(substr($key, 2), $value);
  37955. } elseif ('-' === $key[0]) {
  37956. $this->addShortOption(substr($key, 1), $value);
  37957. } else {
  37958. $this->addArgument($key, $value);
  37959. }
  37960. }
  37961. }
  37962. private function addShortOption($shortcut, $value)
  37963. {
  37964. if (!$this->definition->hasShortcut($shortcut)) {
  37965. throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut));
  37966. }
  37967. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  37968. }
  37969. private function addLongOption($name, $value)
  37970. {
  37971. if (!$this->definition->hasOption($name)) {
  37972. throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
  37973. }
  37974. $option = $this->definition->getOption($name);
  37975. if (null === $value) {
  37976. if ($option->isValueRequired()) {
  37977. throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name));
  37978. }
  37979. $value = $option->isValueOptional() ? $option->getDefault() : true;
  37980. }
  37981. $this->options[$name] = $value;
  37982. }
  37983. private function addArgument($name, $value)
  37984. {
  37985. if (!$this->definition->hasArgument($name)) {
  37986. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  37987. }
  37988. $this->arguments[$name] = $value;
  37989. }
  37990. }
  37991. <?php
  37992. namespace Symfony\Component\Console\Input;
  37993. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37994. use Symfony\Component\Console\Exception\RuntimeException;
  37995. abstract class Input implements InputInterface
  37996. {
  37997. protected $definition;
  37998. protected $options = array();
  37999. protected $arguments = array();
  38000. protected $interactive = true;
  38001. public function __construct(InputDefinition $definition = null)
  38002. {
  38003. if (null === $definition) {
  38004. $this->definition = new InputDefinition();
  38005. } else {
  38006. $this->bind($definition);
  38007. $this->validate();
  38008. }
  38009. }
  38010. public function bind(InputDefinition $definition)
  38011. {
  38012. $this->arguments = array();
  38013. $this->options = array();
  38014. $this->definition = $definition;
  38015. $this->parse();
  38016. }
  38017. abstract protected function parse();
  38018. public function validate()
  38019. {
  38020. $definition = $this->definition;
  38021. $givenArguments = $this->arguments;
  38022. $missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) {
  38023. return !array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired();
  38024. });
  38025. if (\count($missingArguments) > 0) {
  38026. throw new RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments)));
  38027. }
  38028. }
  38029. public function isInteractive()
  38030. {
  38031. return $this->interactive;
  38032. }
  38033. public function setInteractive($interactive)
  38034. {
  38035. $this->interactive = (bool) $interactive;
  38036. }
  38037. public function getArguments()
  38038. {
  38039. return array_merge($this->definition->getArgumentDefaults(), $this->arguments);
  38040. }
  38041. public function getArgument($name)
  38042. {
  38043. if (!$this->definition->hasArgument($name)) {
  38044. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  38045. }
  38046. return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)->getDefault();
  38047. }
  38048. public function setArgument($name, $value)
  38049. {
  38050. if (!$this->definition->hasArgument($name)) {
  38051. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  38052. }
  38053. $this->arguments[$name] = $value;
  38054. }
  38055. public function hasArgument($name)
  38056. {
  38057. return $this->definition->hasArgument($name);
  38058. }
  38059. public function getOptions()
  38060. {
  38061. return array_merge($this->definition->getOptionDefaults(), $this->options);
  38062. }
  38063. public function getOption($name)
  38064. {
  38065. if (!$this->definition->hasOption($name)) {
  38066. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  38067. }
  38068. return isset($this->options[$name]) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
  38069. }
  38070. public function setOption($name, $value)
  38071. {
  38072. if (!$this->definition->hasOption($name)) {
  38073. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  38074. }
  38075. $this->options[$name] = $value;
  38076. }
  38077. public function hasOption($name)
  38078. {
  38079. return $this->definition->hasOption($name);
  38080. }
  38081. public function escapeToken($token)
  38082. {
  38083. return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token);
  38084. }
  38085. }
  38086. <?php
  38087. namespace Symfony\Component\Console\Input;
  38088. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38089. use Symfony\Component\Console\Exception\LogicException;
  38090. class InputArgument
  38091. {
  38092. const REQUIRED = 1;
  38093. const OPTIONAL = 2;
  38094. const IS_ARRAY = 4;
  38095. private $name;
  38096. private $mode;
  38097. private $default;
  38098. private $description;
  38099. public function __construct($name, $mode = null, $description = '', $default = null)
  38100. {
  38101. if (null === $mode) {
  38102. $mode = self::OPTIONAL;
  38103. } elseif (!\is_int($mode) || $mode > 7 || $mode < 1) {
  38104. throw new InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode));
  38105. }
  38106. $this->name = $name;
  38107. $this->mode = $mode;
  38108. $this->description = $description;
  38109. $this->setDefault($default);
  38110. }
  38111. public function getName()
  38112. {
  38113. return $this->name;
  38114. }
  38115. public function isRequired()
  38116. {
  38117. return self::REQUIRED === (self::REQUIRED & $this->mode);
  38118. }
  38119. public function isArray()
  38120. {
  38121. return self::IS_ARRAY === (self::IS_ARRAY & $this->mode);
  38122. }
  38123. public function setDefault($default = null)
  38124. {
  38125. if (self::REQUIRED === $this->mode && null !== $default) {
  38126. throw new LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.');
  38127. }
  38128. if ($this->isArray()) {
  38129. if (null === $default) {
  38130. $default = array();
  38131. } elseif (!\is_array($default)) {
  38132. throw new LogicException('A default value for an array argument must be an array.');
  38133. }
  38134. }
  38135. $this->default = $default;
  38136. }
  38137. public function getDefault()
  38138. {
  38139. return $this->default;
  38140. }
  38141. public function getDescription()
  38142. {
  38143. return $this->description;
  38144. }
  38145. }
  38146. <?php
  38147. namespace Symfony\Component\Console\Input;
  38148. interface InputAwareInterface
  38149. {
  38150. public function setInput(InputInterface $input);
  38151. }
  38152. <?php
  38153. namespace Symfony\Component\Console\Input;
  38154. use Symfony\Component\Console\Descriptor\TextDescriptor;
  38155. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  38156. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38157. use Symfony\Component\Console\Exception\LogicException;
  38158. use Symfony\Component\Console\Output\BufferedOutput;
  38159. class InputDefinition
  38160. {
  38161. private $arguments;
  38162. private $requiredCount;
  38163. private $hasAnArrayArgument = false;
  38164. private $hasOptional;
  38165. private $options;
  38166. private $shortcuts;
  38167. public function __construct(array $definition = array())
  38168. {
  38169. $this->setDefinition($definition);
  38170. }
  38171. public function setDefinition(array $definition)
  38172. {
  38173. $arguments = array();
  38174. $options = array();
  38175. foreach ($definition as $item) {
  38176. if ($item instanceof InputOption) {
  38177. $options[] = $item;
  38178. } else {
  38179. $arguments[] = $item;
  38180. }
  38181. }
  38182. $this->setArguments($arguments);
  38183. $this->setOptions($options);
  38184. }
  38185. public function setArguments($arguments = array())
  38186. {
  38187. $this->arguments = array();
  38188. $this->requiredCount = 0;
  38189. $this->hasOptional = false;
  38190. $this->hasAnArrayArgument = false;
  38191. $this->addArguments($arguments);
  38192. }
  38193. public function addArguments($arguments = array())
  38194. {
  38195. if (null !== $arguments) {
  38196. foreach ($arguments as $argument) {
  38197. $this->addArgument($argument);
  38198. }
  38199. }
  38200. }
  38201. public function addArgument(InputArgument $argument)
  38202. {
  38203. if (isset($this->arguments[$argument->getName()])) {
  38204. throw new LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
  38205. }
  38206. if ($this->hasAnArrayArgument) {
  38207. throw new LogicException('Cannot add an argument after an array argument.');
  38208. }
  38209. if ($argument->isRequired() && $this->hasOptional) {
  38210. throw new LogicException('Cannot add a required argument after an optional one.');
  38211. }
  38212. if ($argument->isArray()) {
  38213. $this->hasAnArrayArgument = true;
  38214. }
  38215. if ($argument->isRequired()) {
  38216. ++$this->requiredCount;
  38217. } else {
  38218. $this->hasOptional = true;
  38219. }
  38220. $this->arguments[$argument->getName()] = $argument;
  38221. }
  38222. public function getArgument($name)
  38223. {
  38224. if (!$this->hasArgument($name)) {
  38225. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  38226. }
  38227. $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
  38228. return $arguments[$name];
  38229. }
  38230. public function hasArgument($name)
  38231. {
  38232. $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
  38233. return isset($arguments[$name]);
  38234. }
  38235. public function getArguments()
  38236. {
  38237. return $this->arguments;
  38238. }
  38239. public function getArgumentCount()
  38240. {
  38241. return $this->hasAnArrayArgument ? PHP_INT_MAX : \count($this->arguments);
  38242. }
  38243. public function getArgumentRequiredCount()
  38244. {
  38245. return $this->requiredCount;
  38246. }
  38247. public function getArgumentDefaults()
  38248. {
  38249. $values = array();
  38250. foreach ($this->arguments as $argument) {
  38251. $values[$argument->getName()] = $argument->getDefault();
  38252. }
  38253. return $values;
  38254. }
  38255. public function setOptions($options = array())
  38256. {
  38257. $this->options = array();
  38258. $this->shortcuts = array();
  38259. $this->addOptions($options);
  38260. }
  38261. public function addOptions($options = array())
  38262. {
  38263. foreach ($options as $option) {
  38264. $this->addOption($option);
  38265. }
  38266. }
  38267. public function addOption(InputOption $option)
  38268. {
  38269. if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
  38270. throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
  38271. }
  38272. if ($option->getShortcut()) {
  38273. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  38274. if (isset($this->shortcuts[$shortcut]) && !$option->equals($this->options[$this->shortcuts[$shortcut]])) {
  38275. throw new LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
  38276. }
  38277. }
  38278. }
  38279. $this->options[$option->getName()] = $option;
  38280. if ($option->getShortcut()) {
  38281. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  38282. $this->shortcuts[$shortcut] = $option->getName();
  38283. }
  38284. }
  38285. }
  38286. public function getOption($name)
  38287. {
  38288. if (!$this->hasOption($name)) {
  38289. throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name));
  38290. }
  38291. return $this->options[$name];
  38292. }
  38293. public function hasOption($name)
  38294. {
  38295. return isset($this->options[$name]);
  38296. }
  38297. public function getOptions()
  38298. {
  38299. return $this->options;
  38300. }
  38301. public function hasShortcut($name)
  38302. {
  38303. return isset($this->shortcuts[$name]);
  38304. }
  38305. public function getOptionForShortcut($shortcut)
  38306. {
  38307. return $this->getOption($this->shortcutToName($shortcut));
  38308. }
  38309. public function getOptionDefaults()
  38310. {
  38311. $values = array();
  38312. foreach ($this->options as $option) {
  38313. $values[$option->getName()] = $option->getDefault();
  38314. }
  38315. return $values;
  38316. }
  38317. private function shortcutToName($shortcut)
  38318. {
  38319. if (!isset($this->shortcuts[$shortcut])) {
  38320. throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
  38321. }
  38322. return $this->shortcuts[$shortcut];
  38323. }
  38324. public function getSynopsis($short = false)
  38325. {
  38326. $elements = array();
  38327. if ($short && $this->getOptions()) {
  38328. $elements[] = '[options]';
  38329. } elseif (!$short) {
  38330. foreach ($this->getOptions() as $option) {
  38331. $value = '';
  38332. if ($option->acceptValue()) {
  38333. $value = sprintf(
  38334. ' %s%s%s',
  38335. $option->isValueOptional() ? '[' : '',
  38336. strtoupper($option->getName()),
  38337. $option->isValueOptional() ? ']' : ''
  38338. );
  38339. }
  38340. $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
  38341. $elements[] = sprintf('[%s--%s%s]', $shortcut, $option->getName(), $value);
  38342. }
  38343. }
  38344. if (\count($elements) && $this->getArguments()) {
  38345. $elements[] = '[--]';
  38346. }
  38347. foreach ($this->getArguments() as $argument) {
  38348. $element = '<'.$argument->getName().'>';
  38349. if (!$argument->isRequired()) {
  38350. $element = '['.$element.']';
  38351. } elseif ($argument->isArray()) {
  38352. $element .= ' ('.$element.')';
  38353. }
  38354. if ($argument->isArray()) {
  38355. $element .= '...';
  38356. }
  38357. $elements[] = $element;
  38358. }
  38359. return implode(' ', $elements);
  38360. }
  38361. public function asText()
  38362. {
  38363. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  38364. $descriptor = new TextDescriptor();
  38365. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  38366. $descriptor->describe($output, $this, array('raw_output' => true));
  38367. return $output->fetch();
  38368. }
  38369. public function asXml($asDom = false)
  38370. {
  38371. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  38372. $descriptor = new XmlDescriptor();
  38373. if ($asDom) {
  38374. return $descriptor->getInputDefinitionDocument($this);
  38375. }
  38376. $output = new BufferedOutput();
  38377. $descriptor->describe($output, $this);
  38378. return $output->fetch();
  38379. }
  38380. }
  38381. <?php
  38382. namespace Symfony\Component\Console\Input;
  38383. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38384. use Symfony\Component\Console\Exception\RuntimeException;
  38385. interface InputInterface
  38386. {
  38387. public function getFirstArgument();
  38388. public function hasParameterOption($values);
  38389. public function getParameterOption($values, $default = false);
  38390. public function bind(InputDefinition $definition);
  38391. public function validate();
  38392. public function getArguments();
  38393. public function getArgument($name);
  38394. public function setArgument($name, $value);
  38395. public function hasArgument($name);
  38396. public function getOptions();
  38397. public function getOption($name);
  38398. public function setOption($name, $value);
  38399. public function hasOption($name);
  38400. public function isInteractive();
  38401. public function setInteractive($interactive);
  38402. }
  38403. <?php
  38404. namespace Symfony\Component\Console\Input;
  38405. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38406. use Symfony\Component\Console\Exception\LogicException;
  38407. class InputOption
  38408. {
  38409. const VALUE_NONE = 1;
  38410. const VALUE_REQUIRED = 2;
  38411. const VALUE_OPTIONAL = 4;
  38412. const VALUE_IS_ARRAY = 8;
  38413. private $name;
  38414. private $shortcut;
  38415. private $mode;
  38416. private $default;
  38417. private $description;
  38418. public function __construct($name, $shortcut = null, $mode = null, $description = '', $default = null)
  38419. {
  38420. if (0 === strpos($name, '--')) {
  38421. $name = substr($name, 2);
  38422. }
  38423. if (empty($name)) {
  38424. throw new InvalidArgumentException('An option name cannot be empty.');
  38425. }
  38426. if (empty($shortcut)) {
  38427. $shortcut = null;
  38428. }
  38429. if (null !== $shortcut) {
  38430. if (\is_array($shortcut)) {
  38431. $shortcut = implode('|', $shortcut);
  38432. }
  38433. $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
  38434. $shortcuts = array_filter($shortcuts);
  38435. $shortcut = implode('|', $shortcuts);
  38436. if (empty($shortcut)) {
  38437. throw new InvalidArgumentException('An option shortcut cannot be empty.');
  38438. }
  38439. }
  38440. if (null === $mode) {
  38441. $mode = self::VALUE_NONE;
  38442. } elseif (!\is_int($mode) || $mode > 15 || $mode < 1) {
  38443. throw new InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
  38444. }
  38445. $this->name = $name;
  38446. $this->shortcut = $shortcut;
  38447. $this->mode = $mode;
  38448. $this->description = $description;
  38449. if ($this->isArray() && !$this->acceptValue()) {
  38450. throw new InvalidArgumentException('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.');
  38451. }
  38452. $this->setDefault($default);
  38453. }
  38454. public function getShortcut()
  38455. {
  38456. return $this->shortcut;
  38457. }
  38458. public function getName()
  38459. {
  38460. return $this->name;
  38461. }
  38462. public function acceptValue()
  38463. {
  38464. return $this->isValueRequired() || $this->isValueOptional();
  38465. }
  38466. public function isValueRequired()
  38467. {
  38468. return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode);
  38469. }
  38470. public function isValueOptional()
  38471. {
  38472. return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode);
  38473. }
  38474. public function isArray()
  38475. {
  38476. return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode);
  38477. }
  38478. public function setDefault($default = null)
  38479. {
  38480. if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
  38481. throw new LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
  38482. }
  38483. if ($this->isArray()) {
  38484. if (null === $default) {
  38485. $default = array();
  38486. } elseif (!\is_array($default)) {
  38487. throw new LogicException('A default value for an array option must be an array.');
  38488. }
  38489. }
  38490. $this->default = $this->acceptValue() ? $default : false;
  38491. }
  38492. public function getDefault()
  38493. {
  38494. return $this->default;
  38495. }
  38496. public function getDescription()
  38497. {
  38498. return $this->description;
  38499. }
  38500. public function equals(self $option)
  38501. {
  38502. return $option->getName() === $this->getName()
  38503. && $option->getShortcut() === $this->getShortcut()
  38504. && $option->getDefault() === $this->getDefault()
  38505. && $option->isArray() === $this->isArray()
  38506. && $option->isValueRequired() === $this->isValueRequired()
  38507. && $option->isValueOptional() === $this->isValueOptional()
  38508. ;
  38509. }
  38510. }
  38511. <?php
  38512. namespace Symfony\Component\Console\Input;
  38513. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38514. class StringInput extends ArgvInput
  38515. {
  38516. const REGEX_STRING = '([^\s]+?)(?:\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
  38517. const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
  38518. public function __construct($input, InputDefinition $definition = null)
  38519. {
  38520. if ($definition) {
  38521. @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);
  38522. }
  38523. parent::__construct(array(), null);
  38524. $this->setTokens($this->tokenize($input));
  38525. if (null !== $definition) {
  38526. $this->bind($definition);
  38527. }
  38528. }
  38529. private function tokenize($input)
  38530. {
  38531. $tokens = array();
  38532. $length = \strlen($input);
  38533. $cursor = 0;
  38534. while ($cursor < $length) {
  38535. if (preg_match('/\s+/A', $input, $match, null, $cursor)) {
  38536. } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) {
  38537. $tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, \strlen($match[3]) - 2)));
  38538. } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) {
  38539. $tokens[] = stripcslashes(substr($match[0], 1, \strlen($match[0]) - 2));
  38540. } elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) {
  38541. $tokens[] = stripcslashes($match[1]);
  38542. } else {
  38543. throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10)));
  38544. }
  38545. $cursor += \strlen($match[0]);
  38546. }
  38547. return $tokens;
  38548. }
  38549. }
  38550. Copyright (c) 2004-2018 Fabien Potencier
  38551. Permission is hereby granted, free of charge, to any person obtaining a copy
  38552. of this software and associated documentation files (the "Software"), to deal
  38553. in the Software without restriction, including without limitation the rights
  38554. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  38555. copies of the Software, and to permit persons to whom the Software is furnished
  38556. to do so, subject to the following conditions:
  38557. The above copyright notice and this permission notice shall be included in all
  38558. copies or substantial portions of the Software.
  38559. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  38560. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  38561. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  38562. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  38563. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  38564. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  38565. THE SOFTWARE.
  38566. <?php
  38567. namespace Symfony\Component\Console\Logger;
  38568. use Psr\Log\AbstractLogger;
  38569. use Psr\Log\InvalidArgumentException;
  38570. use Psr\Log\LogLevel;
  38571. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  38572. use Symfony\Component\Console\Output\OutputInterface;
  38573. class ConsoleLogger extends AbstractLogger
  38574. {
  38575. const INFO = 'info';
  38576. const ERROR = 'error';
  38577. private $output;
  38578. private $verbosityLevelMap = array(
  38579. LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL,
  38580. LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL,
  38581. LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL,
  38582. LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL,
  38583. LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL,
  38584. LogLevel::NOTICE => OutputInterface::VERBOSITY_VERBOSE,
  38585. LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE,
  38586. LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  38587. );
  38588. private $formatLevelMap = array(
  38589. LogLevel::EMERGENCY => self::ERROR,
  38590. LogLevel::ALERT => self::ERROR,
  38591. LogLevel::CRITICAL => self::ERROR,
  38592. LogLevel::ERROR => self::ERROR,
  38593. LogLevel::WARNING => self::INFO,
  38594. LogLevel::NOTICE => self::INFO,
  38595. LogLevel::INFO => self::INFO,
  38596. LogLevel::DEBUG => self::INFO,
  38597. );
  38598. public function __construct(OutputInterface $output, array $verbosityLevelMap = array(), array $formatLevelMap = array())
  38599. {
  38600. $this->output = $output;
  38601. $this->verbosityLevelMap = $verbosityLevelMap + $this->verbosityLevelMap;
  38602. $this->formatLevelMap = $formatLevelMap + $this->formatLevelMap;
  38603. }
  38604. public function log($level, $message, array $context = array())
  38605. {
  38606. if (!isset($this->verbosityLevelMap[$level])) {
  38607. throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
  38608. }
  38609. if (self::ERROR === $this->formatLevelMap[$level] && $this->output instanceof ConsoleOutputInterface) {
  38610. $output = $this->output->getErrorOutput();
  38611. } else {
  38612. $output = $this->output;
  38613. }
  38614. if ($output->getVerbosity() >= $this->verbosityLevelMap[$level]) {
  38615. $output->writeln(sprintf('<%1$s>[%2$s] %3$s</%1$s>', $this->formatLevelMap[$level], $level, $this->interpolate($message, $context)));
  38616. }
  38617. }
  38618. private function interpolate($message, array $context)
  38619. {
  38620. $replace = array();
  38621. foreach ($context as $key => $val) {
  38622. if (!\is_array($val) && (!\is_object($val) || method_exists($val, '__toString'))) {
  38623. $replace[sprintf('{%s}', $key)] = $val;
  38624. }
  38625. }
  38626. return strtr($message, $replace);
  38627. }
  38628. }
  38629. <?php
  38630. namespace Symfony\Component\Console\Output;
  38631. class BufferedOutput extends Output
  38632. {
  38633. private $buffer = '';
  38634. public function fetch()
  38635. {
  38636. $content = $this->buffer;
  38637. $this->buffer = '';
  38638. return $content;
  38639. }
  38640. protected function doWrite($message, $newline)
  38641. {
  38642. $this->buffer .= $message;
  38643. if ($newline) {
  38644. $this->buffer .= PHP_EOL;
  38645. }
  38646. }
  38647. }
  38648. <?php
  38649. namespace Symfony\Component\Console\Output;
  38650. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  38651. class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
  38652. {
  38653. private $stderr;
  38654. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  38655. {
  38656. parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
  38657. $actualDecorated = $this->isDecorated();
  38658. $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
  38659. if (null === $decorated) {
  38660. $this->setDecorated($actualDecorated && $this->stderr->isDecorated());
  38661. }
  38662. }
  38663. public function setDecorated($decorated)
  38664. {
  38665. parent::setDecorated($decorated);
  38666. $this->stderr->setDecorated($decorated);
  38667. }
  38668. public function setFormatter(OutputFormatterInterface $formatter)
  38669. {
  38670. parent::setFormatter($formatter);
  38671. $this->stderr->setFormatter($formatter);
  38672. }
  38673. public function setVerbosity($level)
  38674. {
  38675. parent::setVerbosity($level);
  38676. $this->stderr->setVerbosity($level);
  38677. }
  38678. public function getErrorOutput()
  38679. {
  38680. return $this->stderr;
  38681. }
  38682. public function setErrorOutput(OutputInterface $error)
  38683. {
  38684. $this->stderr = $error;
  38685. }
  38686. protected function hasStdoutSupport()
  38687. {
  38688. return false === $this->isRunningOS400();
  38689. }
  38690. protected function hasStderrSupport()
  38691. {
  38692. return false === $this->isRunningOS400();
  38693. }
  38694. private function isRunningOS400()
  38695. {
  38696. $checks = array(
  38697. \function_exists('php_uname') ? php_uname('s') : '',
  38698. getenv('OSTYPE'),
  38699. PHP_OS,
  38700. );
  38701. return false !== stripos(implode(';', $checks), 'OS400');
  38702. }
  38703. private function openOutputStream()
  38704. {
  38705. $outputStream = $this->hasStdoutSupport() ? 'php://stdout' : 'php://output';
  38706. return @fopen($outputStream, 'w') ?: fopen('php://output', 'w');
  38707. }
  38708. private function openErrorStream()
  38709. {
  38710. $errorStream = $this->hasStderrSupport() ? 'php://stderr' : 'php://output';
  38711. return fopen($errorStream, 'w');
  38712. }
  38713. }
  38714. <?php
  38715. namespace Symfony\Component\Console\Output;
  38716. interface ConsoleOutputInterface extends OutputInterface
  38717. {
  38718. public function getErrorOutput();
  38719. public function setErrorOutput(OutputInterface $error);
  38720. }
  38721. <?php
  38722. namespace Symfony\Component\Console\Output;
  38723. use Symfony\Component\Console\Formatter\OutputFormatter;
  38724. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  38725. class NullOutput implements OutputInterface
  38726. {
  38727. public function setFormatter(OutputFormatterInterface $formatter)
  38728. {
  38729. }
  38730. public function getFormatter()
  38731. {
  38732. return new OutputFormatter();
  38733. }
  38734. public function setDecorated($decorated)
  38735. {
  38736. }
  38737. public function isDecorated()
  38738. {
  38739. return false;
  38740. }
  38741. public function setVerbosity($level)
  38742. {
  38743. }
  38744. public function getVerbosity()
  38745. {
  38746. return self::VERBOSITY_QUIET;
  38747. }
  38748. public function isQuiet()
  38749. {
  38750. return true;
  38751. }
  38752. public function isVerbose()
  38753. {
  38754. return false;
  38755. }
  38756. public function isVeryVerbose()
  38757. {
  38758. return false;
  38759. }
  38760. public function isDebug()
  38761. {
  38762. return false;
  38763. }
  38764. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  38765. {
  38766. }
  38767. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  38768. {
  38769. }
  38770. }
  38771. <?php
  38772. namespace Symfony\Component\Console\Output;
  38773. use Symfony\Component\Console\Formatter\OutputFormatter;
  38774. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  38775. abstract class Output implements OutputInterface
  38776. {
  38777. private $verbosity;
  38778. private $formatter;
  38779. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = false, OutputFormatterInterface $formatter = null)
  38780. {
  38781. $this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
  38782. $this->formatter = $formatter ?: new OutputFormatter();
  38783. $this->formatter->setDecorated($decorated);
  38784. }
  38785. public function setFormatter(OutputFormatterInterface $formatter)
  38786. {
  38787. $this->formatter = $formatter;
  38788. }
  38789. public function getFormatter()
  38790. {
  38791. return $this->formatter;
  38792. }
  38793. public function setDecorated($decorated)
  38794. {
  38795. $this->formatter->setDecorated($decorated);
  38796. }
  38797. public function isDecorated()
  38798. {
  38799. return $this->formatter->isDecorated();
  38800. }
  38801. public function setVerbosity($level)
  38802. {
  38803. $this->verbosity = (int) $level;
  38804. }
  38805. public function getVerbosity()
  38806. {
  38807. return $this->verbosity;
  38808. }
  38809. public function isQuiet()
  38810. {
  38811. return self::VERBOSITY_QUIET === $this->verbosity;
  38812. }
  38813. public function isVerbose()
  38814. {
  38815. return self::VERBOSITY_VERBOSE <= $this->verbosity;
  38816. }
  38817. public function isVeryVerbose()
  38818. {
  38819. return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
  38820. }
  38821. public function isDebug()
  38822. {
  38823. return self::VERBOSITY_DEBUG <= $this->verbosity;
  38824. }
  38825. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  38826. {
  38827. $this->write($messages, true, $options);
  38828. }
  38829. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  38830. {
  38831. $messages = (array) $messages;
  38832. $types = self::OUTPUT_NORMAL | self::OUTPUT_RAW | self::OUTPUT_PLAIN;
  38833. $type = $types & $options ?: self::OUTPUT_NORMAL;
  38834. $verbosities = self::VERBOSITY_QUIET | self::VERBOSITY_NORMAL | self::VERBOSITY_VERBOSE | self::VERBOSITY_VERY_VERBOSE | self::VERBOSITY_DEBUG;
  38835. $verbosity = $verbosities & $options ?: self::VERBOSITY_NORMAL;
  38836. if ($verbosity > $this->getVerbosity()) {
  38837. return;
  38838. }
  38839. foreach ($messages as $message) {
  38840. switch ($type) {
  38841. case OutputInterface::OUTPUT_NORMAL:
  38842. $message = $this->formatter->format($message);
  38843. break;
  38844. case OutputInterface::OUTPUT_RAW:
  38845. break;
  38846. case OutputInterface::OUTPUT_PLAIN:
  38847. $message = strip_tags($this->formatter->format($message));
  38848. break;
  38849. }
  38850. $this->doWrite($message, $newline);
  38851. }
  38852. }
  38853. abstract protected function doWrite($message, $newline);
  38854. }
  38855. <?php
  38856. namespace Symfony\Component\Console\Output;
  38857. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  38858. interface OutputInterface
  38859. {
  38860. const VERBOSITY_QUIET = 16;
  38861. const VERBOSITY_NORMAL = 32;
  38862. const VERBOSITY_VERBOSE = 64;
  38863. const VERBOSITY_VERY_VERBOSE = 128;
  38864. const VERBOSITY_DEBUG = 256;
  38865. const OUTPUT_NORMAL = 1;
  38866. const OUTPUT_RAW = 2;
  38867. const OUTPUT_PLAIN = 4;
  38868. public function write($messages, $newline = false, $options = 0);
  38869. public function writeln($messages, $options = 0);
  38870. public function setVerbosity($level);
  38871. public function getVerbosity();
  38872. public function setDecorated($decorated);
  38873. public function isDecorated();
  38874. public function setFormatter(OutputFormatterInterface $formatter);
  38875. public function getFormatter();
  38876. }
  38877. <?php
  38878. namespace Symfony\Component\Console\Output;
  38879. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38880. use Symfony\Component\Console\Exception\RuntimeException;
  38881. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  38882. class StreamOutput extends Output
  38883. {
  38884. private $stream;
  38885. public function __construct($stream, $verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  38886. {
  38887. if (!\is_resource($stream) || 'stream' !== get_resource_type($stream)) {
  38888. throw new InvalidArgumentException('The StreamOutput class needs a stream as its first argument.');
  38889. }
  38890. $this->stream = $stream;
  38891. if (null === $decorated) {
  38892. $decorated = $this->hasColorSupport();
  38893. }
  38894. parent::__construct($verbosity, $decorated, $formatter);
  38895. }
  38896. public function getStream()
  38897. {
  38898. return $this->stream;
  38899. }
  38900. protected function doWrite($message, $newline)
  38901. {
  38902. if ($newline) {
  38903. $message .= PHP_EOL;
  38904. }
  38905. if (false === @fwrite($this->stream, $message)) {
  38906. throw new RuntimeException('Unable to write output.');
  38907. }
  38908. fflush($this->stream);
  38909. }
  38910. protected function hasColorSupport()
  38911. {
  38912. if ('Hyper' === getenv('TERM_PROGRAM')) {
  38913. return true;
  38914. }
  38915. if (\DIRECTORY_SEPARATOR === '\\') {
  38916. return (\function_exists('sapi_windows_vt100_support')
  38917. && @sapi_windows_vt100_support($this->stream))
  38918. || false !== getenv('ANSICON')
  38919. || 'ON' === getenv('ConEmuANSI')
  38920. || 'xterm' === getenv('TERM');
  38921. }
  38922. if (\function_exists('stream_isatty')) {
  38923. return @stream_isatty($this->stream);
  38924. }
  38925. if (\function_exists('posix_isatty')) {
  38926. return @posix_isatty($this->stream);
  38927. }
  38928. $stat = @fstat($this->stream);
  38929. return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
  38930. }
  38931. }
  38932. <?php
  38933. namespace Symfony\Component\Console\Question;
  38934. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38935. class ChoiceQuestion extends Question
  38936. {
  38937. private $choices;
  38938. private $multiselect = false;
  38939. private $prompt = ' > ';
  38940. private $errorMessage = 'Value "%s" is invalid';
  38941. public function __construct($question, array $choices, $default = null)
  38942. {
  38943. if (!$choices) {
  38944. throw new \LogicException('Choice question must have at least 1 choice available.');
  38945. }
  38946. parent::__construct($question, $default);
  38947. $this->choices = $choices;
  38948. $this->setValidator($this->getDefaultValidator());
  38949. $this->setAutocompleterValues($choices);
  38950. }
  38951. public function getChoices()
  38952. {
  38953. return $this->choices;
  38954. }
  38955. public function setMultiselect($multiselect)
  38956. {
  38957. $this->multiselect = $multiselect;
  38958. $this->setValidator($this->getDefaultValidator());
  38959. return $this;
  38960. }
  38961. public function isMultiselect()
  38962. {
  38963. return $this->multiselect;
  38964. }
  38965. public function getPrompt()
  38966. {
  38967. return $this->prompt;
  38968. }
  38969. public function setPrompt($prompt)
  38970. {
  38971. $this->prompt = $prompt;
  38972. return $this;
  38973. }
  38974. public function setErrorMessage($errorMessage)
  38975. {
  38976. $this->errorMessage = $errorMessage;
  38977. $this->setValidator($this->getDefaultValidator());
  38978. return $this;
  38979. }
  38980. private function getDefaultValidator()
  38981. {
  38982. $choices = $this->choices;
  38983. $errorMessage = $this->errorMessage;
  38984. $multiselect = $this->multiselect;
  38985. $isAssoc = $this->isAssoc($choices);
  38986. return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) {
  38987. $selectedChoices = str_replace(' ', '', $selected);
  38988. if ($multiselect) {
  38989. if (!preg_match('/^[^,]+(?:,[^,]+)*$/', $selectedChoices, $matches)) {
  38990. throw new InvalidArgumentException(sprintf($errorMessage, $selected));
  38991. }
  38992. $selectedChoices = explode(',', $selectedChoices);
  38993. } else {
  38994. $selectedChoices = array($selected);
  38995. }
  38996. $multiselectChoices = array();
  38997. foreach ($selectedChoices as $value) {
  38998. $results = array();
  38999. foreach ($choices as $key => $choice) {
  39000. if ($choice === $value) {
  39001. $results[] = $key;
  39002. }
  39003. }
  39004. if (\count($results) > 1) {
  39005. throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of %s.', implode(' or ', $results)));
  39006. }
  39007. $result = array_search($value, $choices);
  39008. if (!$isAssoc) {
  39009. if (false !== $result) {
  39010. $result = $choices[$result];
  39011. } elseif (isset($choices[$value])) {
  39012. $result = $choices[$value];
  39013. }
  39014. } elseif (false === $result && isset($choices[$value])) {
  39015. $result = $value;
  39016. }
  39017. if (false === $result) {
  39018. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  39019. }
  39020. $multiselectChoices[] = (string) $result;
  39021. }
  39022. if ($multiselect) {
  39023. return $multiselectChoices;
  39024. }
  39025. return current($multiselectChoices);
  39026. };
  39027. }
  39028. }
  39029. <?php
  39030. namespace Symfony\Component\Console\Question;
  39031. class ConfirmationQuestion extends Question
  39032. {
  39033. private $trueAnswerRegex;
  39034. public function __construct($question, $default = true, $trueAnswerRegex = '/^y/i')
  39035. {
  39036. parent::__construct($question, (bool) $default);
  39037. $this->trueAnswerRegex = $trueAnswerRegex;
  39038. $this->setNormalizer($this->getDefaultNormalizer());
  39039. }
  39040. private function getDefaultNormalizer()
  39041. {
  39042. $default = $this->getDefault();
  39043. $regex = $this->trueAnswerRegex;
  39044. return function ($answer) use ($default, $regex) {
  39045. if (\is_bool($answer)) {
  39046. return $answer;
  39047. }
  39048. $answerIsTrue = (bool) preg_match($regex, $answer);
  39049. if (false === $default) {
  39050. return $answer && $answerIsTrue;
  39051. }
  39052. return !$answer || $answerIsTrue;
  39053. };
  39054. }
  39055. }
  39056. <?php
  39057. namespace Symfony\Component\Console\Question;
  39058. use Symfony\Component\Console\Exception\InvalidArgumentException;
  39059. use Symfony\Component\Console\Exception\LogicException;
  39060. class Question
  39061. {
  39062. private $question;
  39063. private $attempts;
  39064. private $hidden = false;
  39065. private $hiddenFallback = true;
  39066. private $autocompleterValues;
  39067. private $validator;
  39068. private $default;
  39069. private $normalizer;
  39070. public function __construct($question, $default = null)
  39071. {
  39072. $this->question = $question;
  39073. $this->default = $default;
  39074. }
  39075. public function getQuestion()
  39076. {
  39077. return $this->question;
  39078. }
  39079. public function getDefault()
  39080. {
  39081. return $this->default;
  39082. }
  39083. public function isHidden()
  39084. {
  39085. return $this->hidden;
  39086. }
  39087. public function setHidden($hidden)
  39088. {
  39089. if ($this->autocompleterValues) {
  39090. throw new LogicException('A hidden question cannot use the autocompleter.');
  39091. }
  39092. $this->hidden = (bool) $hidden;
  39093. return $this;
  39094. }
  39095. public function isHiddenFallback()
  39096. {
  39097. return $this->hiddenFallback;
  39098. }
  39099. public function setHiddenFallback($fallback)
  39100. {
  39101. $this->hiddenFallback = (bool) $fallback;
  39102. return $this;
  39103. }
  39104. public function getAutocompleterValues()
  39105. {
  39106. return $this->autocompleterValues;
  39107. }
  39108. public function setAutocompleterValues($values)
  39109. {
  39110. if (\is_array($values)) {
  39111. $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values);
  39112. }
  39113. if (null !== $values && !\is_array($values) && !$values instanceof \Traversable) {
  39114. throw new InvalidArgumentException('Autocompleter values can be either an array, `null` or a `Traversable` object.');
  39115. }
  39116. if ($this->hidden) {
  39117. throw new LogicException('A hidden question cannot use the autocompleter.');
  39118. }
  39119. $this->autocompleterValues = $values;
  39120. return $this;
  39121. }
  39122. public function setValidator($validator)
  39123. {
  39124. $this->validator = $validator;
  39125. return $this;
  39126. }
  39127. public function getValidator()
  39128. {
  39129. return $this->validator;
  39130. }
  39131. public function setMaxAttempts($attempts)
  39132. {
  39133. if (null !== $attempts && $attempts < 1) {
  39134. throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
  39135. }
  39136. $this->attempts = $attempts;
  39137. return $this;
  39138. }
  39139. public function getMaxAttempts()
  39140. {
  39141. return $this->attempts;
  39142. }
  39143. public function setNormalizer($normalizer)
  39144. {
  39145. $this->normalizer = $normalizer;
  39146. return $this;
  39147. }
  39148. public function getNormalizer()
  39149. {
  39150. return $this->normalizer;
  39151. }
  39152. protected function isAssoc($array)
  39153. {
  39154. return (bool) \count(array_filter(array_keys($array), 'is_string'));
  39155. }
  39156. }
  39157. <?php
  39158. namespace Symfony\Component\Console;
  39159. use Symfony\Component\Console\Exception\RuntimeException;
  39160. use Symfony\Component\Console\Input\StringInput;
  39161. use Symfony\Component\Console\Output\ConsoleOutput;
  39162. use Symfony\Component\Process\PhpExecutableFinder;
  39163. use Symfony\Component\Process\ProcessBuilder;
  39164. class Shell
  39165. {
  39166. private $application;
  39167. private $history;
  39168. private $output;
  39169. private $hasReadline;
  39170. private $processIsolation = false;
  39171. public function __construct(Application $application)
  39172. {
  39173. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  39174. $this->hasReadline = \function_exists('readline');
  39175. $this->application = $application;
  39176. $this->history = getenv('HOME').'/.history_'.$application->getName();
  39177. $this->output = new ConsoleOutput();
  39178. }
  39179. public function run()
  39180. {
  39181. $this->application->setAutoExit(false);
  39182. $this->application->setCatchExceptions(true);
  39183. if ($this->hasReadline) {
  39184. readline_read_history($this->history);
  39185. readline_completion_function(array($this, 'autocompleter'));
  39186. }
  39187. $this->output->writeln($this->getHeader());
  39188. $php = null;
  39189. if ($this->processIsolation) {
  39190. $finder = new PhpExecutableFinder();
  39191. $php = $finder->find();
  39192. $this->output->writeln(<<<'EOF'
  39193. <info>Running with process isolation, you should consider this:</info>
  39194. * each command is executed as separate process,
  39195. * commands don't support interactivity, all params must be passed explicitly,
  39196. * commands output is not colorized.
  39197. EOF
  39198. );
  39199. }
  39200. while (true) {
  39201. $command = $this->readline();
  39202. if (false === $command) {
  39203. $this->output->writeln("\n");
  39204. break;
  39205. }
  39206. if ($this->hasReadline) {
  39207. readline_add_history($command);
  39208. readline_write_history($this->history);
  39209. }
  39210. if ($this->processIsolation) {
  39211. $pb = new ProcessBuilder();
  39212. $process = $pb
  39213. ->add($php)
  39214. ->add($_SERVER['argv'][0])
  39215. ->add($command)
  39216. ->inheritEnvironmentVariables(true)
  39217. ->getProcess()
  39218. ;
  39219. $output = $this->output;
  39220. $process->run(function ($type, $data) use ($output) {
  39221. $output->writeln($data);
  39222. });
  39223. $ret = $process->getExitCode();
  39224. } else {
  39225. $ret = $this->application->run(new StringInput($command), $this->output);
  39226. }
  39227. if (0 !== $ret) {
  39228. $this->output->writeln(sprintf('<error>The command terminated with an error status (%s)</error>', $ret));
  39229. }
  39230. }
  39231. }
  39232. protected function getHeader()
  39233. {
  39234. return <<<EOF
  39235. Welcome to the <info>{$this->application->getName()}</info> shell (<comment>{$this->application->getVersion()}</comment>).
  39236. At the prompt, type <comment>help</comment> for some help,
  39237. or <comment>list</comment> to get a list of available commands.
  39238. To exit the shell, type <comment>^D</comment>.
  39239. EOF;
  39240. }
  39241. protected function getPrompt()
  39242. {
  39243. return $this->output->getFormatter()->format($this->application->getName().' > ');
  39244. }
  39245. protected function getOutput()
  39246. {
  39247. return $this->output;
  39248. }
  39249. protected function getApplication()
  39250. {
  39251. return $this->application;
  39252. }
  39253. private function autocompleter($text)
  39254. {
  39255. $info = readline_info();
  39256. $text = substr($info['line_buffer'], 0, $info['end']);
  39257. if ($info['point'] !== $info['end']) {
  39258. return true;
  39259. }
  39260. if (false === strpos($text, ' ') || !$text) {
  39261. return array_keys($this->application->all());
  39262. }
  39263. try {
  39264. $command = $this->application->find(substr($text, 0, strpos($text, ' ')));
  39265. } catch (\Exception $e) {
  39266. return true;
  39267. }
  39268. $list = array('--help');
  39269. foreach ($command->getDefinition()->getOptions() as $option) {
  39270. $list[] = '--'.$option->getName();
  39271. }
  39272. return $list;
  39273. }
  39274. private function readline()
  39275. {
  39276. if ($this->hasReadline) {
  39277. $line = readline($this->getPrompt());
  39278. } else {
  39279. $this->output->write($this->getPrompt());
  39280. $line = fgets(STDIN, 1024);
  39281. $line = (false === $line || '' === $line) ? false : rtrim($line);
  39282. }
  39283. return $line;
  39284. }
  39285. public function getProcessIsolation()
  39286. {
  39287. return $this->processIsolation;
  39288. }
  39289. public function setProcessIsolation($processIsolation)
  39290. {
  39291. $this->processIsolation = (bool) $processIsolation;
  39292. if ($this->processIsolation && !class_exists('Symfony\\Component\\Process\\Process')) {
  39293. throw new RuntimeException('Unable to isolate processes as the Symfony Process Component is not installed.');
  39294. }
  39295. }
  39296. }
  39297. <?php
  39298. namespace Symfony\Component\Console\Style;
  39299. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  39300. use Symfony\Component\Console\Helper\ProgressBar;
  39301. use Symfony\Component\Console\Output\OutputInterface;
  39302. abstract class OutputStyle implements OutputInterface, StyleInterface
  39303. {
  39304. private $output;
  39305. public function __construct(OutputInterface $output)
  39306. {
  39307. $this->output = $output;
  39308. }
  39309. public function newLine($count = 1)
  39310. {
  39311. $this->output->write(str_repeat(PHP_EOL, $count));
  39312. }
  39313. public function createProgressBar($max = 0)
  39314. {
  39315. return new ProgressBar($this->output, $max);
  39316. }
  39317. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  39318. {
  39319. $this->output->write($messages, $newline, $type);
  39320. }
  39321. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  39322. {
  39323. $this->output->writeln($messages, $type);
  39324. }
  39325. public function setVerbosity($level)
  39326. {
  39327. $this->output->setVerbosity($level);
  39328. }
  39329. public function getVerbosity()
  39330. {
  39331. return $this->output->getVerbosity();
  39332. }
  39333. public function setDecorated($decorated)
  39334. {
  39335. $this->output->setDecorated($decorated);
  39336. }
  39337. public function isDecorated()
  39338. {
  39339. return $this->output->isDecorated();
  39340. }
  39341. public function setFormatter(OutputFormatterInterface $formatter)
  39342. {
  39343. $this->output->setFormatter($formatter);
  39344. }
  39345. public function getFormatter()
  39346. {
  39347. return $this->output->getFormatter();
  39348. }
  39349. }
  39350. <?php
  39351. namespace Symfony\Component\Console\Style;
  39352. interface StyleInterface
  39353. {
  39354. public function title($message);
  39355. public function section($message);
  39356. public function listing(array $elements);
  39357. public function text($message);
  39358. public function success($message);
  39359. public function error($message);
  39360. public function warning($message);
  39361. public function note($message);
  39362. public function caution($message);
  39363. public function table(array $headers, array $rows);
  39364. public function ask($question, $default = null, $validator = null);
  39365. public function askHidden($question, $validator = null);
  39366. public function confirm($question, $default = true);
  39367. public function choice($question, array $choices, $default = null);
  39368. public function newLine($count = 1);
  39369. public function progressStart($max = 0);
  39370. public function progressAdvance($step = 1);
  39371. public function progressFinish();
  39372. }
  39373. <?php
  39374. namespace Symfony\Component\Console\Style;
  39375. use Symfony\Component\Console\Application;
  39376. use Symfony\Component\Console\Exception\RuntimeException;
  39377. use Symfony\Component\Console\Formatter\OutputFormatter;
  39378. use Symfony\Component\Console\Helper\Helper;
  39379. use Symfony\Component\Console\Helper\ProgressBar;
  39380. use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
  39381. use Symfony\Component\Console\Helper\Table;
  39382. use Symfony\Component\Console\Input\InputInterface;
  39383. use Symfony\Component\Console\Output\BufferedOutput;
  39384. use Symfony\Component\Console\Output\OutputInterface;
  39385. use Symfony\Component\Console\Question\ChoiceQuestion;
  39386. use Symfony\Component\Console\Question\ConfirmationQuestion;
  39387. use Symfony\Component\Console\Question\Question;
  39388. class SymfonyStyle extends OutputStyle
  39389. {
  39390. const MAX_LINE_LENGTH = 120;
  39391. private $input;
  39392. private $questionHelper;
  39393. private $progressBar;
  39394. private $lineLength;
  39395. private $bufferedOutput;
  39396. public function __construct(InputInterface $input, OutputInterface $output)
  39397. {
  39398. $this->input = $input;
  39399. $this->bufferedOutput = new BufferedOutput($output->getVerbosity(), false, clone $output->getFormatter());
  39400. $this->lineLength = min($this->getTerminalWidth() - (int) (\DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
  39401. parent::__construct($output);
  39402. }
  39403. public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false)
  39404. {
  39405. $messages = \is_array($messages) ? array_values($messages) : array($messages);
  39406. $this->autoPrependBlock();
  39407. $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, true));
  39408. $this->newLine();
  39409. }
  39410. public function title($message)
  39411. {
  39412. $this->autoPrependBlock();
  39413. $this->writeln(array(
  39414. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  39415. sprintf('<comment>%s</>', str_repeat('=', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  39416. ));
  39417. $this->newLine();
  39418. }
  39419. public function section($message)
  39420. {
  39421. $this->autoPrependBlock();
  39422. $this->writeln(array(
  39423. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  39424. sprintf('<comment>%s</>', str_repeat('-', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  39425. ));
  39426. $this->newLine();
  39427. }
  39428. public function listing(array $elements)
  39429. {
  39430. $this->autoPrependText();
  39431. $elements = array_map(function ($element) {
  39432. return sprintf(' * %s', $element);
  39433. }, $elements);
  39434. $this->writeln($elements);
  39435. $this->newLine();
  39436. }
  39437. public function text($message)
  39438. {
  39439. $this->autoPrependText();
  39440. $messages = \is_array($message) ? array_values($message) : array($message);
  39441. foreach ($messages as $message) {
  39442. $this->writeln(sprintf(' %s', $message));
  39443. }
  39444. }
  39445. public function comment($message)
  39446. {
  39447. $messages = \is_array($message) ? array_values($message) : array($message);
  39448. $this->autoPrependBlock();
  39449. $this->writeln($this->createBlock($messages, null, null, '<fg=default;bg=default> // </>'));
  39450. $this->newLine();
  39451. }
  39452. public function success($message)
  39453. {
  39454. $this->block($message, 'OK', 'fg=black;bg=green', ' ', true);
  39455. }
  39456. public function error($message)
  39457. {
  39458. $this->block($message, 'ERROR', 'fg=white;bg=red', ' ', true);
  39459. }
  39460. public function warning($message)
  39461. {
  39462. $this->block($message, 'WARNING', 'fg=white;bg=red', ' ', true);
  39463. }
  39464. public function note($message)
  39465. {
  39466. $this->block($message, 'NOTE', 'fg=yellow', ' ! ');
  39467. }
  39468. public function caution($message)
  39469. {
  39470. $this->block($message, 'CAUTION', 'fg=white;bg=red', ' ! ', true);
  39471. }
  39472. public function table(array $headers, array $rows)
  39473. {
  39474. $style = clone Table::getStyleDefinition('symfony-style-guide');
  39475. $style->setCellHeaderFormat('<info>%s</info>');
  39476. $table = new Table($this);
  39477. $table->setHeaders($headers);
  39478. $table->setRows($rows);
  39479. $table->setStyle($style);
  39480. $table->render();
  39481. $this->newLine();
  39482. }
  39483. public function ask($question, $default = null, $validator = null)
  39484. {
  39485. $question = new Question($question, $default);
  39486. $question->setValidator($validator);
  39487. return $this->askQuestion($question);
  39488. }
  39489. public function askHidden($question, $validator = null)
  39490. {
  39491. $question = new Question($question);
  39492. $question->setHidden(true);
  39493. $question->setValidator($validator);
  39494. return $this->askQuestion($question);
  39495. }
  39496. public function confirm($question, $default = true)
  39497. {
  39498. return $this->askQuestion(new ConfirmationQuestion($question, $default));
  39499. }
  39500. public function choice($question, array $choices, $default = null)
  39501. {
  39502. if (null !== $default) {
  39503. $values = array_flip($choices);
  39504. $default = $values[$default];
  39505. }
  39506. return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
  39507. }
  39508. public function progressStart($max = 0)
  39509. {
  39510. $this->progressBar = $this->createProgressBar($max);
  39511. $this->progressBar->start();
  39512. }
  39513. public function progressAdvance($step = 1)
  39514. {
  39515. $this->getProgressBar()->advance($step);
  39516. }
  39517. public function progressFinish()
  39518. {
  39519. $this->getProgressBar()->finish();
  39520. $this->newLine(2);
  39521. $this->progressBar = null;
  39522. }
  39523. public function createProgressBar($max = 0)
  39524. {
  39525. $progressBar = parent::createProgressBar($max);
  39526. if ('\\' !== \DIRECTORY_SEPARATOR || 'Hyper' === getenv('TERM_PROGRAM')) {
  39527. $progressBar->setEmptyBarCharacter('â–‘');
  39528. $progressBar->setProgressCharacter('');
  39529. $progressBar->setBarCharacter('â–“');
  39530. }
  39531. return $progressBar;
  39532. }
  39533. public function askQuestion(Question $question)
  39534. {
  39535. if ($this->input->isInteractive()) {
  39536. $this->autoPrependBlock();
  39537. }
  39538. if (!$this->questionHelper) {
  39539. $this->questionHelper = new SymfonyQuestionHelper();
  39540. }
  39541. $answer = $this->questionHelper->ask($this->input, $this, $question);
  39542. if ($this->input->isInteractive()) {
  39543. $this->newLine();
  39544. $this->bufferedOutput->write("\n");
  39545. }
  39546. return $answer;
  39547. }
  39548. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  39549. {
  39550. parent::writeln($messages, $type);
  39551. $this->bufferedOutput->writeln($this->reduceBuffer($messages), $type);
  39552. }
  39553. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  39554. {
  39555. parent::write($messages, $newline, $type);
  39556. $this->bufferedOutput->write($this->reduceBuffer($messages), $newline, $type);
  39557. }
  39558. public function newLine($count = 1)
  39559. {
  39560. parent::newLine($count);
  39561. $this->bufferedOutput->write(str_repeat("\n", $count));
  39562. }
  39563. private function getProgressBar()
  39564. {
  39565. if (!$this->progressBar) {
  39566. throw new RuntimeException('The ProgressBar is not started.');
  39567. }
  39568. return $this->progressBar;
  39569. }
  39570. private function getTerminalWidth()
  39571. {
  39572. $application = new Application();
  39573. $dimensions = $application->getTerminalDimensions();
  39574. return $dimensions[0] ?: self::MAX_LINE_LENGTH;
  39575. }
  39576. private function autoPrependBlock()
  39577. {
  39578. $chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
  39579. if (!isset($chars[0])) {
  39580. return $this->newLine();
  39581. }
  39582. $this->newLine(2 - substr_count($chars, "\n"));
  39583. }
  39584. private function autoPrependText()
  39585. {
  39586. $fetched = $this->bufferedOutput->fetch();
  39587. if ("\n" !== substr($fetched, -1)) {
  39588. $this->newLine();
  39589. }
  39590. }
  39591. private function reduceBuffer($messages)
  39592. {
  39593. return array_map(function ($value) {
  39594. return substr($value, -4);
  39595. }, array_merge(array($this->bufferedOutput->fetch()), (array) $messages));
  39596. }
  39597. private function createBlock($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = false)
  39598. {
  39599. $indentLength = 0;
  39600. $prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
  39601. $lines = array();
  39602. if (null !== $type) {
  39603. $type = sprintf('[%s] ', $type);
  39604. $indentLength = \strlen($type);
  39605. $lineIndentation = str_repeat(' ', $indentLength);
  39606. }
  39607. foreach ($messages as $key => $message) {
  39608. if ($escape) {
  39609. $message = OutputFormatter::escape($message);
  39610. }
  39611. $lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, PHP_EOL, true)));
  39612. if (\count($messages) > 1 && $key < \count($messages) - 1) {
  39613. $lines[] = '';
  39614. }
  39615. }
  39616. $firstLineIndex = 0;
  39617. if ($padding && $this->isDecorated()) {
  39618. $firstLineIndex = 1;
  39619. array_unshift($lines, '');
  39620. $lines[] = '';
  39621. }
  39622. foreach ($lines as $i => &$line) {
  39623. if (null !== $type) {
  39624. $line = $firstLineIndex === $i ? $type.$line : $lineIndentation.$line;
  39625. }
  39626. $line = $prefix.$line;
  39627. $line .= str_repeat(' ', $this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line));
  39628. if ($style) {
  39629. $line = sprintf('<%s>%s</>', $style, $line);
  39630. }
  39631. }
  39632. return $lines;
  39633. }
  39634. }
  39635. <?php
  39636. namespace Symfony\Component\Console\Tester;
  39637. use Symfony\Component\Console\Application;
  39638. use Symfony\Component\Console\Input\ArrayInput;
  39639. use Symfony\Component\Console\Input\InputInterface;
  39640. use Symfony\Component\Console\Output\OutputInterface;
  39641. use Symfony\Component\Console\Output\StreamOutput;
  39642. class ApplicationTester
  39643. {
  39644. private $application;
  39645. private $input;
  39646. private $output;
  39647. private $statusCode;
  39648. public function __construct(Application $application)
  39649. {
  39650. $this->application = $application;
  39651. }
  39652. public function run(array $input, $options = array())
  39653. {
  39654. $this->input = new ArrayInput($input);
  39655. if (isset($options['interactive'])) {
  39656. $this->input->setInteractive($options['interactive']);
  39657. }
  39658. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  39659. if (isset($options['decorated'])) {
  39660. $this->output->setDecorated($options['decorated']);
  39661. }
  39662. if (isset($options['verbosity'])) {
  39663. $this->output->setVerbosity($options['verbosity']);
  39664. }
  39665. return $this->statusCode = $this->application->run($this->input, $this->output);
  39666. }
  39667. public function getDisplay($normalize = false)
  39668. {
  39669. rewind($this->output->getStream());
  39670. $display = stream_get_contents($this->output->getStream());
  39671. if ($normalize) {
  39672. $display = str_replace(PHP_EOL, "\n", $display);
  39673. }
  39674. return $display;
  39675. }
  39676. public function getInput()
  39677. {
  39678. return $this->input;
  39679. }
  39680. public function getOutput()
  39681. {
  39682. return $this->output;
  39683. }
  39684. public function getStatusCode()
  39685. {
  39686. return $this->statusCode;
  39687. }
  39688. }
  39689. <?php
  39690. namespace Symfony\Component\Console\Tester;
  39691. use Symfony\Component\Console\Command\Command;
  39692. use Symfony\Component\Console\Input\ArrayInput;
  39693. use Symfony\Component\Console\Input\InputInterface;
  39694. use Symfony\Component\Console\Output\OutputInterface;
  39695. use Symfony\Component\Console\Output\StreamOutput;
  39696. class CommandTester
  39697. {
  39698. private $command;
  39699. private $input;
  39700. private $output;
  39701. private $statusCode;
  39702. public function __construct(Command $command)
  39703. {
  39704. $this->command = $command;
  39705. }
  39706. public function execute(array $input, array $options = array())
  39707. {
  39708. if (!isset($input['command'])
  39709. && (null !== $application = $this->command->getApplication())
  39710. && $application->getDefinition()->hasArgument('command')
  39711. ) {
  39712. $input = array_merge(array('command' => $this->command->getName()), $input);
  39713. }
  39714. $this->input = new ArrayInput($input);
  39715. if (isset($options['interactive'])) {
  39716. $this->input->setInteractive($options['interactive']);
  39717. }
  39718. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  39719. $this->output->setDecorated(isset($options['decorated']) ? $options['decorated'] : false);
  39720. if (isset($options['verbosity'])) {
  39721. $this->output->setVerbosity($options['verbosity']);
  39722. }
  39723. return $this->statusCode = $this->command->run($this->input, $this->output);
  39724. }
  39725. public function getDisplay($normalize = false)
  39726. {
  39727. rewind($this->output->getStream());
  39728. $display = stream_get_contents($this->output->getStream());
  39729. if ($normalize) {
  39730. $display = str_replace(PHP_EOL, "\n", $display);
  39731. }
  39732. return $display;
  39733. }
  39734. public function getInput()
  39735. {
  39736. return $this->input;
  39737. }
  39738. public function getOutput()
  39739. {
  39740. return $this->output;
  39741. }
  39742. public function getStatusCode()
  39743. {
  39744. return $this->statusCode;
  39745. }
  39746. }
  39747. <?php
  39748. namespace Symfony\Component\Debug;
  39749. use Psr\Log\AbstractLogger;
  39750. class BufferingLogger extends AbstractLogger
  39751. {
  39752. private $logs = array();
  39753. public function log($level, $message, array $context = array())
  39754. {
  39755. $this->logs[] = array($level, $message, $context);
  39756. }
  39757. public function cleanLogs()
  39758. {
  39759. $logs = $this->logs;
  39760. $this->logs = array();
  39761. return $logs;
  39762. }
  39763. }
  39764. <?php
  39765. namespace Symfony\Component\Debug;
  39766. class Debug
  39767. {
  39768. private static $enabled = false;
  39769. public static function enable($errorReportingLevel = null, $displayErrors = true)
  39770. {
  39771. if (static::$enabled) {
  39772. return;
  39773. }
  39774. static::$enabled = true;
  39775. if (null !== $errorReportingLevel) {
  39776. error_reporting($errorReportingLevel);
  39777. } else {
  39778. error_reporting(-1);
  39779. }
  39780. if (!\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true)) {
  39781. ini_set('display_errors', 0);
  39782. ExceptionHandler::register();
  39783. } elseif ($displayErrors && (!filter_var(ini_get('log_errors'), FILTER_VALIDATE_BOOLEAN) || ini_get('error_log'))) {
  39784. ini_set('display_errors', 1);
  39785. }
  39786. if ($displayErrors) {
  39787. ErrorHandler::register(new ErrorHandler(new BufferingLogger()));
  39788. } else {
  39789. ErrorHandler::register()->throwAt(0, true);
  39790. }
  39791. DebugClassLoader::enable();
  39792. }
  39793. }
  39794. <?php
  39795. namespace Symfony\Component\Debug;
  39796. class DebugClassLoader
  39797. {
  39798. private $classLoader;
  39799. private $isFinder;
  39800. private $loaded = array();
  39801. private $wasFinder;
  39802. private static $caseCheck;
  39803. private static $deprecated = array();
  39804. private static $php7Reserved = array('int', 'float', 'bool', 'string', 'true', 'false', 'null');
  39805. private static $darwinCache = array('/' => array('/', array()));
  39806. public function __construct($classLoader)
  39807. {
  39808. $this->wasFinder = \is_object($classLoader) && method_exists($classLoader, 'findFile');
  39809. if ($this->wasFinder) {
  39810. @trigger_error('The '.__METHOD__.' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED);
  39811. $this->classLoader = array($classLoader, 'loadClass');
  39812. $this->isFinder = true;
  39813. } else {
  39814. $this->classLoader = $classLoader;
  39815. $this->isFinder = \is_array($classLoader) && method_exists($classLoader[0], 'findFile');
  39816. }
  39817. if (!isset(self::$caseCheck)) {
  39818. $file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), \DIRECTORY_SEPARATOR);
  39819. $i = strrpos($file, \DIRECTORY_SEPARATOR);
  39820. $dir = substr($file, 0, 1 + $i);
  39821. $file = substr($file, 1 + $i);
  39822. $test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
  39823. $test = realpath($dir.$test);
  39824. if (false === $test || false === $i) {
  39825. self::$caseCheck = 0;
  39826. } elseif (substr($test, -\strlen($file)) === $file) {
  39827. self::$caseCheck = 1;
  39828. } elseif (false !== stripos(PHP_OS, 'darwin')) {
  39829. self::$caseCheck = 2;
  39830. } else {
  39831. self::$caseCheck = 0;
  39832. }
  39833. }
  39834. }
  39835. public function getClassLoader()
  39836. {
  39837. return $this->wasFinder ? $this->classLoader[0] : $this->classLoader;
  39838. }
  39839. public static function enable()
  39840. {
  39841. class_exists('Symfony\Component\Debug\ErrorHandler');
  39842. class_exists('Psr\Log\LogLevel');
  39843. if (!\is_array($functions = spl_autoload_functions())) {
  39844. return;
  39845. }
  39846. foreach ($functions as $function) {
  39847. spl_autoload_unregister($function);
  39848. }
  39849. foreach ($functions as $function) {
  39850. if (!\is_array($function) || !$function[0] instanceof self) {
  39851. $function = array(new static($function), 'loadClass');
  39852. }
  39853. spl_autoload_register($function);
  39854. }
  39855. }
  39856. public static function disable()
  39857. {
  39858. if (!\is_array($functions = spl_autoload_functions())) {
  39859. return;
  39860. }
  39861. foreach ($functions as $function) {
  39862. spl_autoload_unregister($function);
  39863. }
  39864. foreach ($functions as $function) {
  39865. if (\is_array($function) && $function[0] instanceof self) {
  39866. $function = $function[0]->getClassLoader();
  39867. }
  39868. spl_autoload_register($function);
  39869. }
  39870. }
  39871. public function findFile($class)
  39872. {
  39873. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  39874. if ($this->wasFinder) {
  39875. return $this->classLoader[0]->findFile($class);
  39876. }
  39877. }
  39878. public function loadClass($class)
  39879. {
  39880. ErrorHandler::stackErrors();
  39881. try {
  39882. if ($this->isFinder && !isset($this->loaded[$class])) {
  39883. $this->loaded[$class] = true;
  39884. if ($file = $this->classLoader[0]->findFile($class)) {
  39885. require $file;
  39886. }
  39887. } else {
  39888. \call_user_func($this->classLoader, $class);
  39889. $file = false;
  39890. }
  39891. } catch (\Exception $e) {
  39892. ErrorHandler::unstackErrors();
  39893. throw $e;
  39894. } catch (\Throwable $e) {
  39895. ErrorHandler::unstackErrors();
  39896. throw $e;
  39897. }
  39898. ErrorHandler::unstackErrors();
  39899. $exists = class_exists($class, false) || interface_exists($class, false) || (\function_exists('trait_exists') && trait_exists($class, false));
  39900. if ($class && '\\' === $class[0]) {
  39901. $class = substr($class, 1);
  39902. }
  39903. if ($exists) {
  39904. $refl = new \ReflectionClass($class);
  39905. $name = $refl->getName();
  39906. if ($name !== $class && 0 === strcasecmp($name, $class)) {
  39907. throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: %s vs %s', $class, $name));
  39908. }
  39909. if (\in_array(strtolower($refl->getShortName()), self::$php7Reserved)) {
  39910. @trigger_error(sprintf('%s uses a reserved class name (%s) that will break on PHP 7 and higher', $name, $refl->getShortName()), E_USER_DEPRECATED);
  39911. } elseif (preg_match('#\n \* @deprecated (.*?)\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) {
  39912. self::$deprecated[$name] = preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]);
  39913. } else {
  39914. if (2 > $len = 1 + (strpos($name, '\\') ?: strpos($name, '_'))) {
  39915. $len = 0;
  39916. $ns = '';
  39917. } else {
  39918. $ns = substr($name, 0, $len);
  39919. }
  39920. $parent = get_parent_class($class);
  39921. if (!$parent || strncmp($ns, $parent, $len)) {
  39922. if ($parent && isset(self::$deprecated[$parent]) && strncmp($ns, $parent, $len)) {
  39923. @trigger_error(sprintf('The %s class extends %s that is deprecated %s', $name, $parent, self::$deprecated[$parent]), E_USER_DEPRECATED);
  39924. }
  39925. $parentInterfaces = array();
  39926. $deprecatedInterfaces = array();
  39927. if ($parent) {
  39928. foreach (class_implements($parent) as $interface) {
  39929. $parentInterfaces[$interface] = 1;
  39930. }
  39931. }
  39932. foreach ($refl->getInterfaceNames() as $interface) {
  39933. if (isset(self::$deprecated[$interface]) && strncmp($ns, $interface, $len)) {
  39934. $deprecatedInterfaces[] = $interface;
  39935. }
  39936. foreach (class_implements($interface) as $interface) {
  39937. $parentInterfaces[$interface] = 1;
  39938. }
  39939. }
  39940. foreach ($deprecatedInterfaces as $interface) {
  39941. if (!isset($parentInterfaces[$interface])) {
  39942. @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);
  39943. }
  39944. }
  39945. }
  39946. }
  39947. }
  39948. if ($file) {
  39949. if (!$exists) {
  39950. if (false !== strpos($class, '/')) {
  39951. 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));
  39952. }
  39953. 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));
  39954. }
  39955. if (self::$caseCheck) {
  39956. $real = explode('\\', $class.strrchr($file, '.'));
  39957. $tail = explode(\DIRECTORY_SEPARATOR, str_replace('/', \DIRECTORY_SEPARATOR, $file));
  39958. $i = \count($tail) - 1;
  39959. $j = \count($real) - 1;
  39960. while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) {
  39961. --$i;
  39962. --$j;
  39963. }
  39964. array_splice($tail, 0, $i + 1);
  39965. }
  39966. if (self::$caseCheck && $tail) {
  39967. $tail = \DIRECTORY_SEPARATOR.implode(\DIRECTORY_SEPARATOR, $tail);
  39968. $tailLen = \strlen($tail);
  39969. $real = $refl->getFileName();
  39970. if (2 === self::$caseCheck) {
  39971. $i = 1 + strrpos($real, '/');
  39972. $file = substr($real, $i);
  39973. $real = substr($real, 0, $i);
  39974. if (isset(self::$darwinCache[$real])) {
  39975. $kDir = $real;
  39976. } else {
  39977. $kDir = strtolower($real);
  39978. if (isset(self::$darwinCache[$kDir])) {
  39979. $real = self::$darwinCache[$kDir][0];
  39980. } else {
  39981. $dir = getcwd();
  39982. chdir($real);
  39983. $real = getcwd().'/';
  39984. chdir($dir);
  39985. $dir = $real;
  39986. $k = $kDir;
  39987. $i = \strlen($dir) - 1;
  39988. while (!isset(self::$darwinCache[$k])) {
  39989. self::$darwinCache[$k] = array($dir, array());
  39990. self::$darwinCache[$dir] = &self::$darwinCache[$k];
  39991. while ('/' !== $dir[--$i]) {
  39992. }
  39993. $k = substr($k, 0, ++$i);
  39994. $dir = substr($dir, 0, $i--);
  39995. }
  39996. }
  39997. }
  39998. $dirFiles = self::$darwinCache[$kDir][1];
  39999. if (isset($dirFiles[$file])) {
  40000. $kFile = $file;
  40001. } else {
  40002. $kFile = strtolower($file);
  40003. if (!isset($dirFiles[$kFile])) {
  40004. foreach (scandir($real, 2) as $f) {
  40005. if ('.' !== $f[0]) {
  40006. $dirFiles[$f] = $f;
  40007. if ($f === $file) {
  40008. $kFile = $k = $file;
  40009. } elseif ($f !== $k = strtolower($f)) {
  40010. $dirFiles[$k] = $f;
  40011. }
  40012. }
  40013. }
  40014. self::$darwinCache[$kDir][1] = $dirFiles;
  40015. }
  40016. }
  40017. $real .= $dirFiles[$kFile];
  40018. }
  40019. if (0 === substr_compare($real, $tail, -$tailLen, $tailLen, true)
  40020. && 0 !== substr_compare($real, $tail, -$tailLen, $tailLen, false)
  40021. ) {
  40022. 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)));
  40023. }
  40024. }
  40025. return true;
  40026. }
  40027. }
  40028. }
  40029. <?php
  40030. namespace Symfony\Component\Debug;
  40031. use Psr\Log\LoggerInterface;
  40032. use Psr\Log\LogLevel;
  40033. use Symfony\Component\Debug\Exception\ContextErrorException;
  40034. use Symfony\Component\Debug\Exception\FatalErrorException;
  40035. use Symfony\Component\Debug\Exception\FatalThrowableError;
  40036. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  40037. use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler;
  40038. use Symfony\Component\Debug\FatalErrorHandler\FatalErrorHandlerInterface;
  40039. use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler;
  40040. use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler;
  40041. class ErrorHandler
  40042. {
  40043. const TYPE_DEPRECATION = -100;
  40044. private $levels = array(
  40045. E_DEPRECATED => 'Deprecated',
  40046. E_USER_DEPRECATED => 'User Deprecated',
  40047. E_NOTICE => 'Notice',
  40048. E_USER_NOTICE => 'User Notice',
  40049. E_STRICT => 'Runtime Notice',
  40050. E_WARNING => 'Warning',
  40051. E_USER_WARNING => 'User Warning',
  40052. E_COMPILE_WARNING => 'Compile Warning',
  40053. E_CORE_WARNING => 'Core Warning',
  40054. E_USER_ERROR => 'User Error',
  40055. E_RECOVERABLE_ERROR => 'Catchable Fatal Error',
  40056. E_COMPILE_ERROR => 'Compile Error',
  40057. E_PARSE => 'Parse Error',
  40058. E_ERROR => 'Error',
  40059. E_CORE_ERROR => 'Core Error',
  40060. );
  40061. private $loggers = array(
  40062. E_DEPRECATED => array(null, LogLevel::INFO),
  40063. E_USER_DEPRECATED => array(null, LogLevel::INFO),
  40064. E_NOTICE => array(null, LogLevel::WARNING),
  40065. E_USER_NOTICE => array(null, LogLevel::WARNING),
  40066. E_STRICT => array(null, LogLevel::WARNING),
  40067. E_WARNING => array(null, LogLevel::WARNING),
  40068. E_USER_WARNING => array(null, LogLevel::WARNING),
  40069. E_COMPILE_WARNING => array(null, LogLevel::WARNING),
  40070. E_CORE_WARNING => array(null, LogLevel::WARNING),
  40071. E_USER_ERROR => array(null, LogLevel::CRITICAL),
  40072. E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL),
  40073. E_COMPILE_ERROR => array(null, LogLevel::CRITICAL),
  40074. E_PARSE => array(null, LogLevel::CRITICAL),
  40075. E_ERROR => array(null, LogLevel::CRITICAL),
  40076. E_CORE_ERROR => array(null, LogLevel::CRITICAL),
  40077. );
  40078. private $thrownErrors = 0x1FFF;
  40079. private $scopedErrors = 0x1FFF;
  40080. private $tracedErrors = 0x77FB;
  40081. private $screamedErrors = 0x55;
  40082. private $loggedErrors = 0;
  40083. private $loggedTraces = array();
  40084. private $isRecursive = 0;
  40085. private $isRoot = false;
  40086. private $exceptionHandler;
  40087. private $bootstrappingLogger;
  40088. private static $reservedMemory;
  40089. private static $stackedErrors = array();
  40090. private static $stackedErrorLevels = array();
  40091. private static $toStringException = null;
  40092. private static $exitCode = 0;
  40093. private $displayErrors = 0x1FFF;
  40094. public static function register($handler = null, $replace = true)
  40095. {
  40096. if (null === self::$reservedMemory) {
  40097. self::$reservedMemory = str_repeat('x', 10240);
  40098. register_shutdown_function(__CLASS__.'::handleFatalError');
  40099. }
  40100. $levels = -1;
  40101. if ($handlerIsNew = !$handler instanceof self) {
  40102. if (null !== $handler) {
  40103. $levels = $replace ? $handler : 0;
  40104. $replace = true;
  40105. }
  40106. $handler = new static();
  40107. }
  40108. if (null === $prev = set_error_handler(array($handler, 'handleError'))) {
  40109. restore_error_handler();
  40110. set_error_handler(array($handler, 'handleError'), $handler->thrownErrors | $handler->loggedErrors);
  40111. $handler->isRoot = true;
  40112. }
  40113. if ($handlerIsNew && \is_array($prev) && $prev[0] instanceof self) {
  40114. $handler = $prev[0];
  40115. $replace = false;
  40116. }
  40117. if (!$replace && $prev) {
  40118. restore_error_handler();
  40119. $handlerIsRegistered = \is_array($prev) && $handler === $prev[0];
  40120. } else {
  40121. $handlerIsRegistered = true;
  40122. }
  40123. if (\is_array($prev = set_exception_handler(array($handler, 'handleException'))) && $prev[0] instanceof self) {
  40124. restore_exception_handler();
  40125. if (!$handlerIsRegistered) {
  40126. $handler = $prev[0];
  40127. } elseif ($handler !== $prev[0] && $replace) {
  40128. set_exception_handler(array($handler, 'handleException'));
  40129. $p = $prev[0]->setExceptionHandler(null);
  40130. $handler->setExceptionHandler($p);
  40131. $prev[0]->setExceptionHandler($p);
  40132. }
  40133. } else {
  40134. $handler->setExceptionHandler($prev);
  40135. }
  40136. $handler->throwAt($levels & $handler->thrownErrors, true);
  40137. return $handler;
  40138. }
  40139. public function __construct(BufferingLogger $bootstrappingLogger = null)
  40140. {
  40141. if ($bootstrappingLogger) {
  40142. $this->bootstrappingLogger = $bootstrappingLogger;
  40143. $this->setDefaultLogger($bootstrappingLogger);
  40144. }
  40145. }
  40146. public function setDefaultLogger(LoggerInterface $logger, $levels = null, $replace = false)
  40147. {
  40148. $loggers = array();
  40149. if (\is_array($levels)) {
  40150. foreach ($levels as $type => $logLevel) {
  40151. if (empty($this->loggers[$type][0]) || $replace || $this->loggers[$type][0] === $this->bootstrappingLogger) {
  40152. $loggers[$type] = array($logger, $logLevel);
  40153. }
  40154. }
  40155. } else {
  40156. if (null === $levels) {
  40157. $levels = E_ALL | E_STRICT;
  40158. }
  40159. foreach ($this->loggers as $type => $log) {
  40160. if (($type & $levels) && (empty($log[0]) || $replace || $log[0] === $this->bootstrappingLogger)) {
  40161. $log[0] = $logger;
  40162. $loggers[$type] = $log;
  40163. }
  40164. }
  40165. }
  40166. $this->setLoggers($loggers);
  40167. }
  40168. public function setLoggers(array $loggers)
  40169. {
  40170. $prevLogged = $this->loggedErrors;
  40171. $prev = $this->loggers;
  40172. $flush = array();
  40173. foreach ($loggers as $type => $log) {
  40174. if (!isset($prev[$type])) {
  40175. throw new \InvalidArgumentException('Unknown error type: '.$type);
  40176. }
  40177. if (!\is_array($log)) {
  40178. $log = array($log);
  40179. } elseif (!array_key_exists(0, $log)) {
  40180. throw new \InvalidArgumentException('No logger provided');
  40181. }
  40182. if (null === $log[0]) {
  40183. $this->loggedErrors &= ~$type;
  40184. } elseif ($log[0] instanceof LoggerInterface) {
  40185. $this->loggedErrors |= $type;
  40186. } else {
  40187. throw new \InvalidArgumentException('Invalid logger provided');
  40188. }
  40189. $this->loggers[$type] = $log + $prev[$type];
  40190. if ($this->bootstrappingLogger && $prev[$type][0] === $this->bootstrappingLogger) {
  40191. $flush[$type] = $type;
  40192. }
  40193. }
  40194. $this->reRegister($prevLogged | $this->thrownErrors);
  40195. if ($flush) {
  40196. foreach ($this->bootstrappingLogger->cleanLogs() as $log) {
  40197. $type = $log[2]['type'];
  40198. if (!isset($flush[$type])) {
  40199. $this->bootstrappingLogger->log($log[0], $log[1], $log[2]);
  40200. } elseif ($this->loggers[$type][0]) {
  40201. $this->loggers[$type][0]->log($this->loggers[$type][1], $log[1], $log[2]);
  40202. }
  40203. }
  40204. }
  40205. return $prev;
  40206. }
  40207. public function setExceptionHandler($handler)
  40208. {
  40209. if (null !== $handler && !\is_callable($handler)) {
  40210. throw new \LogicException('The exception handler must be a valid PHP callable.');
  40211. }
  40212. $prev = $this->exceptionHandler;
  40213. $this->exceptionHandler = $handler;
  40214. return $prev;
  40215. }
  40216. public function throwAt($levels, $replace = false)
  40217. {
  40218. $prev = $this->thrownErrors;
  40219. $this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED;
  40220. if (!$replace) {
  40221. $this->thrownErrors |= $prev;
  40222. }
  40223. $this->reRegister($prev | $this->loggedErrors);
  40224. $this->displayErrors = $this->thrownErrors;
  40225. return $prev;
  40226. }
  40227. public function scopeAt($levels, $replace = false)
  40228. {
  40229. $prev = $this->scopedErrors;
  40230. $this->scopedErrors = (int) $levels;
  40231. if (!$replace) {
  40232. $this->scopedErrors |= $prev;
  40233. }
  40234. return $prev;
  40235. }
  40236. public function traceAt($levels, $replace = false)
  40237. {
  40238. $prev = $this->tracedErrors;
  40239. $this->tracedErrors = (int) $levels;
  40240. if (!$replace) {
  40241. $this->tracedErrors |= $prev;
  40242. }
  40243. return $prev;
  40244. }
  40245. public function screamAt($levels, $replace = false)
  40246. {
  40247. $prev = $this->screamedErrors;
  40248. $this->screamedErrors = (int) $levels;
  40249. if (!$replace) {
  40250. $this->screamedErrors |= $prev;
  40251. }
  40252. return $prev;
  40253. }
  40254. private function reRegister($prev)
  40255. {
  40256. if ($prev !== $this->thrownErrors | $this->loggedErrors) {
  40257. $handler = set_error_handler('var_dump');
  40258. $handler = \is_array($handler) ? $handler[0] : null;
  40259. restore_error_handler();
  40260. if ($handler === $this) {
  40261. restore_error_handler();
  40262. if ($this->isRoot) {
  40263. set_error_handler(array($this, 'handleError'), $this->thrownErrors | $this->loggedErrors);
  40264. } else {
  40265. set_error_handler(array($this, 'handleError'));
  40266. }
  40267. }
  40268. }
  40269. }
  40270. public function handleError($type, $message, $file, $line)
  40271. {
  40272. $level = error_reporting();
  40273. $silenced = 0 === ($level & $type);
  40274. $level |= E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED;
  40275. $log = $this->loggedErrors & $type;
  40276. $throw = $this->thrownErrors & $type & $level;
  40277. $type &= $level | $this->screamedErrors;
  40278. if (!$type || (!$log && !$throw)) {
  40279. return !$silenced && $type && $log;
  40280. }
  40281. $scope = $this->scopedErrors & $type;
  40282. if (4 < $numArgs = \func_num_args()) {
  40283. $context = $scope ? (func_get_arg(4) ?: array()) : array();
  40284. $backtrace = 5 < $numArgs ? func_get_arg(5) : null;
  40285. } else {
  40286. $context = array();
  40287. $backtrace = null;
  40288. }
  40289. if (isset($context['GLOBALS']) && $scope) {
  40290. $e = $context;
  40291. unset($e['GLOBALS'], $context);
  40292. $context = $e;
  40293. }
  40294. if (null !== $backtrace && $type & E_ERROR) {
  40295. $this->handleFatalError(compact('type', 'message', 'file', 'line', 'backtrace'));
  40296. return true;
  40297. }
  40298. if ($throw) {
  40299. if (null !== self::$toStringException) {
  40300. $throw = self::$toStringException;
  40301. self::$toStringException = null;
  40302. } elseif ($scope && class_exists('Symfony\Component\Debug\Exception\ContextErrorException')) {
  40303. $throw = new ContextErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line, $context);
  40304. } else {
  40305. $throw = new \ErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line);
  40306. }
  40307. if (\PHP_VERSION_ID <= 50407 && (\PHP_VERSION_ID >= 50400 || \PHP_VERSION_ID <= 50317)) {
  40308. $throw->errorHandlerCanary = new ErrorHandlerCanary();
  40309. }
  40310. if (E_USER_ERROR & $type) {
  40311. $backtrace = $backtrace ?: $throw->getTrace();
  40312. for ($i = 1; isset($backtrace[$i]); ++$i) {
  40313. if (isset($backtrace[$i]['function'], $backtrace[$i]['type'], $backtrace[$i - 1]['function'])
  40314. && '__toString' === $backtrace[$i]['function']
  40315. && '->' === $backtrace[$i]['type']
  40316. && !isset($backtrace[$i - 1]['class'])
  40317. && ('trigger_error' === $backtrace[$i - 1]['function'] || 'user_error' === $backtrace[$i - 1]['function'])
  40318. ) {
  40319. foreach ($context as $e) {
  40320. if (($e instanceof \Exception || $e instanceof \Throwable) && $e->__toString() === $message) {
  40321. if (1 === $i) {
  40322. $throw = $e;
  40323. break;
  40324. }
  40325. self::$toStringException = $e;
  40326. return true;
  40327. }
  40328. }
  40329. if (1 < $i) {
  40330. $this->handleException($throw);
  40331. return false;
  40332. }
  40333. }
  40334. }
  40335. }
  40336. throw $throw;
  40337. }
  40338. $e = md5("{$type}/{$line}/{$file}\x00{$message}", true);
  40339. $trace = true;
  40340. if (!($this->tracedErrors & $type) || isset($this->loggedTraces[$e])) {
  40341. $trace = false;
  40342. } else {
  40343. $this->loggedTraces[$e] = 1;
  40344. }
  40345. $e = compact('type', 'file', 'line', 'level');
  40346. if ($type & $level) {
  40347. if ($scope) {
  40348. $e['scope_vars'] = $context;
  40349. if ($trace) {
  40350. $e['stack'] = $backtrace ?: debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT);
  40351. }
  40352. } elseif ($trace) {
  40353. if (null === $backtrace) {
  40354. $e['stack'] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
  40355. } else {
  40356. foreach ($backtrace as &$frame) {
  40357. unset($frame['args'], $frame);
  40358. }
  40359. $e['stack'] = $backtrace;
  40360. }
  40361. }
  40362. }
  40363. if ($this->isRecursive) {
  40364. $log = 0;
  40365. } elseif (self::$stackedErrorLevels) {
  40366. self::$stackedErrors[] = array($this->loggers[$type][0], ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  40367. } else {
  40368. try {
  40369. $this->isRecursive = true;
  40370. $this->loggers[$type][0]->log(($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  40371. $this->isRecursive = false;
  40372. } catch (\Exception $e) {
  40373. $this->isRecursive = false;
  40374. throw $e;
  40375. } catch (\Throwable $e) {
  40376. $this->isRecursive = false;
  40377. throw $e;
  40378. }
  40379. }
  40380. return !$silenced && $type && $log;
  40381. }
  40382. public function handleException($exception, array $error = null)
  40383. {
  40384. if (null === $error) {
  40385. self::$exitCode = 255;
  40386. }
  40387. if (!$exception instanceof \Exception) {
  40388. $exception = new FatalThrowableError($exception);
  40389. }
  40390. $type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR;
  40391. $handlerException = null;
  40392. if (($this->loggedErrors & $type) || $exception instanceof FatalThrowableError) {
  40393. $e = array(
  40394. 'type' => $type,
  40395. 'file' => $exception->getFile(),
  40396. 'line' => $exception->getLine(),
  40397. 'level' => error_reporting(),
  40398. 'stack' => $exception->getTrace(),
  40399. );
  40400. if ($exception instanceof FatalErrorException) {
  40401. if ($exception instanceof FatalThrowableError) {
  40402. $error = array(
  40403. 'type' => $type,
  40404. 'message' => $message = $exception->getMessage(),
  40405. 'file' => $e['file'],
  40406. 'line' => $e['line'],
  40407. );
  40408. } else {
  40409. $message = 'Fatal '.$exception->getMessage();
  40410. }
  40411. } elseif ($exception instanceof \ErrorException) {
  40412. $message = 'Uncaught '.$exception->getMessage();
  40413. if ($exception instanceof ContextErrorException) {
  40414. $e['context'] = $exception->getContext();
  40415. }
  40416. } else {
  40417. $message = 'Uncaught Exception: '.$exception->getMessage();
  40418. }
  40419. }
  40420. if ($this->loggedErrors & $type) {
  40421. try {
  40422. $this->loggers[$type][0]->log($this->loggers[$type][1], $message, $e);
  40423. } catch (\Exception $handlerException) {
  40424. } catch (\Throwable $handlerException) {
  40425. }
  40426. }
  40427. if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) {
  40428. foreach ($this->getFatalErrorHandlers() as $handler) {
  40429. if ($e = $handler->handleError($error, $exception)) {
  40430. $exception = $e;
  40431. break;
  40432. }
  40433. }
  40434. }
  40435. $exceptionHandler = $this->exceptionHandler;
  40436. $this->exceptionHandler = null;
  40437. try {
  40438. if (null !== $exceptionHandler) {
  40439. return \call_user_func($exceptionHandler, $exception);
  40440. }
  40441. $handlerException = $handlerException ?: $exception;
  40442. } catch (\Exception $handlerException) {
  40443. } catch (\Throwable $handlerException) {
  40444. }
  40445. if ($exception === $handlerException) {
  40446. self::$reservedMemory = null;
  40447. throw $exception;
  40448. }
  40449. $this->handleException($handlerException);
  40450. }
  40451. public static function handleFatalError(array $error = null)
  40452. {
  40453. if (null === self::$reservedMemory) {
  40454. return;
  40455. }
  40456. $handler = self::$reservedMemory = null;
  40457. $handlers = array();
  40458. $previousHandler = null;
  40459. $sameHandlerLimit = 10;
  40460. while (!\is_array($handler) || !$handler[0] instanceof self) {
  40461. $handler = set_exception_handler('var_dump');
  40462. restore_exception_handler();
  40463. if (!$handler) {
  40464. break;
  40465. }
  40466. restore_exception_handler();
  40467. if ($handler !== $previousHandler) {
  40468. array_unshift($handlers, $handler);
  40469. $previousHandler = $handler;
  40470. } elseif (0 === --$sameHandlerLimit) {
  40471. $handler = null;
  40472. break;
  40473. }
  40474. }
  40475. foreach ($handlers as $h) {
  40476. set_exception_handler($h);
  40477. }
  40478. if (!$handler) {
  40479. return;
  40480. }
  40481. if ($handler !== $h) {
  40482. $handler[0]->setExceptionHandler($h);
  40483. }
  40484. $handler = $handler[0];
  40485. $handlers = array();
  40486. if ($exit = null === $error) {
  40487. $error = error_get_last();
  40488. }
  40489. try {
  40490. while (self::$stackedErrorLevels) {
  40491. static::unstackErrors();
  40492. }
  40493. } catch (\Exception $exception) {
  40494. } catch (\Throwable $exception) {
  40495. }
  40496. if ($error && $error['type'] &= E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR) {
  40497. $handler->throwAt(0, true);
  40498. $trace = isset($error['backtrace']) ? $error['backtrace'] : null;
  40499. if (0 === strpos($error['message'], 'Allowed memory') || 0 === strpos($error['message'], 'Out of memory')) {
  40500. $exception = new OutOfMemoryException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, false, $trace);
  40501. } else {
  40502. $exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace);
  40503. }
  40504. }
  40505. try {
  40506. if (isset($exception)) {
  40507. self::$exitCode = 255;
  40508. $handler->handleException($exception, $error);
  40509. }
  40510. } catch (FatalErrorException $e) {
  40511. }
  40512. if ($exit && self::$exitCode) {
  40513. $exitCode = self::$exitCode;
  40514. register_shutdown_function('register_shutdown_function', function () use ($exitCode) { exit($exitCode); });
  40515. }
  40516. }
  40517. public static function stackErrors()
  40518. {
  40519. self::$stackedErrorLevels[] = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  40520. }
  40521. public static function unstackErrors()
  40522. {
  40523. $level = array_pop(self::$stackedErrorLevels);
  40524. if (null !== $level) {
  40525. $e = error_reporting($level);
  40526. if ($e !== ($level | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR)) {
  40527. error_reporting($e);
  40528. }
  40529. }
  40530. if (empty(self::$stackedErrorLevels)) {
  40531. $errors = self::$stackedErrors;
  40532. self::$stackedErrors = array();
  40533. foreach ($errors as $e) {
  40534. $e[0]->log($e[1], $e[2], $e[3]);
  40535. }
  40536. }
  40537. }
  40538. protected function getFatalErrorHandlers()
  40539. {
  40540. return array(
  40541. new UndefinedFunctionFatalErrorHandler(),
  40542. new UndefinedMethodFatalErrorHandler(),
  40543. new ClassNotFoundFatalErrorHandler(),
  40544. );
  40545. }
  40546. public function setLevel($level)
  40547. {
  40548. @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);
  40549. $level = null === $level ? error_reporting() : $level;
  40550. $this->throwAt($level, true);
  40551. }
  40552. public function setDisplayErrors($displayErrors)
  40553. {
  40554. @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);
  40555. if ($displayErrors) {
  40556. $this->throwAt($this->displayErrors, true);
  40557. } else {
  40558. $displayErrors = $this->displayErrors;
  40559. $this->throwAt(0, true);
  40560. $this->displayErrors = $displayErrors;
  40561. }
  40562. }
  40563. public static function setLogger(LoggerInterface $logger, $channel = 'deprecation')
  40564. {
  40565. @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);
  40566. $handler = set_error_handler('var_dump');
  40567. $handler = \is_array($handler) ? $handler[0] : null;
  40568. restore_error_handler();
  40569. if (!$handler instanceof self) {
  40570. return;
  40571. }
  40572. if ('deprecation' === $channel) {
  40573. $handler->setDefaultLogger($logger, E_DEPRECATED | E_USER_DEPRECATED, true);
  40574. $handler->screamAt(E_DEPRECATED | E_USER_DEPRECATED);
  40575. } elseif ('scream' === $channel) {
  40576. $handler->setDefaultLogger($logger, E_ALL | E_STRICT, false);
  40577. $handler->screamAt(E_ALL | E_STRICT);
  40578. } elseif ('emergency' === $channel) {
  40579. $handler->setDefaultLogger($logger, E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR, true);
  40580. $handler->screamAt(E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  40581. }
  40582. }
  40583. public function handle($level, $message, $file = 'unknown', $line = 0, $context = array())
  40584. {
  40585. $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());
  40586. return $this->handleError($level, $message, $file, $line, (array) $context);
  40587. }
  40588. public function handleFatal()
  40589. {
  40590. @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);
  40591. static::handleFatalError();
  40592. }
  40593. }
  40594. class ErrorHandlerCanary
  40595. {
  40596. private static $displayErrors = null;
  40597. public function __construct()
  40598. {
  40599. if (null === self::$displayErrors) {
  40600. self::$displayErrors = ini_set('display_errors', 1);
  40601. }
  40602. }
  40603. public function __destruct()
  40604. {
  40605. if (null !== self::$displayErrors) {
  40606. ini_set('display_errors', self::$displayErrors);
  40607. self::$displayErrors = null;
  40608. }
  40609. }
  40610. }
  40611. <?php
  40612. namespace Symfony\Component\Debug\Exception;
  40613. class ClassNotFoundException extends FatalErrorException
  40614. {
  40615. public function __construct($message, \ErrorException $previous)
  40616. {
  40617. parent::__construct(
  40618. $message,
  40619. $previous->getCode(),
  40620. $previous->getSeverity(),
  40621. $previous->getFile(),
  40622. $previous->getLine(),
  40623. null,
  40624. true,
  40625. null,
  40626. $previous->getPrevious()
  40627. );
  40628. $this->setTrace($previous->getTrace());
  40629. }
  40630. }
  40631. <?php
  40632. namespace Symfony\Component\Debug\Exception;
  40633. class ContextErrorException extends \ErrorException
  40634. {
  40635. private $context = array();
  40636. public function __construct($message, $code, $severity, $filename, $lineno, $context = array())
  40637. {
  40638. parent::__construct($message, $code, $severity, $filename, $lineno);
  40639. $this->context = $context;
  40640. }
  40641. public function getContext()
  40642. {
  40643. return $this->context;
  40644. }
  40645. }
  40646. <?php
  40647. namespace Symfony\Component\Debug\Exception;
  40648. @trigger_error('The '.__NAMESPACE__.'\DummyException class is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  40649. class DummyException extends \ErrorException
  40650. {
  40651. }
  40652. <?php
  40653. namespace Symfony\Component\HttpKernel\Exception;
  40654. class FatalErrorException extends \ErrorException
  40655. {
  40656. }
  40657. namespace Symfony\Component\Debug\Exception;
  40658. use Symfony\Component\HttpKernel\Exception\FatalErrorException as LegacyFatalErrorException;
  40659. class FatalErrorException extends LegacyFatalErrorException
  40660. {
  40661. public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null, $previous = null)
  40662. {
  40663. parent::__construct($message, $code, $severity, $filename, $lineno, $previous);
  40664. if (null !== $trace) {
  40665. if (!$traceArgs) {
  40666. foreach ($trace as &$frame) {
  40667. unset($frame['args'], $frame['this'], $frame);
  40668. }
  40669. }
  40670. $this->setTrace($trace);
  40671. } elseif (null !== $traceOffset) {
  40672. if (\function_exists('xdebug_get_function_stack')) {
  40673. $trace = xdebug_get_function_stack();
  40674. if (0 < $traceOffset) {
  40675. array_splice($trace, -$traceOffset);
  40676. }
  40677. foreach ($trace as &$frame) {
  40678. if (!isset($frame['type'])) {
  40679. if (isset($frame['class'])) {
  40680. $frame['type'] = '::';
  40681. }
  40682. } elseif ('dynamic' === $frame['type']) {
  40683. $frame['type'] = '->';
  40684. } elseif ('static' === $frame['type']) {
  40685. $frame['type'] = '::';
  40686. }
  40687. if (!$traceArgs) {
  40688. unset($frame['params'], $frame['args']);
  40689. } elseif (isset($frame['params']) && !isset($frame['args'])) {
  40690. $frame['args'] = $frame['params'];
  40691. unset($frame['params']);
  40692. }
  40693. }
  40694. unset($frame);
  40695. $trace = array_reverse($trace);
  40696. } elseif (\function_exists('symfony_debug_backtrace')) {
  40697. $trace = symfony_debug_backtrace();
  40698. if (0 < $traceOffset) {
  40699. array_splice($trace, 0, $traceOffset);
  40700. }
  40701. } else {
  40702. $trace = array();
  40703. }
  40704. $this->setTrace($trace);
  40705. }
  40706. }
  40707. protected function setTrace($trace)
  40708. {
  40709. $traceReflector = new \ReflectionProperty('Exception', 'trace');
  40710. $traceReflector->setAccessible(true);
  40711. $traceReflector->setValue($this, $trace);
  40712. }
  40713. }
  40714. <?php
  40715. namespace Symfony\Component\Debug\Exception;
  40716. class FatalThrowableError extends FatalErrorException
  40717. {
  40718. public function __construct(\Throwable $e)
  40719. {
  40720. if ($e instanceof \ParseError) {
  40721. $message = 'Parse error: '.$e->getMessage();
  40722. $severity = E_PARSE;
  40723. } elseif ($e instanceof \TypeError) {
  40724. $message = 'Type error: '.$e->getMessage();
  40725. $severity = E_RECOVERABLE_ERROR;
  40726. } else {
  40727. $message = $e->getMessage();
  40728. $severity = E_ERROR;
  40729. }
  40730. \ErrorException::__construct(
  40731. $message,
  40732. $e->getCode(),
  40733. $severity,
  40734. $e->getFile(),
  40735. $e->getLine(),
  40736. $e->getPrevious()
  40737. );
  40738. $this->setTrace($e->getTrace());
  40739. }
  40740. }
  40741. <?php
  40742. namespace Symfony\Component\HttpKernel\Exception;
  40743. use Symfony\Component\Debug\Exception\FlattenException as DebugFlattenException;
  40744. class FlattenException
  40745. {
  40746. private $handler;
  40747. public static function __callStatic($method, $args)
  40748. {
  40749. if (!method_exists('Symfony\Component\Debug\Exception\FlattenException', $method)) {
  40750. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', \get_called_class(), $method));
  40751. }
  40752. return \call_user_func_array(array('Symfony\Component\Debug\Exception\FlattenException', $method), $args);
  40753. }
  40754. public function __call($method, $args)
  40755. {
  40756. if (!isset($this->handler)) {
  40757. $this->handler = new DebugFlattenException();
  40758. }
  40759. if (!method_exists($this->handler, $method)) {
  40760. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', \get_class($this), $method));
  40761. }
  40762. return \call_user_func_array(array($this->handler, $method), $args);
  40763. }
  40764. }
  40765. namespace Symfony\Component\Debug\Exception;
  40766. use Symfony\Component\HttpKernel\Exception\FlattenException as LegacyFlattenException;
  40767. use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
  40768. class FlattenException extends LegacyFlattenException
  40769. {
  40770. private $message;
  40771. private $code;
  40772. private $previous;
  40773. private $trace;
  40774. private $class;
  40775. private $statusCode;
  40776. private $headers;
  40777. private $file;
  40778. private $line;
  40779. public static function create(\Exception $exception, $statusCode = null, array $headers = array())
  40780. {
  40781. $e = new static();
  40782. $e->setMessage($exception->getMessage());
  40783. $e->setCode($exception->getCode());
  40784. if ($exception instanceof HttpExceptionInterface) {
  40785. $statusCode = $exception->getStatusCode();
  40786. $headers = array_merge($headers, $exception->getHeaders());
  40787. }
  40788. if (null === $statusCode) {
  40789. $statusCode = 500;
  40790. }
  40791. $e->setStatusCode($statusCode);
  40792. $e->setHeaders($headers);
  40793. $e->setTraceFromException($exception);
  40794. $e->setClass(\get_class($exception));
  40795. $e->setFile($exception->getFile());
  40796. $e->setLine($exception->getLine());
  40797. $previous = $exception->getPrevious();
  40798. if ($previous instanceof \Exception) {
  40799. $e->setPrevious(static::create($previous));
  40800. } elseif ($previous instanceof \Throwable) {
  40801. $e->setPrevious(static::create(new FatalThrowableError($previous)));
  40802. }
  40803. return $e;
  40804. }
  40805. public function toArray()
  40806. {
  40807. $exceptions = array();
  40808. foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) {
  40809. $exceptions[] = array(
  40810. 'message' => $exception->getMessage(),
  40811. 'class' => $exception->getClass(),
  40812. 'trace' => $exception->getTrace(),
  40813. );
  40814. }
  40815. return $exceptions;
  40816. }
  40817. public function getStatusCode()
  40818. {
  40819. return $this->statusCode;
  40820. }
  40821. public function setStatusCode($code)
  40822. {
  40823. $this->statusCode = $code;
  40824. }
  40825. public function getHeaders()
  40826. {
  40827. return $this->headers;
  40828. }
  40829. public function setHeaders(array $headers)
  40830. {
  40831. $this->headers = $headers;
  40832. }
  40833. public function getClass()
  40834. {
  40835. return $this->class;
  40836. }
  40837. public function setClass($class)
  40838. {
  40839. $this->class = $class;
  40840. }
  40841. public function getFile()
  40842. {
  40843. return $this->file;
  40844. }
  40845. public function setFile($file)
  40846. {
  40847. $this->file = $file;
  40848. }
  40849. public function getLine()
  40850. {
  40851. return $this->line;
  40852. }
  40853. public function setLine($line)
  40854. {
  40855. $this->line = $line;
  40856. }
  40857. public function getMessage()
  40858. {
  40859. return $this->message;
  40860. }
  40861. public function setMessage($message)
  40862. {
  40863. $this->message = $message;
  40864. }
  40865. public function getCode()
  40866. {
  40867. return $this->code;
  40868. }
  40869. public function setCode($code)
  40870. {
  40871. $this->code = $code;
  40872. }
  40873. public function getPrevious()
  40874. {
  40875. return $this->previous;
  40876. }
  40877. public function setPrevious(FlattenException $previous)
  40878. {
  40879. $this->previous = $previous;
  40880. }
  40881. public function getAllPrevious()
  40882. {
  40883. $exceptions = array();
  40884. $e = $this;
  40885. while ($e = $e->getPrevious()) {
  40886. $exceptions[] = $e;
  40887. }
  40888. return $exceptions;
  40889. }
  40890. public function getTrace()
  40891. {
  40892. return $this->trace;
  40893. }
  40894. public function setTraceFromException(\Exception $exception)
  40895. {
  40896. $this->setTrace($exception->getTrace(), $exception->getFile(), $exception->getLine());
  40897. }
  40898. public function setTrace($trace, $file, $line)
  40899. {
  40900. $this->trace = array();
  40901. $this->trace[] = array(
  40902. 'namespace' => '',
  40903. 'short_class' => '',
  40904. 'class' => '',
  40905. 'type' => '',
  40906. 'function' => '',
  40907. 'file' => $file,
  40908. 'line' => $line,
  40909. 'args' => array(),
  40910. );
  40911. foreach ($trace as $entry) {
  40912. $class = '';
  40913. $namespace = '';
  40914. if (isset($entry['class'])) {
  40915. $parts = explode('\\', $entry['class']);
  40916. $class = array_pop($parts);
  40917. $namespace = implode('\\', $parts);
  40918. }
  40919. $this->trace[] = array(
  40920. 'namespace' => $namespace,
  40921. 'short_class' => $class,
  40922. 'class' => isset($entry['class']) ? $entry['class'] : '',
  40923. 'type' => isset($entry['type']) ? $entry['type'] : '',
  40924. 'function' => isset($entry['function']) ? $entry['function'] : null,
  40925. 'file' => isset($entry['file']) ? $entry['file'] : null,
  40926. 'line' => isset($entry['line']) ? $entry['line'] : null,
  40927. 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(),
  40928. );
  40929. }
  40930. }
  40931. private function flattenArgs($args, $level = 0, &$count = 0)
  40932. {
  40933. $result = array();
  40934. foreach ($args as $key => $value) {
  40935. if (++$count > 1e4) {
  40936. return array('array', '*SKIPPED over 10000 entries*');
  40937. }
  40938. if ($value instanceof \__PHP_Incomplete_Class) {
  40939. $result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value));
  40940. } elseif (\is_object($value)) {
  40941. $result[$key] = array('object', \get_class($value));
  40942. } elseif (\is_array($value)) {
  40943. if ($level > 10) {
  40944. $result[$key] = array('array', '*DEEP NESTED ARRAY*');
  40945. } else {
  40946. $result[$key] = array('array', $this->flattenArgs($value, $level + 1, $count));
  40947. }
  40948. } elseif (null === $value) {
  40949. $result[$key] = array('null', null);
  40950. } elseif (\is_bool($value)) {
  40951. $result[$key] = array('boolean', $value);
  40952. } elseif (\is_resource($value)) {
  40953. $result[$key] = array('resource', get_resource_type($value));
  40954. } else {
  40955. $result[$key] = array('string', (string) $value);
  40956. }
  40957. }
  40958. return $result;
  40959. }
  40960. private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value)
  40961. {
  40962. $array = new \ArrayObject($value);
  40963. return $array['__PHP_Incomplete_Class_Name'];
  40964. }
  40965. }
  40966. <?php
  40967. namespace Symfony\Component\Debug\Exception;
  40968. class OutOfMemoryException extends FatalErrorException
  40969. {
  40970. }
  40971. <?php
  40972. namespace Symfony\Component\Debug\Exception;
  40973. class UndefinedFunctionException extends FatalErrorException
  40974. {
  40975. public function __construct($message, \ErrorException $previous)
  40976. {
  40977. parent::__construct(
  40978. $message,
  40979. $previous->getCode(),
  40980. $previous->getSeverity(),
  40981. $previous->getFile(),
  40982. $previous->getLine(),
  40983. null,
  40984. true,
  40985. null,
  40986. $previous->getPrevious()
  40987. );
  40988. $this->setTrace($previous->getTrace());
  40989. }
  40990. }
  40991. <?php
  40992. namespace Symfony\Component\Debug\Exception;
  40993. class UndefinedMethodException extends FatalErrorException
  40994. {
  40995. public function __construct($message, \ErrorException $previous)
  40996. {
  40997. parent::__construct(
  40998. $message,
  40999. $previous->getCode(),
  41000. $previous->getSeverity(),
  41001. $previous->getFile(),
  41002. $previous->getLine(),
  41003. null,
  41004. true,
  41005. null,
  41006. $previous->getPrevious()
  41007. );
  41008. $this->setTrace($previous->getTrace());
  41009. }
  41010. }
  41011. <?php
  41012. namespace Symfony\Component\Debug;
  41013. use Symfony\Component\Debug\Exception\FlattenException;
  41014. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  41015. use Symfony\Component\HttpFoundation\Response;
  41016. class ExceptionHandler
  41017. {
  41018. private $debug;
  41019. private $charset;
  41020. private $handler;
  41021. private $caughtBuffer;
  41022. private $caughtLength;
  41023. private $fileLinkFormat;
  41024. public function __construct($debug = true, $charset = null, $fileLinkFormat = null)
  41025. {
  41026. if (false !== strpos($charset, '%')) {
  41027. @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);
  41028. $pivot = $fileLinkFormat;
  41029. $fileLinkFormat = $charset;
  41030. $charset = $pivot;
  41031. }
  41032. $this->debug = $debug;
  41033. $this->charset = $charset ?: ini_get('default_charset') ?: 'UTF-8';
  41034. $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
  41035. }
  41036. public static function register($debug = true, $charset = null, $fileLinkFormat = null)
  41037. {
  41038. $handler = new static($debug, $charset, $fileLinkFormat);
  41039. $prev = set_exception_handler(array($handler, 'handle'));
  41040. if (\is_array($prev) && $prev[0] instanceof ErrorHandler) {
  41041. restore_exception_handler();
  41042. $prev[0]->setExceptionHandler(array($handler, 'handle'));
  41043. }
  41044. return $handler;
  41045. }
  41046. public function setHandler($handler)
  41047. {
  41048. if (null !== $handler && !\is_callable($handler)) {
  41049. throw new \LogicException('The exception handler must be a valid PHP callable.');
  41050. }
  41051. $old = $this->handler;
  41052. $this->handler = $handler;
  41053. return $old;
  41054. }
  41055. public function setFileLinkFormat($format)
  41056. {
  41057. $old = $this->fileLinkFormat;
  41058. $this->fileLinkFormat = $format;
  41059. return $old;
  41060. }
  41061. public function handle(\Exception $exception)
  41062. {
  41063. if (null === $this->handler || $exception instanceof OutOfMemoryException) {
  41064. $this->failSafeHandle($exception);
  41065. return;
  41066. }
  41067. $caughtLength = $this->caughtLength = 0;
  41068. ob_start(array($this, 'catchOutput'));
  41069. $this->failSafeHandle($exception);
  41070. while (null === $this->caughtBuffer && ob_end_flush()) {
  41071. }
  41072. if (isset($this->caughtBuffer[0])) {
  41073. ob_start(array($this, 'cleanOutput'));
  41074. echo $this->caughtBuffer;
  41075. $caughtLength = ob_get_length();
  41076. }
  41077. $this->caughtBuffer = null;
  41078. try {
  41079. \call_user_func($this->handler, $exception);
  41080. $this->caughtLength = $caughtLength;
  41081. } catch (\Exception $e) {
  41082. if (!$caughtLength) {
  41083. throw $exception;
  41084. }
  41085. }
  41086. }
  41087. private function failSafeHandle(\Exception $exception)
  41088. {
  41089. if (class_exists('Symfony\Component\HttpFoundation\Response', false)
  41090. && __CLASS__ !== \get_class($this)
  41091. && ($reflector = new \ReflectionMethod($this, 'createResponse'))
  41092. && __CLASS__ !== $reflector->class
  41093. ) {
  41094. $response = $this->createResponse($exception);
  41095. $response->sendHeaders();
  41096. $response->sendContent();
  41097. @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);
  41098. return;
  41099. }
  41100. $this->sendPhpResponse($exception);
  41101. }
  41102. public function sendPhpResponse($exception)
  41103. {
  41104. if (!$exception instanceof FlattenException) {
  41105. $exception = FlattenException::create($exception);
  41106. }
  41107. if (!headers_sent()) {
  41108. header(sprintf('HTTP/1.0 %s', $exception->getStatusCode()));
  41109. foreach ($exception->getHeaders() as $name => $value) {
  41110. header($name.': '.$value, false);
  41111. }
  41112. header('Content-Type: text/html; charset='.$this->charset);
  41113. }
  41114. echo $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  41115. }
  41116. public function createResponse($exception)
  41117. {
  41118. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41119. if (!$exception instanceof FlattenException) {
  41120. $exception = FlattenException::create($exception);
  41121. }
  41122. return Response::create($this->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders())->setCharset($this->charset);
  41123. }
  41124. public function getHtml($exception)
  41125. {
  41126. if (!$exception instanceof FlattenException) {
  41127. $exception = FlattenException::create($exception);
  41128. }
  41129. return $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  41130. }
  41131. public function getContent(FlattenException $exception)
  41132. {
  41133. switch ($exception->getStatusCode()) {
  41134. case 404:
  41135. $title = 'Sorry, the page you are looking for could not be found.';
  41136. break;
  41137. default:
  41138. $title = 'Whoops, looks like something went wrong.';
  41139. }
  41140. $content = '';
  41141. if ($this->debug) {
  41142. try {
  41143. $count = \count($exception->getAllPrevious());
  41144. $total = $count + 1;
  41145. foreach ($exception->toArray() as $position => $e) {
  41146. $ind = $count - $position + 1;
  41147. $class = $this->formatClass($e['class']);
  41148. $message = nl2br($this->escapeHtml($e['message']));
  41149. $content .= sprintf(<<<'EOF'
  41150. <h2 class="block_exception clear_fix">
  41151. <span class="exception_counter">%d/%d</span>
  41152. <span class="exception_title">%s%s:</span>
  41153. <span class="exception_message">%s</span>
  41154. </h2>
  41155. <div class="block">
  41156. <ol class="traces list_exception">
  41157. EOF
  41158. , $ind, $total, $class, $this->formatPath($e['trace'][0]['file'], $e['trace'][0]['line']), $message);
  41159. foreach ($e['trace'] as $trace) {
  41160. $content .= ' <li>';
  41161. if ($trace['function']) {
  41162. $content .= sprintf('at %s%s%s(%s)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args']));
  41163. }
  41164. if (isset($trace['file']) && isset($trace['line'])) {
  41165. $content .= $this->formatPath($trace['file'], $trace['line']);
  41166. }
  41167. $content .= "</li>\n";
  41168. }
  41169. $content .= " </ol>\n</div>\n";
  41170. }
  41171. } catch (\Exception $e) {
  41172. if ($this->debug) {
  41173. $title = sprintf('Exception thrown when handling an exception (%s: %s)', \get_class($e), $this->escapeHtml($e->getMessage()));
  41174. } else {
  41175. $title = 'Whoops, looks like something went wrong.';
  41176. }
  41177. }
  41178. }
  41179. return <<<EOF
  41180. <div id="sf-resetcontent" class="sf-reset">
  41181. <h1>$title</h1>
  41182. $content
  41183. </div>
  41184. EOF;
  41185. }
  41186. public function getStylesheet(FlattenException $exception)
  41187. {
  41188. return <<<'EOF'
  41189. .sf-reset { font: 11px Verdana, Arial, sans-serif; color: #333 }
  41190. .sf-reset .clear { clear:both; height:0; font-size:0; line-height:0; }
  41191. .sf-reset .clear_fix:after { display:block; height:0; clear:both; visibility:hidden; }
  41192. .sf-reset .clear_fix { display:inline-block; }
  41193. .sf-reset * html .clear_fix { height:1%; }
  41194. .sf-reset .clear_fix { display:block; }
  41195. .sf-reset, .sf-reset .block { margin: auto }
  41196. .sf-reset abbr { border-bottom: 1px dotted #000; cursor: help; }
  41197. .sf-reset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px }
  41198. .sf-reset strong { font-weight:bold; }
  41199. .sf-reset a { color:#6c6159; cursor: default; }
  41200. .sf-reset a img { border:none; }
  41201. .sf-reset a:hover { text-decoration:underline; }
  41202. .sf-reset em { font-style:italic; }
  41203. .sf-reset h1, .sf-reset h2 { font: 20px Georgia, "Times New Roman", Times, serif }
  41204. .sf-reset .exception_counter { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; float: left; display: block; }
  41205. .sf-reset .exception_title { margin-left: 3em; margin-bottom: 0.7em; display: block; }
  41206. .sf-reset .exception_message { margin-left: 3em; display: block; }
  41207. .sf-reset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; }
  41208. .sf-reset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px;
  41209. -webkit-border-bottom-right-radius: 16px;
  41210. -webkit-border-bottom-left-radius: 16px;
  41211. -moz-border-radius-bottomright: 16px;
  41212. -moz-border-radius-bottomleft: 16px;
  41213. border-bottom-right-radius: 16px;
  41214. border-bottom-left-radius: 16px;
  41215. border-bottom:1px solid #ccc;
  41216. border-right:1px solid #ccc;
  41217. border-left:1px solid #ccc;
  41218. word-wrap: break-word;
  41219. }
  41220. .sf-reset .block_exception { background-color:#ddd; color: #333; padding:20px;
  41221. -webkit-border-top-left-radius: 16px;
  41222. -webkit-border-top-right-radius: 16px;
  41223. -moz-border-radius-topleft: 16px;
  41224. -moz-border-radius-topright: 16px;
  41225. border-top-left-radius: 16px;
  41226. border-top-right-radius: 16px;
  41227. border-top:1px solid #ccc;
  41228. border-right:1px solid #ccc;
  41229. border-left:1px solid #ccc;
  41230. overflow: hidden;
  41231. word-wrap: break-word;
  41232. }
  41233. .sf-reset a { background:none; color:#868686; text-decoration:none; }
  41234. .sf-reset a:hover { background:none; color:#313131; text-decoration:underline; }
  41235. .sf-reset ol { padding: 10px 0; }
  41236. .sf-reset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px;
  41237. -webkit-border-radius: 10px;
  41238. -moz-border-radius: 10px;
  41239. border-radius: 10px;
  41240. border: 1px solid #ccc;
  41241. }
  41242. EOF;
  41243. }
  41244. private function decorate($content, $css)
  41245. {
  41246. return <<<EOF
  41247. <!DOCTYPE html>
  41248. <html>
  41249. <head>
  41250. <meta charset="{$this->charset}" />
  41251. <meta name="robots" content="noindex,nofollow" />
  41252. <style>
  41253. /* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */
  41254. 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;}
  41255. html { background: #eee; padding: 10px }
  41256. img { border: 0; }
  41257. #sf-resetcontent { width:970px; margin:0 auto; }
  41258. $css
  41259. </style>
  41260. </head>
  41261. <body>
  41262. $content
  41263. </body>
  41264. </html>
  41265. EOF;
  41266. }
  41267. private function formatClass($class)
  41268. {
  41269. $parts = explode('\\', $class);
  41270. return sprintf('<abbr title="%s">%s</abbr>', $class, array_pop($parts));
  41271. }
  41272. private function formatPath($path, $line)
  41273. {
  41274. $path = $this->escapeHtml($path);
  41275. $file = preg_match('#[^/\\\\]*$#', $path, $file) ? $file[0] : $path;
  41276. if ($linkFormat = $this->fileLinkFormat) {
  41277. $link = strtr($this->escapeHtml($linkFormat), array('%f' => $path, '%l' => (int) $line));
  41278. return sprintf(' in <a href="%s" title="Go to source">%s line %d</a>', $link, $file, $line);
  41279. }
  41280. 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);
  41281. }
  41282. private function formatArgs(array $args)
  41283. {
  41284. $result = array();
  41285. foreach ($args as $key => $item) {
  41286. if ('object' === $item[0]) {
  41287. $formattedValue = sprintf('<em>object</em>(%s)', $this->formatClass($item[1]));
  41288. } elseif ('array' === $item[0]) {
  41289. $formattedValue = sprintf('<em>array</em>(%s)', \is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
  41290. } elseif ('string' === $item[0]) {
  41291. $formattedValue = sprintf("'%s'", $this->escapeHtml($item[1]));
  41292. } elseif ('null' === $item[0]) {
  41293. $formattedValue = '<em>null</em>';
  41294. } elseif ('boolean' === $item[0]) {
  41295. $formattedValue = '<em>'.strtolower(var_export($item[1], true)).'</em>';
  41296. } elseif ('resource' === $item[0]) {
  41297. $formattedValue = '<em>resource</em>';
  41298. } else {
  41299. $formattedValue = str_replace("\n", '', var_export($this->escapeHtml((string) $item[1]), true));
  41300. }
  41301. $result[] = \is_int($key) ? $formattedValue : sprintf("'%s' => %s", $this->escapeHtml($key), $formattedValue);
  41302. }
  41303. return implode(', ', $result);
  41304. }
  41305. protected static function utf8Htmlize($str)
  41306. {
  41307. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
  41308. return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8');
  41309. }
  41310. private function escapeHtml($str)
  41311. {
  41312. return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), $this->charset);
  41313. }
  41314. public function catchOutput($buffer)
  41315. {
  41316. $this->caughtBuffer = $buffer;
  41317. return '';
  41318. }
  41319. public function cleanOutput($buffer)
  41320. {
  41321. if ($this->caughtLength) {
  41322. $cleanBuffer = substr_replace($buffer, '', 0, $this->caughtLength);
  41323. if (isset($cleanBuffer[0])) {
  41324. $buffer = $cleanBuffer;
  41325. }
  41326. }
  41327. return $buffer;
  41328. }
  41329. }
  41330. <?php
  41331. namespace Symfony\Component\Debug\FatalErrorHandler;
  41332. use Composer\Autoload\ClassLoader as ComposerClassLoader;
  41333. use Symfony\Component\ClassLoader\ClassLoader as SymfonyClassLoader;
  41334. use Symfony\Component\ClassLoader\UniversalClassLoader as SymfonyUniversalClassLoader;
  41335. use Symfony\Component\Debug\DebugClassLoader;
  41336. use Symfony\Component\Debug\Exception\ClassNotFoundException;
  41337. use Symfony\Component\Debug\Exception\FatalErrorException;
  41338. class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
  41339. {
  41340. public function handleError(array $error, FatalErrorException $exception)
  41341. {
  41342. $messageLen = \strlen($error['message']);
  41343. $notFoundSuffix = '\' not found';
  41344. $notFoundSuffixLen = \strlen($notFoundSuffix);
  41345. if ($notFoundSuffixLen > $messageLen) {
  41346. return;
  41347. }
  41348. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  41349. return;
  41350. }
  41351. foreach (array('class', 'interface', 'trait') as $typeName) {
  41352. $prefix = ucfirst($typeName).' \'';
  41353. $prefixLen = \strlen($prefix);
  41354. if (0 !== strpos($error['message'], $prefix)) {
  41355. continue;
  41356. }
  41357. $fullyQualifiedClassName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  41358. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedClassName, '\\')) {
  41359. $className = substr($fullyQualifiedClassName, $namespaceSeparatorIndex + 1);
  41360. $namespacePrefix = substr($fullyQualifiedClassName, 0, $namespaceSeparatorIndex);
  41361. $message = sprintf('Attempted to load %s "%s" from namespace "%s".', $typeName, $className, $namespacePrefix);
  41362. $tail = ' for another namespace?';
  41363. } else {
  41364. $className = $fullyQualifiedClassName;
  41365. $message = sprintf('Attempted to load %s "%s" from the global namespace.', $typeName, $className);
  41366. $tail = '?';
  41367. }
  41368. if ($candidates = $this->getClassCandidates($className)) {
  41369. $tail = array_pop($candidates).'"?';
  41370. if ($candidates) {
  41371. $tail = ' for e.g. "'.implode('", "', $candidates).'" or "'.$tail;
  41372. } else {
  41373. $tail = ' for "'.$tail;
  41374. }
  41375. }
  41376. $message .= "\nDid you forget a \"use\" statement".$tail;
  41377. return new ClassNotFoundException($message, $exception);
  41378. }
  41379. }
  41380. private function getClassCandidates($class)
  41381. {
  41382. if (!\is_array($functions = spl_autoload_functions())) {
  41383. return array();
  41384. }
  41385. $classes = array();
  41386. foreach ($functions as $function) {
  41387. if (!\is_array($function)) {
  41388. continue;
  41389. }
  41390. if ($function[0] instanceof DebugClassLoader) {
  41391. $function = $function[0]->getClassLoader();
  41392. if (\is_object($function)) {
  41393. $function = array($function);
  41394. }
  41395. if (!\is_array($function)) {
  41396. continue;
  41397. }
  41398. }
  41399. if ($function[0] instanceof ComposerClassLoader || $function[0] instanceof SymfonyClassLoader || $function[0] instanceof SymfonyUniversalClassLoader) {
  41400. foreach ($function[0]->getPrefixes() as $prefix => $paths) {
  41401. foreach ($paths as $path) {
  41402. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  41403. }
  41404. }
  41405. }
  41406. if ($function[0] instanceof ComposerClassLoader) {
  41407. foreach ($function[0]->getPrefixesPsr4() as $prefix => $paths) {
  41408. foreach ($paths as $path) {
  41409. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  41410. }
  41411. }
  41412. }
  41413. }
  41414. return array_unique($classes);
  41415. }
  41416. private function findClassInPath($path, $class, $prefix)
  41417. {
  41418. if (!$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.\dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path)) {
  41419. return array();
  41420. }
  41421. $classes = array();
  41422. $filename = $class.'.php';
  41423. foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
  41424. if ($filename == $file->getFileName() && $class = $this->convertFileToClass($path, $file->getPathName(), $prefix)) {
  41425. $classes[] = $class;
  41426. }
  41427. }
  41428. return $classes;
  41429. }
  41430. private function convertFileToClass($path, $file, $prefix)
  41431. {
  41432. $candidates = array(
  41433. $namespacedClass = str_replace(array($path.\DIRECTORY_SEPARATOR, '.php', '/'), array('', '', '\\'), $file),
  41434. $prefix.$namespacedClass,
  41435. $prefix.'\\'.$namespacedClass,
  41436. str_replace('\\', '_', $namespacedClass),
  41437. str_replace('\\', '_', $prefix.$namespacedClass),
  41438. str_replace('\\', '_', $prefix.'\\'.$namespacedClass),
  41439. );
  41440. if ($prefix) {
  41441. $candidates = array_filter($candidates, function ($candidate) use ($prefix) { return 0 === strpos($candidate, $prefix); });
  41442. }
  41443. foreach ($candidates as $candidate) {
  41444. if ($this->classExists($candidate)) {
  41445. return $candidate;
  41446. }
  41447. }
  41448. require_once $file;
  41449. foreach ($candidates as $candidate) {
  41450. if ($this->classExists($candidate)) {
  41451. return $candidate;
  41452. }
  41453. }
  41454. }
  41455. private function classExists($class)
  41456. {
  41457. return class_exists($class, false) || interface_exists($class, false) || (\function_exists('trait_exists') && trait_exists($class, false));
  41458. }
  41459. }
  41460. <?php
  41461. namespace Symfony\Component\Debug\FatalErrorHandler;
  41462. use Symfony\Component\Debug\Exception\FatalErrorException;
  41463. interface FatalErrorHandlerInterface
  41464. {
  41465. public function handleError(array $error, FatalErrorException $exception);
  41466. }
  41467. <?php
  41468. namespace Symfony\Component\Debug\FatalErrorHandler;
  41469. use Symfony\Component\Debug\Exception\FatalErrorException;
  41470. use Symfony\Component\Debug\Exception\UndefinedFunctionException;
  41471. class UndefinedFunctionFatalErrorHandler implements FatalErrorHandlerInterface
  41472. {
  41473. public function handleError(array $error, FatalErrorException $exception)
  41474. {
  41475. $messageLen = \strlen($error['message']);
  41476. $notFoundSuffix = '()';
  41477. $notFoundSuffixLen = \strlen($notFoundSuffix);
  41478. if ($notFoundSuffixLen > $messageLen) {
  41479. return;
  41480. }
  41481. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  41482. return;
  41483. }
  41484. $prefix = 'Call to undefined function ';
  41485. $prefixLen = \strlen($prefix);
  41486. if (0 !== strpos($error['message'], $prefix)) {
  41487. return;
  41488. }
  41489. $fullyQualifiedFunctionName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  41490. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedFunctionName, '\\')) {
  41491. $functionName = substr($fullyQualifiedFunctionName, $namespaceSeparatorIndex + 1);
  41492. $namespacePrefix = substr($fullyQualifiedFunctionName, 0, $namespaceSeparatorIndex);
  41493. $message = sprintf('Attempted to call function "%s" from namespace "%s".', $functionName, $namespacePrefix);
  41494. } else {
  41495. $functionName = $fullyQualifiedFunctionName;
  41496. $message = sprintf('Attempted to call function "%s" from the global namespace.', $functionName);
  41497. }
  41498. $candidates = array();
  41499. foreach (get_defined_functions() as $type => $definedFunctionNames) {
  41500. foreach ($definedFunctionNames as $definedFunctionName) {
  41501. if (false !== $namespaceSeparatorIndex = strrpos($definedFunctionName, '\\')) {
  41502. $definedFunctionNameBasename = substr($definedFunctionName, $namespaceSeparatorIndex + 1);
  41503. } else {
  41504. $definedFunctionNameBasename = $definedFunctionName;
  41505. }
  41506. if ($definedFunctionNameBasename === $functionName) {
  41507. $candidates[] = '\\'.$definedFunctionName;
  41508. }
  41509. }
  41510. }
  41511. if ($candidates) {
  41512. sort($candidates);
  41513. $last = array_pop($candidates).'"?';
  41514. if ($candidates) {
  41515. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  41516. } else {
  41517. $candidates = '"'.$last;
  41518. }
  41519. $message .= "\nDid you mean to call ".$candidates;
  41520. }
  41521. return new UndefinedFunctionException($message, $exception);
  41522. }
  41523. }
  41524. <?php
  41525. namespace Symfony\Component\Debug\FatalErrorHandler;
  41526. use Symfony\Component\Debug\Exception\FatalErrorException;
  41527. use Symfony\Component\Debug\Exception\UndefinedMethodException;
  41528. class UndefinedMethodFatalErrorHandler implements FatalErrorHandlerInterface
  41529. {
  41530. public function handleError(array $error, FatalErrorException $exception)
  41531. {
  41532. preg_match('/^Call to undefined method (.*)::(.*)\(\)$/', $error['message'], $matches);
  41533. if (!$matches) {
  41534. return;
  41535. }
  41536. $className = $matches[1];
  41537. $methodName = $matches[2];
  41538. $message = sprintf('Attempted to call an undefined method named "%s" of class "%s".', $methodName, $className);
  41539. if (!class_exists($className) || null === $methods = get_class_methods($className)) {
  41540. return new UndefinedMethodException($message, $exception);
  41541. }
  41542. $candidates = array();
  41543. foreach ($methods as $definedMethodName) {
  41544. $lev = levenshtein($methodName, $definedMethodName);
  41545. if ($lev <= \strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) {
  41546. $candidates[] = $definedMethodName;
  41547. }
  41548. }
  41549. if ($candidates) {
  41550. sort($candidates);
  41551. $last = array_pop($candidates).'"?';
  41552. if ($candidates) {
  41553. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  41554. } else {
  41555. $candidates = '"'.$last;
  41556. }
  41557. $message .= "\nDid you mean to call ".$candidates;
  41558. }
  41559. return new UndefinedMethodException($message, $exception);
  41560. }
  41561. }
  41562. Copyright (c) 2004-2018 Fabien Potencier
  41563. Permission is hereby granted, free of charge, to any person obtaining a copy
  41564. of this software and associated documentation files (the "Software"), to deal
  41565. in the Software without restriction, including without limitation the rights
  41566. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  41567. copies of the Software, and to permit persons to whom the Software is furnished
  41568. to do so, subject to the following conditions:
  41569. The above copyright notice and this permission notice shall be included in all
  41570. copies or substantial portions of the Software.
  41571. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  41572. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  41573. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  41574. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  41575. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  41576. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  41577. THE SOFTWARE.
  41578. <?php
  41579. namespace Symfony\Component\Filesystem\Exception;
  41580. interface ExceptionInterface
  41581. {
  41582. }
  41583. <?php
  41584. namespace Symfony\Component\Filesystem\Exception;
  41585. class FileNotFoundException extends IOException
  41586. {
  41587. public function __construct($message = null, $code = 0, \Exception $previous = null, $path = null)
  41588. {
  41589. if (null === $message) {
  41590. if (null === $path) {
  41591. $message = 'File could not be found.';
  41592. } else {
  41593. $message = sprintf('File "%s" could not be found.', $path);
  41594. }
  41595. }
  41596. parent::__construct($message, $code, $previous, $path);
  41597. }
  41598. }
  41599. <?php
  41600. namespace Symfony\Component\Filesystem\Exception;
  41601. class IOException extends \RuntimeException implements IOExceptionInterface
  41602. {
  41603. private $path;
  41604. public function __construct($message, $code = 0, \Exception $previous = null, $path = null)
  41605. {
  41606. $this->path = $path;
  41607. parent::__construct($message, $code, $previous);
  41608. }
  41609. public function getPath()
  41610. {
  41611. return $this->path;
  41612. }
  41613. }
  41614. <?php
  41615. namespace Symfony\Component\Filesystem\Exception;
  41616. interface IOExceptionInterface extends ExceptionInterface
  41617. {
  41618. public function getPath();
  41619. }
  41620. <?php
  41621. namespace Symfony\Component\Filesystem;
  41622. use Symfony\Component\Filesystem\Exception\FileNotFoundException;
  41623. use Symfony\Component\Filesystem\Exception\IOException;
  41624. class Filesystem
  41625. {
  41626. private static $lastError;
  41627. public function copy($originFile, $targetFile, $overwriteNewerFiles = false)
  41628. {
  41629. $originIsLocal = stream_is_local($originFile) || 0 === stripos($originFile, 'file://');
  41630. if ($originIsLocal && !is_file($originFile)) {
  41631. throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
  41632. }
  41633. $this->mkdir(\dirname($targetFile));
  41634. $doCopy = true;
  41635. if (!$overwriteNewerFiles && null === parse_url($originFile, PHP_URL_HOST) && is_file($targetFile)) {
  41636. $doCopy = filemtime($originFile) > filemtime($targetFile);
  41637. }
  41638. if ($doCopy) {
  41639. if (false === $source = @fopen($originFile, 'r')) {
  41640. throw new IOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading.', $originFile, $targetFile), 0, null, $originFile);
  41641. }
  41642. if (false === $target = @fopen($targetFile, 'w', null, stream_context_create(array('ftp' => array('overwrite' => true))))) {
  41643. throw new IOException(sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing.', $originFile, $targetFile), 0, null, $originFile);
  41644. }
  41645. $bytesCopied = stream_copy_to_stream($source, $target);
  41646. fclose($source);
  41647. fclose($target);
  41648. unset($source, $target);
  41649. if (!is_file($targetFile)) {
  41650. throw new IOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile);
  41651. }
  41652. if ($originIsLocal) {
  41653. @chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
  41654. if ($bytesCopied !== $bytesOrigin = filesize($originFile)) {
  41655. 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);
  41656. }
  41657. }
  41658. }
  41659. }
  41660. public function mkdir($dirs, $mode = 0777)
  41661. {
  41662. foreach ($this->toIterator($dirs) as $dir) {
  41663. if (is_dir($dir)) {
  41664. continue;
  41665. }
  41666. if (!self::box('mkdir', $dir, $mode, true)) {
  41667. if (!is_dir($dir)) {
  41668. if (self::$lastError) {
  41669. throw new IOException(sprintf('Failed to create "%s": %s.', $dir, self::$lastError), 0, null, $dir);
  41670. }
  41671. throw new IOException(sprintf('Failed to create "%s"', $dir), 0, null, $dir);
  41672. }
  41673. }
  41674. }
  41675. }
  41676. public function exists($files)
  41677. {
  41678. $maxPathLength = PHP_MAXPATHLEN - 2;
  41679. foreach ($this->toIterator($files) as $file) {
  41680. if (\strlen($file) > $maxPathLength) {
  41681. throw new IOException(sprintf('Could not check if file exist because path length exceeds %d characters.', $maxPathLength), 0, null, $file);
  41682. }
  41683. if (!file_exists($file)) {
  41684. return false;
  41685. }
  41686. }
  41687. return true;
  41688. }
  41689. public function touch($files, $time = null, $atime = null)
  41690. {
  41691. foreach ($this->toIterator($files) as $file) {
  41692. $touch = $time ? @touch($file, $time, $atime) : @touch($file);
  41693. if (true !== $touch) {
  41694. throw new IOException(sprintf('Failed to touch "%s".', $file), 0, null, $file);
  41695. }
  41696. }
  41697. }
  41698. public function remove($files)
  41699. {
  41700. if ($files instanceof \Traversable) {
  41701. $files = iterator_to_array($files, false);
  41702. } elseif (!\is_array($files)) {
  41703. $files = array($files);
  41704. }
  41705. $files = array_reverse($files);
  41706. foreach ($files as $file) {
  41707. if (is_link($file)) {
  41708. if (!(self::box('unlink', $file) || '\\' !== \DIRECTORY_SEPARATOR || self::box('rmdir', $file)) && file_exists($file)) {
  41709. throw new IOException(sprintf('Failed to remove symlink "%s": %s.', $file, self::$lastError));
  41710. }
  41711. } elseif (is_dir($file)) {
  41712. $this->remove(new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS));
  41713. if (!self::box('rmdir', $file) && file_exists($file)) {
  41714. throw new IOException(sprintf('Failed to remove directory "%s": %s.', $file, self::$lastError));
  41715. }
  41716. } elseif (!self::box('unlink', $file) && file_exists($file)) {
  41717. throw new IOException(sprintf('Failed to remove file "%s": %s.', $file, self::$lastError));
  41718. }
  41719. }
  41720. }
  41721. public function chmod($files, $mode, $umask = 0000, $recursive = false)
  41722. {
  41723. foreach ($this->toIterator($files) as $file) {
  41724. if (true !== @chmod($file, $mode & ~$umask)) {
  41725. throw new IOException(sprintf('Failed to chmod file "%s".', $file), 0, null, $file);
  41726. }
  41727. if ($recursive && is_dir($file) && !is_link($file)) {
  41728. $this->chmod(new \FilesystemIterator($file), $mode, $umask, true);
  41729. }
  41730. }
  41731. }
  41732. public function chown($files, $user, $recursive = false)
  41733. {
  41734. foreach ($this->toIterator($files) as $file) {
  41735. if ($recursive && is_dir($file) && !is_link($file)) {
  41736. $this->chown(new \FilesystemIterator($file), $user, true);
  41737. }
  41738. if (is_link($file) && \function_exists('lchown')) {
  41739. if (true !== @lchown($file, $user)) {
  41740. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  41741. }
  41742. } else {
  41743. if (true !== @chown($file, $user)) {
  41744. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  41745. }
  41746. }
  41747. }
  41748. }
  41749. public function chgrp($files, $group, $recursive = false)
  41750. {
  41751. foreach ($this->toIterator($files) as $file) {
  41752. if ($recursive && is_dir($file) && !is_link($file)) {
  41753. $this->chgrp(new \FilesystemIterator($file), $group, true);
  41754. }
  41755. if (is_link($file) && \function_exists('lchgrp')) {
  41756. if (true !== @lchgrp($file, $group) || (\defined('HHVM_VERSION') && !posix_getgrnam($group))) {
  41757. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  41758. }
  41759. } else {
  41760. if (true !== @chgrp($file, $group)) {
  41761. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  41762. }
  41763. }
  41764. }
  41765. }
  41766. public function rename($origin, $target, $overwrite = false)
  41767. {
  41768. if (!$overwrite && $this->isReadable($target)) {
  41769. throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target);
  41770. }
  41771. if (true !== @rename($origin, $target)) {
  41772. if (is_dir($origin)) {
  41773. $this->mirror($origin, $target, null, array('override' => $overwrite, 'delete' => $overwrite));
  41774. $this->remove($origin);
  41775. return;
  41776. }
  41777. throw new IOException(sprintf('Cannot rename "%s" to "%s".', $origin, $target), 0, null, $target);
  41778. }
  41779. }
  41780. private function isReadable($filename)
  41781. {
  41782. $maxPathLength = PHP_MAXPATHLEN - 2;
  41783. if (\strlen($filename) > $maxPathLength) {
  41784. throw new IOException(sprintf('Could not check if file is readable because path length exceeds %d characters.', $maxPathLength), 0, null, $filename);
  41785. }
  41786. return is_readable($filename);
  41787. }
  41788. public function symlink($originDir, $targetDir, $copyOnWindows = false)
  41789. {
  41790. if ('\\' === \DIRECTORY_SEPARATOR) {
  41791. $originDir = strtr($originDir, '/', '\\');
  41792. $targetDir = strtr($targetDir, '/', '\\');
  41793. if ($copyOnWindows) {
  41794. $this->mirror($originDir, $targetDir);
  41795. return;
  41796. }
  41797. }
  41798. $this->mkdir(\dirname($targetDir));
  41799. if (is_link($targetDir)) {
  41800. if (readlink($targetDir) === $originDir) {
  41801. return;
  41802. }
  41803. $this->remove($targetDir);
  41804. }
  41805. if (!self::box('symlink', $originDir, $targetDir)) {
  41806. if (null !== self::$lastError) {
  41807. if ('\\' === \DIRECTORY_SEPARATOR && false !== strpos(self::$lastError, 'error code(1314)')) {
  41808. 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);
  41809. }
  41810. }
  41811. throw new IOException(sprintf('Failed to create symbolic link from "%s" to "%s".', $originDir, $targetDir), 0, null, $targetDir);
  41812. }
  41813. }
  41814. public function makePathRelative($endPath, $startPath)
  41815. {
  41816. if ('\\' === \DIRECTORY_SEPARATOR) {
  41817. $endPath = str_replace('\\', '/', $endPath);
  41818. $startPath = str_replace('\\', '/', $startPath);
  41819. }
  41820. $stripDriveLetter = function ($path) {
  41821. if (\strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && ctype_alpha($path[0])) {
  41822. return substr($path, 2);
  41823. }
  41824. return $path;
  41825. };
  41826. $endPath = $stripDriveLetter($endPath);
  41827. $startPath = $stripDriveLetter($startPath);
  41828. $startPathArr = explode('/', trim($startPath, '/'));
  41829. $endPathArr = explode('/', trim($endPath, '/'));
  41830. $normalizePathArray = function ($pathSegments, $absolute) {
  41831. $result = array();
  41832. foreach ($pathSegments as $segment) {
  41833. if ('..' === $segment && ($absolute || \count($result))) {
  41834. array_pop($result);
  41835. } elseif ('.' !== $segment) {
  41836. $result[] = $segment;
  41837. }
  41838. }
  41839. return $result;
  41840. };
  41841. $startPathArr = $normalizePathArray($startPathArr, static::isAbsolutePath($startPath));
  41842. $endPathArr = $normalizePathArray($endPathArr, static::isAbsolutePath($endPath));
  41843. $index = 0;
  41844. while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
  41845. ++$index;
  41846. }
  41847. if (1 === \count($startPathArr) && '' === $startPathArr[0]) {
  41848. $depth = 0;
  41849. } else {
  41850. $depth = \count($startPathArr) - $index;
  41851. }
  41852. $traverser = str_repeat('../', $depth);
  41853. $endPathRemainder = implode('/', \array_slice($endPathArr, $index));
  41854. $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : '');
  41855. return '' === $relativePath ? './' : $relativePath;
  41856. }
  41857. public function mirror($originDir, $targetDir, \Traversable $iterator = null, $options = array())
  41858. {
  41859. $targetDir = rtrim($targetDir, '/\\');
  41860. $originDir = rtrim($originDir, '/\\');
  41861. $originDirLen = \strlen($originDir);
  41862. if ($this->exists($targetDir) && isset($options['delete']) && $options['delete']) {
  41863. $deleteIterator = $iterator;
  41864. if (null === $deleteIterator) {
  41865. $flags = \FilesystemIterator::SKIP_DOTS;
  41866. $deleteIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($targetDir, $flags), \RecursiveIteratorIterator::CHILD_FIRST);
  41867. }
  41868. $targetDirLen = \strlen($targetDir);
  41869. foreach ($deleteIterator as $file) {
  41870. $origin = $originDir.substr($file->getPathname(), $targetDirLen);
  41871. if (!$this->exists($origin)) {
  41872. $this->remove($file);
  41873. }
  41874. }
  41875. }
  41876. $copyOnWindows = false;
  41877. if (isset($options['copy_on_windows'])) {
  41878. $copyOnWindows = $options['copy_on_windows'];
  41879. }
  41880. if (null === $iterator) {
  41881. $flags = $copyOnWindows ? \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS : \FilesystemIterator::SKIP_DOTS;
  41882. $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, $flags), \RecursiveIteratorIterator::SELF_FIRST);
  41883. }
  41884. if ($this->exists($originDir)) {
  41885. $this->mkdir($targetDir);
  41886. }
  41887. foreach ($iterator as $file) {
  41888. $target = $targetDir.substr($file->getPathname(), $originDirLen);
  41889. if ($copyOnWindows) {
  41890. if (is_file($file)) {
  41891. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  41892. } elseif (is_dir($file)) {
  41893. $this->mkdir($target);
  41894. } else {
  41895. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  41896. }
  41897. } else {
  41898. if (is_link($file)) {
  41899. $this->symlink($file->getLinkTarget(), $target);
  41900. } elseif (is_dir($file)) {
  41901. $this->mkdir($target);
  41902. } elseif (is_file($file)) {
  41903. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  41904. } else {
  41905. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  41906. }
  41907. }
  41908. }
  41909. }
  41910. public function isAbsolutePath($file)
  41911. {
  41912. return strspn($file, '/\\', 0, 1)
  41913. || (\strlen($file) > 3 && ctype_alpha($file[0])
  41914. && ':' === substr($file, 1, 1)
  41915. && strspn($file, '/\\', 2, 1)
  41916. )
  41917. || null !== parse_url($file, PHP_URL_SCHEME)
  41918. ;
  41919. }
  41920. public function tempnam($dir, $prefix)
  41921. {
  41922. list($scheme, $hierarchy) = $this->getSchemeAndHierarchy($dir);
  41923. if (null === $scheme || 'file' === $scheme || 'gs' === $scheme) {
  41924. $tmpFile = @tempnam($hierarchy, $prefix);
  41925. if (false !== $tmpFile) {
  41926. if (null !== $scheme && 'gs' !== $scheme) {
  41927. return $scheme.'://'.$tmpFile;
  41928. }
  41929. return $tmpFile;
  41930. }
  41931. throw new IOException('A temporary file could not be created.');
  41932. }
  41933. for ($i = 0; $i < 10; ++$i) {
  41934. $tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true);
  41935. $handle = @fopen($tmpFile, 'x+');
  41936. if (false === $handle) {
  41937. continue;
  41938. }
  41939. @fclose($handle);
  41940. return $tmpFile;
  41941. }
  41942. throw new IOException('A temporary file could not be created.');
  41943. }
  41944. public function dumpFile($filename, $content, $mode = 0666)
  41945. {
  41946. $dir = \dirname($filename);
  41947. if (!is_dir($dir)) {
  41948. $this->mkdir($dir);
  41949. }
  41950. if (!is_writable($dir)) {
  41951. throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir);
  41952. }
  41953. $tmpFile = $this->tempnam($dir, basename($filename));
  41954. if (false === @file_put_contents($tmpFile, $content)) {
  41955. throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename);
  41956. }
  41957. if (null !== $mode) {
  41958. if (\func_num_args() > 2) {
  41959. @trigger_error('Support for modifying file permissions is deprecated since Symfony 2.3.12 and will be removed in 3.0.', E_USER_DEPRECATED);
  41960. }
  41961. $this->chmod($tmpFile, $mode);
  41962. } elseif (file_exists($filename)) {
  41963. @chmod($tmpFile, fileperms($filename));
  41964. }
  41965. $this->rename($tmpFile, $filename, true);
  41966. }
  41967. private function toIterator($files)
  41968. {
  41969. if (!$files instanceof \Traversable) {
  41970. $files = new \ArrayObject(\is_array($files) ? $files : array($files));
  41971. }
  41972. return $files;
  41973. }
  41974. private function getSchemeAndHierarchy($filename)
  41975. {
  41976. $components = explode('://', $filename, 2);
  41977. return 2 === \count($components) ? array($components[0], $components[1]) : array(null, $components[0]);
  41978. }
  41979. private static function box($func)
  41980. {
  41981. self::$lastError = null;
  41982. \set_error_handler(__CLASS__.'::handleError');
  41983. try {
  41984. $result = \call_user_func_array($func, \array_slice(\func_get_args(), 1));
  41985. \restore_error_handler();
  41986. return $result;
  41987. } catch (\Throwable $e) {
  41988. } catch (\Exception $e) {
  41989. }
  41990. \restore_error_handler();
  41991. throw $e;
  41992. }
  41993. public static function handleError($type, $msg)
  41994. {
  41995. self::$lastError = $msg;
  41996. }
  41997. }
  41998. Copyright (c) 2004-2018 Fabien Potencier
  41999. Permission is hereby granted, free of charge, to any person obtaining a copy
  42000. of this software and associated documentation files (the "Software"), to deal
  42001. in the Software without restriction, including without limitation the rights
  42002. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  42003. copies of the Software, and to permit persons to whom the Software is furnished
  42004. to do so, subject to the following conditions:
  42005. The above copyright notice and this permission notice shall be included in all
  42006. copies or substantial portions of the Software.
  42007. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  42008. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  42009. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  42010. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  42011. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  42012. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  42013. THE SOFTWARE.
  42014. <?php
  42015. namespace Symfony\Component\Filesystem;
  42016. use Symfony\Component\Filesystem\Exception\IOException;
  42017. class LockHandler
  42018. {
  42019. private $file;
  42020. private $handle;
  42021. public function __construct($name, $lockPath = null)
  42022. {
  42023. $lockPath = $lockPath ?: sys_get_temp_dir();
  42024. if (!is_dir($lockPath)) {
  42025. $fs = new Filesystem();
  42026. $fs->mkdir($lockPath);
  42027. }
  42028. if (!is_writable($lockPath)) {
  42029. throw new IOException(sprintf('The directory "%s" is not writable.', $lockPath), 0, null, $lockPath);
  42030. }
  42031. $this->file = sprintf('%s/sf.%s.%s.lock', $lockPath, preg_replace('/[^a-z0-9\._-]+/i', '-', $name), hash('sha256', $name));
  42032. }
  42033. public function lock($blocking = false)
  42034. {
  42035. if ($this->handle) {
  42036. return true;
  42037. }
  42038. $error = null;
  42039. set_error_handler(function ($errno, $msg) use (&$error) {
  42040. $error = $msg;
  42041. });
  42042. if (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) {
  42043. if ($this->handle = fopen($this->file, 'x')) {
  42044. chmod($this->file, 0666);
  42045. } elseif (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) {
  42046. usleep(100);
  42047. $this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r');
  42048. }
  42049. }
  42050. restore_error_handler();
  42051. if (!$this->handle) {
  42052. throw new IOException($error, 0, null, $this->file);
  42053. }
  42054. if (!flock($this->handle, LOCK_EX | ($blocking ? 0 : LOCK_NB))) {
  42055. fclose($this->handle);
  42056. $this->handle = null;
  42057. return false;
  42058. }
  42059. return true;
  42060. }
  42061. public function release()
  42062. {
  42063. if ($this->handle) {
  42064. flock($this->handle, LOCK_UN | LOCK_NB);
  42065. fclose($this->handle);
  42066. $this->handle = null;
  42067. }
  42068. }
  42069. }
  42070. <?php
  42071. namespace Symfony\Component\Finder\Adapter;
  42072. @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);
  42073. abstract class AbstractAdapter implements AdapterInterface
  42074. {
  42075. protected $followLinks = false;
  42076. protected $mode = 0;
  42077. protected $minDepth = 0;
  42078. protected $maxDepth = PHP_INT_MAX;
  42079. protected $exclude = array();
  42080. protected $names = array();
  42081. protected $notNames = array();
  42082. protected $contains = array();
  42083. protected $notContains = array();
  42084. protected $sizes = array();
  42085. protected $dates = array();
  42086. protected $filters = array();
  42087. protected $sort = false;
  42088. protected $paths = array();
  42089. protected $notPaths = array();
  42090. protected $ignoreUnreadableDirs = false;
  42091. private static $areSupported = array();
  42092. public function isSupported()
  42093. {
  42094. $name = $this->getName();
  42095. if (!array_key_exists($name, self::$areSupported)) {
  42096. self::$areSupported[$name] = $this->canBeUsed();
  42097. }
  42098. return self::$areSupported[$name];
  42099. }
  42100. public function setFollowLinks($followLinks)
  42101. {
  42102. $this->followLinks = $followLinks;
  42103. return $this;
  42104. }
  42105. public function setMode($mode)
  42106. {
  42107. $this->mode = $mode;
  42108. return $this;
  42109. }
  42110. public function setDepths(array $depths)
  42111. {
  42112. $this->minDepth = 0;
  42113. $this->maxDepth = PHP_INT_MAX;
  42114. foreach ($depths as $comparator) {
  42115. switch ($comparator->getOperator()) {
  42116. case '>':
  42117. $this->minDepth = $comparator->getTarget() + 1;
  42118. break;
  42119. case '>=':
  42120. $this->minDepth = $comparator->getTarget();
  42121. break;
  42122. case '<':
  42123. $this->maxDepth = $comparator->getTarget() - 1;
  42124. break;
  42125. case '<=':
  42126. $this->maxDepth = $comparator->getTarget();
  42127. break;
  42128. default:
  42129. $this->minDepth = $this->maxDepth = $comparator->getTarget();
  42130. }
  42131. }
  42132. return $this;
  42133. }
  42134. public function setExclude(array $exclude)
  42135. {
  42136. $this->exclude = $exclude;
  42137. return $this;
  42138. }
  42139. public function setNames(array $names)
  42140. {
  42141. $this->names = $names;
  42142. return $this;
  42143. }
  42144. public function setNotNames(array $notNames)
  42145. {
  42146. $this->notNames = $notNames;
  42147. return $this;
  42148. }
  42149. public function setContains(array $contains)
  42150. {
  42151. $this->contains = $contains;
  42152. return $this;
  42153. }
  42154. public function setNotContains(array $notContains)
  42155. {
  42156. $this->notContains = $notContains;
  42157. return $this;
  42158. }
  42159. public function setSizes(array $sizes)
  42160. {
  42161. $this->sizes = $sizes;
  42162. return $this;
  42163. }
  42164. public function setDates(array $dates)
  42165. {
  42166. $this->dates = $dates;
  42167. return $this;
  42168. }
  42169. public function setFilters(array $filters)
  42170. {
  42171. $this->filters = $filters;
  42172. return $this;
  42173. }
  42174. public function setSort($sort)
  42175. {
  42176. $this->sort = $sort;
  42177. return $this;
  42178. }
  42179. public function setPath(array $paths)
  42180. {
  42181. $this->paths = $paths;
  42182. return $this;
  42183. }
  42184. public function setNotPath(array $notPaths)
  42185. {
  42186. $this->notPaths = $notPaths;
  42187. return $this;
  42188. }
  42189. public function ignoreUnreadableDirs($ignore = true)
  42190. {
  42191. $this->ignoreUnreadableDirs = (bool) $ignore;
  42192. return $this;
  42193. }
  42194. abstract protected function canBeUsed();
  42195. }
  42196. <?php
  42197. namespace Symfony\Component\Finder\Adapter;
  42198. @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);
  42199. use Symfony\Component\Finder\Comparator\DateComparator;
  42200. use Symfony\Component\Finder\Comparator\NumberComparator;
  42201. use Symfony\Component\Finder\Exception\AccessDeniedException;
  42202. use Symfony\Component\Finder\Expression\Expression;
  42203. use Symfony\Component\Finder\Iterator;
  42204. use Symfony\Component\Finder\Shell\Command;
  42205. use Symfony\Component\Finder\Shell\Shell;
  42206. abstract class AbstractFindAdapter extends AbstractAdapter
  42207. {
  42208. protected $shell;
  42209. public function __construct()
  42210. {
  42211. $this->shell = new Shell();
  42212. }
  42213. public function searchInDirectory($dir)
  42214. {
  42215. $dir = realpath($dir);
  42216. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode && ($this->contains || $this->notContains)) {
  42217. return new Iterator\FilePathsIterator(array(), $dir);
  42218. }
  42219. $command = Command::create();
  42220. $find = $this->buildFindCommand($command, $dir);
  42221. if ($this->followLinks) {
  42222. $find->add('-follow');
  42223. }
  42224. $find->add('-mindepth')->add($this->minDepth + 1);
  42225. if (PHP_INT_MAX !== $this->maxDepth) {
  42226. $find->add('-maxdepth')->add($this->maxDepth + 1);
  42227. }
  42228. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode) {
  42229. $find->add('-type d');
  42230. } elseif (Iterator\FileTypeFilterIterator::ONLY_FILES === $this->mode) {
  42231. $find->add('-type f');
  42232. }
  42233. $this->buildNamesFiltering($find, $this->names);
  42234. $this->buildNamesFiltering($find, $this->notNames, true);
  42235. $this->buildPathsFiltering($find, $dir, $this->paths);
  42236. $this->buildPathsFiltering($find, $dir, $this->notPaths, true);
  42237. $this->buildSizesFiltering($find, $this->sizes);
  42238. $this->buildDatesFiltering($find, $this->dates);
  42239. $useGrep = $this->shell->testCommand('grep') && $this->shell->testCommand('xargs');
  42240. $useSort = \is_int($this->sort) && $this->shell->testCommand('sort') && $this->shell->testCommand('cut');
  42241. if ($useGrep && ($this->contains || $this->notContains)) {
  42242. $grep = $command->ins('grep');
  42243. $this->buildContentFiltering($grep, $this->contains);
  42244. $this->buildContentFiltering($grep, $this->notContains, true);
  42245. }
  42246. if ($useSort) {
  42247. $this->buildSorting($command, $this->sort);
  42248. }
  42249. $command->setErrorHandler(
  42250. $this->ignoreUnreadableDirs
  42251. ? function ($stderr) { }
  42252. : function ($stderr) { throw new AccessDeniedException($stderr); }
  42253. );
  42254. $paths = $this->shell->testCommand('uniq') ? $command->add('| uniq')->execute() : array_unique($command->execute());
  42255. $iterator = new Iterator\FilePathsIterator($paths, $dir);
  42256. if ($this->exclude) {
  42257. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  42258. }
  42259. if (!$useGrep && ($this->contains || $this->notContains)) {
  42260. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  42261. }
  42262. if ($this->filters) {
  42263. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  42264. }
  42265. if (!$useSort && $this->sort) {
  42266. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  42267. $iterator = $iteratorAggregate->getIterator();
  42268. }
  42269. return $iterator;
  42270. }
  42271. protected function canBeUsed()
  42272. {
  42273. return $this->shell->testCommand('find');
  42274. }
  42275. protected function buildFindCommand(Command $command, $dir)
  42276. {
  42277. return $command
  42278. ->ins('find')
  42279. ->add('find ')
  42280. ->arg($dir)
  42281. ->add('-noleaf');
  42282. }
  42283. private function buildNamesFiltering(Command $command, array $names, $not = false)
  42284. {
  42285. if (0 === \count($names)) {
  42286. return;
  42287. }
  42288. $command->add($not ? '-not' : null)->cmd('(');
  42289. foreach ($names as $i => $name) {
  42290. $expr = Expression::create($name);
  42291. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  42292. $expr = Expression::create($expr->getGlob()->toRegex(false));
  42293. }
  42294. if ($expr->isRegex()) {
  42295. $regex = $expr->getRegex();
  42296. $regex->prepend($regex->hasStartFlag() ? '/' : '/[^/]*')
  42297. ->setStartFlag(false)
  42298. ->setStartJoker(true)
  42299. ->replaceJokers('[^/]');
  42300. if (!$regex->hasEndFlag() || $regex->hasEndJoker()) {
  42301. $regex->setEndJoker(false)->append('[^/]*');
  42302. }
  42303. }
  42304. $command
  42305. ->add($i > 0 ? '-or' : null)
  42306. ->add($expr->isRegex()
  42307. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  42308. : ($expr->isCaseSensitive() ? '-name' : '-iname')
  42309. )
  42310. ->arg($expr->renderPattern());
  42311. }
  42312. $command->cmd(')');
  42313. }
  42314. private function buildPathsFiltering(Command $command, $dir, array $paths, $not = false)
  42315. {
  42316. if (0 === \count($paths)) {
  42317. return;
  42318. }
  42319. $command->add($not ? '-not' : null)->cmd('(');
  42320. foreach ($paths as $i => $path) {
  42321. $expr = Expression::create($path);
  42322. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  42323. $expr = Expression::create($expr->getGlob()->toRegex(false));
  42324. }
  42325. if ($expr->isRegex()) {
  42326. $regex = $expr->getRegex();
  42327. $regex->prepend($regex->hasStartFlag() ? preg_quote($dir).\DIRECTORY_SEPARATOR : '.*')->setEndJoker(!$regex->hasEndFlag());
  42328. } else {
  42329. $expr->prepend('*')->append('*');
  42330. }
  42331. $command
  42332. ->add($i > 0 ? '-or' : null)
  42333. ->add($expr->isRegex()
  42334. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  42335. : ($expr->isCaseSensitive() ? '-path' : '-ipath')
  42336. )
  42337. ->arg($expr->renderPattern());
  42338. }
  42339. $command->cmd(')');
  42340. }
  42341. private function buildSizesFiltering(Command $command, array $sizes)
  42342. {
  42343. foreach ($sizes as $i => $size) {
  42344. $command->add($i > 0 ? '-and' : null);
  42345. switch ($size->getOperator()) {
  42346. case '<=':
  42347. $command->add('-size -'.($size->getTarget() + 1).'c');
  42348. break;
  42349. case '>=':
  42350. $command->add('-size +'.($size->getTarget() - 1).'c');
  42351. break;
  42352. case '>':
  42353. $command->add('-size +'.$size->getTarget().'c');
  42354. break;
  42355. case '!=':
  42356. $command->add('-size -'.$size->getTarget().'c');
  42357. $command->add('-size +'.$size->getTarget().'c');
  42358. break;
  42359. case '<':
  42360. default:
  42361. $command->add('-size -'.$size->getTarget().'c');
  42362. }
  42363. }
  42364. }
  42365. private function buildDatesFiltering(Command $command, array $dates)
  42366. {
  42367. foreach ($dates as $i => $date) {
  42368. $command->add($i > 0 ? '-and' : null);
  42369. $mins = (int) round((time() - $date->getTarget()) / 60);
  42370. if (0 > $mins) {
  42371. $command->add(' -mmin -0');
  42372. return;
  42373. }
  42374. switch ($date->getOperator()) {
  42375. case '<=':
  42376. $command->add('-mmin +'.($mins - 1));
  42377. break;
  42378. case '>=':
  42379. $command->add('-mmin -'.($mins + 1));
  42380. break;
  42381. case '>':
  42382. $command->add('-mmin -'.$mins);
  42383. break;
  42384. case '!=':
  42385. $command->add('-mmin +'.$mins.' -or -mmin -'.$mins);
  42386. break;
  42387. case '<':
  42388. default:
  42389. $command->add('-mmin +'.$mins);
  42390. }
  42391. }
  42392. }
  42393. private function buildSorting(Command $command, $sort)
  42394. {
  42395. $this->buildFormatSorting($command, $sort);
  42396. }
  42397. abstract protected function buildFormatSorting(Command $command, $sort);
  42398. abstract protected function buildContentFiltering(Command $command, array $contains, $not = false);
  42399. }
  42400. <?php
  42401. namespace Symfony\Component\Finder\Adapter;
  42402. interface AdapterInterface
  42403. {
  42404. public function setFollowLinks($followLinks);
  42405. public function setMode($mode);
  42406. public function setExclude(array $exclude);
  42407. public function setDepths(array $depths);
  42408. public function setNames(array $names);
  42409. public function setNotNames(array $notNames);
  42410. public function setContains(array $contains);
  42411. public function setNotContains(array $notContains);
  42412. public function setSizes(array $sizes);
  42413. public function setDates(array $dates);
  42414. public function setFilters(array $filters);
  42415. public function setSort($sort);
  42416. public function setPath(array $paths);
  42417. public function setNotPath(array $notPaths);
  42418. public function ignoreUnreadableDirs($ignore = true);
  42419. public function searchInDirectory($dir);
  42420. public function isSupported();
  42421. public function getName();
  42422. }
  42423. <?php
  42424. namespace Symfony\Component\Finder\Adapter;
  42425. @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);
  42426. use Symfony\Component\Finder\Expression\Expression;
  42427. use Symfony\Component\Finder\Iterator\SortableIterator;
  42428. use Symfony\Component\Finder\Shell\Command;
  42429. use Symfony\Component\Finder\Shell\Shell;
  42430. class BsdFindAdapter extends AbstractFindAdapter
  42431. {
  42432. public function getName()
  42433. {
  42434. return 'bsd_find';
  42435. }
  42436. protected function canBeUsed()
  42437. {
  42438. return \in_array($this->shell->getType(), array(Shell::TYPE_BSD, Shell::TYPE_DARWIN)) && parent::canBeUsed();
  42439. }
  42440. protected function buildFormatSorting(Command $command, $sort)
  42441. {
  42442. switch ($sort) {
  42443. case SortableIterator::SORT_BY_NAME:
  42444. $command->ins('sort')->add('| sort');
  42445. return;
  42446. case SortableIterator::SORT_BY_TYPE:
  42447. $format = '%HT';
  42448. break;
  42449. case SortableIterator::SORT_BY_ACCESSED_TIME:
  42450. $format = '%a';
  42451. break;
  42452. case SortableIterator::SORT_BY_CHANGED_TIME:
  42453. $format = '%c';
  42454. break;
  42455. case SortableIterator::SORT_BY_MODIFIED_TIME:
  42456. $format = '%m';
  42457. break;
  42458. default:
  42459. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  42460. }
  42461. $command
  42462. ->add('-print0 | xargs -0 stat -f')
  42463. ->arg($format.'%t%N')
  42464. ->add('| sort | cut -f 2');
  42465. }
  42466. protected function buildFindCommand(Command $command, $dir)
  42467. {
  42468. parent::buildFindCommand($command, $dir)->addAtIndex('-E', 1);
  42469. return $command;
  42470. }
  42471. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  42472. {
  42473. foreach ($contains as $contain) {
  42474. $expr = Expression::create($contain);
  42475. $command
  42476. ->add('| grep -v \'^$\'')
  42477. ->add('| xargs -I{} grep -I')
  42478. ->add($expr->isCaseSensitive() ? null : '-i')
  42479. ->add($not ? '-L' : '-l')
  42480. ->add('-Ee')->arg($expr->renderPattern())
  42481. ->add('{}')
  42482. ;
  42483. }
  42484. }
  42485. }
  42486. <?php
  42487. namespace Symfony\Component\Finder\Adapter;
  42488. @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);
  42489. use Symfony\Component\Finder\Expression\Expression;
  42490. use Symfony\Component\Finder\Iterator\SortableIterator;
  42491. use Symfony\Component\Finder\Shell\Command;
  42492. use Symfony\Component\Finder\Shell\Shell;
  42493. class GnuFindAdapter extends AbstractFindAdapter
  42494. {
  42495. public function getName()
  42496. {
  42497. return 'gnu_find';
  42498. }
  42499. protected function buildFormatSorting(Command $command, $sort)
  42500. {
  42501. switch ($sort) {
  42502. case SortableIterator::SORT_BY_NAME:
  42503. $command->ins('sort')->add('| sort');
  42504. return;
  42505. case SortableIterator::SORT_BY_TYPE:
  42506. $format = '%y';
  42507. break;
  42508. case SortableIterator::SORT_BY_ACCESSED_TIME:
  42509. $format = '%A@';
  42510. break;
  42511. case SortableIterator::SORT_BY_CHANGED_TIME:
  42512. $format = '%C@';
  42513. break;
  42514. case SortableIterator::SORT_BY_MODIFIED_TIME:
  42515. $format = '%T@';
  42516. break;
  42517. default:
  42518. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  42519. }
  42520. $command
  42521. ->get('find')
  42522. ->add('-printf')
  42523. ->arg($format.' %h/%f\\n')
  42524. ->add('| sort | cut')
  42525. ->arg('-d ')
  42526. ->arg('-f2-')
  42527. ;
  42528. }
  42529. protected function canBeUsed()
  42530. {
  42531. return Shell::TYPE_UNIX === $this->shell->getType() && parent::canBeUsed();
  42532. }
  42533. protected function buildFindCommand(Command $command, $dir)
  42534. {
  42535. return parent::buildFindCommand($command, $dir)->add('-regextype posix-extended');
  42536. }
  42537. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  42538. {
  42539. foreach ($contains as $contain) {
  42540. $expr = Expression::create($contain);
  42541. $command
  42542. ->add('| xargs -I{} -r grep -I')
  42543. ->add($expr->isCaseSensitive() ? null : '-i')
  42544. ->add($not ? '-L' : '-l')
  42545. ->add('-Ee')->arg($expr->renderPattern())
  42546. ->add('{}')
  42547. ;
  42548. }
  42549. }
  42550. }
  42551. <?php
  42552. namespace Symfony\Component\Finder\Adapter;
  42553. @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);
  42554. use Symfony\Component\Finder\Iterator;
  42555. class PhpAdapter extends AbstractAdapter
  42556. {
  42557. public function searchInDirectory($dir)
  42558. {
  42559. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  42560. if ($this->followLinks) {
  42561. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  42562. }
  42563. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  42564. if ($this->exclude) {
  42565. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  42566. }
  42567. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  42568. if ($this->minDepth > 0 || $this->maxDepth < PHP_INT_MAX) {
  42569. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $this->minDepth, $this->maxDepth);
  42570. }
  42571. if ($this->mode) {
  42572. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  42573. }
  42574. if ($this->names || $this->notNames) {
  42575. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  42576. }
  42577. if ($this->contains || $this->notContains) {
  42578. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  42579. }
  42580. if ($this->sizes) {
  42581. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  42582. }
  42583. if ($this->dates) {
  42584. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  42585. }
  42586. if ($this->filters) {
  42587. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  42588. }
  42589. if ($this->paths || $this->notPaths) {
  42590. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  42591. }
  42592. if ($this->sort) {
  42593. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  42594. $iterator = $iteratorAggregate->getIterator();
  42595. }
  42596. return $iterator;
  42597. }
  42598. public function getName()
  42599. {
  42600. return 'php';
  42601. }
  42602. protected function canBeUsed()
  42603. {
  42604. return true;
  42605. }
  42606. }
  42607. <?php
  42608. namespace Symfony\Component\Finder\Comparator;
  42609. class Comparator
  42610. {
  42611. private $target;
  42612. private $operator = '==';
  42613. public function getTarget()
  42614. {
  42615. return $this->target;
  42616. }
  42617. public function setTarget($target)
  42618. {
  42619. $this->target = $target;
  42620. }
  42621. public function getOperator()
  42622. {
  42623. return $this->operator;
  42624. }
  42625. public function setOperator($operator)
  42626. {
  42627. if (!$operator) {
  42628. $operator = '==';
  42629. }
  42630. if (!\in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) {
  42631. throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
  42632. }
  42633. $this->operator = $operator;
  42634. }
  42635. public function test($test)
  42636. {
  42637. switch ($this->operator) {
  42638. case '>':
  42639. return $test > $this->target;
  42640. case '>=':
  42641. return $test >= $this->target;
  42642. case '<':
  42643. return $test < $this->target;
  42644. case '<=':
  42645. return $test <= $this->target;
  42646. case '!=':
  42647. return $test != $this->target;
  42648. }
  42649. return $test == $this->target;
  42650. }
  42651. }
  42652. <?php
  42653. namespace Symfony\Component\Finder\Comparator;
  42654. class DateComparator extends Comparator
  42655. {
  42656. public function __construct($test)
  42657. {
  42658. if (!preg_match('#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i', $test, $matches)) {
  42659. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a date test.', $test));
  42660. }
  42661. try {
  42662. $date = new \DateTime($matches[2]);
  42663. $target = $date->format('U');
  42664. } catch (\Exception $e) {
  42665. throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
  42666. }
  42667. $operator = isset($matches[1]) ? $matches[1] : '==';
  42668. if ('since' === $operator || 'after' === $operator) {
  42669. $operator = '>';
  42670. }
  42671. if ('until' === $operator || 'before' === $operator) {
  42672. $operator = '<';
  42673. }
  42674. $this->setOperator($operator);
  42675. $this->setTarget($target);
  42676. }
  42677. }
  42678. <?php
  42679. namespace Symfony\Component\Finder\Comparator;
  42680. class NumberComparator extends Comparator
  42681. {
  42682. public function __construct($test)
  42683. {
  42684. if (!preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
  42685. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test));
  42686. }
  42687. $target = $matches[2];
  42688. if (!is_numeric($target)) {
  42689. throw new \InvalidArgumentException(sprintf('Invalid number "%s".', $target));
  42690. }
  42691. if (isset($matches[3])) {
  42692. switch (strtolower($matches[3])) {
  42693. case 'k':
  42694. $target *= 1000;
  42695. break;
  42696. case 'ki':
  42697. $target *= 1024;
  42698. break;
  42699. case 'm':
  42700. $target *= 1000000;
  42701. break;
  42702. case 'mi':
  42703. $target *= 1024 * 1024;
  42704. break;
  42705. case 'g':
  42706. $target *= 1000000000;
  42707. break;
  42708. case 'gi':
  42709. $target *= 1024 * 1024 * 1024;
  42710. break;
  42711. }
  42712. }
  42713. $this->setTarget($target);
  42714. $this->setOperator(isset($matches[1]) ? $matches[1] : '==');
  42715. }
  42716. }
  42717. <?php
  42718. namespace Symfony\Component\Finder\Exception;
  42719. class AccessDeniedException extends \UnexpectedValueException
  42720. {
  42721. }
  42722. <?php
  42723. namespace Symfony\Component\Finder\Exception;
  42724. @trigger_error('The '.__NAMESPACE__.'\AdapterFailureException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42725. use Symfony\Component\Finder\Adapter\AdapterInterface;
  42726. class AdapterFailureException extends \RuntimeException implements ExceptionInterface
  42727. {
  42728. private $adapter;
  42729. public function __construct(AdapterInterface $adapter, $message = null, \Exception $previous = null)
  42730. {
  42731. $this->adapter = $adapter;
  42732. parent::__construct($message ?: 'Search failed with "'.$adapter->getName().'" adapter.', $previous);
  42733. }
  42734. public function getAdapter()
  42735. {
  42736. return $this->adapter;
  42737. }
  42738. }
  42739. <?php
  42740. namespace Symfony\Component\Finder\Exception;
  42741. interface ExceptionInterface
  42742. {
  42743. public function getAdapter();
  42744. }
  42745. <?php
  42746. namespace Symfony\Component\Finder\Exception;
  42747. @trigger_error('The '.__NAMESPACE__.'\OperationNotPermitedException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42748. class OperationNotPermitedException extends AdapterFailureException
  42749. {
  42750. }
  42751. <?php
  42752. namespace Symfony\Component\Finder\Exception;
  42753. @trigger_error('The '.__NAMESPACE__.'\ShellCommandFailureException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42754. use Symfony\Component\Finder\Adapter\AdapterInterface;
  42755. use Symfony\Component\Finder\Shell\Command;
  42756. class ShellCommandFailureException extends AdapterFailureException
  42757. {
  42758. private $command;
  42759. public function __construct(AdapterInterface $adapter, Command $command, \Exception $previous = null)
  42760. {
  42761. $this->command = $command;
  42762. parent::__construct($adapter, 'Shell command failed: "'.$command->join().'".', $previous);
  42763. }
  42764. public function getCommand()
  42765. {
  42766. return $this->command;
  42767. }
  42768. }
  42769. <?php
  42770. namespace Symfony\Component\Finder\Expression;
  42771. @trigger_error('The '.__NAMESPACE__.'\Expression class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42772. class Expression implements ValueInterface
  42773. {
  42774. const TYPE_REGEX = 1;
  42775. const TYPE_GLOB = 2;
  42776. private $value;
  42777. public static function create($expr)
  42778. {
  42779. return new self($expr);
  42780. }
  42781. public function __construct($expr)
  42782. {
  42783. try {
  42784. $this->value = Regex::create($expr);
  42785. } catch (\InvalidArgumentException $e) {
  42786. $this->value = new Glob($expr);
  42787. }
  42788. }
  42789. public function __toString()
  42790. {
  42791. return $this->render();
  42792. }
  42793. public function render()
  42794. {
  42795. return $this->value->render();
  42796. }
  42797. public function renderPattern()
  42798. {
  42799. return $this->value->renderPattern();
  42800. }
  42801. public function isCaseSensitive()
  42802. {
  42803. return $this->value->isCaseSensitive();
  42804. }
  42805. public function getType()
  42806. {
  42807. return $this->value->getType();
  42808. }
  42809. public function prepend($expr)
  42810. {
  42811. $this->value->prepend($expr);
  42812. return $this;
  42813. }
  42814. public function append($expr)
  42815. {
  42816. $this->value->append($expr);
  42817. return $this;
  42818. }
  42819. public function isRegex()
  42820. {
  42821. return self::TYPE_REGEX === $this->value->getType();
  42822. }
  42823. public function isGlob()
  42824. {
  42825. return self::TYPE_GLOB === $this->value->getType();
  42826. }
  42827. public function getGlob()
  42828. {
  42829. if (self::TYPE_GLOB !== $this->value->getType()) {
  42830. throw new \LogicException('Regex can\'t be transformed to glob.');
  42831. }
  42832. return $this->value;
  42833. }
  42834. public function getRegex()
  42835. {
  42836. return self::TYPE_REGEX === $this->value->getType() ? $this->value : $this->value->toRegex();
  42837. }
  42838. }
  42839. <?php
  42840. namespace Symfony\Component\Finder\Expression;
  42841. @trigger_error('The '.__NAMESPACE__.'\Glob class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42842. use Symfony\Component\Finder\Glob as FinderGlob;
  42843. class Glob implements ValueInterface
  42844. {
  42845. private $pattern;
  42846. public function __construct($pattern)
  42847. {
  42848. $this->pattern = $pattern;
  42849. }
  42850. public function render()
  42851. {
  42852. return $this->pattern;
  42853. }
  42854. public function renderPattern()
  42855. {
  42856. return $this->pattern;
  42857. }
  42858. public function getType()
  42859. {
  42860. return Expression::TYPE_GLOB;
  42861. }
  42862. public function isCaseSensitive()
  42863. {
  42864. return true;
  42865. }
  42866. public function prepend($expr)
  42867. {
  42868. $this->pattern = $expr.$this->pattern;
  42869. return $this;
  42870. }
  42871. public function append($expr)
  42872. {
  42873. $this->pattern .= $expr;
  42874. return $this;
  42875. }
  42876. public function isExpandable()
  42877. {
  42878. return false !== strpos($this->pattern, '{')
  42879. && false !== strpos($this->pattern, '}');
  42880. }
  42881. public function toRegex($strictLeadingDot = true, $strictWildcardSlash = true)
  42882. {
  42883. $regex = FinderGlob::toRegex($this->pattern, $strictLeadingDot, $strictWildcardSlash, '');
  42884. return new Regex($regex);
  42885. }
  42886. }
  42887. <?php
  42888. namespace Symfony\Component\Finder\Expression;
  42889. @trigger_error('The '.__NAMESPACE__.'\Regex class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42890. class Regex implements ValueInterface
  42891. {
  42892. const START_FLAG = '^';
  42893. const END_FLAG = '$';
  42894. const BOUNDARY = '~';
  42895. const JOKER = '.*';
  42896. const ESCAPING = '\\';
  42897. private $pattern;
  42898. private $options;
  42899. private $startFlag;
  42900. private $endFlag;
  42901. private $startJoker;
  42902. private $endJoker;
  42903. public static function create($expr)
  42904. {
  42905. if (preg_match('/^(.{3,}?)([imsxuADU]*)$/', $expr, $m)) {
  42906. $start = substr($m[1], 0, 1);
  42907. $end = substr($m[1], -1);
  42908. if (
  42909. ($start === $end && !preg_match('/[*?[:alnum:] \\\\]/', $start))
  42910. || ('{' === $start && '}' === $end)
  42911. || ('(' === $start && ')' === $end)
  42912. ) {
  42913. return new self(substr($m[1], 1, -1), $m[2], $end);
  42914. }
  42915. }
  42916. throw new \InvalidArgumentException('Given expression is not a regex.');
  42917. }
  42918. public function __construct($pattern, $options = '', $delimiter = null)
  42919. {
  42920. if (null !== $delimiter) {
  42921. $pattern = str_replace('\\'.$delimiter, $delimiter, $pattern);
  42922. }
  42923. $this->parsePattern($pattern);
  42924. $this->options = $options;
  42925. }
  42926. public function __toString()
  42927. {
  42928. return $this->render();
  42929. }
  42930. public function render()
  42931. {
  42932. return self::BOUNDARY
  42933. .$this->renderPattern()
  42934. .self::BOUNDARY
  42935. .$this->options;
  42936. }
  42937. public function renderPattern()
  42938. {
  42939. return ($this->startFlag ? self::START_FLAG : '')
  42940. .($this->startJoker ? self::JOKER : '')
  42941. .str_replace(self::BOUNDARY, '\\'.self::BOUNDARY, $this->pattern)
  42942. .($this->endJoker ? self::JOKER : '')
  42943. .($this->endFlag ? self::END_FLAG : '');
  42944. }
  42945. public function isCaseSensitive()
  42946. {
  42947. return !$this->hasOption('i');
  42948. }
  42949. public function getType()
  42950. {
  42951. return Expression::TYPE_REGEX;
  42952. }
  42953. public function prepend($expr)
  42954. {
  42955. $this->pattern = $expr.$this->pattern;
  42956. return $this;
  42957. }
  42958. public function append($expr)
  42959. {
  42960. $this->pattern .= $expr;
  42961. return $this;
  42962. }
  42963. public function hasOption($option)
  42964. {
  42965. return false !== strpos($this->options, $option);
  42966. }
  42967. public function addOption($option)
  42968. {
  42969. if (!$this->hasOption($option)) {
  42970. $this->options .= $option;
  42971. }
  42972. return $this;
  42973. }
  42974. public function removeOption($option)
  42975. {
  42976. $this->options = str_replace($option, '', $this->options);
  42977. return $this;
  42978. }
  42979. public function setStartFlag($startFlag)
  42980. {
  42981. $this->startFlag = $startFlag;
  42982. return $this;
  42983. }
  42984. public function hasStartFlag()
  42985. {
  42986. return $this->startFlag;
  42987. }
  42988. public function setEndFlag($endFlag)
  42989. {
  42990. $this->endFlag = (bool) $endFlag;
  42991. return $this;
  42992. }
  42993. public function hasEndFlag()
  42994. {
  42995. return $this->endFlag;
  42996. }
  42997. public function setStartJoker($startJoker)
  42998. {
  42999. $this->startJoker = $startJoker;
  43000. return $this;
  43001. }
  43002. public function hasStartJoker()
  43003. {
  43004. return $this->startJoker;
  43005. }
  43006. public function setEndJoker($endJoker)
  43007. {
  43008. $this->endJoker = (bool) $endJoker;
  43009. return $this;
  43010. }
  43011. public function hasEndJoker()
  43012. {
  43013. return $this->endJoker;
  43014. }
  43015. public function replaceJokers($replacement)
  43016. {
  43017. $replace = function ($subject) use ($replacement) {
  43018. $subject = $subject[0];
  43019. $replace = 0 === substr_count($subject, '\\') % 2;
  43020. return $replace ? str_replace('.', $replacement, $subject) : $subject;
  43021. };
  43022. $this->pattern = preg_replace_callback('~[\\\\]*\\.~', $replace, $this->pattern);
  43023. return $this;
  43024. }
  43025. private function parsePattern($pattern)
  43026. {
  43027. if ($this->startFlag = self::START_FLAG === substr($pattern, 0, 1)) {
  43028. $pattern = substr($pattern, 1);
  43029. }
  43030. if ($this->startJoker = self::JOKER === substr($pattern, 0, 2)) {
  43031. $pattern = substr($pattern, 2);
  43032. }
  43033. if ($this->endFlag = (self::END_FLAG === substr($pattern, -1) && self::ESCAPING !== substr($pattern, -2, -1))) {
  43034. $pattern = substr($pattern, 0, -1);
  43035. }
  43036. if ($this->endJoker = (self::JOKER === substr($pattern, -2) && self::ESCAPING !== substr($pattern, -3, -2))) {
  43037. $pattern = substr($pattern, 0, -2);
  43038. }
  43039. $this->pattern = $pattern;
  43040. }
  43041. }
  43042. <?php
  43043. namespace Symfony\Component\Finder\Expression;
  43044. @trigger_error('The '.__NAMESPACE__.'\ValueInterface interface is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43045. interface ValueInterface
  43046. {
  43047. public function render();
  43048. public function renderPattern();
  43049. public function isCaseSensitive();
  43050. public function getType();
  43051. public function prepend($expr);
  43052. public function append($expr);
  43053. }
  43054. <?php
  43055. namespace Symfony\Component\Finder;
  43056. use Symfony\Component\Finder\Adapter\AdapterInterface;
  43057. use Symfony\Component\Finder\Adapter\BsdFindAdapter;
  43058. use Symfony\Component\Finder\Adapter\GnuFindAdapter;
  43059. use Symfony\Component\Finder\Adapter\PhpAdapter;
  43060. use Symfony\Component\Finder\Comparator\DateComparator;
  43061. use Symfony\Component\Finder\Comparator\NumberComparator;
  43062. use Symfony\Component\Finder\Exception\ExceptionInterface;
  43063. use Symfony\Component\Finder\Iterator\CustomFilterIterator;
  43064. use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
  43065. use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator;
  43066. use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator;
  43067. use Symfony\Component\Finder\Iterator\FilecontentFilterIterator;
  43068. use Symfony\Component\Finder\Iterator\FilenameFilterIterator;
  43069. use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
  43070. use Symfony\Component\Finder\Iterator\SortableIterator;
  43071. class Finder implements \IteratorAggregate, \Countable
  43072. {
  43073. const IGNORE_VCS_FILES = 1;
  43074. const IGNORE_DOT_FILES = 2;
  43075. private $mode = 0;
  43076. private $names = array();
  43077. private $notNames = array();
  43078. private $exclude = array();
  43079. private $filters = array();
  43080. private $depths = array();
  43081. private $sizes = array();
  43082. private $followLinks = false;
  43083. private $sort = false;
  43084. private $ignore = 0;
  43085. private $dirs = array();
  43086. private $dates = array();
  43087. private $iterators = array();
  43088. private $contains = array();
  43089. private $notContains = array();
  43090. private $adapters = null;
  43091. private $paths = array();
  43092. private $notPaths = array();
  43093. private $ignoreUnreadableDirs = false;
  43094. private static $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg');
  43095. public function __construct()
  43096. {
  43097. $this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES;
  43098. }
  43099. public static function create()
  43100. {
  43101. return new static();
  43102. }
  43103. public function addAdapter(AdapterInterface $adapter, $priority = 0)
  43104. {
  43105. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43106. $this->initDefaultAdapters();
  43107. $this->adapters[$adapter->getName()] = array(
  43108. 'adapter' => $adapter,
  43109. 'priority' => $priority,
  43110. 'selected' => false,
  43111. );
  43112. return $this->sortAdapters();
  43113. }
  43114. public function useBestAdapter()
  43115. {
  43116. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43117. $this->initDefaultAdapters();
  43118. $this->resetAdapterSelection();
  43119. return $this->sortAdapters();
  43120. }
  43121. public function setAdapter($name)
  43122. {
  43123. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43124. $this->initDefaultAdapters();
  43125. if (!isset($this->adapters[$name])) {
  43126. throw new \InvalidArgumentException(sprintf('Adapter "%s" does not exist.', $name));
  43127. }
  43128. $this->resetAdapterSelection();
  43129. $this->adapters[$name]['selected'] = true;
  43130. return $this->sortAdapters();
  43131. }
  43132. public function removeAdapters()
  43133. {
  43134. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43135. $this->adapters = array();
  43136. return $this;
  43137. }
  43138. public function getAdapters()
  43139. {
  43140. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43141. $this->initDefaultAdapters();
  43142. return array_values(array_map(function (array $adapter) {
  43143. return $adapter['adapter'];
  43144. }, $this->adapters));
  43145. }
  43146. public function directories()
  43147. {
  43148. $this->mode = Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES;
  43149. return $this;
  43150. }
  43151. public function files()
  43152. {
  43153. $this->mode = Iterator\FileTypeFilterIterator::ONLY_FILES;
  43154. return $this;
  43155. }
  43156. public function depth($level)
  43157. {
  43158. $this->depths[] = new Comparator\NumberComparator($level);
  43159. return $this;
  43160. }
  43161. public function date($date)
  43162. {
  43163. $this->dates[] = new Comparator\DateComparator($date);
  43164. return $this;
  43165. }
  43166. public function name($pattern)
  43167. {
  43168. $this->names[] = $pattern;
  43169. return $this;
  43170. }
  43171. public function notName($pattern)
  43172. {
  43173. $this->notNames[] = $pattern;
  43174. return $this;
  43175. }
  43176. public function contains($pattern)
  43177. {
  43178. $this->contains[] = $pattern;
  43179. return $this;
  43180. }
  43181. public function notContains($pattern)
  43182. {
  43183. $this->notContains[] = $pattern;
  43184. return $this;
  43185. }
  43186. public function path($pattern)
  43187. {
  43188. $this->paths[] = $pattern;
  43189. return $this;
  43190. }
  43191. public function notPath($pattern)
  43192. {
  43193. $this->notPaths[] = $pattern;
  43194. return $this;
  43195. }
  43196. public function size($size)
  43197. {
  43198. $this->sizes[] = new Comparator\NumberComparator($size);
  43199. return $this;
  43200. }
  43201. public function exclude($dirs)
  43202. {
  43203. $this->exclude = array_merge($this->exclude, (array) $dirs);
  43204. return $this;
  43205. }
  43206. public function ignoreDotFiles($ignoreDotFiles)
  43207. {
  43208. if ($ignoreDotFiles) {
  43209. $this->ignore |= static::IGNORE_DOT_FILES;
  43210. } else {
  43211. $this->ignore &= ~static::IGNORE_DOT_FILES;
  43212. }
  43213. return $this;
  43214. }
  43215. public function ignoreVCS($ignoreVCS)
  43216. {
  43217. if ($ignoreVCS) {
  43218. $this->ignore |= static::IGNORE_VCS_FILES;
  43219. } else {
  43220. $this->ignore &= ~static::IGNORE_VCS_FILES;
  43221. }
  43222. return $this;
  43223. }
  43224. public static function addVCSPattern($pattern)
  43225. {
  43226. foreach ((array) $pattern as $p) {
  43227. self::$vcsPatterns[] = $p;
  43228. }
  43229. self::$vcsPatterns = array_unique(self::$vcsPatterns);
  43230. }
  43231. public function sort(\Closure $closure)
  43232. {
  43233. $this->sort = $closure;
  43234. return $this;
  43235. }
  43236. public function sortByName()
  43237. {
  43238. $this->sort = Iterator\SortableIterator::SORT_BY_NAME;
  43239. return $this;
  43240. }
  43241. public function sortByType()
  43242. {
  43243. $this->sort = Iterator\SortableIterator::SORT_BY_TYPE;
  43244. return $this;
  43245. }
  43246. public function sortByAccessedTime()
  43247. {
  43248. $this->sort = Iterator\SortableIterator::SORT_BY_ACCESSED_TIME;
  43249. return $this;
  43250. }
  43251. public function sortByChangedTime()
  43252. {
  43253. $this->sort = Iterator\SortableIterator::SORT_BY_CHANGED_TIME;
  43254. return $this;
  43255. }
  43256. public function sortByModifiedTime()
  43257. {
  43258. $this->sort = Iterator\SortableIterator::SORT_BY_MODIFIED_TIME;
  43259. return $this;
  43260. }
  43261. public function filter(\Closure $closure)
  43262. {
  43263. $this->filters[] = $closure;
  43264. return $this;
  43265. }
  43266. public function followLinks()
  43267. {
  43268. $this->followLinks = true;
  43269. return $this;
  43270. }
  43271. public function ignoreUnreadableDirs($ignore = true)
  43272. {
  43273. $this->ignoreUnreadableDirs = (bool) $ignore;
  43274. return $this;
  43275. }
  43276. public function in($dirs)
  43277. {
  43278. $resolvedDirs = array();
  43279. foreach ((array) $dirs as $dir) {
  43280. if (is_dir($dir)) {
  43281. $resolvedDirs[] = $this->normalizeDir($dir);
  43282. } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
  43283. $resolvedDirs = array_merge($resolvedDirs, array_map(array($this, 'normalizeDir'), $glob));
  43284. } else {
  43285. throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
  43286. }
  43287. }
  43288. $this->dirs = array_merge($this->dirs, $resolvedDirs);
  43289. return $this;
  43290. }
  43291. public function getIterator()
  43292. {
  43293. if (0 === \count($this->dirs) && 0 === \count($this->iterators)) {
  43294. throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
  43295. }
  43296. if (1 === \count($this->dirs) && 0 === \count($this->iterators)) {
  43297. return $this->searchInDirectory($this->dirs[0]);
  43298. }
  43299. $iterator = new \AppendIterator();
  43300. foreach ($this->dirs as $dir) {
  43301. $iterator->append($this->searchInDirectory($dir));
  43302. }
  43303. foreach ($this->iterators as $it) {
  43304. $iterator->append($it);
  43305. }
  43306. return $iterator;
  43307. }
  43308. public function append($iterator)
  43309. {
  43310. if ($iterator instanceof \IteratorAggregate) {
  43311. $this->iterators[] = $iterator->getIterator();
  43312. } elseif ($iterator instanceof \Iterator) {
  43313. $this->iterators[] = $iterator;
  43314. } elseif ($iterator instanceof \Traversable || \is_array($iterator)) {
  43315. $it = new \ArrayIterator();
  43316. foreach ($iterator as $file) {
  43317. $it->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file));
  43318. }
  43319. $this->iterators[] = $it;
  43320. } else {
  43321. throw new \InvalidArgumentException('Finder::append() method wrong argument type.');
  43322. }
  43323. return $this;
  43324. }
  43325. public function count()
  43326. {
  43327. return iterator_count($this->getIterator());
  43328. }
  43329. private function sortAdapters()
  43330. {
  43331. uasort($this->adapters, function (array $a, array $b) {
  43332. if ($a['selected'] || $b['selected']) {
  43333. return $a['selected'] ? -1 : 1;
  43334. }
  43335. return $a['priority'] > $b['priority'] ? -1 : 1;
  43336. });
  43337. return $this;
  43338. }
  43339. private function searchInDirectory($dir)
  43340. {
  43341. if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) {
  43342. $this->exclude = array_merge($this->exclude, self::$vcsPatterns);
  43343. }
  43344. if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) {
  43345. $this->notPaths[] = '#(^|/)\..+(/|$)#';
  43346. }
  43347. if ($this->adapters) {
  43348. foreach ($this->adapters as $adapter) {
  43349. if ($adapter['adapter']->isSupported()) {
  43350. try {
  43351. return $this
  43352. ->buildAdapter($adapter['adapter'])
  43353. ->searchInDirectory($dir);
  43354. } catch (ExceptionInterface $e) {
  43355. }
  43356. }
  43357. }
  43358. }
  43359. $minDepth = 0;
  43360. $maxDepth = PHP_INT_MAX;
  43361. foreach ($this->depths as $comparator) {
  43362. switch ($comparator->getOperator()) {
  43363. case '>':
  43364. $minDepth = $comparator->getTarget() + 1;
  43365. break;
  43366. case '>=':
  43367. $minDepth = $comparator->getTarget();
  43368. break;
  43369. case '<':
  43370. $maxDepth = $comparator->getTarget() - 1;
  43371. break;
  43372. case '<=':
  43373. $maxDepth = $comparator->getTarget();
  43374. break;
  43375. default:
  43376. $minDepth = $maxDepth = $comparator->getTarget();
  43377. }
  43378. }
  43379. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  43380. if ($this->followLinks) {
  43381. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  43382. }
  43383. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  43384. if ($this->exclude) {
  43385. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  43386. }
  43387. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  43388. if ($minDepth > 0 || $maxDepth < PHP_INT_MAX) {
  43389. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $minDepth, $maxDepth);
  43390. }
  43391. if ($this->mode) {
  43392. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  43393. }
  43394. if ($this->names || $this->notNames) {
  43395. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  43396. }
  43397. if ($this->contains || $this->notContains) {
  43398. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  43399. }
  43400. if ($this->sizes) {
  43401. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  43402. }
  43403. if ($this->dates) {
  43404. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  43405. }
  43406. if ($this->filters) {
  43407. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  43408. }
  43409. if ($this->paths || $this->notPaths) {
  43410. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  43411. }
  43412. if ($this->sort) {
  43413. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  43414. $iterator = $iteratorAggregate->getIterator();
  43415. }
  43416. return $iterator;
  43417. }
  43418. private function buildAdapter(AdapterInterface $adapter)
  43419. {
  43420. return $adapter
  43421. ->setFollowLinks($this->followLinks)
  43422. ->setDepths($this->depths)
  43423. ->setMode($this->mode)
  43424. ->setExclude($this->exclude)
  43425. ->setNames($this->names)
  43426. ->setNotNames($this->notNames)
  43427. ->setContains($this->contains)
  43428. ->setNotContains($this->notContains)
  43429. ->setSizes($this->sizes)
  43430. ->setDates($this->dates)
  43431. ->setFilters($this->filters)
  43432. ->setSort($this->sort)
  43433. ->setPath($this->paths)
  43434. ->setNotPath($this->notPaths)
  43435. ->ignoreUnreadableDirs($this->ignoreUnreadableDirs);
  43436. }
  43437. private function resetAdapterSelection()
  43438. {
  43439. $this->adapters = array_map(function (array $properties) {
  43440. $properties['selected'] = false;
  43441. return $properties;
  43442. }, $this->adapters);
  43443. }
  43444. private function initDefaultAdapters()
  43445. {
  43446. if (null === $this->adapters) {
  43447. $this->adapters = array();
  43448. $this
  43449. ->addAdapter(new GnuFindAdapter())
  43450. ->addAdapter(new BsdFindAdapter())
  43451. ->addAdapter(new PhpAdapter(), -50)
  43452. ->setAdapter('php')
  43453. ;
  43454. }
  43455. }
  43456. private function normalizeDir($dir)
  43457. {
  43458. return rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
  43459. }
  43460. }
  43461. <?php
  43462. namespace Symfony\Component\Finder;
  43463. class Glob
  43464. {
  43465. public static function toRegex($glob, $strictLeadingDot = true, $strictWildcardSlash = true, $delimiter = '#')
  43466. {
  43467. $firstByte = true;
  43468. $escaping = false;
  43469. $inCurlies = 0;
  43470. $regex = '';
  43471. $sizeGlob = \strlen($glob);
  43472. for ($i = 0; $i < $sizeGlob; ++$i) {
  43473. $car = $glob[$i];
  43474. if ($firstByte) {
  43475. if ($strictLeadingDot && '.' !== $car) {
  43476. $regex .= '(?=[^\.])';
  43477. }
  43478. $firstByte = false;
  43479. }
  43480. if ('/' === $car) {
  43481. $firstByte = true;
  43482. }
  43483. if ($delimiter === $car || '.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {
  43484. $regex .= "\\$car";
  43485. } elseif ('*' === $car) {
  43486. $regex .= $escaping ? '\\*' : ($strictWildcardSlash ? '[^/]*' : '.*');
  43487. } elseif ('?' === $car) {
  43488. $regex .= $escaping ? '\\?' : ($strictWildcardSlash ? '[^/]' : '.');
  43489. } elseif ('{' === $car) {
  43490. $regex .= $escaping ? '\\{' : '(';
  43491. if (!$escaping) {
  43492. ++$inCurlies;
  43493. }
  43494. } elseif ('}' === $car && $inCurlies) {
  43495. $regex .= $escaping ? '}' : ')';
  43496. if (!$escaping) {
  43497. --$inCurlies;
  43498. }
  43499. } elseif (',' === $car && $inCurlies) {
  43500. $regex .= $escaping ? ',' : '|';
  43501. } elseif ('\\' === $car) {
  43502. if ($escaping) {
  43503. $regex .= '\\\\';
  43504. $escaping = false;
  43505. } else {
  43506. $escaping = true;
  43507. }
  43508. continue;
  43509. } else {
  43510. $regex .= $car;
  43511. }
  43512. $escaping = false;
  43513. }
  43514. return $delimiter.'^'.$regex.'$'.$delimiter;
  43515. }
  43516. }
  43517. <?php
  43518. namespace Symfony\Component\Finder\Iterator;
  43519. class CustomFilterIterator extends FilterIterator
  43520. {
  43521. private $filters = array();
  43522. public function __construct(\Iterator $iterator, array $filters)
  43523. {
  43524. foreach ($filters as $filter) {
  43525. if (!\is_callable($filter)) {
  43526. throw new \InvalidArgumentException('Invalid PHP callback.');
  43527. }
  43528. }
  43529. $this->filters = $filters;
  43530. parent::__construct($iterator);
  43531. }
  43532. public function accept()
  43533. {
  43534. $fileinfo = $this->current();
  43535. foreach ($this->filters as $filter) {
  43536. if (false === \call_user_func($filter, $fileinfo)) {
  43537. return false;
  43538. }
  43539. }
  43540. return true;
  43541. }
  43542. }
  43543. <?php
  43544. namespace Symfony\Component\Finder\Iterator;
  43545. use Symfony\Component\Finder\Comparator\DateComparator;
  43546. class DateRangeFilterIterator extends FilterIterator
  43547. {
  43548. private $comparators = array();
  43549. public function __construct(\Iterator $iterator, array $comparators)
  43550. {
  43551. $this->comparators = $comparators;
  43552. parent::__construct($iterator);
  43553. }
  43554. public function accept()
  43555. {
  43556. $fileinfo = $this->current();
  43557. if (!file_exists($fileinfo->getPathname())) {
  43558. return false;
  43559. }
  43560. $filedate = $fileinfo->getMTime();
  43561. foreach ($this->comparators as $compare) {
  43562. if (!$compare->test($filedate)) {
  43563. return false;
  43564. }
  43565. }
  43566. return true;
  43567. }
  43568. }
  43569. <?php
  43570. namespace Symfony\Component\Finder\Iterator;
  43571. class DepthRangeFilterIterator extends FilterIterator
  43572. {
  43573. private $minDepth = 0;
  43574. public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = PHP_INT_MAX)
  43575. {
  43576. $this->minDepth = $minDepth;
  43577. $iterator->setMaxDepth(PHP_INT_MAX === $maxDepth ? -1 : $maxDepth);
  43578. parent::__construct($iterator);
  43579. }
  43580. public function accept()
  43581. {
  43582. return $this->getInnerIterator()->getDepth() >= $this->minDepth;
  43583. }
  43584. }
  43585. <?php
  43586. namespace Symfony\Component\Finder\Iterator;
  43587. class ExcludeDirectoryFilterIterator extends FilterIterator implements \RecursiveIterator
  43588. {
  43589. private $iterator;
  43590. private $isRecursive;
  43591. private $excludedDirs = array();
  43592. private $excludedPattern;
  43593. public function __construct(\Iterator $iterator, array $directories)
  43594. {
  43595. $this->iterator = $iterator;
  43596. $this->isRecursive = $iterator instanceof \RecursiveIterator;
  43597. $patterns = array();
  43598. foreach ($directories as $directory) {
  43599. $directory = rtrim($directory, '/');
  43600. if (!$this->isRecursive || false !== strpos($directory, '/')) {
  43601. $patterns[] = preg_quote($directory, '#');
  43602. } else {
  43603. $this->excludedDirs[$directory] = true;
  43604. }
  43605. }
  43606. if ($patterns) {
  43607. $this->excludedPattern = '#(?:^|/)(?:'.implode('|', $patterns).')(?:/|$)#';
  43608. }
  43609. parent::__construct($iterator);
  43610. }
  43611. public function accept()
  43612. {
  43613. if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) {
  43614. return false;
  43615. }
  43616. if ($this->excludedPattern) {
  43617. $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath();
  43618. $path = str_replace('\\', '/', $path);
  43619. return !preg_match($this->excludedPattern, $path);
  43620. }
  43621. return true;
  43622. }
  43623. public function hasChildren()
  43624. {
  43625. return $this->isRecursive && $this->iterator->hasChildren();
  43626. }
  43627. public function getChildren()
  43628. {
  43629. $children = new self($this->iterator->getChildren(), array());
  43630. $children->excludedDirs = $this->excludedDirs;
  43631. $children->excludedPattern = $this->excludedPattern;
  43632. return $children;
  43633. }
  43634. }
  43635. <?php
  43636. namespace Symfony\Component\Finder\Iterator;
  43637. @trigger_error('The '.__NAMESPACE__.'\FilePathsIterator class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43638. use Symfony\Component\Finder\SplFileInfo;
  43639. class FilePathsIterator extends \ArrayIterator
  43640. {
  43641. private $baseDir;
  43642. private $baseDirLength;
  43643. private $subPath;
  43644. private $subPathname;
  43645. private $current;
  43646. public function __construct(array $paths, $baseDir)
  43647. {
  43648. $this->baseDir = $baseDir;
  43649. $this->baseDirLength = \strlen($baseDir);
  43650. parent::__construct($paths);
  43651. }
  43652. public function __call($name, array $arguments)
  43653. {
  43654. return \call_user_func_array(array($this->current(), $name), $arguments);
  43655. }
  43656. public function current()
  43657. {
  43658. return $this->current;
  43659. }
  43660. public function key()
  43661. {
  43662. return $this->current->getPathname();
  43663. }
  43664. public function next()
  43665. {
  43666. parent::next();
  43667. $this->buildProperties();
  43668. }
  43669. public function rewind()
  43670. {
  43671. parent::rewind();
  43672. $this->buildProperties();
  43673. }
  43674. public function getSubPath()
  43675. {
  43676. return $this->subPath;
  43677. }
  43678. public function getSubPathname()
  43679. {
  43680. return $this->subPathname;
  43681. }
  43682. private function buildProperties()
  43683. {
  43684. $absolutePath = parent::current();
  43685. if ($this->baseDir === substr($absolutePath, 0, $this->baseDirLength)) {
  43686. $this->subPathname = ltrim(substr($absolutePath, $this->baseDirLength), '/\\');
  43687. $dir = \dirname($this->subPathname);
  43688. $this->subPath = '.' === $dir ? '' : $dir;
  43689. } else {
  43690. $this->subPath = $this->subPathname = '';
  43691. }
  43692. $this->current = new SplFileInfo(parent::current(), $this->subPath, $this->subPathname);
  43693. }
  43694. }
  43695. <?php
  43696. namespace Symfony\Component\Finder\Iterator;
  43697. class FileTypeFilterIterator extends FilterIterator
  43698. {
  43699. const ONLY_FILES = 1;
  43700. const ONLY_DIRECTORIES = 2;
  43701. private $mode;
  43702. public function __construct(\Iterator $iterator, $mode)
  43703. {
  43704. $this->mode = $mode;
  43705. parent::__construct($iterator);
  43706. }
  43707. public function accept()
  43708. {
  43709. $fileinfo = $this->current();
  43710. if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) {
  43711. return false;
  43712. } elseif (self::ONLY_FILES === (self::ONLY_FILES & $this->mode) && $fileinfo->isDir()) {
  43713. return false;
  43714. }
  43715. return true;
  43716. }
  43717. }
  43718. <?php
  43719. namespace Symfony\Component\Finder\Iterator;
  43720. class FilecontentFilterIterator extends MultiplePcreFilterIterator
  43721. {
  43722. public function accept()
  43723. {
  43724. if (!$this->matchRegexps && !$this->noMatchRegexps) {
  43725. return true;
  43726. }
  43727. $fileinfo = $this->current();
  43728. if ($fileinfo->isDir() || !$fileinfo->isReadable()) {
  43729. return false;
  43730. }
  43731. $content = $fileinfo->getContents();
  43732. if (!$content) {
  43733. return false;
  43734. }
  43735. return $this->isAccepted($content);
  43736. }
  43737. protected function toRegex($str)
  43738. {
  43739. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  43740. }
  43741. }
  43742. <?php
  43743. namespace Symfony\Component\Finder\Iterator;
  43744. use Symfony\Component\Finder\Glob;
  43745. class FilenameFilterIterator extends MultiplePcreFilterIterator
  43746. {
  43747. public function accept()
  43748. {
  43749. return $this->isAccepted($this->current()->getFilename());
  43750. }
  43751. protected function toRegex($str)
  43752. {
  43753. return $this->isRegex($str) ? $str : Glob::toRegex($str);
  43754. }
  43755. }
  43756. <?php
  43757. namespace Symfony\Component\Finder\Iterator;
  43758. abstract class FilterIterator extends \FilterIterator
  43759. {
  43760. public function rewind()
  43761. {
  43762. if (\PHP_VERSION_ID > 50607 || (\PHP_VERSION_ID > 50523 && \PHP_VERSION_ID < 50600)) {
  43763. parent::rewind();
  43764. return;
  43765. }
  43766. $iterator = $this;
  43767. while ($iterator instanceof \OuterIterator) {
  43768. $innerIterator = $iterator->getInnerIterator();
  43769. if ($innerIterator instanceof RecursiveDirectoryIterator) {
  43770. if ($innerIterator->isRewindable()) {
  43771. $innerIterator->next();
  43772. $innerIterator->rewind();
  43773. }
  43774. } elseif ($innerIterator instanceof \FilesystemIterator) {
  43775. $innerIterator->next();
  43776. $innerIterator->rewind();
  43777. }
  43778. $iterator = $innerIterator;
  43779. }
  43780. parent::rewind();
  43781. }
  43782. }
  43783. <?php
  43784. namespace Symfony\Component\Finder\Iterator;
  43785. abstract class MultiplePcreFilterIterator extends FilterIterator
  43786. {
  43787. protected $matchRegexps = array();
  43788. protected $noMatchRegexps = array();
  43789. public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns)
  43790. {
  43791. foreach ($matchPatterns as $pattern) {
  43792. $this->matchRegexps[] = $this->toRegex($pattern);
  43793. }
  43794. foreach ($noMatchPatterns as $pattern) {
  43795. $this->noMatchRegexps[] = $this->toRegex($pattern);
  43796. }
  43797. parent::__construct($iterator);
  43798. }
  43799. protected function isAccepted($string)
  43800. {
  43801. foreach ($this->noMatchRegexps as $regex) {
  43802. if (preg_match($regex, $string)) {
  43803. return false;
  43804. }
  43805. }
  43806. if ($this->matchRegexps) {
  43807. foreach ($this->matchRegexps as $regex) {
  43808. if (preg_match($regex, $string)) {
  43809. return true;
  43810. }
  43811. }
  43812. return false;
  43813. }
  43814. return true;
  43815. }
  43816. protected function isRegex($str)
  43817. {
  43818. if (preg_match('/^(.{3,}?)[imsxuADU]*$/', $str, $m)) {
  43819. $start = substr($m[1], 0, 1);
  43820. $end = substr($m[1], -1);
  43821. if ($start === $end) {
  43822. return !preg_match('/[*?[:alnum:] \\\\]/', $start);
  43823. }
  43824. foreach (array(array('{', '}'), array('(', ')'), array('[', ']'), array('<', '>')) as $delimiters) {
  43825. if ($start === $delimiters[0] && $end === $delimiters[1]) {
  43826. return true;
  43827. }
  43828. }
  43829. }
  43830. return false;
  43831. }
  43832. abstract protected function toRegex($str);
  43833. }
  43834. <?php
  43835. namespace Symfony\Component\Finder\Iterator;
  43836. class PathFilterIterator extends MultiplePcreFilterIterator
  43837. {
  43838. public function accept()
  43839. {
  43840. $filename = $this->current()->getRelativePathname();
  43841. if ('\\' === \DIRECTORY_SEPARATOR) {
  43842. $filename = str_replace('\\', '/', $filename);
  43843. }
  43844. return $this->isAccepted($filename);
  43845. }
  43846. protected function toRegex($str)
  43847. {
  43848. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  43849. }
  43850. }
  43851. <?php
  43852. namespace Symfony\Component\Finder\Iterator;
  43853. use Symfony\Component\Finder\Exception\AccessDeniedException;
  43854. use Symfony\Component\Finder\SplFileInfo;
  43855. class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
  43856. {
  43857. private $ignoreUnreadableDirs;
  43858. private $rewindable;
  43859. private $rootPath;
  43860. private $subPath;
  43861. private $directorySeparator = '/';
  43862. public function __construct($path, $flags, $ignoreUnreadableDirs = false)
  43863. {
  43864. if ($flags & (self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF)) {
  43865. throw new \RuntimeException('This iterator only support returning current as fileinfo.');
  43866. }
  43867. parent::__construct($path, $flags);
  43868. $this->ignoreUnreadableDirs = $ignoreUnreadableDirs;
  43869. $this->rootPath = (string) $path;
  43870. if ('/' !== \DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) {
  43871. $this->directorySeparator = \DIRECTORY_SEPARATOR;
  43872. }
  43873. }
  43874. public function current()
  43875. {
  43876. if (null === $subPathname = $this->subPath) {
  43877. $subPathname = $this->subPath = (string) $this->getSubPath();
  43878. }
  43879. if ('' !== $subPathname) {
  43880. $subPathname .= $this->directorySeparator;
  43881. }
  43882. $subPathname .= $this->getFilename();
  43883. return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname);
  43884. }
  43885. public function getChildren()
  43886. {
  43887. try {
  43888. $children = parent::getChildren();
  43889. if ($children instanceof self) {
  43890. $children->ignoreUnreadableDirs = $this->ignoreUnreadableDirs;
  43891. $children->rewindable = &$this->rewindable;
  43892. $children->rootPath = $this->rootPath;
  43893. }
  43894. return $children;
  43895. } catch (\UnexpectedValueException $e) {
  43896. if ($this->ignoreUnreadableDirs) {
  43897. return new \RecursiveArrayIterator(array());
  43898. } else {
  43899. throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
  43900. }
  43901. }
  43902. }
  43903. public function rewind()
  43904. {
  43905. if (false === $this->isRewindable()) {
  43906. return;
  43907. }
  43908. if (\PHP_VERSION_ID < 50523 || \PHP_VERSION_ID >= 50600 && \PHP_VERSION_ID < 50607) {
  43909. parent::next();
  43910. }
  43911. parent::rewind();
  43912. }
  43913. public function isRewindable()
  43914. {
  43915. if (null !== $this->rewindable) {
  43916. return $this->rewindable;
  43917. }
  43918. if ('' === $this->getPath()) {
  43919. return $this->rewindable = false;
  43920. }
  43921. if (false !== $stream = @opendir($this->getPath())) {
  43922. $infos = stream_get_meta_data($stream);
  43923. closedir($stream);
  43924. if ($infos['seekable']) {
  43925. return $this->rewindable = true;
  43926. }
  43927. }
  43928. return $this->rewindable = false;
  43929. }
  43930. }
  43931. <?php
  43932. namespace Symfony\Component\Finder\Iterator;
  43933. use Symfony\Component\Finder\Comparator\NumberComparator;
  43934. class SizeRangeFilterIterator extends FilterIterator
  43935. {
  43936. private $comparators = array();
  43937. public function __construct(\Iterator $iterator, array $comparators)
  43938. {
  43939. $this->comparators = $comparators;
  43940. parent::__construct($iterator);
  43941. }
  43942. public function accept()
  43943. {
  43944. $fileinfo = $this->current();
  43945. if (!$fileinfo->isFile()) {
  43946. return true;
  43947. }
  43948. $filesize = $fileinfo->getSize();
  43949. foreach ($this->comparators as $compare) {
  43950. if (!$compare->test($filesize)) {
  43951. return false;
  43952. }
  43953. }
  43954. return true;
  43955. }
  43956. }
  43957. <?php
  43958. namespace Symfony\Component\Finder\Iterator;
  43959. class SortableIterator implements \IteratorAggregate
  43960. {
  43961. const SORT_BY_NAME = 1;
  43962. const SORT_BY_TYPE = 2;
  43963. const SORT_BY_ACCESSED_TIME = 3;
  43964. const SORT_BY_CHANGED_TIME = 4;
  43965. const SORT_BY_MODIFIED_TIME = 5;
  43966. private $iterator;
  43967. private $sort;
  43968. public function __construct(\Traversable $iterator, $sort)
  43969. {
  43970. $this->iterator = $iterator;
  43971. if (self::SORT_BY_NAME === $sort) {
  43972. $this->sort = function ($a, $b) {
  43973. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  43974. };
  43975. } elseif (self::SORT_BY_TYPE === $sort) {
  43976. $this->sort = function ($a, $b) {
  43977. if ($a->isDir() && $b->isFile()) {
  43978. return -1;
  43979. } elseif ($a->isFile() && $b->isDir()) {
  43980. return 1;
  43981. }
  43982. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  43983. };
  43984. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  43985. $this->sort = function ($a, $b) {
  43986. return $a->getATime() - $b->getATime();
  43987. };
  43988. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  43989. $this->sort = function ($a, $b) {
  43990. return $a->getCTime() - $b->getCTime();
  43991. };
  43992. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  43993. $this->sort = function ($a, $b) {
  43994. return $a->getMTime() - $b->getMTime();
  43995. };
  43996. } elseif (\is_callable($sort)) {
  43997. $this->sort = $sort;
  43998. } else {
  43999. throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
  44000. }
  44001. }
  44002. public function getIterator()
  44003. {
  44004. $array = iterator_to_array($this->iterator, true);
  44005. uasort($array, $this->sort);
  44006. return new \ArrayIterator($array);
  44007. }
  44008. }
  44009. Copyright (c) 2004-2018 Fabien Potencier
  44010. Permission is hereby granted, free of charge, to any person obtaining a copy
  44011. of this software and associated documentation files (the "Software"), to deal
  44012. in the Software without restriction, including without limitation the rights
  44013. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  44014. copies of the Software, and to permit persons to whom the Software is furnished
  44015. to do so, subject to the following conditions:
  44016. The above copyright notice and this permission notice shall be included in all
  44017. copies or substantial portions of the Software.
  44018. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  44019. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  44020. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  44021. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  44022. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  44023. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  44024. THE SOFTWARE.
  44025. <?php
  44026. namespace Symfony\Component\Finder\Shell;
  44027. @trigger_error('The '.__NAMESPACE__.'\Command class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  44028. class Command
  44029. {
  44030. private $parent;
  44031. private $bits = array();
  44032. private $labels = array();
  44033. private $errorHandler;
  44034. public function __construct(Command $parent = null)
  44035. {
  44036. $this->parent = $parent;
  44037. }
  44038. public function __toString()
  44039. {
  44040. return $this->join();
  44041. }
  44042. public static function create(Command $parent = null)
  44043. {
  44044. return new self($parent);
  44045. }
  44046. public static function escape($input)
  44047. {
  44048. return escapeshellcmd($input);
  44049. }
  44050. public static function quote($input)
  44051. {
  44052. return escapeshellarg($input);
  44053. }
  44054. public function add($bit)
  44055. {
  44056. $this->bits[] = $bit;
  44057. return $this;
  44058. }
  44059. public function top($bit)
  44060. {
  44061. array_unshift($this->bits, $bit);
  44062. foreach ($this->labels as $label => $index) {
  44063. ++$this->labels[$label];
  44064. }
  44065. return $this;
  44066. }
  44067. public function arg($arg)
  44068. {
  44069. $this->bits[] = self::quote($arg);
  44070. return $this;
  44071. }
  44072. public function cmd($esc)
  44073. {
  44074. $this->bits[] = self::escape($esc);
  44075. return $this;
  44076. }
  44077. public function ins($label)
  44078. {
  44079. if (isset($this->labels[$label])) {
  44080. throw new \RuntimeException(sprintf('Label "%s" already exists.', $label));
  44081. }
  44082. $this->bits[] = self::create($this);
  44083. $this->labels[$label] = \count($this->bits) - 1;
  44084. return $this->bits[$this->labels[$label]];
  44085. }
  44086. public function get($label)
  44087. {
  44088. if (!isset($this->labels[$label])) {
  44089. throw new \RuntimeException(sprintf('Label "%s" does not exist.', $label));
  44090. }
  44091. return $this->bits[$this->labels[$label]];
  44092. }
  44093. public function end()
  44094. {
  44095. if (null === $this->parent) {
  44096. throw new \RuntimeException('Calling end on root command doesn\'t make sense.');
  44097. }
  44098. return $this->parent;
  44099. }
  44100. public function length()
  44101. {
  44102. return \count($this->bits);
  44103. }
  44104. public function setErrorHandler(\Closure $errorHandler)
  44105. {
  44106. $this->errorHandler = $errorHandler;
  44107. return $this;
  44108. }
  44109. public function getErrorHandler()
  44110. {
  44111. return $this->errorHandler;
  44112. }
  44113. public function execute()
  44114. {
  44115. if (null === $errorHandler = $this->errorHandler) {
  44116. exec($this->join(), $output);
  44117. } else {
  44118. $process = proc_open($this->join(), array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w')), $pipes);
  44119. $output = preg_split('~(\r\n|\r|\n)~', stream_get_contents($pipes[1]), -1, PREG_SPLIT_NO_EMPTY);
  44120. if ($error = stream_get_contents($pipes[2])) {
  44121. $errorHandler($error);
  44122. }
  44123. proc_close($process);
  44124. }
  44125. return $output ?: array();
  44126. }
  44127. public function join()
  44128. {
  44129. return implode(' ', array_filter(
  44130. array_map(function ($bit) {
  44131. return $bit instanceof Command ? $bit->join() : ($bit ?: null);
  44132. }, $this->bits),
  44133. function ($bit) { return null !== $bit; }
  44134. ));
  44135. }
  44136. public function addAtIndex($bit, $index)
  44137. {
  44138. array_splice($this->bits, $index, 0, $bit instanceof self ? array($bit) : $bit);
  44139. return $this;
  44140. }
  44141. }
  44142. <?php
  44143. namespace Symfony\Component\Finder\Shell;
  44144. @trigger_error('The '.__NAMESPACE__.'\Shell class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  44145. class Shell
  44146. {
  44147. const TYPE_UNIX = 1;
  44148. const TYPE_DARWIN = 2;
  44149. const TYPE_CYGWIN = 3;
  44150. const TYPE_WINDOWS = 4;
  44151. const TYPE_BSD = 5;
  44152. private $type;
  44153. public function getType()
  44154. {
  44155. if (null === $this->type) {
  44156. $this->type = $this->guessType();
  44157. }
  44158. return $this->type;
  44159. }
  44160. public function testCommand($command)
  44161. {
  44162. if (!\function_exists('exec')) {
  44163. return false;
  44164. }
  44165. $testCommand = 'which ';
  44166. if (self::TYPE_WINDOWS === $this->type) {
  44167. $testCommand = 'where ';
  44168. }
  44169. $command = escapeshellcmd($command);
  44170. exec($testCommand.$command, $output, $code);
  44171. return 0 === $code && \count($output) > 0;
  44172. }
  44173. private function guessType()
  44174. {
  44175. $os = strtolower(PHP_OS);
  44176. if (false !== strpos($os, 'cygwin')) {
  44177. return self::TYPE_CYGWIN;
  44178. }
  44179. if (false !== strpos($os, 'darwin')) {
  44180. return self::TYPE_DARWIN;
  44181. }
  44182. if (false !== strpos($os, 'bsd')) {
  44183. return self::TYPE_BSD;
  44184. }
  44185. if (0 === strpos($os, 'win')) {
  44186. return self::TYPE_WINDOWS;
  44187. }
  44188. return self::TYPE_UNIX;
  44189. }
  44190. }
  44191. <?php
  44192. namespace Symfony\Component\Finder;
  44193. class SplFileInfo extends \SplFileInfo
  44194. {
  44195. private $relativePath;
  44196. private $relativePathname;
  44197. public function __construct($file, $relativePath, $relativePathname)
  44198. {
  44199. parent::__construct($file);
  44200. $this->relativePath = $relativePath;
  44201. $this->relativePathname = $relativePathname;
  44202. }
  44203. public function getRelativePath()
  44204. {
  44205. return $this->relativePath;
  44206. }
  44207. public function getRelativePathname()
  44208. {
  44209. return $this->relativePathname;
  44210. }
  44211. public function getContents()
  44212. {
  44213. set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
  44214. $content = file_get_contents($this->getPathname());
  44215. restore_error_handler();
  44216. if (false === $content) {
  44217. throw new \RuntimeException($error);
  44218. }
  44219. return $content;
  44220. }
  44221. }
  44222. <?php
  44223. namespace Symfony\Polyfill\Ctype;
  44224. final class Ctype
  44225. {
  44226. public static function ctype_alnum($text)
  44227. {
  44228. $text = self::convert_int_to_char_for_ctype($text);
  44229. return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z0-9]/', $text);
  44230. }
  44231. public static function ctype_alpha($text)
  44232. {
  44233. $text = self::convert_int_to_char_for_ctype($text);
  44234. return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z]/', $text);
  44235. }
  44236. public static function ctype_cntrl($text)
  44237. {
  44238. $text = self::convert_int_to_char_for_ctype($text);
  44239. return \is_string($text) && '' !== $text && !preg_match('/[^\x00-\x1f\x7f]/', $text);
  44240. }
  44241. public static function ctype_digit($text)
  44242. {
  44243. $text = self::convert_int_to_char_for_ctype($text);
  44244. return \is_string($text) && '' !== $text && !preg_match('/[^0-9]/', $text);
  44245. }
  44246. public static function ctype_graph($text)
  44247. {
  44248. $text = self::convert_int_to_char_for_ctype($text);
  44249. return \is_string($text) && '' !== $text && !preg_match('/[^!-~]/', $text);
  44250. }
  44251. public static function ctype_lower($text)
  44252. {
  44253. $text = self::convert_int_to_char_for_ctype($text);
  44254. return \is_string($text) && '' !== $text && !preg_match('/[^a-z]/', $text);
  44255. }
  44256. public static function ctype_print($text)
  44257. {
  44258. $text = self::convert_int_to_char_for_ctype($text);
  44259. return \is_string($text) && '' !== $text && !preg_match('/[^ -~]/', $text);
  44260. }
  44261. public static function ctype_punct($text)
  44262. {
  44263. $text = self::convert_int_to_char_for_ctype($text);
  44264. return \is_string($text) && '' !== $text && !preg_match('/[^!-\/\:-@\[-`\{-~]/', $text);
  44265. }
  44266. public static function ctype_space($text)
  44267. {
  44268. $text = self::convert_int_to_char_for_ctype($text);
  44269. return \is_string($text) && '' !== $text && !preg_match('/[^\s]/', $text);
  44270. }
  44271. public static function ctype_upper($text)
  44272. {
  44273. $text = self::convert_int_to_char_for_ctype($text);
  44274. return \is_string($text) && '' !== $text && !preg_match('/[^A-Z]/', $text);
  44275. }
  44276. public static function ctype_xdigit($text)
  44277. {
  44278. $text = self::convert_int_to_char_for_ctype($text);
  44279. return \is_string($text) && '' !== $text && !preg_match('/[^A-Fa-f0-9]/', $text);
  44280. }
  44281. private static function convert_int_to_char_for_ctype($int)
  44282. {
  44283. if (!\is_int($int)) {
  44284. return $int;
  44285. }
  44286. if ($int < -128 || $int > 255) {
  44287. return (string) $int;
  44288. }
  44289. if ($int < 0) {
  44290. $int += 256;
  44291. }
  44292. return \chr($int);
  44293. }
  44294. }
  44295. Copyright (c) 2018-2019 Fabien Potencier
  44296. Permission is hereby granted, free of charge, to any person obtaining a copy
  44297. of this software and associated documentation files (the "Software"), to deal
  44298. in the Software without restriction, including without limitation the rights
  44299. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  44300. copies of the Software, and to permit persons to whom the Software is furnished
  44301. to do so, subject to the following conditions:
  44302. The above copyright notice and this permission notice shall be included in all
  44303. copies or substantial portions of the Software.
  44304. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  44305. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  44306. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  44307. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  44308. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  44309. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  44310. THE SOFTWARE.
  44311. <?php
  44312. use Symfony\Polyfill\Ctype as p;
  44313. if (!function_exists('ctype_alnum')) {
  44314. function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); }
  44315. }
  44316. if (!function_exists('ctype_alpha')) {
  44317. function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); }
  44318. }
  44319. if (!function_exists('ctype_cntrl')) {
  44320. function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); }
  44321. }
  44322. if (!function_exists('ctype_digit')) {
  44323. function ctype_digit($text) { return p\Ctype::ctype_digit($text); }
  44324. }
  44325. if (!function_exists('ctype_graph')) {
  44326. function ctype_graph($text) { return p\Ctype::ctype_graph($text); }
  44327. }
  44328. if (!function_exists('ctype_lower')) {
  44329. function ctype_lower($text) { return p\Ctype::ctype_lower($text); }
  44330. }
  44331. if (!function_exists('ctype_print')) {
  44332. function ctype_print($text) { return p\Ctype::ctype_print($text); }
  44333. }
  44334. if (!function_exists('ctype_punct')) {
  44335. function ctype_punct($text) { return p\Ctype::ctype_punct($text); }
  44336. }
  44337. if (!function_exists('ctype_space')) {
  44338. function ctype_space($text) { return p\Ctype::ctype_space($text); }
  44339. }
  44340. if (!function_exists('ctype_upper')) {
  44341. function ctype_upper($text) { return p\Ctype::ctype_upper($text); }
  44342. }
  44343. if (!function_exists('ctype_xdigit')) {
  44344. function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); }
  44345. }
  44346. Copyright (c) 2015-2019 Fabien Potencier
  44347. Permission is hereby granted, free of charge, to any person obtaining a copy
  44348. of this software and associated documentation files (the "Software"), to deal
  44349. in the Software without restriction, including without limitation the rights
  44350. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  44351. copies of the Software, and to permit persons to whom the Software is furnished
  44352. to do so, subject to the following conditions:
  44353. The above copyright notice and this permission notice shall be included in all
  44354. copies or substantial portions of the Software.
  44355. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  44356. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  44357. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  44358. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  44359. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  44360. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  44361. THE SOFTWARE.
  44362. <?php
  44363. namespace Symfony\Polyfill\Mbstring;
  44364. final class Mbstring
  44365. {
  44366. const MB_CASE_FOLD = PHP_INT_MAX;
  44367. private static $encodingList = array('ASCII', 'UTF-8');
  44368. private static $language = 'neutral';
  44369. private static $internalEncoding = 'UTF-8';
  44370. private static $caseFold = array(
  44371. array('µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"),
  44372. array('μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', '�', 'ε', "\xE1\xB9\xA1", 'ι'),
  44373. );
  44374. public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
  44375. {
  44376. if (\is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) {
  44377. $fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
  44378. } else {
  44379. $fromEncoding = self::getEncoding($fromEncoding);
  44380. }
  44381. $toEncoding = self::getEncoding($toEncoding);
  44382. if ('BASE64' === $fromEncoding) {
  44383. $s = base64_decode($s);
  44384. $fromEncoding = $toEncoding;
  44385. }
  44386. if ('BASE64' === $toEncoding) {
  44387. return base64_encode($s);
  44388. }
  44389. if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) {
  44390. if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) {
  44391. $fromEncoding = 'Windows-1252';
  44392. }
  44393. if ('UTF-8' !== $fromEncoding) {
  44394. $s = iconv($fromEncoding, 'UTF-8//IGNORE', $s);
  44395. }
  44396. return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s);
  44397. }
  44398. if ('HTML-ENTITIES' === $fromEncoding) {
  44399. $s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
  44400. $fromEncoding = 'UTF-8';
  44401. }
  44402. return iconv($fromEncoding, $toEncoding.'//IGNORE', $s);
  44403. }
  44404. public static function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null)
  44405. {
  44406. $vars = array(&$a, &$b, &$c, &$d, &$e, &$f);
  44407. $ok = true;
  44408. array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) {
  44409. if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
  44410. $ok = false;
  44411. }
  44412. });
  44413. return $ok ? $fromEncoding : false;
  44414. }
  44415. public static function mb_decode_mimeheader($s)
  44416. {
  44417. return iconv_mime_decode($s, 2, self::$internalEncoding);
  44418. }
  44419. public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
  44420. {
  44421. trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING);
  44422. }
  44423. public static function mb_decode_numericentity($s, $convmap, $encoding = null)
  44424. {
  44425. if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
  44426. trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING);
  44427. return null;
  44428. }
  44429. if (!\is_array($convmap) || !$convmap) {
  44430. return false;
  44431. }
  44432. if (null !== $encoding && !\is_scalar($encoding)) {
  44433. trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING);
  44434. return '';
  44435. }
  44436. $s = (string) $s;
  44437. if ('' === $s) {
  44438. return '';
  44439. }
  44440. $encoding = self::getEncoding($encoding);
  44441. if ('UTF-8' === $encoding) {
  44442. $encoding = null;
  44443. if (!preg_match('//u', $s)) {
  44444. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  44445. }
  44446. } else {
  44447. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  44448. }
  44449. $cnt = floor(\count($convmap) / 4) * 4;
  44450. for ($i = 0; $i < $cnt; $i += 4) {
  44451. $convmap[$i] += $convmap[$i + 2];
  44452. $convmap[$i + 1] += $convmap[$i + 2];
  44453. }
  44454. $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use ($cnt, $convmap) {
  44455. $c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1];
  44456. for ($i = 0; $i < $cnt; $i += 4) {
  44457. if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) {
  44458. return Mbstring::mb_chr($c - $convmap[$i + 2]);
  44459. }
  44460. }
  44461. return $m[0];
  44462. }, $s);
  44463. if (null === $encoding) {
  44464. return $s;
  44465. }
  44466. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  44467. }
  44468. public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false)
  44469. {
  44470. if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
  44471. trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING);
  44472. return null;
  44473. }
  44474. if (!\is_array($convmap) || !$convmap) {
  44475. return false;
  44476. }
  44477. if (null !== $encoding && !\is_scalar($encoding)) {
  44478. trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING);
  44479. return null;
  44480. }
  44481. if (null !== $is_hex && !\is_scalar($is_hex)) {
  44482. trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', E_USER_WARNING);
  44483. return null;
  44484. }
  44485. $s = (string) $s;
  44486. if ('' === $s) {
  44487. return '';
  44488. }
  44489. $encoding = self::getEncoding($encoding);
  44490. if ('UTF-8' === $encoding) {
  44491. $encoding = null;
  44492. if (!preg_match('//u', $s)) {
  44493. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  44494. }
  44495. } else {
  44496. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  44497. }
  44498. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  44499. $cnt = floor(\count($convmap) / 4) * 4;
  44500. $i = 0;
  44501. $len = \strlen($s);
  44502. $result = '';
  44503. while ($i < $len) {
  44504. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  44505. $uchr = substr($s, $i, $ulen);
  44506. $i += $ulen;
  44507. $c = self::mb_ord($uchr);
  44508. for ($j = 0; $j < $cnt; $j += 4) {
  44509. if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) {
  44510. $cOffset = ($c + $convmap[$j + 2]) & $convmap[$j + 3];
  44511. $result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#'.$cOffset.';';
  44512. continue 2;
  44513. }
  44514. }
  44515. $result .= $uchr;
  44516. }
  44517. if (null === $encoding) {
  44518. return $result;
  44519. }
  44520. return iconv('UTF-8', $encoding.'//IGNORE', $result);
  44521. }
  44522. public static function mb_convert_case($s, $mode, $encoding = null)
  44523. {
  44524. $s = (string) $s;
  44525. if ('' === $s) {
  44526. return '';
  44527. }
  44528. $encoding = self::getEncoding($encoding);
  44529. if ('UTF-8' === $encoding) {
  44530. $encoding = null;
  44531. if (!preg_match('//u', $s)) {
  44532. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  44533. }
  44534. } else {
  44535. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  44536. }
  44537. if (MB_CASE_TITLE == $mode) {
  44538. static $titleRegexp = null;
  44539. if (null === $titleRegexp) {
  44540. $titleRegexp = self::getData('titleCaseRegexp');
  44541. }
  44542. $s = preg_replace_callback($titleRegexp, array(__CLASS__, 'title_case'), $s);
  44543. } else {
  44544. if (MB_CASE_UPPER == $mode) {
  44545. static $upper = null;
  44546. if (null === $upper) {
  44547. $upper = self::getData('upperCase');
  44548. }
  44549. $map = $upper;
  44550. } else {
  44551. if (self::MB_CASE_FOLD === $mode) {
  44552. $s = str_replace(self::$caseFold[0], self::$caseFold[1], $s);
  44553. }
  44554. static $lower = null;
  44555. if (null === $lower) {
  44556. $lower = self::getData('lowerCase');
  44557. }
  44558. $map = $lower;
  44559. }
  44560. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  44561. $i = 0;
  44562. $len = \strlen($s);
  44563. while ($i < $len) {
  44564. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  44565. $uchr = substr($s, $i, $ulen);
  44566. $i += $ulen;
  44567. if (isset($map[$uchr])) {
  44568. $uchr = $map[$uchr];
  44569. $nlen = \strlen($uchr);
  44570. if ($nlen == $ulen) {
  44571. $nlen = $i;
  44572. do {
  44573. $s[--$nlen] = $uchr[--$ulen];
  44574. } while ($ulen);
  44575. } else {
  44576. $s = substr_replace($s, $uchr, $i - $ulen, $ulen);
  44577. $len += $nlen - $ulen;
  44578. $i += $nlen - $ulen;
  44579. }
  44580. }
  44581. }
  44582. }
  44583. if (null === $encoding) {
  44584. return $s;
  44585. }
  44586. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  44587. }
  44588. public static function mb_internal_encoding($encoding = null)
  44589. {
  44590. if (null === $encoding) {
  44591. return self::$internalEncoding;
  44592. }
  44593. $encoding = self::getEncoding($encoding);
  44594. if ('UTF-8' === $encoding || false !== @iconv($encoding, $encoding, ' ')) {
  44595. self::$internalEncoding = $encoding;
  44596. return true;
  44597. }
  44598. return false;
  44599. }
  44600. public static function mb_language($lang = null)
  44601. {
  44602. if (null === $lang) {
  44603. return self::$language;
  44604. }
  44605. switch ($lang = strtolower($lang)) {
  44606. case 'uni':
  44607. case 'neutral':
  44608. self::$language = $lang;
  44609. return true;
  44610. }
  44611. return false;
  44612. }
  44613. public static function mb_list_encodings()
  44614. {
  44615. return array('UTF-8');
  44616. }
  44617. public static function mb_encoding_aliases($encoding)
  44618. {
  44619. switch (strtoupper($encoding)) {
  44620. case 'UTF8':
  44621. case 'UTF-8':
  44622. return array('utf8');
  44623. }
  44624. return false;
  44625. }
  44626. public static function mb_check_encoding($var = null, $encoding = null)
  44627. {
  44628. if (null === $encoding) {
  44629. if (null === $var) {
  44630. return false;
  44631. }
  44632. $encoding = self::$internalEncoding;
  44633. }
  44634. return self::mb_detect_encoding($var, array($encoding)) || false !== @iconv($encoding, $encoding, $var);
  44635. }
  44636. public static function mb_detect_encoding($str, $encodingList = null, $strict = false)
  44637. {
  44638. if (null === $encodingList) {
  44639. $encodingList = self::$encodingList;
  44640. } else {
  44641. if (!\is_array($encodingList)) {
  44642. $encodingList = array_map('trim', explode(',', $encodingList));
  44643. }
  44644. $encodingList = array_map('strtoupper', $encodingList);
  44645. }
  44646. foreach ($encodingList as $enc) {
  44647. switch ($enc) {
  44648. case 'ASCII':
  44649. if (!preg_match('/[\x80-\xFF]/', $str)) {
  44650. return $enc;
  44651. }
  44652. break;
  44653. case 'UTF8':
  44654. case 'UTF-8':
  44655. if (preg_match('//u', $str)) {
  44656. return 'UTF-8';
  44657. }
  44658. break;
  44659. default:
  44660. if (0 === strncmp($enc, 'ISO-8859-', 9)) {
  44661. return $enc;
  44662. }
  44663. }
  44664. }
  44665. return false;
  44666. }
  44667. public static function mb_detect_order($encodingList = null)
  44668. {
  44669. if (null === $encodingList) {
  44670. return self::$encodingList;
  44671. }
  44672. if (!\is_array($encodingList)) {
  44673. $encodingList = array_map('trim', explode(',', $encodingList));
  44674. }
  44675. $encodingList = array_map('strtoupper', $encodingList);
  44676. foreach ($encodingList as $enc) {
  44677. switch ($enc) {
  44678. default:
  44679. if (strncmp($enc, 'ISO-8859-', 9)) {
  44680. return false;
  44681. }
  44682. case 'ASCII':
  44683. case 'UTF8':
  44684. case 'UTF-8':
  44685. }
  44686. }
  44687. self::$encodingList = $encodingList;
  44688. return true;
  44689. }
  44690. public static function mb_strlen($s, $encoding = null)
  44691. {
  44692. $encoding = self::getEncoding($encoding);
  44693. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  44694. return \strlen($s);
  44695. }
  44696. return @iconv_strlen($s, $encoding);
  44697. }
  44698. public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null)
  44699. {
  44700. $encoding = self::getEncoding($encoding);
  44701. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  44702. return strpos($haystack, $needle, $offset);
  44703. }
  44704. $needle = (string) $needle;
  44705. if ('' === $needle) {
  44706. trigger_error(__METHOD__.': Empty delimiter', E_USER_WARNING);
  44707. return false;
  44708. }
  44709. return iconv_strpos($haystack, $needle, $offset, $encoding);
  44710. }
  44711. public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null)
  44712. {
  44713. $encoding = self::getEncoding($encoding);
  44714. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  44715. return strrpos($haystack, $needle, $offset);
  44716. }
  44717. if ($offset != (int) $offset) {
  44718. $offset = 0;
  44719. } elseif ($offset = (int) $offset) {
  44720. if ($offset < 0) {
  44721. if (0 > $offset += self::mb_strlen($needle)) {
  44722. $haystack = self::mb_substr($haystack, 0, $offset, $encoding);
  44723. }
  44724. $offset = 0;
  44725. } else {
  44726. $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
  44727. }
  44728. }
  44729. $pos = iconv_strrpos($haystack, $needle, $encoding);
  44730. return false !== $pos ? $offset + $pos : false;
  44731. }
  44732. public static function mb_str_split($string, $split_length = 1, $encoding = null)
  44733. {
  44734. if (null !== $string && !\is_scalar($string) && !(\is_object($string) && \method_exists($string, '__toString'))) {
  44735. trigger_error('mb_str_split() expects parameter 1 to be string, '.\gettype($string).' given', E_USER_WARNING);
  44736. return null;
  44737. }
  44738. if (1 > $split_length = (int) $split_length) {
  44739. trigger_error('The length of each segment must be greater than zero', E_USER_WARNING);
  44740. return false;
  44741. }
  44742. if (null === $encoding) {
  44743. $encoding = mb_internal_encoding();
  44744. }
  44745. if ('UTF-8' === $encoding = self::getEncoding($encoding)) {
  44746. $rx = '/(';
  44747. while (65535 < $split_length) {
  44748. $rx .= '.{65535}';
  44749. $split_length -= 65535;
  44750. }
  44751. $rx .= '.{'.$split_length.'})/us';
  44752. return preg_split($rx, $string, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
  44753. }
  44754. $result = array();
  44755. $length = mb_strlen($string, $encoding);
  44756. for ($i = 0; $i < $length; $i += $split_length) {
  44757. $result[] = mb_substr($string, $i, $split_length, $encoding);
  44758. }
  44759. return $result;
  44760. }
  44761. public static function mb_strtolower($s, $encoding = null)
  44762. {
  44763. return self::mb_convert_case($s, MB_CASE_LOWER, $encoding);
  44764. }
  44765. public static function mb_strtoupper($s, $encoding = null)
  44766. {
  44767. return self::mb_convert_case($s, MB_CASE_UPPER, $encoding);
  44768. }
  44769. public static function mb_substitute_character($c = null)
  44770. {
  44771. if (0 === strcasecmp($c, 'none')) {
  44772. return true;
  44773. }
  44774. return null !== $c ? false : 'none';
  44775. }
  44776. public static function mb_substr($s, $start, $length = null, $encoding = null)
  44777. {
  44778. $encoding = self::getEncoding($encoding);
  44779. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  44780. return (string) substr($s, $start, null === $length ? 2147483647 : $length);
  44781. }
  44782. if ($start < 0) {
  44783. $start = iconv_strlen($s, $encoding) + $start;
  44784. if ($start < 0) {
  44785. $start = 0;
  44786. }
  44787. }
  44788. if (null === $length) {
  44789. $length = 2147483647;
  44790. } elseif ($length < 0) {
  44791. $length = iconv_strlen($s, $encoding) + $length - $start;
  44792. if ($length < 0) {
  44793. return '';
  44794. }
  44795. }
  44796. return (string) iconv_substr($s, $start, $length, $encoding);
  44797. }
  44798. public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null)
  44799. {
  44800. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  44801. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  44802. return self::mb_strpos($haystack, $needle, $offset, $encoding);
  44803. }
  44804. public static function mb_stristr($haystack, $needle, $part = false, $encoding = null)
  44805. {
  44806. $pos = self::mb_stripos($haystack, $needle, 0, $encoding);
  44807. return self::getSubpart($pos, $part, $haystack, $encoding);
  44808. }
  44809. public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null)
  44810. {
  44811. $encoding = self::getEncoding($encoding);
  44812. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  44813. return strrchr($haystack, $needle, $part);
  44814. }
  44815. $needle = self::mb_substr($needle, 0, 1, $encoding);
  44816. $pos = iconv_strrpos($haystack, $needle, $encoding);
  44817. return self::getSubpart($pos, $part, $haystack, $encoding);
  44818. }
  44819. public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null)
  44820. {
  44821. $needle = self::mb_substr($needle, 0, 1, $encoding);
  44822. $pos = self::mb_strripos($haystack, $needle, $encoding);
  44823. return self::getSubpart($pos, $part, $haystack, $encoding);
  44824. }
  44825. public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null)
  44826. {
  44827. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  44828. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  44829. return self::mb_strrpos($haystack, $needle, $offset, $encoding);
  44830. }
  44831. public static function mb_strstr($haystack, $needle, $part = false, $encoding = null)
  44832. {
  44833. $pos = strpos($haystack, $needle);
  44834. if (false === $pos) {
  44835. return false;
  44836. }
  44837. if ($part) {
  44838. return substr($haystack, 0, $pos);
  44839. }
  44840. return substr($haystack, $pos);
  44841. }
  44842. public static function mb_get_info($type = 'all')
  44843. {
  44844. $info = array(
  44845. 'internal_encoding' => self::$internalEncoding,
  44846. 'http_output' => 'pass',
  44847. 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)',
  44848. 'func_overload' => 0,
  44849. 'func_overload_list' => 'no overload',
  44850. 'mail_charset' => 'UTF-8',
  44851. 'mail_header_encoding' => 'BASE64',
  44852. 'mail_body_encoding' => 'BASE64',
  44853. 'illegal_chars' => 0,
  44854. 'encoding_translation' => 'Off',
  44855. 'language' => self::$language,
  44856. 'detect_order' => self::$encodingList,
  44857. 'substitute_character' => 'none',
  44858. 'strict_detection' => 'Off',
  44859. );
  44860. if ('all' === $type) {
  44861. return $info;
  44862. }
  44863. if (isset($info[$type])) {
  44864. return $info[$type];
  44865. }
  44866. return false;
  44867. }
  44868. public static function mb_http_input($type = '')
  44869. {
  44870. return false;
  44871. }
  44872. public static function mb_http_output($encoding = null)
  44873. {
  44874. return null !== $encoding ? 'pass' === $encoding : 'pass';
  44875. }
  44876. public static function mb_strwidth($s, $encoding = null)
  44877. {
  44878. $encoding = self::getEncoding($encoding);
  44879. if ('UTF-8' !== $encoding) {
  44880. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  44881. }
  44882. $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);
  44883. return ($wide << 1) + iconv_strlen($s, 'UTF-8');
  44884. }
  44885. public static function mb_substr_count($haystack, $needle, $encoding = null)
  44886. {
  44887. return substr_count($haystack, $needle);
  44888. }
  44889. public static function mb_output_handler($contents, $status)
  44890. {
  44891. return $contents;
  44892. }
  44893. public static function mb_chr($code, $encoding = null)
  44894. {
  44895. if (0x80 > $code %= 0x200000) {
  44896. $s = \chr($code);
  44897. } elseif (0x800 > $code) {
  44898. $s = \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F);
  44899. } elseif (0x10000 > $code) {
  44900. $s = \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  44901. } else {
  44902. $s = \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  44903. }
  44904. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  44905. $s = mb_convert_encoding($s, $encoding, 'UTF-8');
  44906. }
  44907. return $s;
  44908. }
  44909. public static function mb_ord($s, $encoding = null)
  44910. {
  44911. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  44912. $s = mb_convert_encoding($s, 'UTF-8', $encoding);
  44913. }
  44914. if (1 === \strlen($s)) {
  44915. return \ord($s);
  44916. }
  44917. $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0;
  44918. if (0xF0 <= $code) {
  44919. return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80;
  44920. }
  44921. if (0xE0 <= $code) {
  44922. return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80;
  44923. }
  44924. if (0xC0 <= $code) {
  44925. return (($code - 0xC0) << 6) + $s[2] - 0x80;
  44926. }
  44927. return $code;
  44928. }
  44929. private static function getSubpart($pos, $part, $haystack, $encoding)
  44930. {
  44931. if (false === $pos) {
  44932. return false;
  44933. }
  44934. if ($part) {
  44935. return self::mb_substr($haystack, 0, $pos, $encoding);
  44936. }
  44937. return self::mb_substr($haystack, $pos, null, $encoding);
  44938. }
  44939. private static function html_encoding_callback(array $m)
  44940. {
  44941. $i = 1;
  44942. $entities = '';
  44943. $m = unpack('C*', htmlentities($m[0], ENT_COMPAT, 'UTF-8'));
  44944. while (isset($m[$i])) {
  44945. if (0x80 > $m[$i]) {
  44946. $entities .= \chr($m[$i++]);
  44947. continue;
  44948. }
  44949. if (0xF0 <= $m[$i]) {
  44950. $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  44951. } elseif (0xE0 <= $m[$i]) {
  44952. $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  44953. } else {
  44954. $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
  44955. }
  44956. $entities .= '&#'.$c.';';
  44957. }
  44958. return $entities;
  44959. }
  44960. private static function title_case(array $s)
  44961. {
  44962. return self::mb_convert_case($s[1], MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], MB_CASE_LOWER, 'UTF-8');
  44963. }
  44964. private static function getData($file)
  44965. {
  44966. if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
  44967. return require $file;
  44968. }
  44969. return false;
  44970. }
  44971. private static function getEncoding($encoding)
  44972. {
  44973. if (null === $encoding) {
  44974. return self::$internalEncoding;
  44975. }
  44976. if ('UTF-8' === $encoding) {
  44977. return 'UTF-8';
  44978. }
  44979. $encoding = strtoupper($encoding);
  44980. if ('8BIT' === $encoding || 'BINARY' === $encoding) {
  44981. return 'CP850';
  44982. }
  44983. if ('UTF8' === $encoding) {
  44984. return 'UTF-8';
  44985. }
  44986. return $encoding;
  44987. }
  44988. }
  44989. <?php
  44990. return array(
  44991. 'A' => 'a',
  44992. 'B' => 'b',
  44993. 'C' => 'c',
  44994. 'D' => 'd',
  44995. 'E' => 'e',
  44996. 'F' => 'f',
  44997. 'G' => 'g',
  44998. 'H' => 'h',
  44999. 'I' => 'i',
  45000. 'J' => 'j',
  45001. 'K' => 'k',
  45002. 'L' => 'l',
  45003. 'M' => 'm',
  45004. 'N' => 'n',
  45005. 'O' => 'o',
  45006. 'P' => 'p',
  45007. 'Q' => 'q',
  45008. 'R' => 'r',
  45009. 'S' => 's',
  45010. 'T' => 't',
  45011. 'U' => 'u',
  45012. 'V' => 'v',
  45013. 'W' => 'w',
  45014. 'X' => 'x',
  45015. 'Y' => 'y',
  45016. 'Z' => 'z',
  45017. 'À' => 'à',
  45018. '�' => 'á',
  45019. 'Â' => 'â',
  45020. 'Ã' => 'ã',
  45021. 'Ä' => 'ä',
  45022. 'Ã…' => 'Ã¥',
  45023. 'Æ' => 'æ',
  45024. 'Ç' => 'ç',
  45025. 'È' => 'è',
  45026. 'É' => 'é',
  45027. 'Ê' => 'ê',
  45028. 'Ë' => 'ë',
  45029. 'Ì' => 'ì',
  45030. '�' => 'í',
  45031. 'Î' => 'î',
  45032. '�' => 'ï',
  45033. '�' => 'ð',
  45034. 'Ñ' => 'ñ',
  45035. 'Ò' => 'ò',
  45036. 'Ó' => 'ó',
  45037. 'Ô' => 'ô',
  45038. 'Õ' => 'õ',
  45039. 'Ö' => 'ö',
  45040. 'Ø' => 'ø',
  45041. 'Ù' => 'ù',
  45042. 'Ú' => 'ú',
  45043. 'Û' => 'û',
  45044. 'Ü' => 'ü',
  45045. '�' => 'ý',
  45046. 'Þ' => 'þ',
  45047. 'Ā' => '�',
  45048. 'Ă' => 'ă',
  45049. 'Ä„' => 'Ä…',
  45050. 'Ć' => 'ć',
  45051. 'Ĉ' => 'ĉ',
  45052. 'ÄŠ' => 'Ä‹',
  45053. 'Č' => '�',
  45054. 'Ď' => '�',
  45055. '�' => 'đ',
  45056. 'Ä’' => 'Ä“',
  45057. 'Ä”' => 'Ä•',
  45058. 'Ä–' => 'Ä—',
  45059. 'Ę' => 'ę',
  45060. 'Äš' => 'Ä›',
  45061. 'Ĝ' => '�',
  45062. 'Äž' => 'ÄŸ',
  45063. 'Ä ' => 'Ä¡',
  45064. 'Ä¢' => 'Ä£',
  45065. 'Ĥ' => 'ĥ',
  45066. 'Ħ' => 'ħ',
  45067. 'Ĩ' => 'ĩ',
  45068. 'Ī' => 'ī',
  45069. 'Ĭ' => 'ĭ',
  45070. 'Į' => 'į',
  45071. 'Ä°' => 'i',
  45072. 'IJ' => 'ij',
  45073. 'Ĵ' => 'ĵ',
  45074. 'Ķ' => 'ķ',
  45075. 'Ĺ' => 'ĺ',
  45076. 'Ļ' => 'ļ',
  45077. 'Ľ' => 'ľ',
  45078. 'Ä¿' => 'Å€',
  45079. '�' => 'ł',
  45080. 'Ń' => 'ń',
  45081. 'Ņ' => 'ņ',
  45082. 'Ň' => 'ň',
  45083. 'ÅŠ' => 'Å‹',
  45084. 'Ō' => '�',
  45085. 'Ŏ' => '�',
  45086. '�' => 'ő',
  45087. 'Å’' => 'Å“',
  45088. 'Å”' => 'Å•',
  45089. 'Å–' => 'Å—',
  45090. 'Ř' => 'ř',
  45091. 'Åš' => 'Å›',
  45092. 'Ŝ' => '�',
  45093. 'Åž' => 'ÅŸ',
  45094. 'Å ' => 'Å¡',
  45095. 'Å¢' => 'Å£',
  45096. 'Ť' => 'ť',
  45097. 'Ŧ' => 'ŧ',
  45098. 'Ũ' => 'ũ',
  45099. 'Ū' => 'ū',
  45100. 'Ŭ' => 'ŭ',
  45101. 'Ů' => 'ů',
  45102. 'Ű' => 'ű',
  45103. 'Ų' => 'ų',
  45104. 'Ŵ' => 'ŵ',
  45105. 'Ŷ' => 'ŷ',
  45106. 'Ÿ' => 'ÿ',
  45107. 'Ź' => 'ź',
  45108. 'Ż' => 'ż',
  45109. 'Ž' => 'ž',
  45110. '�' => 'ɓ',
  45111. 'Ƃ' => 'ƃ',
  45112. 'Æ„' => 'Æ…',
  45113. 'Ɔ' => 'ɔ',
  45114. 'Ƈ' => 'ƈ',
  45115. 'Ɖ' => 'ɖ',
  45116. 'ÆŠ' => 'É—',
  45117. 'Ƌ' => 'ƌ',
  45118. 'Ǝ' => '�',
  45119. '�' => 'ə',
  45120. '�' => 'ɛ',
  45121. 'Æ‘' => 'Æ’',
  45122. 'Æ“' => 'É ',
  45123. 'Æ”' => 'É£',
  45124. 'Æ–' => 'É©',
  45125. 'Ɨ' => 'ɨ',
  45126. 'Ƙ' => 'ƙ',
  45127. 'Ɯ' => 'ɯ',
  45128. '�' => 'ɲ',
  45129. 'Ɵ' => 'ɵ',
  45130. 'Æ ' => 'Æ¡',
  45131. 'Æ¢' => 'Æ£',
  45132. 'Ƥ' => 'ƥ',
  45133. 'Ʀ' => 'ʀ',
  45134. 'Ƨ' => 'ƨ',
  45135. 'Ʃ' => 'ʃ',
  45136. 'Ƭ' => 'ƭ',
  45137. 'Ʈ' => 'ʈ',
  45138. 'Ư' => 'ư',
  45139. 'Ʊ' => 'ʊ',
  45140. 'Ʋ' => 'ʋ',
  45141. 'Ƴ' => 'ƴ',
  45142. 'Ƶ' => 'ƶ',
  45143. 'Æ·' => 'Ê’',
  45144. 'Ƹ' => 'ƹ',
  45145. 'Ƽ' => 'ƽ',
  45146. 'DŽ' => 'dž',
  45147. 'Dž' => 'dž',
  45148. 'LJ' => 'lj',
  45149. 'Lj' => 'lj',
  45150. 'NJ' => 'nj',
  45151. 'Nj' => 'nj',
  45152. '�' => 'ǎ',
  45153. '�' => '�',
  45154. 'Ç‘' => 'Ç’',
  45155. 'Ç“' => 'Ç”',
  45156. 'Ç•' => 'Ç–',
  45157. 'Ǘ' => 'ǘ',
  45158. 'Ç™' => 'Çš',
  45159. 'Ǜ' => 'ǜ',
  45160. 'Çž' => 'ÇŸ',
  45161. 'Ç ' => 'Ç¡',
  45162. 'Ç¢' => 'Ç£',
  45163. 'Ǥ' => 'ǥ',
  45164. 'Ǧ' => 'ǧ',
  45165. 'Ǩ' => 'ǩ',
  45166. 'Ǫ' => 'ǫ',
  45167. 'Ǭ' => 'ǭ',
  45168. 'Ǯ' => 'ǯ',
  45169. 'DZ' => 'dz',
  45170. 'Dz' => 'dz',
  45171. 'Ǵ' => 'ǵ',
  45172. 'Ƕ' => 'ƕ',
  45173. 'Ç·' => 'Æ¿',
  45174. 'Ǹ' => 'ǹ',
  45175. 'Ǻ' => 'ǻ',
  45176. 'Ǽ' => 'ǽ',
  45177. 'Ǿ' => 'ǿ',
  45178. 'Ȁ' => '�',
  45179. 'Ȃ' => 'ȃ',
  45180. 'È„' => 'È…',
  45181. 'Ȇ' => 'ȇ',
  45182. 'Ȉ' => 'ȉ',
  45183. 'ÈŠ' => 'È‹',
  45184. 'Ȍ' => '�',
  45185. 'Ȏ' => '�',
  45186. '�' => 'ȑ',
  45187. 'È’' => 'È“',
  45188. 'È”' => 'È•',
  45189. 'È–' => 'È—',
  45190. 'Ș' => 'ș',
  45191. 'Èš' => 'È›',
  45192. 'Ȝ' => '�',
  45193. 'Èž' => 'ÈŸ',
  45194. 'È ' => 'Æž',
  45195. 'È¢' => 'È£',
  45196. 'Ȥ' => 'ȥ',
  45197. 'Ȧ' => 'ȧ',
  45198. 'Ȩ' => 'ȩ',
  45199. 'Ȫ' => 'ȫ',
  45200. 'Ȭ' => 'ȭ',
  45201. 'Ȯ' => 'ȯ',
  45202. 'Ȱ' => 'ȱ',
  45203. 'Ȳ' => 'ȳ',
  45204. 'Ⱥ' => 'ⱥ',
  45205. 'Ȼ' => 'ȼ',
  45206. 'Ƚ' => 'ƚ',
  45207. 'Ⱦ' => 'ⱦ',
  45208. '�' => 'ɂ',
  45209. 'Ƀ' => 'ƀ',
  45210. 'Ʉ' => 'ʉ',
  45211. 'Ʌ' => 'ʌ',
  45212. 'Ɇ' => 'ɇ',
  45213. 'Ɉ' => 'ɉ',
  45214. 'ÉŠ' => 'É‹',
  45215. 'Ɍ' => '�',
  45216. 'Ɏ' => '�',
  45217. 'Ͱ' => 'ͱ',
  45218. 'Ͳ' => 'ͳ',
  45219. 'Ͷ' => 'ͷ',
  45220. 'Ϳ' => 'ϳ',
  45221. 'Ά' => 'ά',
  45222. 'Έ' => 'έ',
  45223. 'Ή' => 'ή',
  45224. 'Ί' => 'ί',
  45225. 'Ό' => 'ό',
  45226. 'Ύ' => '�',
  45227. '�' => 'ώ',
  45228. 'Α' => 'α',
  45229. 'Β' => 'β',
  45230. 'Γ' => 'γ',
  45231. 'Δ' => 'δ',
  45232. 'Ε' => 'ε',
  45233. 'Ζ' => 'ζ',
  45234. 'Η' => 'η',
  45235. 'Θ' => 'θ',
  45236. 'Ι' => 'ι',
  45237. 'Κ' => 'κ',
  45238. 'Λ' => 'λ',
  45239. 'Μ' => 'μ',
  45240. '�' => 'ν',
  45241. 'Ξ' => 'ξ',
  45242. 'Ο' => 'ο',
  45243. 'Π' => 'π',
  45244. 'Ρ' => '�',
  45245. 'Σ' => 'σ',
  45246. 'Τ' => 'τ',
  45247. 'Î¥' => 'Ï…',
  45248. 'Φ' => 'φ',
  45249. 'Χ' => 'χ',
  45250. 'Ψ' => 'ψ',
  45251. 'Ω' => 'ω',
  45252. 'Ϊ' => 'ϊ',
  45253. 'Ϋ' => 'ϋ',
  45254. '�' => 'ϗ',
  45255. 'Ϙ' => 'ϙ',
  45256. 'Ïš' => 'Ï›',
  45257. 'Ϝ' => '�',
  45258. 'Ïž' => 'ÏŸ',
  45259. 'Ï ' => 'Ï¡',
  45260. 'Ï¢' => 'Ï£',
  45261. 'Ϥ' => 'ϥ',
  45262. 'Ϧ' => 'ϧ',
  45263. 'Ϩ' => 'ϩ',
  45264. 'Ϫ' => 'ϫ',
  45265. 'Ϭ' => 'ϭ',
  45266. 'Ϯ' => 'ϯ',
  45267. 'ϴ' => 'θ',
  45268. 'Ϸ' => 'ϸ',
  45269. 'Ϲ' => 'ϲ',
  45270. 'Ϻ' => 'ϻ',
  45271. 'Ͻ' => 'ͻ',
  45272. 'Ͼ' => 'ͼ',
  45273. 'Ͽ' => 'ͽ',
  45274. 'Ѐ' => '�',
  45275. '�' => 'ё',
  45276. 'Ђ' => 'ђ',
  45277. 'Ѓ' => 'ѓ',
  45278. 'Є' => 'є',
  45279. 'Ð…' => 'Ñ•',
  45280. 'І' => 'і',
  45281. 'Ї' => 'ї',
  45282. 'Ј' => 'ј',
  45283. 'Љ' => 'љ',
  45284. 'Њ' => 'њ',
  45285. 'Ћ' => 'ћ',
  45286. 'Ќ' => 'ќ',
  45287. '�' => '�',
  45288. 'ÐŽ' => 'Ñž',
  45289. '�' => 'џ',
  45290. '�' => 'а',
  45291. 'Б' => 'б',
  45292. 'В' => 'в',
  45293. 'Г' => 'г',
  45294. 'Д' => 'д',
  45295. 'Е' => 'е',
  45296. 'Ж' => 'ж',
  45297. 'З' => 'з',
  45298. 'И' => 'и',
  45299. 'Й' => 'й',
  45300. 'К' => 'к',
  45301. 'Л' => 'л',
  45302. 'М' => 'м',
  45303. '�' => 'н',
  45304. 'О' => 'о',
  45305. 'П' => 'п',
  45306. 'Р' => 'р',
  45307. 'С' => '�',
  45308. 'Т' => 'т',
  45309. 'У' => 'у',
  45310. 'Ф' => 'ф',
  45311. 'Ð¥' => 'Ñ…',
  45312. 'Ц' => 'ц',
  45313. 'Ч' => 'ч',
  45314. 'Ш' => 'ш',
  45315. 'Щ' => 'щ',
  45316. 'Ъ' => 'ъ',
  45317. 'Ы' => 'ы',
  45318. 'Ь' => 'ь',
  45319. 'Э' => '�',
  45320. 'Ю' => 'ю',
  45321. 'Я' => '�',
  45322. 'Ñ ' => 'Ñ¡',
  45323. 'Ñ¢' => 'Ñ£',
  45324. 'Ѥ' => 'ѥ',
  45325. 'Ѧ' => 'ѧ',
  45326. 'Ѩ' => 'ѩ',
  45327. 'Ѫ' => 'ѫ',
  45328. 'Ѭ' => 'ѭ',
  45329. 'Ѯ' => 'ѯ',
  45330. 'Ѱ' => 'ѱ',
  45331. 'Ѳ' => 'ѳ',
  45332. 'Ѵ' => 'ѵ',
  45333. 'Ѷ' => 'ѷ',
  45334. 'Ѹ' => 'ѹ',
  45335. 'Ѻ' => 'ѻ',
  45336. 'Ѽ' => 'ѽ',
  45337. 'Ѿ' => 'ѿ',
  45338. 'Ò€' => 'Ò�',
  45339. 'ÒŠ' => 'Ò‹',
  45340. 'Ҍ' => '�',
  45341. 'ÒŽ' => 'Ò�',
  45342. 'Ò�' => 'Ò‘',
  45343. 'Ò’' => 'Ò“',
  45344. 'Ò”' => 'Ò•',
  45345. 'Ò–' => 'Ò—',
  45346. 'Ò˜' => 'Ò™',
  45347. 'Òš' => 'Ò›',
  45348. 'Ҝ' => '�',
  45349. 'Òž' => 'ÒŸ',
  45350. 'Ò ' => 'Ò¡',
  45351. 'Ò¢' => 'Ò£',
  45352. 'Ò¤' => 'Ò¥',
  45353. 'Ò¦' => 'Ò§',
  45354. 'Ò¨' => 'Ò©',
  45355. 'Òª' => 'Ò«',
  45356. 'Ò¬' => 'Ò­',
  45357. 'Ò®' => 'Ò¯',
  45358. 'Ò°' => 'Ò±',
  45359. 'Ò²' => 'Ò³',
  45360. 'Ò´' => 'Òµ',
  45361. 'Ò¶' => 'Ò·',
  45362. 'Ò¸' => 'Ò¹',
  45363. 'Òº' => 'Ò»',
  45364. 'Ò¼' => 'Ò½',
  45365. 'Ò¾' => 'Ò¿',
  45366. 'Ó€' => 'Ó�',
  45367. 'Ó�' => 'Ó‚',
  45368. 'Óƒ' => 'Ó„',
  45369. 'Ó…' => 'Ó†',
  45370. 'Ó‡' => 'Óˆ',
  45371. 'Ó‰' => 'ÓŠ',
  45372. 'Ӌ' => 'ӌ',
  45373. 'Ó�' => 'ÓŽ',
  45374. 'Ó�' => 'Ó‘',
  45375. 'Ó’' => 'Ó“',
  45376. 'Ó”' => 'Ó•',
  45377. 'Ó–' => 'Ó—',
  45378. 'Ó˜' => 'Ó™',
  45379. 'Óš' => 'Ó›',
  45380. 'Ӝ' => '�',
  45381. 'Óž' => 'ÓŸ',
  45382. 'Ó ' => 'Ó¡',
  45383. 'Ó¢' => 'Ó£',
  45384. 'Ó¤' => 'Ó¥',
  45385. 'Ó¦' => 'Ó§',
  45386. 'Ó¨' => 'Ó©',
  45387. 'Óª' => 'Ó«',
  45388. 'Ó¬' => 'Ó­',
  45389. 'Ó®' => 'Ó¯',
  45390. 'Ó°' => 'Ó±',
  45391. 'Ó²' => 'Ó³',
  45392. 'Ó´' => 'Óµ',
  45393. 'Ó¶' => 'Ó·',
  45394. 'Ó¸' => 'Ó¹',
  45395. 'Óº' => 'Ó»',
  45396. 'Ó¼' => 'Ó½',
  45397. 'Ó¾' => 'Ó¿',
  45398. 'Ô€' => 'Ô�',
  45399. 'Ô‚' => 'Ôƒ',
  45400. 'Ô„' => 'Ô…',
  45401. 'Ô†' => 'Ô‡',
  45402. 'Ôˆ' => 'Ô‰',
  45403. 'ÔŠ' => 'Ô‹',
  45404. 'Ԍ' => '�',
  45405. 'ÔŽ' => 'Ô�',
  45406. 'Ô�' => 'Ô‘',
  45407. 'Ô’' => 'Ô“',
  45408. 'Ô”' => 'Ô•',
  45409. 'Ô–' => 'Ô—',
  45410. 'Ô˜' => 'Ô™',
  45411. 'Ôš' => 'Ô›',
  45412. 'Ԝ' => '�',
  45413. 'Ôž' => 'ÔŸ',
  45414. 'Ô ' => 'Ô¡',
  45415. 'Ô¢' => 'Ô£',
  45416. 'Ô¤' => 'Ô¥',
  45417. 'Ô¦' => 'Ô§',
  45418. 'Ô¨' => 'Ô©',
  45419. 'Ôª' => 'Ô«',
  45420. 'Ô¬' => 'Ô­',
  45421. 'Ô®' => 'Ô¯',
  45422. 'Ô±' => 'Õ¡',
  45423. 'Ô²' => 'Õ¢',
  45424. 'Ô³' => 'Õ£',
  45425. 'Ô´' => 'Õ¤',
  45426. 'Ôµ' => 'Õ¥',
  45427. 'Ô¶' => 'Õ¦',
  45428. 'Ô·' => 'Õ§',
  45429. 'Ô¸' => 'Õ¨',
  45430. 'Ô¹' => 'Õ©',
  45431. 'Ôº' => 'Õª',
  45432. 'Ô»' => 'Õ«',
  45433. 'Ô¼' => 'Õ¬',
  45434. 'Ô½' => 'Õ­',
  45435. 'Ô¾' => 'Õ®',
  45436. 'Ô¿' => 'Õ¯',
  45437. 'Õ€' => 'Õ°',
  45438. 'Õ�' => 'Õ±',
  45439. 'Õ‚' => 'Õ²',
  45440. 'Õƒ' => 'Õ³',
  45441. 'Õ„' => 'Õ´',
  45442. 'Õ…' => 'Õµ',
  45443. 'Õ†' => 'Õ¶',
  45444. 'Õ‡' => 'Õ·',
  45445. 'Õˆ' => 'Õ¸',
  45446. 'Õ‰' => 'Õ¹',
  45447. 'ÕŠ' => 'Õº',
  45448. 'Õ‹' => 'Õ»',
  45449. 'Ռ' => 'ռ',
  45450. 'Õ�' => 'Õ½',
  45451. 'ÕŽ' => 'Õ¾',
  45452. 'Õ�' => 'Õ¿',
  45453. 'Õ�' => 'Ö€',
  45454. 'Õ‘' => 'Ö�',
  45455. 'Õ’' => 'Ö‚',
  45456. 'Õ“' => 'Öƒ',
  45457. 'Õ”' => 'Ö„',
  45458. 'Õ•' => 'Ö…',
  45459. 'Õ–' => 'Ö†',
  45460. 'á‚ ' => 'â´€',
  45461. 'á‚¡' => 'â´�',
  45462. 'á‚¢' => 'â´‚',
  45463. 'á‚£' => 'â´ƒ',
  45464. 'Ⴄ' => 'ⴄ',
  45465. 'á‚¥' => 'â´…',
  45466. 'Ⴆ' => 'ⴆ',
  45467. 'Ⴇ' => 'ⴇ',
  45468. 'Ⴈ' => 'ⴈ',
  45469. 'á‚©' => 'â´‰',
  45470. 'Ⴊ' => 'ⴊ',
  45471. 'á‚«' => 'â´‹',
  45472. 'Ⴌ' => 'ⴌ',
  45473. 'á‚­' => 'â´�',
  45474. 'á‚®' => 'â´Ž',
  45475. 'Ⴏ' => '�',
  45476. 'á‚°' => 'â´�',
  45477. 'Ⴑ' => 'ⴑ',
  45478. 'Ⴒ' => 'ⴒ',
  45479. 'Ⴓ' => 'ⴓ',
  45480. 'á‚´' => 'â´”',
  45481. 'Ⴕ' => 'ⴕ',
  45482. 'Ⴖ' => 'ⴖ',
  45483. 'á‚·' => 'â´—',
  45484. 'Ⴘ' => 'ⴘ',
  45485. 'Ⴙ' => 'ⴙ',
  45486. 'Ⴚ' => 'ⴚ',
  45487. 'á‚»' => 'â´›',
  45488. 'Ⴜ' => 'ⴜ',
  45489. 'Ⴝ' => '�',
  45490. 'Ⴞ' => 'ⴞ',
  45491. 'á‚¿' => 'â´Ÿ',
  45492. 'Ⴠ' => 'ⴠ',
  45493. '�' => 'ⴡ',
  45494. 'Ⴢ' => 'ⴢ',
  45495. 'Ⴣ' => 'ⴣ',
  45496. 'Ⴤ' => 'ⴤ',
  45497. 'Ⴥ' => 'ⴥ',
  45498. 'Ⴧ' => 'ⴧ',
  45499. '�' => 'ⴭ',
  45500. 'Ḁ' => '�',
  45501. 'Ḃ' => 'ḃ',
  45502. 'Ḅ' => 'ḅ',
  45503. 'Ḇ' => 'ḇ',
  45504. 'Ḉ' => 'ḉ',
  45505. 'Ḋ' => 'ḋ',
  45506. 'Ḍ' => '�',
  45507. 'Ḏ' => '�',
  45508. '�' => 'ḑ',
  45509. 'Ḓ' => 'ḓ',
  45510. 'Ḕ' => 'ḕ',
  45511. 'Ḗ' => 'ḗ',
  45512. 'Ḙ' => 'ḙ',
  45513. 'Ḛ' => 'ḛ',
  45514. 'Ḝ' => '�',
  45515. 'Ḟ' => 'ḟ',
  45516. 'Ḡ' => 'ḡ',
  45517. 'Ḣ' => 'ḣ',
  45518. 'Ḥ' => 'ḥ',
  45519. 'Ḧ' => 'ḧ',
  45520. 'Ḩ' => 'ḩ',
  45521. 'Ḫ' => 'ḫ',
  45522. 'Ḭ' => 'ḭ',
  45523. 'Ḯ' => 'ḯ',
  45524. 'Ḱ' => 'ḱ',
  45525. 'Ḳ' => 'ḳ',
  45526. 'Ḵ' => 'ḵ',
  45527. 'Ḷ' => 'ḷ',
  45528. 'Ḹ' => 'ḹ',
  45529. 'Ḻ' => 'ḻ',
  45530. 'Ḽ' => 'ḽ',
  45531. 'Ḿ' => 'ḿ',
  45532. 'Ṁ' => '�',
  45533. 'Ṃ' => 'ṃ',
  45534. 'Ṅ' => 'ṅ',
  45535. 'Ṇ' => 'ṇ',
  45536. 'Ṉ' => 'ṉ',
  45537. 'Ṋ' => 'ṋ',
  45538. 'Ṍ' => '�',
  45539. 'Ṏ' => '�',
  45540. '�' => 'ṑ',
  45541. 'Ṓ' => 'ṓ',
  45542. 'Ṕ' => 'ṕ',
  45543. 'á¹–' => 'á¹—',
  45544. 'Ṙ' => 'ṙ',
  45545. 'Ṛ' => 'ṛ',
  45546. 'Ṝ' => '�',
  45547. 'Ṟ' => 'ṟ',
  45548. 'Ṡ' => 'ṡ',
  45549. 'á¹¢' => 'á¹£',
  45550. 'Ṥ' => 'ṥ',
  45551. 'Ṧ' => 'ṧ',
  45552. 'Ṩ' => 'ṩ',
  45553. 'Ṫ' => 'ṫ',
  45554. 'Ṭ' => 'ṭ',
  45555. 'Ṯ' => 'ṯ',
  45556. 'á¹°' => 'á¹±',
  45557. 'á¹²' => 'á¹³',
  45558. 'á¹´' => 'á¹µ',
  45559. 'Ṷ' => 'ṷ',
  45560. 'Ṹ' => 'ṹ',
  45561. 'Ṻ' => 'ṻ',
  45562. 'á¹¼' => 'á¹½',
  45563. 'Ṿ' => 'ṿ',
  45564. 'Ẁ' => '�',
  45565. 'Ẃ' => 'ẃ',
  45566. 'Ẅ' => 'ẅ',
  45567. 'Ẇ' => 'ẇ',
  45568. 'Ẉ' => 'ẉ',
  45569. 'Ẋ' => 'ẋ',
  45570. 'Ẍ' => '�',
  45571. 'Ẏ' => '�',
  45572. '�' => 'ẑ',
  45573. 'Ẓ' => 'ẓ',
  45574. 'Ẕ' => 'ẕ',
  45575. 'ẞ' => 'ß',
  45576. 'Ạ' => 'ạ',
  45577. 'Ả' => 'ả',
  45578. 'Ấ' => 'ấ',
  45579. 'Ầ' => 'ầ',
  45580. 'Ẩ' => 'ẩ',
  45581. 'Ẫ' => 'ẫ',
  45582. 'Ậ' => 'ậ',
  45583. 'Ắ' => 'ắ',
  45584. 'Ằ' => 'ằ',
  45585. 'Ẳ' => 'ẳ',
  45586. 'Ẵ' => 'ẵ',
  45587. 'Ặ' => 'ặ',
  45588. 'Ẹ' => 'ẹ',
  45589. 'Ẻ' => 'ẻ',
  45590. 'Ẽ' => 'ẽ',
  45591. 'Ế' => 'ế',
  45592. 'Ề' => '�',
  45593. 'Ể' => 'ể',
  45594. 'Ễ' => 'ễ',
  45595. 'Ệ' => 'ệ',
  45596. 'Ỉ' => 'ỉ',
  45597. 'Ị' => 'ị',
  45598. 'Ọ' => '�',
  45599. 'Ỏ' => '�',
  45600. '�' => 'ố',
  45601. 'Ồ' => 'ồ',
  45602. 'Ổ' => 'ổ',
  45603. 'á»–' => 'á»—',
  45604. 'Ộ' => 'ộ',
  45605. 'Ớ' => 'ớ',
  45606. 'Ờ' => '�',
  45607. 'Ở' => 'ở',
  45608. 'Ỡ' => 'ỡ',
  45609. 'Ợ' => 'ợ',
  45610. 'Ụ' => 'ụ',
  45611. 'Ủ' => 'ủ',
  45612. 'Ứ' => 'ứ',
  45613. 'Ừ' => 'ừ',
  45614. 'Ử' => 'ử',
  45615. 'Ữ' => 'ữ',
  45616. 'á»°' => 'á»±',
  45617. 'Ỳ' => 'ỳ',
  45618. 'Ỵ' => 'ỵ',
  45619. 'Ỷ' => 'ỷ',
  45620. 'Ỹ' => 'ỹ',
  45621. 'Ỻ' => 'ỻ',
  45622. 'Ỽ' => 'ỽ',
  45623. 'Ỿ' => 'ỿ',
  45624. 'Ἀ' => 'ἀ',
  45625. 'Ἁ' => '�',
  45626. 'Ἂ' => 'ἂ',
  45627. 'Ἃ' => 'ἃ',
  45628. 'Ἄ' => 'ἄ',
  45629. '�' => 'ἅ',
  45630. 'Ἆ' => 'ἆ',
  45631. '�' => 'ἇ',
  45632. 'Ἐ' => '�',
  45633. 'Ἑ' => 'ἑ',
  45634. 'Ἒ' => 'ἒ',
  45635. 'Ἓ' => 'ἓ',
  45636. 'Ἔ' => 'ἔ',
  45637. '�' => 'ἕ',
  45638. 'Ἠ' => 'ἠ',
  45639. 'Ἡ' => 'ἡ',
  45640. 'Ἢ' => 'ἢ',
  45641. 'Ἣ' => 'ἣ',
  45642. 'Ἤ' => 'ἤ',
  45643. 'á¼­' => 'á¼¥',
  45644. 'Ἦ' => 'ἦ',
  45645. 'Ἧ' => 'ἧ',
  45646. 'Ἰ' => 'ἰ',
  45647. 'á¼¹' => 'á¼±',
  45648. 'Ἲ' => 'ἲ',
  45649. 'á¼»' => 'á¼³',
  45650. 'á¼¼' => 'á¼´',
  45651. 'á¼½' => 'á¼µ',
  45652. 'Ἶ' => 'ἶ',
  45653. 'Ἷ' => 'ἷ',
  45654. 'Ὀ' => 'ὀ',
  45655. 'Ὁ' => '�',
  45656. 'Ὂ' => 'ὂ',
  45657. 'Ὃ' => 'ὃ',
  45658. 'Ὄ' => 'ὄ',
  45659. '�' => 'ὅ',
  45660. 'Ὑ' => 'ὑ',
  45661. 'Ὓ' => 'ὓ',
  45662. '�' => 'ὕ',
  45663. 'Ὗ' => 'ὗ',
  45664. 'Ὠ' => 'ὠ',
  45665. 'Ὡ' => 'ὡ',
  45666. 'Ὢ' => 'ὢ',
  45667. 'Ὣ' => 'ὣ',
  45668. 'Ὤ' => 'ὤ',
  45669. 'á½­' => 'á½¥',
  45670. 'Ὦ' => 'ὦ',
  45671. 'Ὧ' => 'ὧ',
  45672. 'ᾈ' => 'ᾀ',
  45673. 'ᾉ' => '�',
  45674. 'ᾊ' => 'ᾂ',
  45675. 'ᾋ' => 'ᾃ',
  45676. 'ᾌ' => 'ᾄ',
  45677. '�' => 'ᾅ',
  45678. 'ᾎ' => 'ᾆ',
  45679. '�' => 'ᾇ',
  45680. 'ᾘ' => '�',
  45681. 'ᾙ' => 'ᾑ',
  45682. 'ᾚ' => 'ᾒ',
  45683. 'ᾛ' => 'ᾓ',
  45684. 'ᾜ' => 'ᾔ',
  45685. '�' => 'ᾕ',
  45686. 'ᾞ' => 'ᾖ',
  45687. 'ᾟ' => 'ᾗ',
  45688. 'ᾨ' => 'ᾠ',
  45689. 'ᾩ' => 'ᾡ',
  45690. 'ᾪ' => 'ᾢ',
  45691. 'ᾫ' => 'ᾣ',
  45692. 'ᾬ' => 'ᾤ',
  45693. 'á¾­' => 'á¾¥',
  45694. 'ᾮ' => 'ᾦ',
  45695. 'ᾯ' => 'ᾧ',
  45696. 'Ᾰ' => 'ᾰ',
  45697. 'á¾¹' => 'á¾±',
  45698. 'Ὰ' => 'ὰ',
  45699. 'á¾»' => 'á½±',
  45700. 'á¾¼' => 'á¾³',
  45701. 'Ὲ' => 'ὲ',
  45702. 'Έ' => 'έ',
  45703. 'á¿Š' => 'á½´',
  45704. 'á¿‹' => 'á½µ',
  45705. 'ῌ' => 'ῃ',
  45706. 'Ῐ' => '�',
  45707. 'á¿™' => 'á¿‘',
  45708. 'Ὶ' => 'ὶ',
  45709. 'á¿›' => 'á½·',
  45710. 'Ῠ' => 'ῠ',
  45711. 'á¿©' => 'á¿¡',
  45712. 'Ὺ' => 'ὺ',
  45713. 'á¿«' => 'á½»',
  45714. 'Ῥ' => 'ῥ',
  45715. 'Ὸ' => 'ὸ',
  45716. 'Ό' => 'ό',
  45717. 'Ὼ' => 'ὼ',
  45718. 'á¿»' => 'á½½',
  45719. 'ῼ' => 'ῳ',
  45720. 'Ω' => 'ω',
  45721. 'K' => 'k',
  45722. 'â„«' => 'Ã¥',
  45723. 'Ⅎ' => 'ⅎ',
  45724. 'â… ' => 'â…°',
  45725. 'â…¡' => 'â…±',
  45726. 'â…¢' => 'â…²',
  45727. 'â…£' => 'â…³',
  45728. 'â…¤' => 'â…´',
  45729. 'â…¥' => 'â…µ',
  45730. 'â…¦' => 'â…¶',
  45731. 'â…§' => 'â…·',
  45732. 'â…¨' => 'â…¸',
  45733. 'â…©' => 'â…¹',
  45734. 'â…ª' => 'â…º',
  45735. 'â…«' => 'â…»',
  45736. 'â…¬' => 'â…¼',
  45737. 'â…­' => 'â…½',
  45738. 'â…®' => 'â…¾',
  45739. 'â…¯' => 'â…¿',
  45740. 'Ↄ' => 'ↄ',
  45741. 'Ⓐ' => '�',
  45742. 'â’·' => 'â“‘',
  45743. 'â’¸' => 'â“’',
  45744. 'â’¹' => 'â““',
  45745. 'â’º' => 'â“”',
  45746. 'â’»' => 'â“•',
  45747. 'â’¼' => 'â“–',
  45748. 'â’½' => 'â“—',
  45749. 'Ⓘ' => 'ⓘ',
  45750. 'â’¿' => 'â“™',
  45751. 'â“€' => 'â“š',
  45752. '�' => 'ⓛ',
  45753. 'Ⓜ' => 'ⓜ',
  45754. 'Ⓝ' => '�',
  45755. 'â“„' => 'â“ž',
  45756. 'â“…' => 'â“Ÿ',
  45757. 'Ⓠ' => 'ⓠ',
  45758. 'Ⓡ' => 'ⓡ',
  45759. 'Ⓢ' => 'ⓢ',
  45760. 'Ⓣ' => 'ⓣ',
  45761. 'Ⓤ' => 'ⓤ',
  45762. 'â“‹' => 'â“¥',
  45763. 'Ⓦ' => 'ⓦ',
  45764. '�' => 'ⓧ',
  45765. 'Ⓨ' => 'ⓨ',
  45766. '�' => 'ⓩ',
  45767. 'â°€' => 'â°°',
  45768. 'â°�' => 'â°±',
  45769. 'â°‚' => 'â°²',
  45770. 'â°ƒ' => 'â°³',
  45771. 'â°„' => 'â°´',
  45772. 'â°…' => 'â°µ',
  45773. 'â°†' => 'â°¶',
  45774. 'â°‡' => 'â°·',
  45775. 'â°ˆ' => 'â°¸',
  45776. 'â°‰' => 'â°¹',
  45777. 'â°Š' => 'â°º',
  45778. 'â°‹' => 'â°»',
  45779. 'Ⰼ' => 'ⰼ',
  45780. 'â°�' => 'â°½',
  45781. 'â°Ž' => 'â°¾',
  45782. 'â°�' => 'â°¿',
  45783. 'â°�' => 'â±€',
  45784. 'Ⱁ' => '�',
  45785. 'Ⱂ' => 'ⱂ',
  45786. 'Ⱃ' => 'ⱃ',
  45787. 'Ⱄ' => 'ⱄ',
  45788. 'â°•' => 'â±…',
  45789. 'Ⱆ' => 'ⱆ',
  45790. 'Ⱇ' => 'ⱇ',
  45791. 'Ⱈ' => 'ⱈ',
  45792. 'Ⱉ' => 'ⱉ',
  45793. 'Ⱊ' => 'ⱊ',
  45794. 'Ⱋ' => 'ⱋ',
  45795. 'Ⱌ' => 'ⱌ',
  45796. '�' => '�',
  45797. 'Ⱎ' => 'ⱎ',
  45798. 'Ⱏ' => '�',
  45799. 'Ⱐ' => '�',
  45800. 'Ⱑ' => 'ⱑ',
  45801. 'â°¢' => 'â±’',
  45802. 'Ⱓ' => 'ⱓ',
  45803. 'â°¤' => 'â±”',
  45804. 'Ⱕ' => 'ⱕ',
  45805. 'â°¦' => 'â±–',
  45806. 'â°§' => 'â±—',
  45807. 'Ⱘ' => 'ⱘ',
  45808. 'â°©' => 'â±™',
  45809. 'Ⱚ' => 'ⱚ',
  45810. 'â°«' => 'â±›',
  45811. 'Ⱜ' => 'ⱜ',
  45812. 'Ⱝ' => '�',
  45813. 'Ⱞ' => 'ⱞ',
  45814. 'Ⱡ' => 'ⱡ',
  45815. 'â±¢' => 'É«',
  45816. 'â±£' => 'áµ½',
  45817. 'Ɽ' => 'ɽ',
  45818. 'Ⱨ' => 'ⱨ',
  45819. 'Ⱪ' => 'ⱪ',
  45820. 'Ⱬ' => 'ⱬ',
  45821. 'â±­' => 'É‘',
  45822. 'Ɱ' => 'ɱ',
  45823. 'Ɐ' => '�',
  45824. 'â±°' => 'É’',
  45825. 'â±²' => 'â±³',
  45826. 'Ⱶ' => 'ⱶ',
  45827. 'â±¾' => 'È¿',
  45828. 'Ɀ' => 'ɀ',
  45829. 'Ⲁ' => '�',
  45830. 'Ⲃ' => 'ⲃ',
  45831. 'Ⲅ' => 'ⲅ',
  45832. 'Ⲇ' => 'ⲇ',
  45833. 'Ⲉ' => 'ⲉ',
  45834. 'Ⲋ' => 'ⲋ',
  45835. 'Ⲍ' => '�',
  45836. 'Ⲏ' => '�',
  45837. '�' => 'ⲑ',
  45838. 'Ⲓ' => 'ⲓ',
  45839. 'Ⲕ' => 'ⲕ',
  45840. 'â²–' => 'â²—',
  45841. 'Ⲙ' => 'ⲙ',
  45842. 'Ⲛ' => 'ⲛ',
  45843. 'Ⲝ' => '�',
  45844. 'Ⲟ' => 'ⲟ',
  45845. 'Ⲡ' => 'ⲡ',
  45846. 'â²¢' => 'â²£',
  45847. 'Ⲥ' => 'ⲥ',
  45848. 'Ⲧ' => 'ⲧ',
  45849. 'Ⲩ' => 'ⲩ',
  45850. 'Ⲫ' => 'ⲫ',
  45851. 'Ⲭ' => 'ⲭ',
  45852. 'Ⲯ' => 'ⲯ',
  45853. 'â²°' => 'â²±',
  45854. 'â²²' => 'â²³',
  45855. 'â²´' => 'â²µ',
  45856. 'Ⲷ' => 'ⲷ',
  45857. 'Ⲹ' => 'ⲹ',
  45858. 'Ⲻ' => 'ⲻ',
  45859. 'â²¼' => 'â²½',
  45860. 'Ⲿ' => 'ⲿ',
  45861. 'Ⳁ' => '�',
  45862. 'Ⳃ' => 'ⳃ',
  45863. 'Ⳅ' => 'ⳅ',
  45864. 'Ⳇ' => 'ⳇ',
  45865. 'Ⳉ' => 'ⳉ',
  45866. 'Ⳋ' => 'ⳋ',
  45867. 'Ⳍ' => '�',
  45868. 'Ⳏ' => '�',
  45869. '�' => 'ⳑ',
  45870. 'Ⳓ' => 'ⳓ',
  45871. 'Ⳕ' => 'ⳕ',
  45872. 'â³–' => 'â³—',
  45873. 'Ⳙ' => 'ⳙ',
  45874. 'Ⳛ' => 'ⳛ',
  45875. 'Ⳝ' => '�',
  45876. 'Ⳟ' => 'ⳟ',
  45877. 'Ⳡ' => 'ⳡ',
  45878. 'â³¢' => 'â³£',
  45879. 'Ⳬ' => 'ⳬ',
  45880. 'â³­' => 'â³®',
  45881. 'â³²' => 'â³³',
  45882. 'Ꙁ' => '�',
  45883. 'Ꙃ' => 'ꙃ',
  45884. 'Ꙅ' => 'ꙅ',
  45885. 'Ꙇ' => 'ꙇ',
  45886. 'Ꙉ' => 'ꙉ',
  45887. 'Ꙋ' => 'ꙋ',
  45888. 'Ꙍ' => '�',
  45889. 'Ꙏ' => '�',
  45890. '�' => 'ꙑ',
  45891. 'Ꙓ' => 'ꙓ',
  45892. 'Ꙕ' => 'ꙕ',
  45893. 'ê™–' => 'ê™—',
  45894. 'Ꙙ' => 'ꙙ',
  45895. 'Ꙛ' => 'ꙛ',
  45896. 'Ꙝ' => '�',
  45897. 'Ꙟ' => 'ꙟ',
  45898. 'Ꙡ' => 'ꙡ',
  45899. 'Ꙣ' => 'ꙣ',
  45900. 'Ꙥ' => 'ꙥ',
  45901. 'Ꙧ' => 'ꙧ',
  45902. 'Ꙩ' => 'ꙩ',
  45903. 'Ꙫ' => 'ꙫ',
  45904. 'Ꙭ' => 'ꙭ',
  45905. 'Ꚁ' => '�',
  45906. 'Ꚃ' => 'ꚃ',
  45907. 'êš„' => 'êš…',
  45908. 'Ꚇ' => 'ꚇ',
  45909. 'Ꚉ' => 'ꚉ',
  45910. 'Ꚋ' => 'ꚋ',
  45911. 'Ꚍ' => '�',
  45912. 'Ꚏ' => '�',
  45913. '�' => 'ꚑ',
  45914. 'êš’' => 'êš“',
  45915. 'êš”' => 'êš•',
  45916. 'êš–' => 'êš—',
  45917. 'Ꚙ' => 'ꚙ',
  45918. 'êšš' => 'êš›',
  45919. 'Ꜣ' => 'ꜣ',
  45920. 'Ꜥ' => 'ꜥ',
  45921. 'Ꜧ' => 'ꜧ',
  45922. 'Ꜩ' => 'ꜩ',
  45923. 'Ꜫ' => 'ꜫ',
  45924. 'Ꜭ' => 'ꜭ',
  45925. 'Ꜯ' => 'ꜯ',
  45926. 'Ꜳ' => 'ꜳ',
  45927. 'Ꜵ' => 'ꜵ',
  45928. 'Ꜷ' => 'ꜷ',
  45929. 'Ꜹ' => 'ꜹ',
  45930. 'Ꜻ' => 'ꜻ',
  45931. 'Ꜽ' => 'ꜽ',
  45932. 'Ꜿ' => 'ꜿ',
  45933. '�' => '�',
  45934. '�' => '�',
  45935. '�' => '�',
  45936. '�' => '�',
  45937. '�' => '�',
  45938. '�' => '�',
  45939. '�' => '�',
  45940. '�' => '�',
  45941. '�' => '�',
  45942. '�' => '�',
  45943. '�' => '�',
  45944. '�' => '�',
  45945. '�' => '�',
  45946. '�' => '�',
  45947. '�' => '�',
  45948. '�' => '�',
  45949. '�' => '�',
  45950. '�' => '�',
  45951. '�' => '�',
  45952. '�' => '�',
  45953. '�' => '�',
  45954. '�' => '�',
  45955. '�' => '�',
  45956. '�' => '�',
  45957. '�' => '�',
  45958. '�' => '�',
  45959. '�' => 'ᵹ',
  45960. '�' => '�',
  45961. 'Ꞁ' => '�',
  45962. 'Ꞃ' => 'ꞃ',
  45963. 'êž„' => 'êž…',
  45964. 'Ꞇ' => 'ꞇ',
  45965. 'Ꞌ' => 'ꞌ',
  45966. '�' => 'ɥ',
  45967. '�' => 'ꞑ',
  45968. 'êž’' => 'êž“',
  45969. 'êž–' => 'êž—',
  45970. 'Ꞙ' => 'ꞙ',
  45971. 'êžš' => 'êž›',
  45972. 'Ꞝ' => '�',
  45973. 'Ꞟ' => 'ꞟ',
  45974. 'êž ' => 'êž¡',
  45975. 'Ꞣ' => 'ꞣ',
  45976. 'Ꞥ' => 'ꞥ',
  45977. 'Ꞧ' => 'ꞧ',
  45978. 'Ꞩ' => 'ꞩ',
  45979. 'Ɦ' => 'ɦ',
  45980. 'Ɜ' => 'ɜ',
  45981. 'Ɡ' => 'ɡ',
  45982. 'Ɬ' => 'ɬ',
  45983. 'êž°' => 'Êž',
  45984. 'Ʇ' => 'ʇ',
  45985. 'A' => '�',
  45986. 'B' => 'b',
  45987. 'C' => 'c',
  45988. 'D' => 'd',
  45989. 'ï¼¥' => 'ï½…',
  45990. 'F' => 'f',
  45991. 'G' => 'g',
  45992. 'H' => 'h',
  45993. 'I' => 'i',
  45994. 'J' => 'j',
  45995. 'K' => 'k',
  45996. 'L' => 'l',
  45997. 'M' => '�',
  45998. 'N' => 'n',
  45999. 'O' => '�',
  46000. 'P' => '�',
  46001. 'Q' => 'q',
  46002. 'ï¼²' => 'ï½’',
  46003. 'S' => 's',
  46004. 'ï¼´' => 'ï½”',
  46005. 'U' => 'u',
  46006. 'V' => 'v',
  46007. 'ï¼·' => 'ï½—',
  46008. 'X' => 'x',
  46009. 'ï¼¹' => 'ï½™',
  46010. 'Z' => 'z',
  46011. '�' => '�',
  46012. '�' => '�',
  46013. '�' => '�',
  46014. '�' => '�',
  46015. '�' => '�',
  46016. '�' => '�',
  46017. '�' => '�',
  46018. '�' => '�',
  46019. '�' => '�',
  46020. '�' => '�',
  46021. '�' => '�',
  46022. '�' => '�',
  46023. '�' => '�',
  46024. '�' => '�',
  46025. '�' => '�',
  46026. '�' => '�',
  46027. '�' => '�',
  46028. '�' => '�',
  46029. '�' => '�',
  46030. '�' => '�',
  46031. '�' => '�',
  46032. '�' => '�',
  46033. '�' => '�',
  46034. '�' => '�',
  46035. '�' => '�',
  46036. '�' => '�',
  46037. '�' => '�',
  46038. '�' => '�',
  46039. '�' => '�',
  46040. '�' => '�',
  46041. '�' => '�',
  46042. '�' => '�',
  46043. '�' => '�',
  46044. '�' => '�',
  46045. '�' => '�',
  46046. '�' => '�',
  46047. '�' => '�',
  46048. '�' => '�',
  46049. '�' => '�',
  46050. '�' => '�',
  46051. 'ð‘¢ ' => 'ð‘£€',
  46052. '𑢡' => '�',
  46053. '𑢢' => '𑣂',
  46054. '𑢣' => '𑣃',
  46055. '𑢤' => '𑣄',
  46056. 'ð‘¢¥' => 'ð‘£…',
  46057. '𑢦' => '𑣆',
  46058. '𑢧' => '𑣇',
  46059. '𑢨' => '𑣈',
  46060. '𑢩' => '𑣉',
  46061. '𑢪' => '𑣊',
  46062. '𑢫' => '𑣋',
  46063. '𑢬' => '𑣌',
  46064. '𑢭' => '�',
  46065. '𑢮' => '𑣎',
  46066. '𑢯' => '�',
  46067. '𑢰' => '�',
  46068. '𑢱' => '𑣑',
  46069. 'ð‘¢²' => 'ð‘£’',
  46070. '𑢳' => '𑣓',
  46071. 'ð‘¢´' => 'ð‘£”',
  46072. '𑢵' => '𑣕',
  46073. '𑢶' => '𑣖',
  46074. 'ð‘¢·' => 'ð‘£—',
  46075. '𑢸' => '𑣘',
  46076. 'ð‘¢¹' => 'ð‘£™',
  46077. '𑢺' => '𑣚',
  46078. 'ð‘¢»' => 'ð‘£›',
  46079. '𑢼' => '𑣜',
  46080. '𑢽' => '�',
  46081. '𑢾' => '𑣞',
  46082. '𑢿' => '𑣟',
  46083. );
  46084. <?php
  46085. return '/(?<![\x{0027}\x{002E}\x{003A}\x{005E}\x{0060}\x{00A8}\x{00AD}\x{00AF}\x{00B4}\x{00B7}\x{00B8}\x{02B0}-\x{02C1}\x{02C2}-\x{02C5}\x{02C6}-\x{02D1}\x{02D2}-\x{02DF}\x{02E0}-\x{02E4}\x{02E5}-\x{02EB}\x{02EC}\x{02ED}\x{02EE}\x{02EF}-\x{02FF}\x{0300}-\x{036F}\x{0374}\x{0375}\x{037A}\x{0384}-\x{0385}\x{0387}\x{0483}-\x{0487}\x{0488}-\x{0489}\x{0559}\x{0591}-\x{05BD}\x{05BF}\x{05C1}-\x{05C2}\x{05C4}-\x{05C5}\x{05C7}\x{05F4}\x{0600}-\x{0605}\x{0610}-\x{061A}\x{061C}\x{0640}\x{064B}-\x{065F}\x{0670}\x{06D6}-\x{06DC}\x{06DD}\x{06DF}-\x{06E4}\x{06E5}-\x{06E6}\x{06E7}-\x{06E8}\x{06EA}-\x{06ED}\x{070F}\x{0711}\x{0730}-\x{074A}\x{07A6}-\x{07B0}\x{07EB}-\x{07F3}\x{07F4}-\x{07F5}\x{07FA}\x{07FD}\x{0816}-\x{0819}\x{081A}\x{081B}-\x{0823}\x{0824}\x{0825}-\x{0827}\x{0828}\x{0829}-\x{082D}\x{0859}-\x{085B}\x{08D3}-\x{08E1}\x{08E2}\x{08E3}-\x{0902}\x{093A}\x{093C}\x{0941}-\x{0948}\x{094D}\x{0951}-\x{0957}\x{0962}-\x{0963}\x{0971}\x{0981}\x{09BC}\x{09C1}-\x{09C4}\x{09CD}\x{09E2}-\x{09E3}\x{09FE}\x{0A01}-\x{0A02}\x{0A3C}\x{0A41}-\x{0A42}\x{0A47}-\x{0A48}\x{0A4B}-\x{0A4D}\x{0A51}\x{0A70}-\x{0A71}\x{0A75}\x{0A81}-\x{0A82}\x{0ABC}\x{0AC1}-\x{0AC5}\x{0AC7}-\x{0AC8}\x{0ACD}\x{0AE2}-\x{0AE3}\x{0AFA}-\x{0AFF}\x{0B01}\x{0B3C}\x{0B3F}\x{0B41}-\x{0B44}\x{0B4D}\x{0B56}\x{0B62}-\x{0B63}\x{0B82}\x{0BC0}\x{0BCD}\x{0C00}\x{0C04}\x{0C3E}-\x{0C40}\x{0C46}-\x{0C48}\x{0C4A}-\x{0C4D}\x{0C55}-\x{0C56}\x{0C62}-\x{0C63}\x{0C81}\x{0CBC}\x{0CBF}\x{0CC6}\x{0CCC}-\x{0CCD}\x{0CE2}-\x{0CE3}\x{0D00}-\x{0D01}\x{0D3B}-\x{0D3C}\x{0D41}-\x{0D44}\x{0D4D}\x{0D62}-\x{0D63}\x{0DCA}\x{0DD2}-\x{0DD4}\x{0DD6}\x{0E31}\x{0E34}-\x{0E3A}\x{0E46}\x{0E47}-\x{0E4E}\x{0EB1}\x{0EB4}-\x{0EB9}\x{0EBB}-\x{0EBC}\x{0EC6}\x{0EC8}-\x{0ECD}\x{0F18}-\x{0F19}\x{0F35}\x{0F37}\x{0F39}\x{0F71}-\x{0F7E}\x{0F80}-\x{0F84}\x{0F86}-\x{0F87}\x{0F8D}-\x{0F97}\x{0F99}-\x{0FBC}\x{0FC6}\x{102D}-\x{1030}\x{1032}-\x{1037}\x{1039}-\x{103A}\x{103D}-\x{103E}\x{1058}-\x{1059}\x{105E}-\x{1060}\x{1071}-\x{1074}\x{1082}\x{1085}-\x{1086}\x{108D}\x{109D}\x{10FC}\x{135D}-\x{135F}\x{1712}-\x{1714}\x{1732}-\x{1734}\x{1752}-\x{1753}\x{1772}-\x{1773}\x{17B4}-\x{17B5}\x{17B7}-\x{17BD}\x{17C6}\x{17C9}-\x{17D3}\x{17D7}\x{17DD}\x{180B}-\x{180D}\x{180E}\x{1843}\x{1885}-\x{1886}\x{18A9}\x{1920}-\x{1922}\x{1927}-\x{1928}\x{1932}\x{1939}-\x{193B}\x{1A17}-\x{1A18}\x{1A1B}\x{1A56}\x{1A58}-\x{1A5E}\x{1A60}\x{1A62}\x{1A65}-\x{1A6C}\x{1A73}-\x{1A7C}\x{1A7F}\x{1AA7}\x{1AB0}-\x{1ABD}\x{1ABE}\x{1B00}-\x{1B03}\x{1B34}\x{1B36}-\x{1B3A}\x{1B3C}\x{1B42}\x{1B6B}-\x{1B73}\x{1B80}-\x{1B81}\x{1BA2}-\x{1BA5}\x{1BA8}-\x{1BA9}\x{1BAB}-\x{1BAD}\x{1BE6}\x{1BE8}-\x{1BE9}\x{1BED}\x{1BEF}-\x{1BF1}\x{1C2C}-\x{1C33}\x{1C36}-\x{1C37}\x{1C78}-\x{1C7D}\x{1CD0}-\x{1CD2}\x{1CD4}-\x{1CE0}\x{1CE2}-\x{1CE8}\x{1CED}\x{1CF4}\x{1CF8}-\x{1CF9}\x{1D2C}-\x{1D6A}\x{1D78}\x{1D9B}-\x{1DBF}\x{1DC0}-\x{1DF9}\x{1DFB}-\x{1DFF}\x{1FBD}\x{1FBF}-\x{1FC1}\x{1FCD}-\x{1FCF}\x{1FDD}-\x{1FDF}\x{1FED}-\x{1FEF}\x{1FFD}-\x{1FFE}\x{200B}-\x{200F}\x{2018}\x{2019}\x{2024}\x{2027}\x{202A}-\x{202E}\x{2060}-\x{2064}\x{2066}-\x{206F}\x{2071}\x{207F}\x{2090}-\x{209C}\x{20D0}-\x{20DC}\x{20DD}-\x{20E0}\x{20E1}\x{20E2}-\x{20E4}\x{20E5}-\x{20F0}\x{2C7C}-\x{2C7D}\x{2CEF}-\x{2CF1}\x{2D6F}\x{2D7F}\x{2DE0}-\x{2DFF}\x{2E2F}\x{3005}\x{302A}-\x{302D}\x{3031}-\x{3035}\x{303B}\x{3099}-\x{309A}\x{309B}-\x{309C}\x{309D}-\x{309E}\x{30FC}-\x{30FE}\x{A015}\x{A4F8}-\x{A4FD}\x{A60C}\x{A66F}\x{A670}-\x{A672}\x{A674}-\x{A67D}\x{A67F}\x{A69C}-\x{A69D}\x{A69E}-\x{A69F}\x{A6F0}-\x{A6F1}\x{A700}-\x{A716}\x{A717}-\x{A71F}\x{A720}-\x{A721}\x{A770}\x{A788}\x{A789}-\x{A78A}\x{A7F8}-\x{A7F9}\x{A802}\x{A806}\x{A80B}\x{A825}-\x{A826}\x{A8C4}-\x{A8C5}\x{A8E0}-\x{A8F1}\x{A8FF}\x{A926}-\x{A92D}\x{A947}-\x{A951}\x{A980}-\x{A982}\x{A9B3}\x{A9B6}-\x{A9B9}\x{A9BC}\x{A9CF}\x{A9E5}\x{A9E6}\x{AA29}-\x{AA2E}\x{AA31}-\x{AA32}\x{AA35}-\x{AA36}\x{AA43}\x{AA4C}\x{AA70}\x{AA7C}\x{AAB0}\x{AAB2}-\x{AAB4}\x{AAB7}-\x{AAB8}\x{AABE}-\x{AABF}\x{AAC1}\x{AADD}\x{AAEC}-\x{AAED}\x{AAF3}-\x{AAF4}\x{AAF6}\x{AB5B}\x{AB5C}-\x{AB5F}\x{ABE5}\x{ABE8}\x{ABED}\x{FB1E}\x{FBB2}-\x{FBC1}\x{FE00}-\x{FE0F}\x{FE13}\x{FE20}-\x{FE2F}\x{FE52}\x{FE55}\x{FEFF}\x{FF07}\x{FF0E}\x{FF1A}\x{FF3E}\x{FF40}\x{FF70}\x{FF9E}-\x{FF9F}\x{FFE3}\x{FFF9}-\x{FFFB}\x{101FD}\x{102E0}\x{10376}-\x{1037A}\x{10A01}-\x{10A03}\x{10A05}-\x{10A06}\x{10A0C}-\x{10A0F}\x{10A38}-\x{10A3A}\x{10A3F}\x{10AE5}-\x{10AE6}\x{10D24}-\x{10D27}\x{10F46}-\x{10F50}\x{11001}\x{11038}-\x{11046}\x{1107F}-\x{11081}\x{110B3}-\x{110B6}\x{110B9}-\x{110BA}\x{110BD}\x{110CD}\x{11100}-\x{11102}\x{11127}-\x{1112B}\x{1112D}-\x{11134}\x{11173}\x{11180}-\x{11181}\x{111B6}-\x{111BE}\x{111C9}-\x{111CC}\x{1122F}-\x{11231}\x{11234}\x{11236}-\x{11237}\x{1123E}\x{112DF}\x{112E3}-\x{112EA}\x{11300}-\x{11301}\x{1133B}-\x{1133C}\x{11340}\x{11366}-\x{1136C}\x{11370}-\x{11374}\x{11438}-\x{1143F}\x{11442}-\x{11444}\x{11446}\x{1145E}\x{114B3}-\x{114B8}\x{114BA}\x{114BF}-\x{114C0}\x{114C2}-\x{114C3}\x{115B2}-\x{115B5}\x{115BC}-\x{115BD}\x{115BF}-\x{115C0}\x{115DC}-\x{115DD}\x{11633}-\x{1163A}\x{1163D}\x{1163F}-\x{11640}\x{116AB}\x{116AD}\x{116B0}-\x{116B5}\x{116B7}\x{1171D}-\x{1171F}\x{11722}-\x{11725}\x{11727}-\x{1172B}\x{1182F}-\x{11837}\x{11839}-\x{1183A}\x{11A01}-\x{11A0A}\x{11A33}-\x{11A38}\x{11A3B}-\x{11A3E}\x{11A47}\x{11A51}-\x{11A56}\x{11A59}-\x{11A5B}\x{11A8A}-\x{11A96}\x{11A98}-\x{11A99}\x{11C30}-\x{11C36}\x{11C38}-\x{11C3D}\x{11C3F}\x{11C92}-\x{11CA7}\x{11CAA}-\x{11CB0}\x{11CB2}-\x{11CB3}\x{11CB5}-\x{11CB6}\x{11D31}-\x{11D36}\x{11D3A}\x{11D3C}-\x{11D3D}\x{11D3F}-\x{11D45}\x{11D47}\x{11D90}-\x{11D91}\x{11D95}\x{11D97}\x{11EF3}-\x{11EF4}\x{16AF0}-\x{16AF4}\x{16B30}-\x{16B36}\x{16B40}-\x{16B43}\x{16F8F}-\x{16F92}\x{16F93}-\x{16F9F}\x{16FE0}-\x{16FE1}\x{1BC9D}-\x{1BC9E}\x{1BCA0}-\x{1BCA3}\x{1D167}-\x{1D169}\x{1D173}-\x{1D17A}\x{1D17B}-\x{1D182}\x{1D185}-\x{1D18B}\x{1D1AA}-\x{1D1AD}\x{1D242}-\x{1D244}\x{1DA00}-\x{1DA36}\x{1DA3B}-\x{1DA6C}\x{1DA75}\x{1DA84}\x{1DA9B}-\x{1DA9F}\x{1DAA1}-\x{1DAAF}\x{1E000}-\x{1E006}\x{1E008}-\x{1E018}\x{1E01B}-\x{1E021}\x{1E023}-\x{1E024}\x{1E026}-\x{1E02A}\x{1E8D0}-\x{1E8D6}\x{1E944}-\x{1E94A}\x{1F3FB}-\x{1F3FF}\x{E0001}\x{E0020}-\x{E007F}\x{E0100}-\x{E01EF}])(\pL)(\pL*+)/u';
  46086. <?php
  46087. return array(
  46088. 'a' => 'A',
  46089. 'b' => 'B',
  46090. 'c' => 'C',
  46091. 'd' => 'D',
  46092. 'e' => 'E',
  46093. 'f' => 'F',
  46094. 'g' => 'G',
  46095. 'h' => 'H',
  46096. 'i' => 'I',
  46097. 'j' => 'J',
  46098. 'k' => 'K',
  46099. 'l' => 'L',
  46100. 'm' => 'M',
  46101. 'n' => 'N',
  46102. 'o' => 'O',
  46103. 'p' => 'P',
  46104. 'q' => 'Q',
  46105. 'r' => 'R',
  46106. 's' => 'S',
  46107. 't' => 'T',
  46108. 'u' => 'U',
  46109. 'v' => 'V',
  46110. 'w' => 'W',
  46111. 'x' => 'X',
  46112. 'y' => 'Y',
  46113. 'z' => 'Z',
  46114. 'µ' => 'Μ',
  46115. 'à' => 'À',
  46116. 'á' => '�',
  46117. 'â' => 'Â',
  46118. 'ã' => 'Ã',
  46119. 'ä' => 'Ä',
  46120. 'Ã¥' => 'Ã…',
  46121. 'æ' => 'Æ',
  46122. 'ç' => 'Ç',
  46123. 'è' => 'È',
  46124. 'é' => 'É',
  46125. 'ê' => 'Ê',
  46126. 'ë' => 'Ë',
  46127. 'ì' => 'Ì',
  46128. 'í' => '�',
  46129. 'î' => 'Î',
  46130. 'ï' => '�',
  46131. 'ð' => '�',
  46132. 'ñ' => 'Ñ',
  46133. 'ò' => 'Ò',
  46134. 'ó' => 'Ó',
  46135. 'ô' => 'Ô',
  46136. 'õ' => 'Õ',
  46137. 'ö' => 'Ö',
  46138. 'ø' => 'Ø',
  46139. 'ù' => 'Ù',
  46140. 'ú' => 'Ú',
  46141. 'û' => 'Û',
  46142. 'ü' => 'Ü',
  46143. 'ý' => '�',
  46144. 'þ' => 'Þ',
  46145. 'ÿ' => 'Ÿ',
  46146. '�' => 'Ā',
  46147. 'ă' => 'Ă',
  46148. 'Ä…' => 'Ä„',
  46149. 'ć' => 'Ć',
  46150. 'ĉ' => 'Ĉ',
  46151. 'Ä‹' => 'ÄŠ',
  46152. '�' => 'Č',
  46153. '�' => 'Ď',
  46154. 'đ' => '�',
  46155. 'Ä“' => 'Ä’',
  46156. 'Ä•' => 'Ä”',
  46157. 'Ä—' => 'Ä–',
  46158. 'ę' => 'Ę',
  46159. 'Ä›' => 'Äš',
  46160. '�' => 'Ĝ',
  46161. 'ÄŸ' => 'Äž',
  46162. 'Ä¡' => 'Ä ',
  46163. 'Ä£' => 'Ä¢',
  46164. 'ĥ' => 'Ĥ',
  46165. 'ħ' => 'Ħ',
  46166. 'ĩ' => 'Ĩ',
  46167. 'ī' => 'Ī',
  46168. 'ĭ' => 'Ĭ',
  46169. 'į' => 'Į',
  46170. 'ı' => 'I',
  46171. 'ij' => 'IJ',
  46172. 'ĵ' => 'Ĵ',
  46173. 'ķ' => 'Ķ',
  46174. 'ĺ' => 'Ĺ',
  46175. 'ļ' => 'Ļ',
  46176. 'ľ' => 'Ľ',
  46177. 'Å€' => 'Ä¿',
  46178. 'ł' => '�',
  46179. 'ń' => 'Ń',
  46180. 'ņ' => 'Ņ',
  46181. 'ň' => 'Ň',
  46182. 'Å‹' => 'ÅŠ',
  46183. '�' => 'Ō',
  46184. '�' => 'Ŏ',
  46185. 'ő' => '�',
  46186. 'Å“' => 'Å’',
  46187. 'Å•' => 'Å”',
  46188. 'Å—' => 'Å–',
  46189. 'ř' => 'Ř',
  46190. 'Å›' => 'Åš',
  46191. '�' => 'Ŝ',
  46192. 'ÅŸ' => 'Åž',
  46193. 'Å¡' => 'Å ',
  46194. 'Å£' => 'Å¢',
  46195. 'ť' => 'Ť',
  46196. 'ŧ' => 'Ŧ',
  46197. 'ũ' => 'Ũ',
  46198. 'ū' => 'Ū',
  46199. 'ŭ' => 'Ŭ',
  46200. 'ů' => 'Ů',
  46201. 'ű' => 'Ű',
  46202. 'ų' => 'Ų',
  46203. 'ŵ' => 'Ŵ',
  46204. 'ŷ' => 'Ŷ',
  46205. 'ź' => 'Ź',
  46206. 'ż' => 'Ż',
  46207. 'ž' => 'Ž',
  46208. 'Å¿' => 'S',
  46209. 'ƀ' => 'Ƀ',
  46210. 'ƃ' => 'Ƃ',
  46211. 'Æ…' => 'Æ„',
  46212. 'ƈ' => 'Ƈ',
  46213. 'ƌ' => 'Ƌ',
  46214. 'Æ’' => 'Æ‘',
  46215. 'ƕ' => 'Ƕ',
  46216. 'ƙ' => 'Ƙ',
  46217. 'ƚ' => 'Ƚ',
  46218. 'Æž' => 'È ',
  46219. 'Æ¡' => 'Æ ',
  46220. 'Æ£' => 'Æ¢',
  46221. 'ƥ' => 'Ƥ',
  46222. 'ƨ' => 'Ƨ',
  46223. 'ƭ' => 'Ƭ',
  46224. 'ư' => 'Ư',
  46225. 'ƴ' => 'Ƴ',
  46226. 'ƶ' => 'Ƶ',
  46227. 'ƹ' => 'Ƹ',
  46228. 'ƽ' => 'Ƽ',
  46229. 'Æ¿' => 'Ç·',
  46230. 'Ç…' => 'Ç„',
  46231. 'dž' => 'DŽ',
  46232. 'Lj' => 'LJ',
  46233. 'lj' => 'LJ',
  46234. 'Ç‹' => 'ÇŠ',
  46235. 'nj' => 'NJ',
  46236. 'ǎ' => '�',
  46237. '�' => '�',
  46238. 'Ç’' => 'Ç‘',
  46239. 'Ç”' => 'Ç“',
  46240. 'Ç–' => 'Ç•',
  46241. 'ǘ' => 'Ǘ',
  46242. 'Çš' => 'Ç™',
  46243. 'ǜ' => 'Ǜ',
  46244. '�' => 'Ǝ',
  46245. 'ÇŸ' => 'Çž',
  46246. 'Ç¡' => 'Ç ',
  46247. 'Ç£' => 'Ç¢',
  46248. 'ǥ' => 'Ǥ',
  46249. 'ǧ' => 'Ǧ',
  46250. 'ǩ' => 'Ǩ',
  46251. 'ǫ' => 'Ǫ',
  46252. 'ǭ' => 'Ǭ',
  46253. 'ǯ' => 'Ǯ',
  46254. 'Dz' => 'DZ',
  46255. 'dz' => 'DZ',
  46256. 'ǵ' => 'Ǵ',
  46257. 'ǹ' => 'Ǹ',
  46258. 'ǻ' => 'Ǻ',
  46259. 'ǽ' => 'Ǽ',
  46260. 'ǿ' => 'Ǿ',
  46261. '�' => 'Ȁ',
  46262. 'ȃ' => 'Ȃ',
  46263. 'È…' => 'È„',
  46264. 'ȇ' => 'Ȇ',
  46265. 'ȉ' => 'Ȉ',
  46266. 'È‹' => 'ÈŠ',
  46267. '�' => 'Ȍ',
  46268. '�' => 'Ȏ',
  46269. 'ȑ' => '�',
  46270. 'È“' => 'È’',
  46271. 'È•' => 'È”',
  46272. 'È—' => 'È–',
  46273. 'ș' => 'Ș',
  46274. 'È›' => 'Èš',
  46275. '�' => 'Ȝ',
  46276. 'ÈŸ' => 'Èž',
  46277. 'È£' => 'È¢',
  46278. 'ȥ' => 'Ȥ',
  46279. 'ȧ' => 'Ȧ',
  46280. 'ȩ' => 'Ȩ',
  46281. 'ȫ' => 'Ȫ',
  46282. 'ȭ' => 'Ȭ',
  46283. 'ȯ' => 'Ȯ',
  46284. 'ȱ' => 'Ȱ',
  46285. 'ȳ' => 'Ȳ',
  46286. 'ȼ' => 'Ȼ',
  46287. 'È¿' => 'â±¾',
  46288. 'ɀ' => 'Ɀ',
  46289. 'ɂ' => '�',
  46290. 'ɇ' => 'Ɇ',
  46291. 'ɉ' => 'Ɉ',
  46292. 'É‹' => 'ÉŠ',
  46293. '�' => 'Ɍ',
  46294. '�' => 'Ɏ',
  46295. '�' => 'Ɐ',
  46296. 'É‘' => 'â±­',
  46297. 'É’' => 'â±°',
  46298. 'ɓ' => '�',
  46299. 'ɔ' => 'Ɔ',
  46300. 'ɖ' => 'Ɖ',
  46301. 'É—' => 'ÆŠ',
  46302. 'ə' => '�',
  46303. 'ɛ' => '�',
  46304. 'ɜ' => 'Ɜ',
  46305. 'É ' => 'Æ“',
  46306. 'ɡ' => 'Ɡ',
  46307. 'É£' => 'Æ”',
  46308. 'ɥ' => '�',
  46309. 'ɦ' => 'Ɦ',
  46310. 'ɨ' => 'Ɨ',
  46311. 'É©' => 'Æ–',
  46312. 'É«' => 'â±¢',
  46313. 'ɬ' => 'Ɬ',
  46314. 'ɯ' => 'Ɯ',
  46315. 'ɱ' => 'Ɱ',
  46316. 'ɲ' => '�',
  46317. 'ɵ' => 'Ɵ',
  46318. 'ɽ' => 'Ɽ',
  46319. 'ʀ' => 'Ʀ',
  46320. 'ʃ' => 'Ʃ',
  46321. 'ʇ' => 'Ʇ',
  46322. 'ʈ' => 'Ʈ',
  46323. 'ʉ' => 'Ʉ',
  46324. 'ʊ' => 'Ʊ',
  46325. 'ʋ' => 'Ʋ',
  46326. 'ʌ' => 'Ʌ',
  46327. 'Ê’' => 'Æ·',
  46328. 'Êž' => 'êž°',
  46329. 'ͅ' => 'Ι',
  46330. 'ͱ' => 'Ͱ',
  46331. 'ͳ' => 'Ͳ',
  46332. 'ͷ' => 'Ͷ',
  46333. 'ͻ' => 'Ͻ',
  46334. 'ͼ' => 'Ͼ',
  46335. 'ͽ' => 'Ͽ',
  46336. 'ά' => 'Ά',
  46337. 'έ' => 'Έ',
  46338. 'ή' => 'Ή',
  46339. 'ί' => 'Ί',
  46340. 'α' => 'Α',
  46341. 'β' => 'Β',
  46342. 'γ' => 'Γ',
  46343. 'δ' => 'Δ',
  46344. 'ε' => 'Ε',
  46345. 'ζ' => 'Ζ',
  46346. 'η' => 'Η',
  46347. 'θ' => 'Θ',
  46348. 'ι' => 'Ι',
  46349. 'κ' => 'Κ',
  46350. 'λ' => 'Λ',
  46351. 'μ' => 'Μ',
  46352. 'ν' => '�',
  46353. 'ξ' => 'Ξ',
  46354. 'ο' => 'Ο',
  46355. 'π' => 'Π',
  46356. '�' => 'Ρ',
  46357. 'ς' => 'Σ',
  46358. 'σ' => 'Σ',
  46359. 'τ' => 'Τ',
  46360. 'Ï…' => 'Î¥',
  46361. 'φ' => 'Φ',
  46362. 'χ' => 'Χ',
  46363. 'ψ' => 'Ψ',
  46364. 'ω' => 'Ω',
  46365. 'ϊ' => 'Ϊ',
  46366. 'ϋ' => 'Ϋ',
  46367. 'ό' => 'Ό',
  46368. '�' => 'Ύ',
  46369. 'ώ' => '�',
  46370. '�' => 'Β',
  46371. 'ϑ' => 'Θ',
  46372. 'ϕ' => 'Φ',
  46373. 'ϖ' => 'Π',
  46374. 'ϗ' => '�',
  46375. 'ϙ' => 'Ϙ',
  46376. 'Ï›' => 'Ïš',
  46377. '�' => 'Ϝ',
  46378. 'ÏŸ' => 'Ïž',
  46379. 'Ï¡' => 'Ï ',
  46380. 'Ï£' => 'Ï¢',
  46381. 'ϥ' => 'Ϥ',
  46382. 'ϧ' => 'Ϧ',
  46383. 'ϩ' => 'Ϩ',
  46384. 'ϫ' => 'Ϫ',
  46385. 'ϭ' => 'Ϭ',
  46386. 'ϯ' => 'Ϯ',
  46387. 'ϰ' => 'Κ',
  46388. 'ϱ' => 'Ρ',
  46389. 'ϲ' => 'Ϲ',
  46390. 'ϳ' => 'Ϳ',
  46391. 'ϵ' => 'Ε',
  46392. 'ϸ' => 'Ϸ',
  46393. 'ϻ' => 'Ϻ',
  46394. 'а' => '�',
  46395. 'б' => 'Б',
  46396. 'в' => 'В',
  46397. 'г' => 'Г',
  46398. 'д' => 'Д',
  46399. 'е' => 'Е',
  46400. 'ж' => 'Ж',
  46401. 'з' => 'З',
  46402. 'и' => 'И',
  46403. 'й' => 'Й',
  46404. 'к' => 'К',
  46405. 'л' => 'Л',
  46406. 'м' => 'М',
  46407. 'н' => '�',
  46408. 'о' => 'О',
  46409. 'п' => 'П',
  46410. 'р' => 'Р',
  46411. '�' => 'С',
  46412. 'т' => 'Т',
  46413. 'у' => 'У',
  46414. 'ф' => 'Ф',
  46415. 'Ñ…' => 'Ð¥',
  46416. 'ц' => 'Ц',
  46417. 'ч' => 'Ч',
  46418. 'ш' => 'Ш',
  46419. 'щ' => 'Щ',
  46420. 'ъ' => 'Ъ',
  46421. 'ы' => 'Ы',
  46422. 'ь' => 'Ь',
  46423. '�' => 'Э',
  46424. 'ю' => 'Ю',
  46425. '�' => 'Я',
  46426. '�' => 'Ѐ',
  46427. 'ё' => '�',
  46428. 'ђ' => 'Ђ',
  46429. 'ѓ' => 'Ѓ',
  46430. 'є' => 'Є',
  46431. 'Ñ•' => 'Ð…',
  46432. 'і' => 'І',
  46433. 'ї' => 'Ї',
  46434. 'ј' => 'Ј',
  46435. 'љ' => 'Љ',
  46436. 'њ' => 'Њ',
  46437. 'ћ' => 'Ћ',
  46438. 'ќ' => 'Ќ',
  46439. '�' => '�',
  46440. 'Ñž' => 'ÐŽ',
  46441. 'џ' => '�',
  46442. 'Ñ¡' => 'Ñ ',
  46443. 'Ñ£' => 'Ñ¢',
  46444. 'ѥ' => 'Ѥ',
  46445. 'ѧ' => 'Ѧ',
  46446. 'ѩ' => 'Ѩ',
  46447. 'ѫ' => 'Ѫ',
  46448. 'ѭ' => 'Ѭ',
  46449. 'ѯ' => 'Ѯ',
  46450. 'ѱ' => 'Ѱ',
  46451. 'ѳ' => 'Ѳ',
  46452. 'ѵ' => 'Ѵ',
  46453. 'ѷ' => 'Ѷ',
  46454. 'ѹ' => 'Ѹ',
  46455. 'ѻ' => 'Ѻ',
  46456. 'ѽ' => 'Ѽ',
  46457. 'ѿ' => 'Ѿ',
  46458. 'Ò�' => 'Ò€',
  46459. 'Ò‹' => 'ÒŠ',
  46460. '�' => 'Ҍ',
  46461. 'Ò�' => 'ÒŽ',
  46462. 'Ò‘' => 'Ò�',
  46463. 'Ò“' => 'Ò’',
  46464. 'Ò•' => 'Ò”',
  46465. 'Ò—' => 'Ò–',
  46466. 'Ò™' => 'Ò˜',
  46467. 'Ò›' => 'Òš',
  46468. '�' => 'Ҝ',
  46469. 'ÒŸ' => 'Òž',
  46470. 'Ò¡' => 'Ò ',
  46471. 'Ò£' => 'Ò¢',
  46472. 'Ò¥' => 'Ò¤',
  46473. 'Ò§' => 'Ò¦',
  46474. 'Ò©' => 'Ò¨',
  46475. 'Ò«' => 'Òª',
  46476. 'Ò­' => 'Ò¬',
  46477. 'Ò¯' => 'Ò®',
  46478. 'Ò±' => 'Ò°',
  46479. 'Ò³' => 'Ò²',
  46480. 'Òµ' => 'Ò´',
  46481. 'Ò·' => 'Ò¶',
  46482. 'Ò¹' => 'Ò¸',
  46483. 'Ò»' => 'Òº',
  46484. 'Ò½' => 'Ò¼',
  46485. 'Ò¿' => 'Ò¾',
  46486. 'Ó‚' => 'Ó�',
  46487. 'Ó„' => 'Óƒ',
  46488. 'Ó†' => 'Ó…',
  46489. 'Óˆ' => 'Ó‡',
  46490. 'ÓŠ' => 'Ó‰',
  46491. 'ӌ' => 'Ӌ',
  46492. 'ÓŽ' => 'Ó�',
  46493. 'Ó�' => 'Ó€',
  46494. 'Ó‘' => 'Ó�',
  46495. 'Ó“' => 'Ó’',
  46496. 'Ó•' => 'Ó”',
  46497. 'Ó—' => 'Ó–',
  46498. 'Ó™' => 'Ó˜',
  46499. 'Ó›' => 'Óš',
  46500. '�' => 'Ӝ',
  46501. 'ÓŸ' => 'Óž',
  46502. 'Ó¡' => 'Ó ',
  46503. 'Ó£' => 'Ó¢',
  46504. 'Ó¥' => 'Ó¤',
  46505. 'Ó§' => 'Ó¦',
  46506. 'Ó©' => 'Ó¨',
  46507. 'Ó«' => 'Óª',
  46508. 'Ó­' => 'Ó¬',
  46509. 'Ó¯' => 'Ó®',
  46510. 'Ó±' => 'Ó°',
  46511. 'Ó³' => 'Ó²',
  46512. 'Óµ' => 'Ó´',
  46513. 'Ó·' => 'Ó¶',
  46514. 'Ó¹' => 'Ó¸',
  46515. 'Ó»' => 'Óº',
  46516. 'Ó½' => 'Ó¼',
  46517. 'Ó¿' => 'Ó¾',
  46518. 'Ô�' => 'Ô€',
  46519. 'Ôƒ' => 'Ô‚',
  46520. 'Ô…' => 'Ô„',
  46521. 'Ô‡' => 'Ô†',
  46522. 'Ô‰' => 'Ôˆ',
  46523. 'Ô‹' => 'ÔŠ',
  46524. '�' => 'Ԍ',
  46525. 'Ô�' => 'ÔŽ',
  46526. 'Ô‘' => 'Ô�',
  46527. 'Ô“' => 'Ô’',
  46528. 'Ô•' => 'Ô”',
  46529. 'Ô—' => 'Ô–',
  46530. 'Ô™' => 'Ô˜',
  46531. 'Ô›' => 'Ôš',
  46532. '�' => 'Ԝ',
  46533. 'ÔŸ' => 'Ôž',
  46534. 'Ô¡' => 'Ô ',
  46535. 'Ô£' => 'Ô¢',
  46536. 'Ô¥' => 'Ô¤',
  46537. 'Ô§' => 'Ô¦',
  46538. 'Ô©' => 'Ô¨',
  46539. 'Ô«' => 'Ôª',
  46540. 'Ô­' => 'Ô¬',
  46541. 'Ô¯' => 'Ô®',
  46542. 'Õ¡' => 'Ô±',
  46543. 'Õ¢' => 'Ô²',
  46544. 'Õ£' => 'Ô³',
  46545. 'Õ¤' => 'Ô´',
  46546. 'Õ¥' => 'Ôµ',
  46547. 'Õ¦' => 'Ô¶',
  46548. 'Õ§' => 'Ô·',
  46549. 'Õ¨' => 'Ô¸',
  46550. 'Õ©' => 'Ô¹',
  46551. 'Õª' => 'Ôº',
  46552. 'Õ«' => 'Ô»',
  46553. 'Õ¬' => 'Ô¼',
  46554. 'Õ­' => 'Ô½',
  46555. 'Õ®' => 'Ô¾',
  46556. 'Õ¯' => 'Ô¿',
  46557. 'Õ°' => 'Õ€',
  46558. 'Õ±' => 'Õ�',
  46559. 'Õ²' => 'Õ‚',
  46560. 'Õ³' => 'Õƒ',
  46561. 'Õ´' => 'Õ„',
  46562. 'Õµ' => 'Õ…',
  46563. 'Õ¶' => 'Õ†',
  46564. 'Õ·' => 'Õ‡',
  46565. 'Õ¸' => 'Õˆ',
  46566. 'Õ¹' => 'Õ‰',
  46567. 'Õº' => 'ÕŠ',
  46568. 'Õ»' => 'Õ‹',
  46569. 'ռ' => 'Ռ',
  46570. 'Õ½' => 'Õ�',
  46571. 'Õ¾' => 'ÕŽ',
  46572. 'Õ¿' => 'Õ�',
  46573. 'Ö€' => 'Õ�',
  46574. 'Ö�' => 'Õ‘',
  46575. 'Ö‚' => 'Õ’',
  46576. 'Öƒ' => 'Õ“',
  46577. 'Ö„' => 'Õ”',
  46578. 'Ö…' => 'Õ•',
  46579. 'Ö†' => 'Õ–',
  46580. 'ᵹ' => '�',
  46581. 'áµ½' => 'â±£',
  46582. '�' => 'Ḁ',
  46583. 'ḃ' => 'Ḃ',
  46584. 'ḅ' => 'Ḅ',
  46585. 'ḇ' => 'Ḇ',
  46586. 'ḉ' => 'Ḉ',
  46587. 'ḋ' => 'Ḋ',
  46588. '�' => 'Ḍ',
  46589. '�' => 'Ḏ',
  46590. 'ḑ' => '�',
  46591. 'ḓ' => 'Ḓ',
  46592. 'ḕ' => 'Ḕ',
  46593. 'ḗ' => 'Ḗ',
  46594. 'ḙ' => 'Ḙ',
  46595. 'ḛ' => 'Ḛ',
  46596. '�' => 'Ḝ',
  46597. 'ḟ' => 'Ḟ',
  46598. 'ḡ' => 'Ḡ',
  46599. 'ḣ' => 'Ḣ',
  46600. 'ḥ' => 'Ḥ',
  46601. 'ḧ' => 'Ḧ',
  46602. 'ḩ' => 'Ḩ',
  46603. 'ḫ' => 'Ḫ',
  46604. 'ḭ' => 'Ḭ',
  46605. 'ḯ' => 'Ḯ',
  46606. 'ḱ' => 'Ḱ',
  46607. 'ḳ' => 'Ḳ',
  46608. 'ḵ' => 'Ḵ',
  46609. 'ḷ' => 'Ḷ',
  46610. 'ḹ' => 'Ḹ',
  46611. 'ḻ' => 'Ḻ',
  46612. 'ḽ' => 'Ḽ',
  46613. 'ḿ' => 'Ḿ',
  46614. '�' => 'Ṁ',
  46615. 'ṃ' => 'Ṃ',
  46616. 'ṅ' => 'Ṅ',
  46617. 'ṇ' => 'Ṇ',
  46618. 'ṉ' => 'Ṉ',
  46619. 'ṋ' => 'Ṋ',
  46620. '�' => 'Ṍ',
  46621. '�' => 'Ṏ',
  46622. 'ṑ' => '�',
  46623. 'ṓ' => 'Ṓ',
  46624. 'ṕ' => 'Ṕ',
  46625. 'á¹—' => 'á¹–',
  46626. 'ṙ' => 'Ṙ',
  46627. 'ṛ' => 'Ṛ',
  46628. '�' => 'Ṝ',
  46629. 'ṟ' => 'Ṟ',
  46630. 'ṡ' => 'Ṡ',
  46631. 'á¹£' => 'á¹¢',
  46632. 'ṥ' => 'Ṥ',
  46633. 'ṧ' => 'Ṧ',
  46634. 'ṩ' => 'Ṩ',
  46635. 'ṫ' => 'Ṫ',
  46636. 'ṭ' => 'Ṭ',
  46637. 'ṯ' => 'Ṯ',
  46638. 'á¹±' => 'á¹°',
  46639. 'á¹³' => 'á¹²',
  46640. 'á¹µ' => 'á¹´',
  46641. 'ṷ' => 'Ṷ',
  46642. 'ṹ' => 'Ṹ',
  46643. 'ṻ' => 'Ṻ',
  46644. 'á¹½' => 'á¹¼',
  46645. 'ṿ' => 'Ṿ',
  46646. '�' => 'Ẁ',
  46647. 'ẃ' => 'Ẃ',
  46648. 'ẅ' => 'Ẅ',
  46649. 'ẇ' => 'Ẇ',
  46650. 'ẉ' => 'Ẉ',
  46651. 'ẋ' => 'Ẋ',
  46652. '�' => 'Ẍ',
  46653. '�' => 'Ẏ',
  46654. 'ẑ' => '�',
  46655. 'ẓ' => 'Ẓ',
  46656. 'ẕ' => 'Ẕ',
  46657. 'ẛ' => 'Ṡ',
  46658. 'ạ' => 'Ạ',
  46659. 'ả' => 'Ả',
  46660. 'ấ' => 'Ấ',
  46661. 'ầ' => 'Ầ',
  46662. 'ẩ' => 'Ẩ',
  46663. 'ẫ' => 'Ẫ',
  46664. 'ậ' => 'Ậ',
  46665. 'ắ' => 'Ắ',
  46666. 'ằ' => 'Ằ',
  46667. 'ẳ' => 'Ẳ',
  46668. 'ẵ' => 'Ẵ',
  46669. 'ặ' => 'Ặ',
  46670. 'ẹ' => 'Ẹ',
  46671. 'ẻ' => 'Ẻ',
  46672. 'ẽ' => 'Ẽ',
  46673. 'ế' => 'Ế',
  46674. '�' => 'Ề',
  46675. 'ể' => 'Ể',
  46676. 'ễ' => 'Ễ',
  46677. 'ệ' => 'Ệ',
  46678. 'ỉ' => 'Ỉ',
  46679. 'ị' => 'Ị',
  46680. '�' => 'Ọ',
  46681. '�' => 'Ỏ',
  46682. 'ố' => '�',
  46683. 'ồ' => 'Ồ',
  46684. 'ổ' => 'Ổ',
  46685. 'á»—' => 'á»–',
  46686. 'ộ' => 'Ộ',
  46687. 'ớ' => 'Ớ',
  46688. '�' => 'Ờ',
  46689. 'ở' => 'Ở',
  46690. 'ỡ' => 'Ỡ',
  46691. 'ợ' => 'Ợ',
  46692. 'ụ' => 'Ụ',
  46693. 'ủ' => 'Ủ',
  46694. 'ứ' => 'Ứ',
  46695. 'ừ' => 'Ừ',
  46696. 'ử' => 'Ử',
  46697. 'ữ' => 'Ữ',
  46698. 'á»±' => 'á»°',
  46699. 'ỳ' => 'Ỳ',
  46700. 'ỵ' => 'Ỵ',
  46701. 'ỷ' => 'Ỷ',
  46702. 'ỹ' => 'Ỹ',
  46703. 'ỻ' => 'Ỻ',
  46704. 'ỽ' => 'Ỽ',
  46705. 'ỿ' => 'Ỿ',
  46706. 'ἀ' => 'Ἀ',
  46707. '�' => 'Ἁ',
  46708. 'ἂ' => 'Ἂ',
  46709. 'ἃ' => 'Ἃ',
  46710. 'ἄ' => 'Ἄ',
  46711. 'ἅ' => '�',
  46712. 'ἆ' => 'Ἆ',
  46713. 'ἇ' => '�',
  46714. '�' => 'Ἐ',
  46715. 'ἑ' => 'Ἑ',
  46716. 'ἒ' => 'Ἒ',
  46717. 'ἓ' => 'Ἓ',
  46718. 'ἔ' => 'Ἔ',
  46719. 'ἕ' => '�',
  46720. 'ἠ' => 'Ἠ',
  46721. 'ἡ' => 'Ἡ',
  46722. 'ἢ' => 'Ἢ',
  46723. 'ἣ' => 'Ἣ',
  46724. 'ἤ' => 'Ἤ',
  46725. 'á¼¥' => 'á¼­',
  46726. 'ἦ' => 'Ἦ',
  46727. 'ἧ' => 'Ἧ',
  46728. 'ἰ' => 'Ἰ',
  46729. 'á¼±' => 'á¼¹',
  46730. 'ἲ' => 'Ἲ',
  46731. 'á¼³' => 'á¼»',
  46732. 'á¼´' => 'á¼¼',
  46733. 'á¼µ' => 'á¼½',
  46734. 'ἶ' => 'Ἶ',
  46735. 'ἷ' => 'Ἷ',
  46736. 'ὀ' => 'Ὀ',
  46737. '�' => 'Ὁ',
  46738. 'ὂ' => 'Ὂ',
  46739. 'ὃ' => 'Ὃ',
  46740. 'ὄ' => 'Ὄ',
  46741. 'ὅ' => '�',
  46742. 'ὑ' => 'Ὑ',
  46743. 'ὓ' => 'Ὓ',
  46744. 'ὕ' => '�',
  46745. 'ὗ' => 'Ὗ',
  46746. 'ὠ' => 'Ὠ',
  46747. 'ὡ' => 'Ὡ',
  46748. 'ὢ' => 'Ὢ',
  46749. 'ὣ' => 'Ὣ',
  46750. 'ὤ' => 'Ὤ',
  46751. 'á½¥' => 'á½­',
  46752. 'ὦ' => 'Ὦ',
  46753. 'ὧ' => 'Ὧ',
  46754. 'ὰ' => 'Ὰ',
  46755. 'á½±' => 'á¾»',
  46756. 'ὲ' => 'Ὲ',
  46757. 'έ' => 'Έ',
  46758. 'á½´' => 'á¿Š',
  46759. 'á½µ' => 'á¿‹',
  46760. 'ὶ' => 'Ὶ',
  46761. 'á½·' => 'á¿›',
  46762. 'ὸ' => 'Ὸ',
  46763. 'ό' => 'Ό',
  46764. 'ὺ' => 'Ὺ',
  46765. 'á½»' => 'á¿«',
  46766. 'ὼ' => 'Ὼ',
  46767. 'á½½' => 'á¿»',
  46768. 'ᾀ' => 'ᾈ',
  46769. '�' => 'ᾉ',
  46770. 'ᾂ' => 'ᾊ',
  46771. 'ᾃ' => 'ᾋ',
  46772. 'ᾄ' => 'ᾌ',
  46773. 'ᾅ' => '�',
  46774. 'ᾆ' => 'ᾎ',
  46775. 'ᾇ' => '�',
  46776. '�' => 'ᾘ',
  46777. 'ᾑ' => 'ᾙ',
  46778. 'ᾒ' => 'ᾚ',
  46779. 'ᾓ' => 'ᾛ',
  46780. 'ᾔ' => 'ᾜ',
  46781. 'ᾕ' => '�',
  46782. 'ᾖ' => 'ᾞ',
  46783. 'ᾗ' => 'ᾟ',
  46784. 'ᾠ' => 'ᾨ',
  46785. 'ᾡ' => 'ᾩ',
  46786. 'ᾢ' => 'ᾪ',
  46787. 'ᾣ' => 'ᾫ',
  46788. 'ᾤ' => 'ᾬ',
  46789. 'á¾¥' => 'á¾­',
  46790. 'ᾦ' => 'ᾮ',
  46791. 'ᾧ' => 'ᾯ',
  46792. 'ᾰ' => 'Ᾰ',
  46793. 'á¾±' => 'á¾¹',
  46794. 'á¾³' => 'á¾¼',
  46795. 'ι' => 'Ι',
  46796. 'ῃ' => 'ῌ',
  46797. '�' => 'Ῐ',
  46798. 'á¿‘' => 'á¿™',
  46799. 'ῠ' => 'Ῠ',
  46800. 'á¿¡' => 'á¿©',
  46801. 'ῥ' => 'Ῥ',
  46802. 'ῳ' => 'ῼ',
  46803. 'ⅎ' => 'Ⅎ',
  46804. 'â…°' => 'â… ',
  46805. 'â…±' => 'â…¡',
  46806. 'â…²' => 'â…¢',
  46807. 'â…³' => 'â…£',
  46808. 'â…´' => 'â…¤',
  46809. 'â…µ' => 'â…¥',
  46810. 'â…¶' => 'â…¦',
  46811. 'â…·' => 'â…§',
  46812. 'â…¸' => 'â…¨',
  46813. 'â…¹' => 'â…©',
  46814. 'â…º' => 'â…ª',
  46815. 'â…»' => 'â…«',
  46816. 'â…¼' => 'â…¬',
  46817. 'â…½' => 'â…­',
  46818. 'â…¾' => 'â…®',
  46819. 'â…¿' => 'â…¯',
  46820. 'ↄ' => 'Ↄ',
  46821. '�' => 'Ⓐ',
  46822. 'â“‘' => 'â’·',
  46823. 'â“’' => 'â’¸',
  46824. 'â““' => 'â’¹',
  46825. 'â“”' => 'â’º',
  46826. 'â“•' => 'â’»',
  46827. 'â“–' => 'â’¼',
  46828. 'â“—' => 'â’½',
  46829. 'ⓘ' => 'Ⓘ',
  46830. 'â“™' => 'â’¿',
  46831. 'â“š' => 'â“€',
  46832. 'ⓛ' => '�',
  46833. 'ⓜ' => 'Ⓜ',
  46834. '�' => 'Ⓝ',
  46835. 'â“ž' => 'â“„',
  46836. 'â“Ÿ' => 'â“…',
  46837. 'ⓠ' => 'Ⓠ',
  46838. 'ⓡ' => 'Ⓡ',
  46839. 'ⓢ' => 'Ⓢ',
  46840. 'ⓣ' => 'Ⓣ',
  46841. 'ⓤ' => 'Ⓤ',
  46842. 'â“¥' => 'â“‹',
  46843. 'ⓦ' => 'Ⓦ',
  46844. 'ⓧ' => '�',
  46845. 'ⓨ' => 'Ⓨ',
  46846. 'ⓩ' => '�',
  46847. 'â°°' => 'â°€',
  46848. 'â°±' => 'â°�',
  46849. 'â°²' => 'â°‚',
  46850. 'â°³' => 'â°ƒ',
  46851. 'â°´' => 'â°„',
  46852. 'â°µ' => 'â°…',
  46853. 'â°¶' => 'â°†',
  46854. 'â°·' => 'â°‡',
  46855. 'â°¸' => 'â°ˆ',
  46856. 'â°¹' => 'â°‰',
  46857. 'â°º' => 'â°Š',
  46858. 'â°»' => 'â°‹',
  46859. 'ⰼ' => 'Ⰼ',
  46860. 'â°½' => 'â°�',
  46861. 'â°¾' => 'â°Ž',
  46862. 'â°¿' => 'â°�',
  46863. 'â±€' => 'â°�',
  46864. '�' => 'Ⱁ',
  46865. 'ⱂ' => 'Ⱂ',
  46866. 'ⱃ' => 'Ⱃ',
  46867. 'ⱄ' => 'Ⱄ',
  46868. 'â±…' => 'â°•',
  46869. 'ⱆ' => 'Ⱆ',
  46870. 'ⱇ' => 'Ⱇ',
  46871. 'ⱈ' => 'Ⱈ',
  46872. 'ⱉ' => 'Ⱉ',
  46873. 'ⱊ' => 'Ⱊ',
  46874. 'ⱋ' => 'Ⱋ',
  46875. 'ⱌ' => 'Ⱌ',
  46876. '�' => '�',
  46877. 'ⱎ' => 'Ⱎ',
  46878. '�' => 'Ⱏ',
  46879. '�' => 'Ⱐ',
  46880. 'ⱑ' => 'Ⱑ',
  46881. 'â±’' => 'â°¢',
  46882. 'ⱓ' => 'Ⱓ',
  46883. 'â±”' => 'â°¤',
  46884. 'ⱕ' => 'Ⱕ',
  46885. 'â±–' => 'â°¦',
  46886. 'â±—' => 'â°§',
  46887. 'ⱘ' => 'Ⱘ',
  46888. 'â±™' => 'â°©',
  46889. 'ⱚ' => 'Ⱚ',
  46890. 'â±›' => 'â°«',
  46891. 'ⱜ' => 'Ⱜ',
  46892. '�' => 'Ⱝ',
  46893. 'ⱞ' => 'Ⱞ',
  46894. 'ⱡ' => 'Ⱡ',
  46895. 'ⱥ' => 'Ⱥ',
  46896. 'ⱦ' => 'Ⱦ',
  46897. 'ⱨ' => 'Ⱨ',
  46898. 'ⱪ' => 'Ⱪ',
  46899. 'ⱬ' => 'Ⱬ',
  46900. 'â±³' => 'â±²',
  46901. 'ⱶ' => 'Ⱶ',
  46902. '�' => 'Ⲁ',
  46903. 'ⲃ' => 'Ⲃ',
  46904. 'ⲅ' => 'Ⲅ',
  46905. 'ⲇ' => 'Ⲇ',
  46906. 'ⲉ' => 'Ⲉ',
  46907. 'ⲋ' => 'Ⲋ',
  46908. '�' => 'Ⲍ',
  46909. '�' => 'Ⲏ',
  46910. 'ⲑ' => '�',
  46911. 'ⲓ' => 'Ⲓ',
  46912. 'ⲕ' => 'Ⲕ',
  46913. 'â²—' => 'â²–',
  46914. 'ⲙ' => 'Ⲙ',
  46915. 'ⲛ' => 'Ⲛ',
  46916. '�' => 'Ⲝ',
  46917. 'ⲟ' => 'Ⲟ',
  46918. 'ⲡ' => 'Ⲡ',
  46919. 'â²£' => 'â²¢',
  46920. 'ⲥ' => 'Ⲥ',
  46921. 'ⲧ' => 'Ⲧ',
  46922. 'ⲩ' => 'Ⲩ',
  46923. 'ⲫ' => 'Ⲫ',
  46924. 'ⲭ' => 'Ⲭ',
  46925. 'ⲯ' => 'Ⲯ',
  46926. 'â²±' => 'â²°',
  46927. 'â²³' => 'â²²',
  46928. 'â²µ' => 'â²´',
  46929. 'ⲷ' => 'Ⲷ',
  46930. 'ⲹ' => 'Ⲹ',
  46931. 'ⲻ' => 'Ⲻ',
  46932. 'â²½' => 'â²¼',
  46933. 'ⲿ' => 'Ⲿ',
  46934. '�' => 'Ⳁ',
  46935. 'ⳃ' => 'Ⳃ',
  46936. 'ⳅ' => 'Ⳅ',
  46937. 'ⳇ' => 'Ⳇ',
  46938. 'ⳉ' => 'Ⳉ',
  46939. 'ⳋ' => 'Ⳋ',
  46940. '�' => 'Ⳍ',
  46941. '�' => 'Ⳏ',
  46942. 'ⳑ' => '�',
  46943. 'ⳓ' => 'Ⳓ',
  46944. 'ⳕ' => 'Ⳕ',
  46945. 'â³—' => 'â³–',
  46946. 'ⳙ' => 'Ⳙ',
  46947. 'ⳛ' => 'Ⳛ',
  46948. '�' => 'Ⳝ',
  46949. 'ⳟ' => 'Ⳟ',
  46950. 'ⳡ' => 'Ⳡ',
  46951. 'â³£' => 'â³¢',
  46952. 'ⳬ' => 'Ⳬ',
  46953. 'â³®' => 'â³­',
  46954. 'â³³' => 'â³²',
  46955. 'â´€' => 'á‚ ',
  46956. 'â´�' => 'á‚¡',
  46957. 'â´‚' => 'á‚¢',
  46958. 'â´ƒ' => 'á‚£',
  46959. 'ⴄ' => 'Ⴄ',
  46960. 'â´…' => 'á‚¥',
  46961. 'ⴆ' => 'Ⴆ',
  46962. 'ⴇ' => 'Ⴇ',
  46963. 'ⴈ' => 'Ⴈ',
  46964. 'â´‰' => 'á‚©',
  46965. 'ⴊ' => 'Ⴊ',
  46966. 'â´‹' => 'á‚«',
  46967. 'ⴌ' => 'Ⴌ',
  46968. 'â´�' => 'á‚­',
  46969. 'â´Ž' => 'á‚®',
  46970. '�' => 'Ⴏ',
  46971. 'â´�' => 'á‚°',
  46972. 'ⴑ' => 'Ⴑ',
  46973. 'ⴒ' => 'Ⴒ',
  46974. 'ⴓ' => 'Ⴓ',
  46975. 'â´”' => 'á‚´',
  46976. 'ⴕ' => 'Ⴕ',
  46977. 'ⴖ' => 'Ⴖ',
  46978. 'â´—' => 'á‚·',
  46979. 'ⴘ' => 'Ⴘ',
  46980. 'ⴙ' => 'Ⴙ',
  46981. 'ⴚ' => 'Ⴚ',
  46982. 'â´›' => 'á‚»',
  46983. 'ⴜ' => 'Ⴜ',
  46984. '�' => 'Ⴝ',
  46985. 'ⴞ' => 'Ⴞ',
  46986. 'â´Ÿ' => 'á‚¿',
  46987. 'ⴠ' => 'Ⴠ',
  46988. 'ⴡ' => '�',
  46989. 'ⴢ' => 'Ⴢ',
  46990. 'ⴣ' => 'Ⴣ',
  46991. 'ⴤ' => 'Ⴤ',
  46992. 'ⴥ' => 'Ⴥ',
  46993. 'ⴧ' => 'Ⴧ',
  46994. 'ⴭ' => '�',
  46995. '�' => 'Ꙁ',
  46996. 'ꙃ' => 'Ꙃ',
  46997. 'ꙅ' => 'Ꙅ',
  46998. 'ꙇ' => 'Ꙇ',
  46999. 'ꙉ' => 'Ꙉ',
  47000. 'ꙋ' => 'Ꙋ',
  47001. '�' => 'Ꙍ',
  47002. '�' => 'Ꙏ',
  47003. 'ꙑ' => '�',
  47004. 'ꙓ' => 'Ꙓ',
  47005. 'ꙕ' => 'Ꙕ',
  47006. 'ê™—' => 'ê™–',
  47007. 'ꙙ' => 'Ꙙ',
  47008. 'ꙛ' => 'Ꙛ',
  47009. '�' => 'Ꙝ',
  47010. 'ꙟ' => 'Ꙟ',
  47011. 'ꙡ' => 'Ꙡ',
  47012. 'ꙣ' => 'Ꙣ',
  47013. 'ꙥ' => 'Ꙥ',
  47014. 'ꙧ' => 'Ꙧ',
  47015. 'ꙩ' => 'Ꙩ',
  47016. 'ꙫ' => 'Ꙫ',
  47017. 'ꙭ' => 'Ꙭ',
  47018. '�' => 'Ꚁ',
  47019. 'ꚃ' => 'Ꚃ',
  47020. 'êš…' => 'êš„',
  47021. 'ꚇ' => 'Ꚇ',
  47022. 'ꚉ' => 'Ꚉ',
  47023. 'ꚋ' => 'Ꚋ',
  47024. '�' => 'Ꚍ',
  47025. '�' => 'Ꚏ',
  47026. 'ꚑ' => '�',
  47027. 'êš“' => 'êš’',
  47028. 'êš•' => 'êš”',
  47029. 'êš—' => 'êš–',
  47030. 'ꚙ' => 'Ꚙ',
  47031. 'êš›' => 'êšš',
  47032. 'ꜣ' => 'Ꜣ',
  47033. 'ꜥ' => 'Ꜥ',
  47034. 'ꜧ' => 'Ꜧ',
  47035. 'ꜩ' => 'Ꜩ',
  47036. 'ꜫ' => 'Ꜫ',
  47037. 'ꜭ' => 'Ꜭ',
  47038. 'ꜯ' => 'Ꜯ',
  47039. 'ꜳ' => 'Ꜳ',
  47040. 'ꜵ' => 'Ꜵ',
  47041. 'ꜷ' => 'Ꜷ',
  47042. 'ꜹ' => 'Ꜹ',
  47043. 'ꜻ' => 'Ꜻ',
  47044. 'ꜽ' => 'Ꜽ',
  47045. 'ꜿ' => 'Ꜿ',
  47046. '�' => '�',
  47047. '�' => '�',
  47048. '�' => '�',
  47049. '�' => '�',
  47050. '�' => '�',
  47051. '�' => '�',
  47052. '�' => '�',
  47053. '�' => '�',
  47054. '�' => '�',
  47055. '�' => '�',
  47056. '�' => '�',
  47057. '�' => '�',
  47058. '�' => '�',
  47059. '�' => '�',
  47060. '�' => '�',
  47061. '�' => '�',
  47062. '�' => '�',
  47063. '�' => '�',
  47064. '�' => '�',
  47065. '�' => '�',
  47066. '�' => '�',
  47067. '�' => '�',
  47068. '�' => '�',
  47069. '�' => '�',
  47070. '�' => '�',
  47071. '�' => '�',
  47072. '�' => '�',
  47073. '�' => 'Ꞁ',
  47074. 'ꞃ' => 'Ꞃ',
  47075. 'êž…' => 'êž„',
  47076. 'ꞇ' => 'Ꞇ',
  47077. 'ꞌ' => 'Ꞌ',
  47078. 'ꞑ' => '�',
  47079. 'êž“' => 'êž’',
  47080. 'êž—' => 'êž–',
  47081. 'ꞙ' => 'Ꞙ',
  47082. 'êž›' => 'êžš',
  47083. '�' => 'Ꞝ',
  47084. 'ꞟ' => 'Ꞟ',
  47085. 'êž¡' => 'êž ',
  47086. 'ꞣ' => 'Ꞣ',
  47087. 'ꞥ' => 'Ꞥ',
  47088. 'ꞧ' => 'Ꞧ',
  47089. 'ꞩ' => 'Ꞩ',
  47090. '�' => 'A',
  47091. 'b' => 'B',
  47092. 'c' => 'C',
  47093. 'd' => 'D',
  47094. 'ï½…' => 'ï¼¥',
  47095. 'f' => 'F',
  47096. 'g' => 'G',
  47097. 'h' => 'H',
  47098. 'i' => 'I',
  47099. 'j' => 'J',
  47100. 'k' => 'K',
  47101. 'l' => 'L',
  47102. '�' => 'M',
  47103. 'n' => 'N',
  47104. '�' => 'O',
  47105. '�' => 'P',
  47106. 'q' => 'Q',
  47107. 'ï½’' => 'ï¼²',
  47108. 's' => 'S',
  47109. 'ï½”' => 'ï¼´',
  47110. 'u' => 'U',
  47111. 'v' => 'V',
  47112. 'ï½—' => 'ï¼·',
  47113. 'x' => 'X',
  47114. 'ï½™' => 'ï¼¹',
  47115. 'z' => 'Z',
  47116. '�' => '�',
  47117. '�' => '�',
  47118. '�' => '�',
  47119. '�' => '�',
  47120. '�' => '�',
  47121. '�' => '�',
  47122. '�' => '�',
  47123. '�' => '�',
  47124. '�' => '�',
  47125. '�' => '�',
  47126. '�' => '�',
  47127. '�' => '�',
  47128. '�' => '�',
  47129. '�' => '�',
  47130. '�' => '�',
  47131. '�' => '�',
  47132. '�' => '�',
  47133. '�' => '�',
  47134. '�' => '�',
  47135. '�' => '�',
  47136. '�' => '�',
  47137. '�' => '�',
  47138. '�' => '�',
  47139. '�' => '�',
  47140. '�' => '�',
  47141. '�' => '�',
  47142. '�' => '�',
  47143. '�' => '�',
  47144. '�' => '�',
  47145. '�' => '�',
  47146. '�' => '�',
  47147. '�' => '�',
  47148. '�' => '�',
  47149. '�' => '�',
  47150. '�' => '�',
  47151. '�' => '�',
  47152. '�' => '�',
  47153. '�' => '�',
  47154. '�' => '�',
  47155. '�' => '�',
  47156. 'ð‘£€' => 'ð‘¢ ',
  47157. '�' => '𑢡',
  47158. '𑣂' => '𑢢',
  47159. '𑣃' => '𑢣',
  47160. '𑣄' => '𑢤',
  47161. 'ð‘£…' => 'ð‘¢¥',
  47162. '𑣆' => '𑢦',
  47163. '𑣇' => '𑢧',
  47164. '𑣈' => '𑢨',
  47165. '𑣉' => '𑢩',
  47166. '𑣊' => '𑢪',
  47167. '𑣋' => '𑢫',
  47168. '𑣌' => '𑢬',
  47169. '�' => '𑢭',
  47170. '𑣎' => '𑢮',
  47171. '�' => '𑢯',
  47172. '�' => '𑢰',
  47173. '𑣑' => '𑢱',
  47174. 'ð‘£’' => 'ð‘¢²',
  47175. '𑣓' => '𑢳',
  47176. 'ð‘£”' => 'ð‘¢´',
  47177. '𑣕' => '𑢵',
  47178. '𑣖' => '𑢶',
  47179. 'ð‘£—' => 'ð‘¢·',
  47180. '𑣘' => '𑢸',
  47181. 'ð‘£™' => 'ð‘¢¹',
  47182. '𑣚' => '𑢺',
  47183. 'ð‘£›' => 'ð‘¢»',
  47184. '𑣜' => '𑢼',
  47185. '�' => '𑢽',
  47186. '𑣞' => '𑢾',
  47187. '𑣟' => '𑢿',
  47188. );
  47189. <?php
  47190. use Symfony\Polyfill\Mbstring as p;
  47191. if (!function_exists('mb_convert_encoding')) {
  47192. function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); }
  47193. }
  47194. if (!function_exists('mb_decode_mimeheader')) {
  47195. function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); }
  47196. }
  47197. if (!function_exists('mb_encode_mimeheader')) {
  47198. function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); }
  47199. }
  47200. if (!function_exists('mb_decode_numericentity')) {
  47201. function mb_decode_numericentity($s, $convmap, $enc = null) { return p\Mbstring::mb_decode_numericentity($s, $convmap, $enc); }
  47202. }
  47203. if (!function_exists('mb_encode_numericentity')) {
  47204. function mb_encode_numericentity($s, $convmap, $enc = null, $is_hex = false) { return p\Mbstring::mb_encode_numericentity($s, $convmap, $enc, $is_hex); }
  47205. }
  47206. if (!function_exists('mb_convert_case')) {
  47207. function mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); }
  47208. }
  47209. if (!function_exists('mb_internal_encoding')) {
  47210. function mb_internal_encoding($enc = null) { return p\Mbstring::mb_internal_encoding($enc); }
  47211. }
  47212. if (!function_exists('mb_language')) {
  47213. function mb_language($lang = null) { return p\Mbstring::mb_language($lang); }
  47214. }
  47215. if (!function_exists('mb_list_encodings')) {
  47216. function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
  47217. }
  47218. if (!function_exists('mb_encoding_aliases')) {
  47219. function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); }
  47220. }
  47221. if (!function_exists('mb_check_encoding')) {
  47222. function mb_check_encoding($var = null, $encoding = null) { return p\Mbstring::mb_check_encoding($var, $encoding); }
  47223. }
  47224. if (!function_exists('mb_detect_encoding')) {
  47225. function mb_detect_encoding($str, $encodingList = null, $strict = false) { return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); }
  47226. }
  47227. if (!function_exists('mb_detect_order')) {
  47228. function mb_detect_order($encodingList = null) { return p\Mbstring::mb_detect_order($encodingList); }
  47229. }
  47230. if (!function_exists('mb_parse_str')) {
  47231. function mb_parse_str($s, &$result = array()) { parse_str($s, $result); }
  47232. }
  47233. if (!function_exists('mb_strlen')) {
  47234. function mb_strlen($s, $enc = null) { return p\Mbstring::mb_strlen($s, $enc); }
  47235. }
  47236. if (!function_exists('mb_strpos')) {
  47237. function mb_strpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); }
  47238. }
  47239. if (!function_exists('mb_strtolower')) {
  47240. function mb_strtolower($s, $enc = null) { return p\Mbstring::mb_strtolower($s, $enc); }
  47241. }
  47242. if (!function_exists('mb_strtoupper')) {
  47243. function mb_strtoupper($s, $enc = null) { return p\Mbstring::mb_strtoupper($s, $enc); }
  47244. }
  47245. if (!function_exists('mb_substitute_character')) {
  47246. function mb_substitute_character($char = null) { return p\Mbstring::mb_substitute_character($char); }
  47247. }
  47248. if (!function_exists('mb_substr')) {
  47249. function mb_substr($s, $start, $length = 2147483647, $enc = null) { return p\Mbstring::mb_substr($s, $start, $length, $enc); }
  47250. }
  47251. if (!function_exists('mb_stripos')) {
  47252. function mb_stripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); }
  47253. }
  47254. if (!function_exists('mb_stristr')) {
  47255. function mb_stristr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_stristr($s, $needle, $part, $enc); }
  47256. }
  47257. if (!function_exists('mb_strrchr')) {
  47258. function mb_strrchr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); }
  47259. }
  47260. if (!function_exists('mb_strrichr')) {
  47261. function mb_strrichr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); }
  47262. }
  47263. if (!function_exists('mb_strripos')) {
  47264. function mb_strripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); }
  47265. }
  47266. if (!function_exists('mb_strrpos')) {
  47267. function mb_strrpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); }
  47268. }
  47269. if (!function_exists('mb_strstr')) {
  47270. function mb_strstr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strstr($s, $needle, $part, $enc); }
  47271. }
  47272. if (!function_exists('mb_get_info')) {
  47273. function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); }
  47274. }
  47275. if (!function_exists('mb_http_output')) {
  47276. function mb_http_output($enc = null) { return p\Mbstring::mb_http_output($enc); }
  47277. }
  47278. if (!function_exists('mb_strwidth')) {
  47279. function mb_strwidth($s, $enc = null) { return p\Mbstring::mb_strwidth($s, $enc); }
  47280. }
  47281. if (!function_exists('mb_substr_count')) {
  47282. function mb_substr_count($haystack, $needle, $enc = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $enc); }
  47283. }
  47284. if (!function_exists('mb_output_handler')) {
  47285. function mb_output_handler($contents, $status) { return p\Mbstring::mb_output_handler($contents, $status); }
  47286. }
  47287. if (!function_exists('mb_http_input')) {
  47288. function mb_http_input($type = '') { return p\Mbstring::mb_http_input($type); }
  47289. }
  47290. if (!function_exists('mb_convert_variables')) {
  47291. 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); }
  47292. }
  47293. if (!function_exists('mb_ord')) {
  47294. function mb_ord($s, $enc = null) { return p\Mbstring::mb_ord($s, $enc); }
  47295. }
  47296. if (!function_exists('mb_chr')) {
  47297. function mb_chr($code, $enc = null) { return p\Mbstring::mb_chr($code, $enc); }
  47298. }
  47299. if (!function_exists('mb_scrub')) {
  47300. function mb_scrub($s, $enc = null) { $enc = null === $enc ? mb_internal_encoding() : $enc; return mb_convert_encoding($s, $enc, $enc); }
  47301. }
  47302. if (!function_exists('mb_str_split')) {
  47303. function mb_str_split($string, $split_length = 1, $encoding = null) { return p\Mbstring::mb_str_split($string, $split_length, $encoding); }
  47304. }
  47305. if (extension_loaded('mbstring')) {
  47306. return;
  47307. }
  47308. if (!defined('MB_CASE_UPPER')) {
  47309. define('MB_CASE_UPPER', 0);
  47310. }
  47311. if (!defined('MB_CASE_LOWER')) {
  47312. define('MB_CASE_LOWER', 1);
  47313. }
  47314. if (!defined('MB_CASE_TITLE')) {
  47315. define('MB_CASE_TITLE', 2);
  47316. }
  47317. <?php
  47318. namespace Symfony\Component\Process\Exception;
  47319. interface ExceptionInterface
  47320. {
  47321. }
  47322. <?php
  47323. namespace Symfony\Component\Process\Exception;
  47324. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  47325. {
  47326. }
  47327. <?php
  47328. namespace Symfony\Component\Process\Exception;
  47329. class LogicException extends \LogicException implements ExceptionInterface
  47330. {
  47331. }
  47332. <?php
  47333. namespace Symfony\Component\Process\Exception;
  47334. use Symfony\Component\Process\Process;
  47335. class ProcessFailedException extends RuntimeException
  47336. {
  47337. private $process;
  47338. public function __construct(Process $process)
  47339. {
  47340. if ($process->isSuccessful()) {
  47341. throw new InvalidArgumentException('Expected a failed process, but the given process was successful.');
  47342. }
  47343. $error = sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s",
  47344. $process->getCommandLine(),
  47345. $process->getExitCode(),
  47346. $process->getExitCodeText(),
  47347. $process->getWorkingDirectory()
  47348. );
  47349. if (!$process->isOutputDisabled()) {
  47350. $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s",
  47351. $process->getOutput(),
  47352. $process->getErrorOutput()
  47353. );
  47354. }
  47355. parent::__construct($error);
  47356. $this->process = $process;
  47357. }
  47358. public function getProcess()
  47359. {
  47360. return $this->process;
  47361. }
  47362. }
  47363. <?php
  47364. namespace Symfony\Component\Process\Exception;
  47365. use Symfony\Component\Process\Process;
  47366. class ProcessTimedOutException extends RuntimeException
  47367. {
  47368. const TYPE_GENERAL = 1;
  47369. const TYPE_IDLE = 2;
  47370. private $process;
  47371. private $timeoutType;
  47372. public function __construct(Process $process, $timeoutType)
  47373. {
  47374. $this->process = $process;
  47375. $this->timeoutType = $timeoutType;
  47376. parent::__construct(sprintf(
  47377. 'The process "%s" exceeded the timeout of %s seconds.',
  47378. $process->getCommandLine(),
  47379. $this->getExceededTimeout()
  47380. ));
  47381. }
  47382. public function getProcess()
  47383. {
  47384. return $this->process;
  47385. }
  47386. public function isGeneralTimeout()
  47387. {
  47388. return self::TYPE_GENERAL === $this->timeoutType;
  47389. }
  47390. public function isIdleTimeout()
  47391. {
  47392. return self::TYPE_IDLE === $this->timeoutType;
  47393. }
  47394. public function getExceededTimeout()
  47395. {
  47396. switch ($this->timeoutType) {
  47397. case self::TYPE_GENERAL:
  47398. return $this->process->getTimeout();
  47399. case self::TYPE_IDLE:
  47400. return $this->process->getIdleTimeout();
  47401. default:
  47402. throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType));
  47403. }
  47404. }
  47405. }
  47406. <?php
  47407. namespace Symfony\Component\Process\Exception;
  47408. class RuntimeException extends \RuntimeException implements ExceptionInterface
  47409. {
  47410. }
  47411. <?php
  47412. namespace Symfony\Component\Process;
  47413. class ExecutableFinder
  47414. {
  47415. private $suffixes = array('.exe', '.bat', '.cmd', '.com');
  47416. public function setSuffixes(array $suffixes)
  47417. {
  47418. $this->suffixes = $suffixes;
  47419. }
  47420. public function addSuffix($suffix)
  47421. {
  47422. $this->suffixes[] = $suffix;
  47423. }
  47424. public function find($name, $default = null, array $extraDirs = array())
  47425. {
  47426. if (ini_get('open_basedir')) {
  47427. $searchPath = explode(PATH_SEPARATOR, ini_get('open_basedir'));
  47428. $dirs = array();
  47429. foreach ($searchPath as $path) {
  47430. if (@is_dir($path)) {
  47431. $dirs[] = $path;
  47432. } else {
  47433. if (basename($path) == $name && @is_executable($path)) {
  47434. return $path;
  47435. }
  47436. }
  47437. }
  47438. } else {
  47439. $dirs = array_merge(
  47440. explode(PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
  47441. $extraDirs
  47442. );
  47443. }
  47444. $suffixes = array('');
  47445. if ('\\' === \DIRECTORY_SEPARATOR) {
  47446. $pathExt = getenv('PATHEXT');
  47447. $suffixes = array_merge($pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes);
  47448. }
  47449. foreach ($suffixes as $suffix) {
  47450. foreach ($dirs as $dir) {
  47451. if (@is_file($file = $dir.\DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === \DIRECTORY_SEPARATOR || @is_executable($file))) {
  47452. return $file;
  47453. }
  47454. }
  47455. }
  47456. return $default;
  47457. }
  47458. }
  47459. Copyright (c) 2004-2018 Fabien Potencier
  47460. Permission is hereby granted, free of charge, to any person obtaining a copy
  47461. of this software and associated documentation files (the "Software"), to deal
  47462. in the Software without restriction, including without limitation the rights
  47463. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  47464. copies of the Software, and to permit persons to whom the Software is furnished
  47465. to do so, subject to the following conditions:
  47466. The above copyright notice and this permission notice shall be included in all
  47467. copies or substantial portions of the Software.
  47468. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  47469. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  47470. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  47471. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  47472. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  47473. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  47474. THE SOFTWARE.
  47475. <?php
  47476. namespace Symfony\Component\Process;
  47477. class PhpExecutableFinder
  47478. {
  47479. private $executableFinder;
  47480. public function __construct()
  47481. {
  47482. $this->executableFinder = new ExecutableFinder();
  47483. }
  47484. public function find($includeArgs = true)
  47485. {
  47486. $args = $this->findArguments();
  47487. $args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
  47488. if (\defined('HHVM_VERSION')) {
  47489. return (getenv('PHP_BINARY') ?: PHP_BINARY).$args;
  47490. }
  47491. if (\defined('PHP_BINARY') && PHP_BINARY && \in_array(\PHP_SAPI, array('cli', 'cli-server', 'phpdbg'), true)) {
  47492. return PHP_BINARY.$args;
  47493. }
  47494. if ($php = getenv('PHP_PATH')) {
  47495. if (!@is_executable($php)) {
  47496. return false;
  47497. }
  47498. return $php;
  47499. }
  47500. if ($php = getenv('PHP_PEAR_PHP_BIN')) {
  47501. if (@is_executable($php)) {
  47502. return $php;
  47503. }
  47504. }
  47505. if (@is_executable($php = PHP_BINDIR.('\\' === \DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) {
  47506. return $php;
  47507. }
  47508. $dirs = array(PHP_BINDIR);
  47509. if ('\\' === \DIRECTORY_SEPARATOR) {
  47510. $dirs[] = 'C:\xampp\php\\';
  47511. }
  47512. return $this->executableFinder->find('php', false, $dirs);
  47513. }
  47514. public function findArguments()
  47515. {
  47516. $arguments = array();
  47517. if (\defined('HHVM_VERSION')) {
  47518. $arguments[] = '--php';
  47519. } elseif ('phpdbg' === \PHP_SAPI) {
  47520. $arguments[] = '-qrr';
  47521. }
  47522. return $arguments;
  47523. }
  47524. }
  47525. <?php
  47526. namespace Symfony\Component\Process;
  47527. use Symfony\Component\Process\Exception\RuntimeException;
  47528. class PhpProcess extends Process
  47529. {
  47530. public function __construct($script, $cwd = null, array $env = null, $timeout = 60, array $options = array())
  47531. {
  47532. $executableFinder = new PhpExecutableFinder();
  47533. if (false === $php = $executableFinder->find()) {
  47534. $php = null;
  47535. }
  47536. if ('phpdbg' === \PHP_SAPI) {
  47537. $file = tempnam(sys_get_temp_dir(), 'dbg');
  47538. file_put_contents($file, $script);
  47539. register_shutdown_function('unlink', $file);
  47540. $php .= ' '.ProcessUtils::escapeArgument($file);
  47541. $script = null;
  47542. }
  47543. if ('\\' !== \DIRECTORY_SEPARATOR && null !== $php) {
  47544. $php = 'exec '.$php;
  47545. }
  47546. parent::__construct($php, $cwd, $env, $script, $timeout, $options);
  47547. }
  47548. public function setPhpBinary($php)
  47549. {
  47550. $this->setCommandLine($php);
  47551. }
  47552. public function start($callback = null)
  47553. {
  47554. if (null === $this->getCommandLine()) {
  47555. throw new RuntimeException('Unable to find the PHP executable.');
  47556. }
  47557. parent::start($callback);
  47558. }
  47559. }
  47560. <?php
  47561. namespace Symfony\Component\Process\Pipes;
  47562. abstract class AbstractPipes implements PipesInterface
  47563. {
  47564. public $pipes = array();
  47565. private $inputBuffer = '';
  47566. private $input;
  47567. private $blocked = true;
  47568. private $lastError;
  47569. public function __construct($input)
  47570. {
  47571. if (\is_resource($input)) {
  47572. $this->input = $input;
  47573. } elseif (\is_string($input)) {
  47574. $this->inputBuffer = $input;
  47575. } else {
  47576. $this->inputBuffer = (string) $input;
  47577. }
  47578. }
  47579. public function close()
  47580. {
  47581. foreach ($this->pipes as $pipe) {
  47582. fclose($pipe);
  47583. }
  47584. $this->pipes = array();
  47585. }
  47586. protected function hasSystemCallBeenInterrupted()
  47587. {
  47588. $lastError = $this->lastError;
  47589. $this->lastError = null;
  47590. return null !== $lastError && false !== stripos($lastError, 'interrupted system call');
  47591. }
  47592. protected function unblock()
  47593. {
  47594. if (!$this->blocked) {
  47595. return;
  47596. }
  47597. foreach ($this->pipes as $pipe) {
  47598. stream_set_blocking($pipe, 0);
  47599. }
  47600. if (null !== $this->input) {
  47601. stream_set_blocking($this->input, 0);
  47602. }
  47603. $this->blocked = false;
  47604. }
  47605. protected function write()
  47606. {
  47607. if (!isset($this->pipes[0])) {
  47608. return;
  47609. }
  47610. $input = $this->input;
  47611. $r = $e = array();
  47612. $w = array($this->pipes[0]);
  47613. if (false === @stream_select($r, $w, $e, 0, 0)) {
  47614. return;
  47615. }
  47616. foreach ($w as $stdin) {
  47617. if (isset($this->inputBuffer[0])) {
  47618. $written = fwrite($stdin, $this->inputBuffer);
  47619. $this->inputBuffer = substr($this->inputBuffer, $written);
  47620. if (isset($this->inputBuffer[0])) {
  47621. return array($this->pipes[0]);
  47622. }
  47623. }
  47624. if ($input) {
  47625. for (;;) {
  47626. $data = fread($input, self::CHUNK_SIZE);
  47627. if (!isset($data[0])) {
  47628. break;
  47629. }
  47630. $written = fwrite($stdin, $data);
  47631. $data = substr($data, $written);
  47632. if (isset($data[0])) {
  47633. $this->inputBuffer = $data;
  47634. return array($this->pipes[0]);
  47635. }
  47636. }
  47637. if (feof($input)) {
  47638. $this->input = null;
  47639. }
  47640. }
  47641. }
  47642. if (null === $this->input && !isset($this->inputBuffer[0])) {
  47643. fclose($this->pipes[0]);
  47644. unset($this->pipes[0]);
  47645. } elseif (!$w) {
  47646. return array($this->pipes[0]);
  47647. }
  47648. }
  47649. public function handleError($type, $msg)
  47650. {
  47651. $this->lastError = $msg;
  47652. }
  47653. }
  47654. <?php
  47655. namespace Symfony\Component\Process\Pipes;
  47656. interface PipesInterface
  47657. {
  47658. const CHUNK_SIZE = 16384;
  47659. public function getDescriptors();
  47660. public function getFiles();
  47661. public function readAndWrite($blocking, $close = false);
  47662. public function areOpen();
  47663. public function close();
  47664. }
  47665. <?php
  47666. namespace Symfony\Component\Process\Pipes;
  47667. use Symfony\Component\Process\Process;
  47668. class UnixPipes extends AbstractPipes
  47669. {
  47670. private $ttyMode;
  47671. private $ptyMode;
  47672. private $disableOutput;
  47673. public function __construct($ttyMode, $ptyMode, $input, $disableOutput)
  47674. {
  47675. $this->ttyMode = (bool) $ttyMode;
  47676. $this->ptyMode = (bool) $ptyMode;
  47677. $this->disableOutput = (bool) $disableOutput;
  47678. parent::__construct($input);
  47679. }
  47680. public function __destruct()
  47681. {
  47682. $this->close();
  47683. }
  47684. public function getDescriptors()
  47685. {
  47686. if ($this->disableOutput) {
  47687. $nullstream = fopen('/dev/null', 'c');
  47688. return array(
  47689. array('pipe', 'r'),
  47690. $nullstream,
  47691. $nullstream,
  47692. );
  47693. }
  47694. if ($this->ttyMode) {
  47695. return array(
  47696. array('file', '/dev/tty', 'r'),
  47697. array('file', '/dev/tty', 'w'),
  47698. array('file', '/dev/tty', 'w'),
  47699. );
  47700. }
  47701. if ($this->ptyMode && Process::isPtySupported()) {
  47702. return array(
  47703. array('pty'),
  47704. array('pty'),
  47705. array('pty'),
  47706. );
  47707. }
  47708. return array(
  47709. array('pipe', 'r'),
  47710. array('pipe', 'w'),
  47711. array('pipe', 'w'),
  47712. );
  47713. }
  47714. public function getFiles()
  47715. {
  47716. return array();
  47717. }
  47718. public function readAndWrite($blocking, $close = false)
  47719. {
  47720. $this->unblock();
  47721. $w = $this->write();
  47722. $read = $e = array();
  47723. $r = $this->pipes;
  47724. unset($r[0]);
  47725. set_error_handler(array($this, 'handleError'));
  47726. if (($r || $w) && false === stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
  47727. restore_error_handler();
  47728. if (!$this->hasSystemCallBeenInterrupted()) {
  47729. $this->pipes = array();
  47730. }
  47731. return $read;
  47732. }
  47733. restore_error_handler();
  47734. foreach ($r as $pipe) {
  47735. $read[$type = array_search($pipe, $this->pipes, true)] = '';
  47736. do {
  47737. $data = fread($pipe, self::CHUNK_SIZE);
  47738. $read[$type] .= $data;
  47739. } while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));
  47740. if (!isset($read[$type][0])) {
  47741. unset($read[$type]);
  47742. }
  47743. if ($close && feof($pipe)) {
  47744. fclose($pipe);
  47745. unset($this->pipes[$type]);
  47746. }
  47747. }
  47748. return $read;
  47749. }
  47750. public function areOpen()
  47751. {
  47752. return (bool) $this->pipes;
  47753. }
  47754. public static function create(Process $process, $input)
  47755. {
  47756. return new static($process->isTty(), $process->isPty(), $input, $process->isOutputDisabled());
  47757. }
  47758. }
  47759. <?php
  47760. namespace Symfony\Component\Process\Pipes;
  47761. use Symfony\Component\Process\Exception\RuntimeException;
  47762. use Symfony\Component\Process\Process;
  47763. class WindowsPipes extends AbstractPipes
  47764. {
  47765. private $files = array();
  47766. private $fileHandles = array();
  47767. private $lockHandles = array();
  47768. private $readBytes = array(
  47769. Process::STDOUT => 0,
  47770. Process::STDERR => 0,
  47771. );
  47772. private $disableOutput;
  47773. public function __construct($disableOutput, $input)
  47774. {
  47775. $this->disableOutput = (bool) $disableOutput;
  47776. if (!$this->disableOutput) {
  47777. $pipes = array(
  47778. Process::STDOUT => Process::OUT,
  47779. Process::STDERR => Process::ERR,
  47780. );
  47781. $tmpDir = sys_get_temp_dir();
  47782. $lastError = 'unknown reason';
  47783. set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
  47784. for ($i = 0;; ++$i) {
  47785. foreach ($pipes as $pipe => $name) {
  47786. $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
  47787. if (!$h = fopen($file.'.lock', 'w')) {
  47788. restore_error_handler();
  47789. throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $lastError));
  47790. }
  47791. if (!flock($h, LOCK_EX | LOCK_NB)) {
  47792. continue 2;
  47793. }
  47794. if (isset($this->lockHandles[$pipe])) {
  47795. flock($this->lockHandles[$pipe], LOCK_UN);
  47796. fclose($this->lockHandles[$pipe]);
  47797. }
  47798. $this->lockHandles[$pipe] = $h;
  47799. if (!fclose(fopen($file, 'w')) || !$h = fopen($file, 'r')) {
  47800. flock($this->lockHandles[$pipe], LOCK_UN);
  47801. fclose($this->lockHandles[$pipe]);
  47802. unset($this->lockHandles[$pipe]);
  47803. continue 2;
  47804. }
  47805. $this->fileHandles[$pipe] = $h;
  47806. $this->files[$pipe] = $file;
  47807. }
  47808. break;
  47809. }
  47810. restore_error_handler();
  47811. }
  47812. parent::__construct($input);
  47813. }
  47814. public function __destruct()
  47815. {
  47816. $this->close();
  47817. }
  47818. public function getDescriptors()
  47819. {
  47820. if ($this->disableOutput) {
  47821. $nullstream = fopen('NUL', 'c');
  47822. return array(
  47823. array('pipe', 'r'),
  47824. $nullstream,
  47825. $nullstream,
  47826. );
  47827. }
  47828. return array(
  47829. array('pipe', 'r'),
  47830. array('file', 'NUL', 'w'),
  47831. array('file', 'NUL', 'w'),
  47832. );
  47833. }
  47834. public function getFiles()
  47835. {
  47836. return $this->files;
  47837. }
  47838. public function readAndWrite($blocking, $close = false)
  47839. {
  47840. $this->unblock();
  47841. $w = $this->write();
  47842. $read = $r = $e = array();
  47843. if ($blocking) {
  47844. if ($w) {
  47845. @stream_select($r, $w, $e, 0, Process::TIMEOUT_PRECISION * 1E6);
  47846. } elseif ($this->fileHandles) {
  47847. usleep(Process::TIMEOUT_PRECISION * 1E6);
  47848. }
  47849. }
  47850. foreach ($this->fileHandles as $type => $fileHandle) {
  47851. $data = stream_get_contents($fileHandle, -1, $this->readBytes[$type]);
  47852. if (isset($data[0])) {
  47853. $this->readBytes[$type] += \strlen($data);
  47854. $read[$type] = $data;
  47855. }
  47856. if ($close) {
  47857. ftruncate($fileHandle, 0);
  47858. fclose($fileHandle);
  47859. flock($this->lockHandles[$type], LOCK_UN);
  47860. fclose($this->lockHandles[$type]);
  47861. unset($this->fileHandles[$type], $this->lockHandles[$type]);
  47862. }
  47863. }
  47864. return $read;
  47865. }
  47866. public function areOpen()
  47867. {
  47868. return $this->pipes && $this->fileHandles;
  47869. }
  47870. public function close()
  47871. {
  47872. parent::close();
  47873. foreach ($this->fileHandles as $type => $handle) {
  47874. ftruncate($handle, 0);
  47875. fclose($handle);
  47876. flock($this->lockHandles[$type], LOCK_UN);
  47877. fclose($this->lockHandles[$type]);
  47878. }
  47879. $this->fileHandles = $this->lockHandles = array();
  47880. }
  47881. public static function create(Process $process, $input)
  47882. {
  47883. return new static($process->isOutputDisabled(), $input);
  47884. }
  47885. }
  47886. <?php
  47887. namespace Symfony\Component\Process;
  47888. use Symfony\Component\Process\Exception\InvalidArgumentException;
  47889. use Symfony\Component\Process\Exception\LogicException;
  47890. use Symfony\Component\Process\Exception\ProcessFailedException;
  47891. use Symfony\Component\Process\Exception\ProcessTimedOutException;
  47892. use Symfony\Component\Process\Exception\RuntimeException;
  47893. use Symfony\Component\Process\Pipes\PipesInterface;
  47894. use Symfony\Component\Process\Pipes\UnixPipes;
  47895. use Symfony\Component\Process\Pipes\WindowsPipes;
  47896. class Process
  47897. {
  47898. const ERR = 'err';
  47899. const OUT = 'out';
  47900. const STATUS_READY = 'ready';
  47901. const STATUS_STARTED = 'started';
  47902. const STATUS_TERMINATED = 'terminated';
  47903. const STDIN = 0;
  47904. const STDOUT = 1;
  47905. const STDERR = 2;
  47906. const TIMEOUT_PRECISION = 0.2;
  47907. private $callback;
  47908. private $commandline;
  47909. private $cwd;
  47910. private $env;
  47911. private $input;
  47912. private $starttime;
  47913. private $lastOutputTime;
  47914. private $timeout;
  47915. private $idleTimeout;
  47916. private $options;
  47917. private $exitcode;
  47918. private $fallbackStatus = array();
  47919. private $processInformation;
  47920. private $outputDisabled = false;
  47921. private $stdout;
  47922. private $stderr;
  47923. private $enhanceWindowsCompatibility = true;
  47924. private $enhanceSigchildCompatibility;
  47925. private $process;
  47926. private $status = self::STATUS_READY;
  47927. private $incrementalOutputOffset = 0;
  47928. private $incrementalErrorOutputOffset = 0;
  47929. private $tty;
  47930. private $pty;
  47931. private $useFileHandles = false;
  47932. private $processPipes;
  47933. private $latestSignal;
  47934. private static $sigchild;
  47935. public static $exitCodes = array(
  47936. 0 => 'OK',
  47937. 1 => 'General error',
  47938. 2 => 'Misuse of shell builtins',
  47939. 126 => 'Invoked command cannot execute',
  47940. 127 => 'Command not found',
  47941. 128 => 'Invalid exit argument',
  47942. 129 => 'Hangup',
  47943. 130 => 'Interrupt',
  47944. 131 => 'Quit and dump core',
  47945. 132 => 'Illegal instruction',
  47946. 133 => 'Trace/breakpoint trap',
  47947. 134 => 'Process aborted',
  47948. 135 => 'Bus error: "access to undefined portion of memory object"',
  47949. 136 => 'Floating point exception: "erroneous arithmetic operation"',
  47950. 137 => 'Kill (terminate immediately)',
  47951. 138 => 'User-defined 1',
  47952. 139 => 'Segmentation violation',
  47953. 140 => 'User-defined 2',
  47954. 141 => 'Write to pipe with no one reading',
  47955. 142 => 'Signal raised by alarm',
  47956. 143 => 'Termination (request to terminate)',
  47957. 145 => 'Child process terminated, stopped (or continued*)',
  47958. 146 => 'Continue if stopped',
  47959. 147 => 'Stop executing temporarily',
  47960. 148 => 'Terminal stop signal',
  47961. 149 => 'Background process attempting to read from tty ("in")',
  47962. 150 => 'Background process attempting to write to tty ("out")',
  47963. 151 => 'Urgent data available on socket',
  47964. 152 => 'CPU time limit exceeded',
  47965. 153 => 'File size limit exceeded',
  47966. 154 => 'Signal raised by timer counting virtual time: "virtual timer expired"',
  47967. 155 => 'Profiling timer expired',
  47968. 157 => 'Pollable event',
  47969. 159 => 'Bad syscall',
  47970. );
  47971. public function __construct($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = array())
  47972. {
  47973. if (!\function_exists('proc_open')) {
  47974. throw new RuntimeException('The Process class relies on proc_open, which is not available on your PHP installation.');
  47975. }
  47976. $this->commandline = $commandline;
  47977. $this->cwd = $cwd;
  47978. if (null === $this->cwd && (\defined('ZEND_THREAD_SAFE') || '\\' === \DIRECTORY_SEPARATOR)) {
  47979. $this->cwd = getcwd();
  47980. }
  47981. if (null !== $env) {
  47982. $this->setEnv($env);
  47983. }
  47984. $this->setInput($input);
  47985. $this->setTimeout($timeout);
  47986. $this->useFileHandles = '\\' === \DIRECTORY_SEPARATOR;
  47987. $this->pty = false;
  47988. $this->enhanceSigchildCompatibility = '\\' !== \DIRECTORY_SEPARATOR && $this->isSigchildEnabled();
  47989. $this->options = array_replace(array('suppress_errors' => true, 'binary_pipes' => true), $options);
  47990. }
  47991. public function __destruct()
  47992. {
  47993. $this->stop(0);
  47994. }
  47995. public function __clone()
  47996. {
  47997. $this->resetProcessData();
  47998. }
  47999. public function run($callback = null)
  48000. {
  48001. $this->start($callback);
  48002. return $this->wait();
  48003. }
  48004. public function mustRun($callback = null)
  48005. {
  48006. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  48007. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  48008. }
  48009. if (0 !== $this->run($callback)) {
  48010. throw new ProcessFailedException($this);
  48011. }
  48012. return $this;
  48013. }
  48014. public function start($callback = null)
  48015. {
  48016. if ($this->isRunning()) {
  48017. throw new RuntimeException('Process is already running');
  48018. }
  48019. if ($this->outputDisabled && null !== $callback) {
  48020. throw new LogicException('Output has been disabled, enable it to allow the use of a callback.');
  48021. }
  48022. $this->resetProcessData();
  48023. $this->starttime = $this->lastOutputTime = microtime(true);
  48024. $this->callback = $this->buildCallback($callback);
  48025. $descriptors = $this->getDescriptors();
  48026. $commandline = $this->commandline;
  48027. if ('\\' === \DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) {
  48028. $commandline = 'cmd /V:ON /E:ON /D /C "('.$commandline.')';
  48029. foreach ($this->processPipes->getFiles() as $offset => $filename) {
  48030. $commandline .= ' '.$offset.'>'.ProcessUtils::escapeArgument($filename);
  48031. }
  48032. $commandline .= '"';
  48033. if (!isset($this->options['bypass_shell'])) {
  48034. $this->options['bypass_shell'] = true;
  48035. }
  48036. } elseif (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  48037. $descriptors[3] = array('pipe', 'w');
  48038. $commandline = '{ ('.$this->commandline.') <&3 3<&- 3>/dev/null & } 3<&0;';
  48039. $commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code';
  48040. $ptsWorkaround = fopen(__FILE__, 'r');
  48041. }
  48042. $this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $this->env, $this->options);
  48043. if (!\is_resource($this->process)) {
  48044. throw new RuntimeException('Unable to launch a new process.');
  48045. }
  48046. $this->status = self::STATUS_STARTED;
  48047. if (isset($descriptors[3])) {
  48048. $this->fallbackStatus['pid'] = (int) fgets($this->processPipes->pipes[3]);
  48049. }
  48050. if ($this->tty) {
  48051. return;
  48052. }
  48053. $this->updateStatus(false);
  48054. $this->checkTimeout();
  48055. }
  48056. public function restart($callback = null)
  48057. {
  48058. if ($this->isRunning()) {
  48059. throw new RuntimeException('Process is already running');
  48060. }
  48061. $process = clone $this;
  48062. $process->start($callback);
  48063. return $process;
  48064. }
  48065. public function wait($callback = null)
  48066. {
  48067. $this->requireProcessIsStarted(__FUNCTION__);
  48068. $this->updateStatus(false);
  48069. if (null !== $callback) {
  48070. $this->callback = $this->buildCallback($callback);
  48071. }
  48072. do {
  48073. $this->checkTimeout();
  48074. $running = '\\' === \DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
  48075. $this->readPipes($running, '\\' !== \DIRECTORY_SEPARATOR || !$running);
  48076. } while ($running);
  48077. while ($this->isRunning()) {
  48078. usleep(1000);
  48079. }
  48080. if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
  48081. throw new RuntimeException(sprintf('The process has been signaled with signal "%s".', $this->processInformation['termsig']));
  48082. }
  48083. return $this->exitcode;
  48084. }
  48085. public function getPid()
  48086. {
  48087. return $this->isRunning() ? $this->processInformation['pid'] : null;
  48088. }
  48089. public function signal($signal)
  48090. {
  48091. $this->doSignal($signal, true);
  48092. return $this;
  48093. }
  48094. public function disableOutput()
  48095. {
  48096. if ($this->isRunning()) {
  48097. throw new RuntimeException('Disabling output while the process is running is not possible.');
  48098. }
  48099. if (null !== $this->idleTimeout) {
  48100. throw new LogicException('Output can not be disabled while an idle timeout is set.');
  48101. }
  48102. $this->outputDisabled = true;
  48103. return $this;
  48104. }
  48105. public function enableOutput()
  48106. {
  48107. if ($this->isRunning()) {
  48108. throw new RuntimeException('Enabling output while the process is running is not possible.');
  48109. }
  48110. $this->outputDisabled = false;
  48111. return $this;
  48112. }
  48113. public function isOutputDisabled()
  48114. {
  48115. return $this->outputDisabled;
  48116. }
  48117. public function getOutput()
  48118. {
  48119. $this->readPipesForOutput(__FUNCTION__);
  48120. if (false === $ret = stream_get_contents($this->stdout, -1, 0)) {
  48121. return '';
  48122. }
  48123. return $ret;
  48124. }
  48125. public function getIncrementalOutput()
  48126. {
  48127. $this->readPipesForOutput(__FUNCTION__);
  48128. $latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
  48129. $this->incrementalOutputOffset = ftell($this->stdout);
  48130. if (false === $latest) {
  48131. return '';
  48132. }
  48133. return $latest;
  48134. }
  48135. public function clearOutput()
  48136. {
  48137. ftruncate($this->stdout, 0);
  48138. fseek($this->stdout, 0);
  48139. $this->incrementalOutputOffset = 0;
  48140. return $this;
  48141. }
  48142. public function getErrorOutput()
  48143. {
  48144. $this->readPipesForOutput(__FUNCTION__);
  48145. if (false === $ret = stream_get_contents($this->stderr, -1, 0)) {
  48146. return '';
  48147. }
  48148. return $ret;
  48149. }
  48150. public function getIncrementalErrorOutput()
  48151. {
  48152. $this->readPipesForOutput(__FUNCTION__);
  48153. $latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
  48154. $this->incrementalErrorOutputOffset = ftell($this->stderr);
  48155. if (false === $latest) {
  48156. return '';
  48157. }
  48158. return $latest;
  48159. }
  48160. public function clearErrorOutput()
  48161. {
  48162. ftruncate($this->stderr, 0);
  48163. fseek($this->stderr, 0);
  48164. $this->incrementalErrorOutputOffset = 0;
  48165. return $this;
  48166. }
  48167. public function getExitCode()
  48168. {
  48169. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  48170. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  48171. }
  48172. $this->updateStatus(false);
  48173. return $this->exitcode;
  48174. }
  48175. public function getExitCodeText()
  48176. {
  48177. if (null === $exitcode = $this->getExitCode()) {
  48178. return;
  48179. }
  48180. return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error';
  48181. }
  48182. public function isSuccessful()
  48183. {
  48184. return 0 === $this->getExitCode();
  48185. }
  48186. public function hasBeenSignaled()
  48187. {
  48188. $this->requireProcessIsTerminated(__FUNCTION__);
  48189. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  48190. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  48191. }
  48192. return $this->processInformation['signaled'];
  48193. }
  48194. public function getTermSignal()
  48195. {
  48196. $this->requireProcessIsTerminated(__FUNCTION__);
  48197. if ($this->isSigchildEnabled() && (!$this->enhanceSigchildCompatibility || -1 === $this->processInformation['termsig'])) {
  48198. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  48199. }
  48200. return $this->processInformation['termsig'];
  48201. }
  48202. public function hasBeenStopped()
  48203. {
  48204. $this->requireProcessIsTerminated(__FUNCTION__);
  48205. return $this->processInformation['stopped'];
  48206. }
  48207. public function getStopSignal()
  48208. {
  48209. $this->requireProcessIsTerminated(__FUNCTION__);
  48210. return $this->processInformation['stopsig'];
  48211. }
  48212. public function isRunning()
  48213. {
  48214. if (self::STATUS_STARTED !== $this->status) {
  48215. return false;
  48216. }
  48217. $this->updateStatus(false);
  48218. return $this->processInformation['running'];
  48219. }
  48220. public function isStarted()
  48221. {
  48222. return self::STATUS_READY != $this->status;
  48223. }
  48224. public function isTerminated()
  48225. {
  48226. $this->updateStatus(false);
  48227. return self::STATUS_TERMINATED == $this->status;
  48228. }
  48229. public function getStatus()
  48230. {
  48231. $this->updateStatus(false);
  48232. return $this->status;
  48233. }
  48234. public function stop($timeout = 10, $signal = null)
  48235. {
  48236. $timeoutMicro = microtime(true) + $timeout;
  48237. if ($this->isRunning()) {
  48238. $this->doSignal(15, false);
  48239. do {
  48240. usleep(1000);
  48241. } while ($this->isRunning() && microtime(true) < $timeoutMicro);
  48242. if ($this->isRunning()) {
  48243. $this->doSignal($signal ?: 9, false);
  48244. }
  48245. }
  48246. if ($this->isRunning()) {
  48247. if (isset($this->fallbackStatus['pid'])) {
  48248. unset($this->fallbackStatus['pid']);
  48249. return $this->stop(0, $signal);
  48250. }
  48251. $this->close();
  48252. }
  48253. return $this->exitcode;
  48254. }
  48255. public function addOutput($line)
  48256. {
  48257. $this->lastOutputTime = microtime(true);
  48258. fseek($this->stdout, 0, SEEK_END);
  48259. fwrite($this->stdout, $line);
  48260. fseek($this->stdout, $this->incrementalOutputOffset);
  48261. }
  48262. public function addErrorOutput($line)
  48263. {
  48264. $this->lastOutputTime = microtime(true);
  48265. fseek($this->stderr, 0, SEEK_END);
  48266. fwrite($this->stderr, $line);
  48267. fseek($this->stderr, $this->incrementalErrorOutputOffset);
  48268. }
  48269. public function getCommandLine()
  48270. {
  48271. return $this->commandline;
  48272. }
  48273. public function setCommandLine($commandline)
  48274. {
  48275. $this->commandline = $commandline;
  48276. return $this;
  48277. }
  48278. public function getTimeout()
  48279. {
  48280. return $this->timeout;
  48281. }
  48282. public function getIdleTimeout()
  48283. {
  48284. return $this->idleTimeout;
  48285. }
  48286. public function setTimeout($timeout)
  48287. {
  48288. $this->timeout = $this->validateTimeout($timeout);
  48289. return $this;
  48290. }
  48291. public function setIdleTimeout($timeout)
  48292. {
  48293. if (null !== $timeout && $this->outputDisabled) {
  48294. throw new LogicException('Idle timeout can not be set while the output is disabled.');
  48295. }
  48296. $this->idleTimeout = $this->validateTimeout($timeout);
  48297. return $this;
  48298. }
  48299. public function setTty($tty)
  48300. {
  48301. if ('\\' === \DIRECTORY_SEPARATOR && $tty) {
  48302. throw new RuntimeException('TTY mode is not supported on Windows platform.');
  48303. }
  48304. if ($tty) {
  48305. static $isTtySupported;
  48306. if (null === $isTtySupported) {
  48307. $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);
  48308. }
  48309. if (!$isTtySupported) {
  48310. throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
  48311. }
  48312. }
  48313. $this->tty = (bool) $tty;
  48314. return $this;
  48315. }
  48316. public function isTty()
  48317. {
  48318. return $this->tty;
  48319. }
  48320. public function setPty($bool)
  48321. {
  48322. $this->pty = (bool) $bool;
  48323. return $this;
  48324. }
  48325. public function isPty()
  48326. {
  48327. return $this->pty;
  48328. }
  48329. public function getWorkingDirectory()
  48330. {
  48331. if (null === $this->cwd) {
  48332. return getcwd() ?: null;
  48333. }
  48334. return $this->cwd;
  48335. }
  48336. public function setWorkingDirectory($cwd)
  48337. {
  48338. $this->cwd = $cwd;
  48339. return $this;
  48340. }
  48341. public function getEnv()
  48342. {
  48343. return $this->env;
  48344. }
  48345. public function setEnv(array $env)
  48346. {
  48347. $env = array_filter($env, function ($value) {
  48348. return !\is_array($value);
  48349. });
  48350. $this->env = array();
  48351. foreach ($env as $key => $value) {
  48352. $this->env[$key] = (string) $value;
  48353. }
  48354. return $this;
  48355. }
  48356. public function getStdin()
  48357. {
  48358. @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);
  48359. return $this->getInput();
  48360. }
  48361. public function getInput()
  48362. {
  48363. return $this->input;
  48364. }
  48365. public function setStdin($stdin)
  48366. {
  48367. @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);
  48368. return $this->setInput($stdin);
  48369. }
  48370. public function setInput($input)
  48371. {
  48372. if ($this->isRunning()) {
  48373. throw new LogicException('Input can not be set while the process is running.');
  48374. }
  48375. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  48376. return $this;
  48377. }
  48378. public function getOptions()
  48379. {
  48380. return $this->options;
  48381. }
  48382. public function setOptions(array $options)
  48383. {
  48384. $this->options = $options;
  48385. return $this;
  48386. }
  48387. public function getEnhanceWindowsCompatibility()
  48388. {
  48389. return $this->enhanceWindowsCompatibility;
  48390. }
  48391. public function setEnhanceWindowsCompatibility($enhance)
  48392. {
  48393. $this->enhanceWindowsCompatibility = (bool) $enhance;
  48394. return $this;
  48395. }
  48396. public function getEnhanceSigchildCompatibility()
  48397. {
  48398. return $this->enhanceSigchildCompatibility;
  48399. }
  48400. public function setEnhanceSigchildCompatibility($enhance)
  48401. {
  48402. $this->enhanceSigchildCompatibility = (bool) $enhance;
  48403. return $this;
  48404. }
  48405. public function checkTimeout()
  48406. {
  48407. if (self::STATUS_STARTED !== $this->status) {
  48408. return;
  48409. }
  48410. if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
  48411. $this->stop(0);
  48412. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
  48413. }
  48414. if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
  48415. $this->stop(0);
  48416. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_IDLE);
  48417. }
  48418. }
  48419. public static function isPtySupported()
  48420. {
  48421. static $result;
  48422. if (null !== $result) {
  48423. return $result;
  48424. }
  48425. if ('\\' === \DIRECTORY_SEPARATOR) {
  48426. return $result = false;
  48427. }
  48428. return $result = (bool) @proc_open('echo 1 >/dev/null', array(array('pty'), array('pty'), array('pty')), $pipes);
  48429. }
  48430. private function getDescriptors()
  48431. {
  48432. if ('\\' === \DIRECTORY_SEPARATOR) {
  48433. $this->processPipes = WindowsPipes::create($this, $this->input);
  48434. } else {
  48435. $this->processPipes = UnixPipes::create($this, $this->input);
  48436. }
  48437. return $this->processPipes->getDescriptors();
  48438. }
  48439. protected function buildCallback($callback)
  48440. {
  48441. $that = $this;
  48442. $out = self::OUT;
  48443. $callback = function ($type, $data) use ($that, $callback, $out) {
  48444. if ($out == $type) {
  48445. $that->addOutput($data);
  48446. } else {
  48447. $that->addErrorOutput($data);
  48448. }
  48449. if (null !== $callback) {
  48450. \call_user_func($callback, $type, $data);
  48451. }
  48452. };
  48453. return $callback;
  48454. }
  48455. protected function updateStatus($blocking)
  48456. {
  48457. if (self::STATUS_STARTED !== $this->status) {
  48458. return;
  48459. }
  48460. $this->processInformation = proc_get_status($this->process);
  48461. $running = $this->processInformation['running'];
  48462. $this->readPipes($running && $blocking, '\\' !== \DIRECTORY_SEPARATOR || !$running);
  48463. if ($this->fallbackStatus && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  48464. $this->processInformation = $this->fallbackStatus + $this->processInformation;
  48465. }
  48466. if (!$running) {
  48467. $this->close();
  48468. }
  48469. }
  48470. protected function isSigchildEnabled()
  48471. {
  48472. if (null !== self::$sigchild) {
  48473. return self::$sigchild;
  48474. }
  48475. if (!\function_exists('phpinfo') || \defined('HHVM_VERSION')) {
  48476. return self::$sigchild = false;
  48477. }
  48478. ob_start();
  48479. phpinfo(INFO_GENERAL);
  48480. return self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild');
  48481. }
  48482. private function readPipesForOutput($caller)
  48483. {
  48484. if ($this->outputDisabled) {
  48485. throw new LogicException('Output has been disabled.');
  48486. }
  48487. $this->requireProcessIsStarted($caller);
  48488. $this->updateStatus(false);
  48489. }
  48490. private function validateTimeout($timeout)
  48491. {
  48492. $timeout = (float) $timeout;
  48493. if (0.0 === $timeout) {
  48494. $timeout = null;
  48495. } elseif ($timeout < 0) {
  48496. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  48497. }
  48498. return $timeout;
  48499. }
  48500. private function readPipes($blocking, $close)
  48501. {
  48502. $result = $this->processPipes->readAndWrite($blocking, $close);
  48503. $callback = $this->callback;
  48504. foreach ($result as $type => $data) {
  48505. if (3 !== $type) {
  48506. $callback(self::STDOUT === $type ? self::OUT : self::ERR, $data);
  48507. } elseif (!isset($this->fallbackStatus['signaled'])) {
  48508. $this->fallbackStatus['exitcode'] = (int) $data;
  48509. }
  48510. }
  48511. }
  48512. private function close()
  48513. {
  48514. $this->processPipes->close();
  48515. if (\is_resource($this->process)) {
  48516. proc_close($this->process);
  48517. }
  48518. $this->exitcode = $this->processInformation['exitcode'];
  48519. $this->status = self::STATUS_TERMINATED;
  48520. if (-1 === $this->exitcode) {
  48521. if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) {
  48522. $this->exitcode = 128 + $this->processInformation['termsig'];
  48523. } elseif ($this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  48524. $this->processInformation['signaled'] = true;
  48525. $this->processInformation['termsig'] = -1;
  48526. }
  48527. }
  48528. $this->callback = null;
  48529. return $this->exitcode;
  48530. }
  48531. private function resetProcessData()
  48532. {
  48533. $this->starttime = null;
  48534. $this->callback = null;
  48535. $this->exitcode = null;
  48536. $this->fallbackStatus = array();
  48537. $this->processInformation = null;
  48538. $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b');
  48539. $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b');
  48540. $this->process = null;
  48541. $this->latestSignal = null;
  48542. $this->status = self::STATUS_READY;
  48543. $this->incrementalOutputOffset = 0;
  48544. $this->incrementalErrorOutputOffset = 0;
  48545. }
  48546. private function doSignal($signal, $throwException)
  48547. {
  48548. if (null === $pid = $this->getPid()) {
  48549. if ($throwException) {
  48550. throw new LogicException('Can not send signal on a non running process.');
  48551. }
  48552. return false;
  48553. }
  48554. if ('\\' === \DIRECTORY_SEPARATOR) {
  48555. exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
  48556. if ($exitCode && $this->isRunning()) {
  48557. if ($throwException) {
  48558. throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
  48559. }
  48560. return false;
  48561. }
  48562. } else {
  48563. if (!$this->enhanceSigchildCompatibility || !$this->isSigchildEnabled()) {
  48564. $ok = @proc_terminate($this->process, $signal);
  48565. } elseif (\function_exists('posix_kill')) {
  48566. $ok = @posix_kill($pid, $signal);
  48567. } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), array(2 => array('pipe', 'w')), $pipes)) {
  48568. $ok = false === fgets($pipes[2]);
  48569. }
  48570. if (!$ok) {
  48571. if ($throwException) {
  48572. throw new RuntimeException(sprintf('Error while sending signal `%s`.', $signal));
  48573. }
  48574. return false;
  48575. }
  48576. }
  48577. $this->latestSignal = (int) $signal;
  48578. $this->fallbackStatus['signaled'] = true;
  48579. $this->fallbackStatus['exitcode'] = -1;
  48580. $this->fallbackStatus['termsig'] = $this->latestSignal;
  48581. return true;
  48582. }
  48583. private function requireProcessIsStarted($functionName)
  48584. {
  48585. if (!$this->isStarted()) {
  48586. throw new LogicException(sprintf('Process must be started before calling %s.', $functionName));
  48587. }
  48588. }
  48589. private function requireProcessIsTerminated($functionName)
  48590. {
  48591. if (!$this->isTerminated()) {
  48592. throw new LogicException(sprintf('Process must be terminated before calling %s.', $functionName));
  48593. }
  48594. }
  48595. }
  48596. <?php
  48597. namespace Symfony\Component\Process;
  48598. use Symfony\Component\Process\Exception\InvalidArgumentException;
  48599. use Symfony\Component\Process\Exception\LogicException;
  48600. class ProcessBuilder
  48601. {
  48602. private $arguments;
  48603. private $cwd;
  48604. private $env = array();
  48605. private $input;
  48606. private $timeout = 60;
  48607. private $options = array();
  48608. private $inheritEnv = true;
  48609. private $prefix = array();
  48610. private $outputDisabled = false;
  48611. public function __construct(array $arguments = array())
  48612. {
  48613. $this->arguments = $arguments;
  48614. }
  48615. public static function create(array $arguments = array())
  48616. {
  48617. return new static($arguments);
  48618. }
  48619. public function add($argument)
  48620. {
  48621. $this->arguments[] = $argument;
  48622. return $this;
  48623. }
  48624. public function setPrefix($prefix)
  48625. {
  48626. $this->prefix = \is_array($prefix) ? $prefix : array($prefix);
  48627. return $this;
  48628. }
  48629. public function setArguments(array $arguments)
  48630. {
  48631. $this->arguments = $arguments;
  48632. return $this;
  48633. }
  48634. public function setWorkingDirectory($cwd)
  48635. {
  48636. $this->cwd = $cwd;
  48637. return $this;
  48638. }
  48639. public function inheritEnvironmentVariables($inheritEnv = true)
  48640. {
  48641. $this->inheritEnv = $inheritEnv;
  48642. return $this;
  48643. }
  48644. public function setEnv($name, $value)
  48645. {
  48646. $this->env[$name] = $value;
  48647. return $this;
  48648. }
  48649. public function addEnvironmentVariables(array $variables)
  48650. {
  48651. $this->env = array_replace($this->env, $variables);
  48652. return $this;
  48653. }
  48654. public function setInput($input)
  48655. {
  48656. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  48657. return $this;
  48658. }
  48659. public function setTimeout($timeout)
  48660. {
  48661. if (null === $timeout) {
  48662. $this->timeout = null;
  48663. return $this;
  48664. }
  48665. $timeout = (float) $timeout;
  48666. if ($timeout < 0) {
  48667. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  48668. }
  48669. $this->timeout = $timeout;
  48670. return $this;
  48671. }
  48672. public function setOption($name, $value)
  48673. {
  48674. $this->options[$name] = $value;
  48675. return $this;
  48676. }
  48677. public function disableOutput()
  48678. {
  48679. $this->outputDisabled = true;
  48680. return $this;
  48681. }
  48682. public function enableOutput()
  48683. {
  48684. $this->outputDisabled = false;
  48685. return $this;
  48686. }
  48687. public function getProcess()
  48688. {
  48689. if (0 === \count($this->prefix) && 0 === \count($this->arguments)) {
  48690. throw new LogicException('You must add() command arguments before calling getProcess().');
  48691. }
  48692. $options = $this->options;
  48693. $arguments = array_merge($this->prefix, $this->arguments);
  48694. $script = implode(' ', array_map(array(__NAMESPACE__.'\\ProcessUtils', 'escapeArgument'), $arguments));
  48695. if ($this->inheritEnv) {
  48696. $env = array_replace($_ENV, $_SERVER, $this->env);
  48697. } else {
  48698. $env = $this->env;
  48699. }
  48700. $process = new Process($script, $this->cwd, $env, $this->input, $this->timeout, $options);
  48701. if ($this->outputDisabled) {
  48702. $process->disableOutput();
  48703. }
  48704. return $process;
  48705. }
  48706. }
  48707. <?php
  48708. namespace Symfony\Component\Process;
  48709. use Symfony\Component\Process\Exception\InvalidArgumentException;
  48710. class ProcessUtils
  48711. {
  48712. private function __construct()
  48713. {
  48714. }
  48715. public static function escapeArgument($argument)
  48716. {
  48717. if ('\\' === \DIRECTORY_SEPARATOR) {
  48718. if ('' === $argument) {
  48719. return escapeshellarg($argument);
  48720. }
  48721. $escapedArgument = '';
  48722. $quote = false;
  48723. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  48724. if ('"' === $part) {
  48725. $escapedArgument .= '\\"';
  48726. } elseif (self::isSurroundedBy($part, '%')) {
  48727. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  48728. } else {
  48729. if ('\\' === substr($part, -1)) {
  48730. $part .= '\\';
  48731. }
  48732. $quote = true;
  48733. $escapedArgument .= $part;
  48734. }
  48735. }
  48736. if ($quote) {
  48737. $escapedArgument = '"'.$escapedArgument.'"';
  48738. }
  48739. return $escapedArgument;
  48740. }
  48741. return "'".str_replace("'", "'\\''", $argument)."'";
  48742. }
  48743. public static function validateInput($caller, $input)
  48744. {
  48745. if (null !== $input) {
  48746. if (\is_resource($input)) {
  48747. return $input;
  48748. }
  48749. if (\is_string($input)) {
  48750. return $input;
  48751. }
  48752. if (is_scalar($input)) {
  48753. return (string) $input;
  48754. }
  48755. if (\is_object($input) && method_exists($input, '__toString')) {
  48756. @trigger_error('Passing an object as an input is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  48757. return (string) $input;
  48758. }
  48759. throw new InvalidArgumentException(sprintf('%s only accepts strings or stream resources.', $caller));
  48760. }
  48761. return $input;
  48762. }
  48763. private static function isSurroundedBy($arg, $char)
  48764. {
  48765. return 2 < \strlen($arg) && $char === $arg[0] && $char === $arg[\strlen($arg) - 1];
  48766. }
  48767. }
  48768. Copyright (c) 2011 Jordi Boggiano
  48769. Permission is hereby granted, free of charge, to any person obtaining a copy
  48770. of this software and associated documentation files (the "Software"), to deal
  48771. in the Software without restriction, including without limitation the rights
  48772. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  48773. copies of the Software, and to permit persons to whom the Software is furnished
  48774. to do so, subject to the following conditions:
  48775. The above copyright notice and this permission notice shall be included in all
  48776. copies or substantial portions of the Software.
  48777. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  48778. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  48779. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  48780. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  48781. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  48782. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  48783. THE SOFTWARE.
  48784. <?php
  48785. namespace Seld\JsonLint;
  48786. class DuplicateKeyException extends ParsingException
  48787. {
  48788. public function __construct($message, $key, array $details = array())
  48789. {
  48790. $details['key'] = $key;
  48791. parent::__construct($message, $details);
  48792. }
  48793. public function getKey()
  48794. {
  48795. return $this->details['key'];
  48796. }
  48797. }
  48798. <?php
  48799. namespace Seld\JsonLint;
  48800. use stdClass;
  48801. class JsonParser
  48802. {
  48803. const DETECT_KEY_CONFLICTS = 1;
  48804. const ALLOW_DUPLICATE_KEYS = 2;
  48805. const PARSE_TO_ASSOC = 4;
  48806. private $lexer;
  48807. private $flags;
  48808. private $stack;
  48809. private $vstack;
  48810. private $lstack;
  48811. private $symbols = array(
  48812. 'error' => 2,
  48813. 'JSONString' => 3,
  48814. 'STRING' => 4,
  48815. 'JSONNumber' => 5,
  48816. 'NUMBER' => 6,
  48817. 'JSONNullLiteral' => 7,
  48818. 'NULL' => 8,
  48819. 'JSONBooleanLiteral' => 9,
  48820. 'TRUE' => 10,
  48821. 'FALSE' => 11,
  48822. 'JSONText' => 12,
  48823. 'JSONValue' => 13,
  48824. 'EOF' => 14,
  48825. 'JSONObject' => 15,
  48826. 'JSONArray' => 16,
  48827. '{' => 17,
  48828. '}' => 18,
  48829. 'JSONMemberList' => 19,
  48830. 'JSONMember' => 20,
  48831. ':' => 21,
  48832. ',' => 22,
  48833. '[' => 23,
  48834. ']' => 24,
  48835. 'JSONElementList' => 25,
  48836. '$accept' => 0,
  48837. '$end' => 1,
  48838. );
  48839. private $terminals_ = array(
  48840. 2 => "error",
  48841. 4 => "STRING",
  48842. 6 => "NUMBER",
  48843. 8 => "NULL",
  48844. 10 => "TRUE",
  48845. 11 => "FALSE",
  48846. 14 => "EOF",
  48847. 17 => "{",
  48848. 18 => "}",
  48849. 21 => ":",
  48850. 22 => ",",
  48851. 23 => "[",
  48852. 24 => "]",
  48853. );
  48854. private $productions_ = array(
  48855. 0,
  48856. array(3, 1),
  48857. array(5, 1),
  48858. array(7, 1),
  48859. array(9, 1),
  48860. array(9, 1),
  48861. array(12, 2),
  48862. array(13, 1),
  48863. array(13, 1),
  48864. array(13, 1),
  48865. array(13, 1),
  48866. array(13, 1),
  48867. array(13, 1),
  48868. array(15, 2),
  48869. array(15, 3),
  48870. array(20, 3),
  48871. array(19, 1),
  48872. array(19, 3),
  48873. array(16, 2),
  48874. array(16, 3),
  48875. array(25, 1),
  48876. array(25, 3)
  48877. );
  48878. 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)),
  48879. );
  48880. private $defaultActions = array(
  48881. 16 => array(2, 6)
  48882. );
  48883. public function lint($input, $flags = 0)
  48884. {
  48885. try {
  48886. $this->parse($input, $flags);
  48887. } catch (ParsingException $e) {
  48888. return $e;
  48889. }
  48890. }
  48891. public function parse($input, $flags = 0)
  48892. {
  48893. $this->failOnBOM($input);
  48894. $this->flags = $flags;
  48895. $this->stack = array(0);
  48896. $this->vstack = array(null);
  48897. $this->lstack = array();
  48898. $yytext = '';
  48899. $yylineno = 0;
  48900. $yyleng = 0;
  48901. $recovering = 0;
  48902. $TERROR = 2;
  48903. $EOF = 1;
  48904. $this->lexer = new Lexer();
  48905. $this->lexer->setInput($input);
  48906. $yyloc = $this->lexer->yylloc;
  48907. $this->lstack[] = $yyloc;
  48908. $symbol = null;
  48909. $preErrorSymbol = null;
  48910. $state = null;
  48911. $action = null;
  48912. $a = null;
  48913. $r = null;
  48914. $yyval = new stdClass;
  48915. $p = null;
  48916. $len = null;
  48917. $newState = null;
  48918. $expected = null;
  48919. $errStr = null;
  48920. while (true) {
  48921. $state = $this->stack[\count($this->stack)-1];
  48922. if (isset($this->defaultActions[$state])) {
  48923. $action = $this->defaultActions[$state];
  48924. } else {
  48925. if ($symbol == null) {
  48926. $symbol = $this->lex();
  48927. }
  48928. $action = isset($this->table[$state][$symbol]) ? $this->table[$state][$symbol] : false;
  48929. }
  48930. if (!$action || !$action[0]) {
  48931. if (!$recovering) {
  48932. $expected = array();
  48933. foreach ($this->table[$state] as $p => $ignore) {
  48934. if (isset($this->terminals_[$p]) && $p > 2) {
  48935. $expected[] = "'" . $this->terminals_[$p] . "'";
  48936. }
  48937. }
  48938. $message = null;
  48939. if (\in_array("'STRING'", $expected) && \in_array(substr($this->lexer->match, 0, 1), array('"', "'"))) {
  48940. $message = "Invalid string";
  48941. if ("'" === substr($this->lexer->match, 0, 1)) {
  48942. $message .= ", it appears you used single quotes instead of double quotes";
  48943. } elseif (preg_match('{".+?(\\\\[^"bfnrt/\\\\u](...)?)}', $this->lexer->getFullUpcomingInput(), $match)) {
  48944. $message .= ", it appears you have an unescaped backslash at: ".$match[1];
  48945. } elseif (preg_match('{"(?:[^"]+|\\\\")*$}m', $this->lexer->getFullUpcomingInput())) {
  48946. $message .= ", it appears you forgot to terminate a string, or attempted to write a multiline string which is invalid";
  48947. }
  48948. }
  48949. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  48950. $errStr .= $this->lexer->showPosition() . "\n";
  48951. if ($message) {
  48952. $errStr .= $message;
  48953. } else {
  48954. $errStr .= (\count($expected) > 1) ? "Expected one of: " : "Expected: ";
  48955. $errStr .= implode(', ', $expected);
  48956. }
  48957. if (',' === substr(trim($this->lexer->getPastInput()), -1)) {
  48958. $errStr .= " - It appears you have an extra trailing comma";
  48959. }
  48960. $this->parseError($errStr, array(
  48961. 'text' => $this->lexer->match,
  48962. 'token' => !empty($this->terminals_[$symbol]) ? $this->terminals_[$symbol] : $symbol,
  48963. 'line' => $this->lexer->yylineno,
  48964. 'loc' => $yyloc,
  48965. 'expected' => $expected,
  48966. ));
  48967. }
  48968. if ($recovering == 3) {
  48969. if ($symbol == $EOF) {
  48970. throw new ParsingException($errStr ?: 'Parsing halted.');
  48971. }
  48972. $yyleng = $this->lexer->yyleng;
  48973. $yytext = $this->lexer->yytext;
  48974. $yylineno = $this->lexer->yylineno;
  48975. $yyloc = $this->lexer->yylloc;
  48976. $symbol = $this->lex();
  48977. }
  48978. while (true) {
  48979. if (\array_key_exists($TERROR, $this->table[$state])) {
  48980. break;
  48981. }
  48982. if ($state == 0) {
  48983. throw new ParsingException($errStr ?: 'Parsing halted.');
  48984. }
  48985. $this->popStack(1);
  48986. $state = $this->stack[\count($this->stack)-1];
  48987. }
  48988. $preErrorSymbol = $symbol;
  48989. $symbol = $TERROR;
  48990. $state = $this->stack[\count($this->stack)-1];
  48991. $action = isset($this->table[$state][$TERROR]) ? $this->table[$state][$TERROR] : false;
  48992. $recovering = 3;
  48993. }
  48994. if (\is_array($action[0]) && \count($action) > 1) {
  48995. throw new ParsingException('Parse Error: multiple actions possible at state: ' . $state . ', token: ' . $symbol);
  48996. }
  48997. switch ($action[0]) {
  48998. case 1:
  48999. $this->stack[] = $symbol;
  49000. $this->vstack[] = $this->lexer->yytext;
  49001. $this->lstack[] = $this->lexer->yylloc;
  49002. $this->stack[] = $action[1];
  49003. $symbol = null;
  49004. if (!$preErrorSymbol) {
  49005. $yyleng = $this->lexer->yyleng;
  49006. $yytext = $this->lexer->yytext;
  49007. $yylineno = $this->lexer->yylineno;
  49008. $yyloc = $this->lexer->yylloc;
  49009. if ($recovering > 0) {
  49010. $recovering--;
  49011. }
  49012. } else {
  49013. $symbol = $preErrorSymbol;
  49014. $preErrorSymbol = null;
  49015. }
  49016. break;
  49017. case 2:
  49018. $len = $this->productions_[$action[1]][1];
  49019. $yyval->token = $this->vstack[\count($this->vstack) - $len];
  49020. $yyval->store = array(
  49021. 'first_line' => $this->lstack[\count($this->lstack) - ($len ?: 1)]['first_line'],
  49022. 'last_line' => $this->lstack[\count($this->lstack) - 1]['last_line'],
  49023. 'first_column' => $this->lstack[\count($this->lstack) - ($len ?: 1)]['first_column'],
  49024. 'last_column' => $this->lstack[\count($this->lstack) - 1]['last_column'],
  49025. );
  49026. $r = $this->performAction($yyval, $yytext, $yyleng, $yylineno, $action[1], $this->vstack, $this->lstack);
  49027. if (!$r instanceof Undefined) {
  49028. return $r;
  49029. }
  49030. if ($len) {
  49031. $this->popStack($len);
  49032. }
  49033. $this->stack[] = $this->productions_[$action[1]][0];
  49034. $this->vstack[] = $yyval->token;
  49035. $this->lstack[] = $yyval->store;
  49036. $newState = $this->table[$this->stack[\count($this->stack)-2]][$this->stack[\count($this->stack)-1]];
  49037. $this->stack[] = $newState;
  49038. break;
  49039. case 3:
  49040. return true;
  49041. }
  49042. }
  49043. return true;
  49044. }
  49045. protected function parseError($str, $hash)
  49046. {
  49047. throw new ParsingException($str, $hash);
  49048. }
  49049. private function performAction(stdClass $yyval, $yytext, $yyleng, $yylineno, $yystate, &$tokens)
  49050. {
  49051. $len = \count($tokens) - 1;
  49052. switch ($yystate) {
  49053. case 1:
  49054. $yytext = preg_replace_callback('{(?:\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4})}', array($this, 'stringInterpolation'), $yytext);
  49055. $yyval->token = $yytext;
  49056. break;
  49057. case 2:
  49058. if (strpos($yytext, 'e') !== false || strpos($yytext, 'E') !== false) {
  49059. $yyval->token = \floatval($yytext);
  49060. } else {
  49061. $yyval->token = strpos($yytext, '.') === false ? \intval($yytext) : \floatval($yytext);
  49062. }
  49063. break;
  49064. case 3:
  49065. $yyval->token = null;
  49066. break;
  49067. case 4:
  49068. $yyval->token = true;
  49069. break;
  49070. case 5:
  49071. $yyval->token = false;
  49072. break;
  49073. case 6:
  49074. return $yyval->token = $tokens[$len-1];
  49075. case 13:
  49076. if ($this->flags & self::PARSE_TO_ASSOC) {
  49077. $yyval->token = array();
  49078. } else {
  49079. $yyval->token = new stdClass;
  49080. }
  49081. break;
  49082. case 14:
  49083. $yyval->token = $tokens[$len-1];
  49084. break;
  49085. case 15:
  49086. $yyval->token = array($tokens[$len-2], $tokens[$len]);
  49087. break;
  49088. case 16:
  49089. if (PHP_VERSION_ID < 70100) {
  49090. $property = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  49091. } else {
  49092. $property = $tokens[$len][0];
  49093. }
  49094. if ($this->flags & self::PARSE_TO_ASSOC) {
  49095. $yyval->token = array();
  49096. $yyval->token[$property] = $tokens[$len][1];
  49097. } else {
  49098. $yyval->token = new stdClass;
  49099. $yyval->token->$property = $tokens[$len][1];
  49100. }
  49101. break;
  49102. case 17:
  49103. if ($this->flags & self::PARSE_TO_ASSOC) {
  49104. $yyval->token =& $tokens[$len-2];
  49105. $key = $tokens[$len][0];
  49106. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2][$key])) {
  49107. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  49108. $errStr .= $this->lexer->showPosition() . "\n";
  49109. $errStr .= "Duplicate key: ".$tokens[$len][0];
  49110. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  49111. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2][$key])) {
  49112. $duplicateCount = 1;
  49113. do {
  49114. $duplicateKey = $key . '.' . $duplicateCount++;
  49115. } while (isset($tokens[$len-2][$duplicateKey]));
  49116. $key = $duplicateKey;
  49117. }
  49118. $tokens[$len-2][$key] = $tokens[$len][1];
  49119. } else {
  49120. $yyval->token = $tokens[$len-2];
  49121. if (PHP_VERSION_ID < 70100) {
  49122. $key = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  49123. } else {
  49124. $key = $tokens[$len][0];
  49125. }
  49126. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2]->{$key})) {
  49127. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  49128. $errStr .= $this->lexer->showPosition() . "\n";
  49129. $errStr .= "Duplicate key: ".$tokens[$len][0];
  49130. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  49131. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2]->{$key})) {
  49132. $duplicateCount = 1;
  49133. do {
  49134. $duplicateKey = $key . '.' . $duplicateCount++;
  49135. } while (isset($tokens[$len-2]->$duplicateKey));
  49136. $key = $duplicateKey;
  49137. }
  49138. $tokens[$len-2]->$key = $tokens[$len][1];
  49139. }
  49140. break;
  49141. case 18:
  49142. $yyval->token = array();
  49143. break;
  49144. case 19:
  49145. $yyval->token = $tokens[$len-1];
  49146. break;
  49147. case 20:
  49148. $yyval->token = array($tokens[$len]);
  49149. break;
  49150. case 21:
  49151. $tokens[$len-2][] = $tokens[$len];
  49152. $yyval->token = $tokens[$len-2];
  49153. break;
  49154. }
  49155. return new Undefined();
  49156. }
  49157. private function stringInterpolation($match)
  49158. {
  49159. switch ($match[0]) {
  49160. case '\\\\':
  49161. return '\\';
  49162. case '\"':
  49163. return '"';
  49164. case '\b':
  49165. return \chr(8);
  49166. case '\f':
  49167. return \chr(12);
  49168. case '\n':
  49169. return "\n";
  49170. case '\r':
  49171. return "\r";
  49172. case '\t':
  49173. return "\t";
  49174. case '\/':
  49175. return "/";
  49176. default:
  49177. return html_entity_decode('&#x'.ltrim(substr($match[0], 2), '0').';', ENT_QUOTES, 'UTF-8');
  49178. }
  49179. }
  49180. private function popStack($n)
  49181. {
  49182. $this->stack = \array_slice($this->stack, 0, - (2 * $n));
  49183. $this->vstack = \array_slice($this->vstack, 0, - $n);
  49184. $this->lstack = \array_slice($this->lstack, 0, - $n);
  49185. }
  49186. private function lex()
  49187. {
  49188. $token = $this->lexer->lex() ?: 1;
  49189. if (!is_numeric($token)) {
  49190. $token = isset($this->symbols[$token]) ? $this->symbols[$token] : $token;
  49191. }
  49192. return $token;
  49193. }
  49194. private function failOnBOM($input)
  49195. {
  49196. $bom = "\xEF\xBB\xBF";
  49197. if (substr($input, 0, 3) === $bom) {
  49198. $this->parseError("BOM detected, make sure your input does not include a Unicode Byte-Order-Mark", array());
  49199. }
  49200. }
  49201. }
  49202. <?php
  49203. namespace Seld\JsonLint;
  49204. class Lexer
  49205. {
  49206. private $EOF = 1;
  49207. private $rules = array(
  49208. 0 => '/\G\s+/',
  49209. 1 => '/\G-?([0-9]|[1-9][0-9]+)(\.[0-9]+)?([eE][+-]?[0-9]+)?\b/',
  49210. 2 => '{\G"(?>\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4}|[^\0-\x1f\\\\"]++)*+"}',
  49211. 3 => '/\G\{/',
  49212. 4 => '/\G\}/',
  49213. 5 => '/\G\[/',
  49214. 6 => '/\G\]/',
  49215. 7 => '/\G,/',
  49216. 8 => '/\G:/',
  49217. 9 => '/\Gtrue\b/',
  49218. 10 => '/\Gfalse\b/',
  49219. 11 => '/\Gnull\b/',
  49220. 12 => '/\G$/',
  49221. 13 => '/\G./',
  49222. );
  49223. private $conditions = array(
  49224. "INITIAL" => array(
  49225. "rules" => array(0,1,2,3,4,5,6,7,8,9,10,11,12,13),
  49226. "inclusive" => true,
  49227. ),
  49228. );
  49229. private $conditionStack;
  49230. private $input;
  49231. private $more;
  49232. private $done;
  49233. private $offset;
  49234. public $match;
  49235. public $yylineno;
  49236. public $yyleng;
  49237. public $yytext;
  49238. public $yylloc;
  49239. public function lex()
  49240. {
  49241. $r = $this->next();
  49242. if (!$r instanceof Undefined) {
  49243. return $r;
  49244. }
  49245. return $this->lex();
  49246. }
  49247. public function setInput($input)
  49248. {
  49249. $this->input = $input;
  49250. $this->more = false;
  49251. $this->done = false;
  49252. $this->offset = 0;
  49253. $this->yylineno = $this->yyleng = 0;
  49254. $this->yytext = $this->match = '';
  49255. $this->conditionStack = array('INITIAL');
  49256. $this->yylloc = array('first_line' => 1, 'first_column' => 0, 'last_line' => 1, 'last_column' => 0);
  49257. return $this;
  49258. }
  49259. public function showPosition()
  49260. {
  49261. $pre = str_replace("\n", '', $this->getPastInput());
  49262. $c = str_repeat('-', max(0, \strlen($pre) - 1));
  49263. return $pre . str_replace("\n", '', $this->getUpcomingInput()) . "\n" . $c . "^";
  49264. }
  49265. public function getPastInput()
  49266. {
  49267. $pastLength = $this->offset - \strlen($this->match);
  49268. return ($pastLength > 20 ? '...' : '') . substr($this->input, max(0, $pastLength - 20), min(20, $pastLength));
  49269. }
  49270. public function getUpcomingInput()
  49271. {
  49272. $next = $this->match;
  49273. if (\strlen($next) < 20) {
  49274. $next .= substr($this->input, $this->offset, 20 - \strlen($next));
  49275. }
  49276. return substr($next, 0, 20) . (\strlen($next) > 20 ? '...' : '');
  49277. }
  49278. public function getFullUpcomingInput()
  49279. {
  49280. $next = $this->match;
  49281. if (substr($next, 0, 1) === '"' && substr_count($next, '"') === 1) {
  49282. $len = \strlen($this->input);
  49283. $strEnd = min(strpos($this->input, '"', $this->offset + 1) ?: $len, strpos($this->input, "\n", $this->offset + 1) ?: $len);
  49284. $next .= substr($this->input, $this->offset, $strEnd - $this->offset);
  49285. } elseif (\strlen($next) < 20) {
  49286. $next .= substr($this->input, $this->offset, 20 - \strlen($next));
  49287. }
  49288. return $next;
  49289. }
  49290. protected function parseError($str, $hash)
  49291. {
  49292. throw new \Exception($str);
  49293. }
  49294. private function next()
  49295. {
  49296. if ($this->done) {
  49297. return $this->EOF;
  49298. }
  49299. if ($this->offset === \strlen($this->input)) {
  49300. $this->done = true;
  49301. }
  49302. $token = null;
  49303. $match = null;
  49304. $col = null;
  49305. $lines = null;
  49306. if (!$this->more) {
  49307. $this->yytext = '';
  49308. $this->match = '';
  49309. }
  49310. $rules = $this->getCurrentRules();
  49311. $rulesLen = \count($rules);
  49312. for ($i=0; $i < $rulesLen; $i++) {
  49313. if (preg_match($this->rules[$rules[$i]], $this->input, $match, 0, $this->offset)) {
  49314. preg_match_all('/\n.*/', $match[0], $lines);
  49315. $lines = $lines[0];
  49316. if ($lines) {
  49317. $this->yylineno += \count($lines);
  49318. }
  49319. $this->yylloc = array(
  49320. 'first_line' => $this->yylloc['last_line'],
  49321. 'last_line' => $this->yylineno+1,
  49322. 'first_column' => $this->yylloc['last_column'],
  49323. 'last_column' => $lines ? \strlen($lines[\count($lines) - 1]) - 1 : $this->yylloc['last_column'] + \strlen($match[0]),
  49324. );
  49325. $this->yytext .= $match[0];
  49326. $this->match .= $match[0];
  49327. $this->yyleng = \strlen($this->yytext);
  49328. $this->more = false;
  49329. $this->offset += \strlen($match[0]);
  49330. $token = $this->performAction($rules[$i], $this->conditionStack[\count($this->conditionStack)-1]);
  49331. if ($token) {
  49332. return $token;
  49333. }
  49334. return new Undefined();
  49335. }
  49336. }
  49337. if ($this->offset === \strlen($this->input)) {
  49338. return $this->EOF;
  49339. }
  49340. $this->parseError(
  49341. 'Lexical error on line ' . ($this->yylineno+1) . ". Unrecognized text.\n" . $this->showPosition(),
  49342. array(
  49343. 'text' => "",
  49344. 'token' => null,
  49345. 'line' => $this->yylineno,
  49346. )
  49347. );
  49348. }
  49349. private function getCurrentRules()
  49350. {
  49351. return $this->conditions[$this->conditionStack[\count($this->conditionStack)-1]]['rules'];
  49352. }
  49353. private function performAction($avoiding_name_collisions, $YY_START)
  49354. {
  49355. switch ($avoiding_name_collisions) {
  49356. case 0:
  49357. break;
  49358. case 1:
  49359. return 6;
  49360. break;
  49361. case 2:
  49362. $this->yytext = substr($this->yytext, 1, $this->yyleng-2);
  49363. return 4;
  49364. case 3:
  49365. return 17;
  49366. case 4:
  49367. return 18;
  49368. case 5:
  49369. return 23;
  49370. case 6:
  49371. return 24;
  49372. case 7:
  49373. return 22;
  49374. case 8:
  49375. return 21;
  49376. case 9:
  49377. return 10;
  49378. case 10:
  49379. return 11;
  49380. case 11:
  49381. return 8;
  49382. case 12:
  49383. return 14;
  49384. case 13:
  49385. return 'INVALID';
  49386. }
  49387. }
  49388. }
  49389. <?php
  49390. namespace Seld\JsonLint;
  49391. class ParsingException extends \Exception
  49392. {
  49393. protected $details;
  49394. public function __construct($message, $details = array())
  49395. {
  49396. $this->details = $details;
  49397. parent::__construct($message);
  49398. }
  49399. public function getDetails()
  49400. {
  49401. return $this->details;
  49402. }
  49403. }
  49404. <?php
  49405. namespace Seld\JsonLint;
  49406. class Undefined
  49407. {
  49408. }
  49409. MIT License
  49410. Copyright (c) 2016
  49411. Permission is hereby granted, free of charge, to any person obtaining a copy
  49412. of this software and associated documentation files (the "Software"), to deal
  49413. in the Software without restriction, including without limitation the rights
  49414. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  49415. copies of the Software, and to permit persons to whom the Software is
  49416. furnished to do so, subject to the following conditions:
  49417. The above copyright notice and this permission notice shall be included in all
  49418. copies or substantial portions of the Software.
  49419. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  49420. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  49421. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  49422. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  49423. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  49424. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  49425. SOFTWARE.
  49426. <?php
  49427. require __DIR__ . '/../vendor/autoload.php';
  49428. $data = json_decode(file_get_contents('data.json'));
  49429. $validator = new JsonSchema\Validator();
  49430. $validator->check($data, (object) array('$ref' => 'file://' . realpath('schema.json')));
  49431. if ($validator->isValid()) {
  49432. echo "The supplied JSON validates against the schema.\n";
  49433. } else {
  49434. echo "JSON does not validate. Violations:\n";
  49435. foreach ($validator->getErrors() as $error) {
  49436. echo sprintf("[%s] %s\n", $error['property'], $error['message']);
  49437. }
  49438. }
  49439. <?php
  49440. namespace JsonSchema\Constraints;
  49441. use JsonSchema\Entity\JsonPointer;
  49442. use JsonSchema\Exception\InvalidArgumentException;
  49443. use JsonSchema\Exception\ValidationException;
  49444. use JsonSchema\Validator;
  49445. class BaseConstraint
  49446. {
  49447. protected $errors = array();
  49448. protected $errorMask = Validator::ERROR_NONE;
  49449. protected $factory;
  49450. public function __construct(Factory $factory = null)
  49451. {
  49452. $this->factory = $factory ?: new Factory();
  49453. }
  49454. public function addError(JsonPointer $path = null, $message, $constraint = '', array $more = null)
  49455. {
  49456. $error = array(
  49457. 'property' => $this->convertJsonPointerIntoPropertyPath($path ?: new JsonPointer('')),
  49458. 'pointer' => ltrim(strval($path ?: new JsonPointer('')), '#'),
  49459. 'message' => $message,
  49460. 'constraint' => $constraint,
  49461. 'context' => $this->factory->getErrorContext(),
  49462. );
  49463. if ($this->factory->getConfig(Constraint::CHECK_MODE_EXCEPTIONS)) {
  49464. throw new ValidationException(sprintf('Error validating %s: %s', $error['pointer'], $error['message']));
  49465. }
  49466. if (is_array($more) && count($more) > 0) {
  49467. $error += $more;
  49468. }
  49469. $this->errors[] = $error;
  49470. $this->errorMask |= $error['context'];
  49471. }
  49472. public function addErrors(array $errors)
  49473. {
  49474. if ($errors) {
  49475. $this->errors = array_merge($this->errors, $errors);
  49476. $errorMask = &$this->errorMask;
  49477. array_walk($errors, function ($error) use (&$errorMask) {
  49478. if (isset($error['context'])) {
  49479. $errorMask |= $error['context'];
  49480. }
  49481. });
  49482. }
  49483. }
  49484. public function getErrors($errorContext = Validator::ERROR_ALL)
  49485. {
  49486. if ($errorContext === Validator::ERROR_ALL) {
  49487. return $this->errors;
  49488. }
  49489. return array_filter($this->errors, function ($error) use ($errorContext) {
  49490. if ($errorContext & $error['context']) {
  49491. return true;
  49492. }
  49493. });
  49494. }
  49495. public function numErrors($errorContext = Validator::ERROR_ALL)
  49496. {
  49497. if ($errorContext === Validator::ERROR_ALL) {
  49498. return count($this->errors);
  49499. }
  49500. return count($this->getErrors($errorContext));
  49501. }
  49502. public function isValid()
  49503. {
  49504. return !$this->getErrors();
  49505. }
  49506. public function reset()
  49507. {
  49508. $this->errors = array();
  49509. $this->errorMask = Validator::ERROR_NONE;
  49510. }
  49511. public function getErrorMask()
  49512. {
  49513. return $this->errorMask;
  49514. }
  49515. public static function arrayToObjectRecursive($array)
  49516. {
  49517. $json = json_encode($array);
  49518. if (json_last_error() !== \JSON_ERROR_NONE) {
  49519. $message = 'Unable to encode schema array as JSON';
  49520. if (function_exists('json_last_error_msg')) {
  49521. $message .= ': ' . json_last_error_msg();
  49522. }
  49523. throw new InvalidArgumentException($message);
  49524. }
  49525. return (object) json_decode($json);
  49526. }
  49527. }
  49528. <?php
  49529. namespace JsonSchema\Constraints;
  49530. use JsonSchema\Entity\JsonPointer;
  49531. class CollectionConstraint extends Constraint
  49532. {
  49533. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null)
  49534. {
  49535. if (isset($schema->minItems) && count($value) < $schema->minItems) {
  49536. $this->addError($path, 'There must be a minimum of ' . $schema->minItems . ' items in the array', 'minItems', array('minItems' => $schema->minItems));
  49537. }
  49538. if (isset($schema->maxItems) && count($value) > $schema->maxItems) {
  49539. $this->addError($path, 'There must be a maximum of ' . $schema->maxItems . ' items in the array', 'maxItems', array('maxItems' => $schema->maxItems));
  49540. }
  49541. if (isset($schema->uniqueItems) && $schema->uniqueItems) {
  49542. $unique = $value;
  49543. if (is_array($value) && count($value)) {
  49544. $unique = array_map(function ($e) {
  49545. return var_export($e, true);
  49546. }, $value);
  49547. }
  49548. if (count(array_unique($unique)) != count($value)) {
  49549. $this->addError($path, 'There are no duplicates allowed in the array', 'uniqueItems');
  49550. }
  49551. }
  49552. if (isset($schema->items)) {
  49553. $this->validateItems($value, $schema, $path, $i);
  49554. }
  49555. }
  49556. protected function validateItems(&$value, $schema = null, JsonPointer $path = null, $i = null)
  49557. {
  49558. if (is_object($schema->items)) {
  49559. foreach ($value as $k => &$v) {
  49560. $initErrors = $this->getErrors();
  49561. $this->checkUndefined($v, $schema->items, $path, $k);
  49562. if (count($initErrors) < count($this->getErrors()) && (isset($schema->additionalItems) && $schema->additionalItems !== false)) {
  49563. $secondErrors = $this->getErrors();
  49564. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  49565. }
  49566. if (isset($secondErrors) && count($secondErrors) < count($this->getErrors())) {
  49567. $this->errors = $secondErrors;
  49568. } elseif (isset($secondErrors) && count($secondErrors) === count($this->getErrors())) {
  49569. $this->errors = $initErrors;
  49570. }
  49571. }
  49572. unset($v);
  49573. } else {
  49574. foreach ($value as $k => &$v) {
  49575. if (array_key_exists($k, $schema->items)) {
  49576. $this->checkUndefined($v, $schema->items[$k], $path, $k);
  49577. } else {
  49578. if (property_exists($schema, 'additionalItems')) {
  49579. if ($schema->additionalItems !== false) {
  49580. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  49581. } else {
  49582. $this->addError(
  49583. $path, 'The item ' . $i . '[' . $k . '] is not defined and the definition does not allow additional items', 'additionalItems', array('additionalItems' => $schema->additionalItems));
  49584. }
  49585. } else {
  49586. $this->checkUndefined($v, new \stdClass(), $path, $k);
  49587. }
  49588. }
  49589. }
  49590. unset($v);
  49591. if (count($value) > 0) {
  49592. for ($k = count($value); $k < count($schema->items); $k++) {
  49593. $undefinedInstance = $this->factory->createInstanceFor('undefined');
  49594. $this->checkUndefined($undefinedInstance, $schema->items[$k], $path, $k);
  49595. }
  49596. }
  49597. }
  49598. }
  49599. }
  49600. <?php
  49601. namespace JsonSchema\Constraints;
  49602. use JsonSchema\Entity\JsonPointer;
  49603. abstract class Constraint extends BaseConstraint implements ConstraintInterface
  49604. {
  49605. protected $inlineSchemaProperty = '$schema';
  49606. const CHECK_MODE_NONE = 0x00000000;
  49607. const CHECK_MODE_NORMAL = 0x00000001;
  49608. const CHECK_MODE_TYPE_CAST = 0x00000002;
  49609. const CHECK_MODE_COERCE_TYPES = 0x00000004;
  49610. const CHECK_MODE_APPLY_DEFAULTS = 0x00000008;
  49611. const CHECK_MODE_EXCEPTIONS = 0x00000010;
  49612. const CHECK_MODE_DISABLE_FORMAT = 0x00000020;
  49613. const CHECK_MODE_ONLY_REQUIRED_DEFAULTS = 0x00000080;
  49614. const CHECK_MODE_VALIDATE_SCHEMA = 0x00000100;
  49615. protected function incrementPath(JsonPointer $path = null, $i)
  49616. {
  49617. $path = $path ?: new JsonPointer('');
  49618. $path = $path->withPropertyPaths(
  49619. array_merge(
  49620. $path->getPropertyPaths(),
  49621. array_filter(array($i), 'strlen')
  49622. )
  49623. );
  49624. return $path;
  49625. }
  49626. protected function checkArray(&$value, $schema = null, JsonPointer $path = null, $i = null)
  49627. {
  49628. $validator = $this->factory->createInstanceFor('collection');
  49629. $validator->check($value, $schema, $path, $i);
  49630. $this->addErrors($validator->getErrors());
  49631. }
  49632. protected function checkObject(&$value, $schema = null, JsonPointer $path = null, $properties = null,
  49633. $additionalProperties = null, $patternProperties = null, $appliedDefaults = array())
  49634. {
  49635. $validator = $this->factory->createInstanceFor('object');
  49636. $validator->check($value, $schema, $path, $properties, $additionalProperties, $patternProperties, $appliedDefaults);
  49637. $this->addErrors($validator->getErrors());
  49638. }
  49639. protected function checkType(&$value, $schema = null, JsonPointer $path = null, $i = null)
  49640. {
  49641. $validator = $this->factory->createInstanceFor('type');
  49642. $validator->check($value, $schema, $path, $i);
  49643. $this->addErrors($validator->getErrors());
  49644. }
  49645. protected function checkUndefined(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  49646. {
  49647. $validator = $this->factory->createInstanceFor('undefined');
  49648. $validator->check($value, $this->factory->getSchemaStorage()->resolveRefSchema($schema), $path, $i, $fromDefault);
  49649. $this->addErrors($validator->getErrors());
  49650. }
  49651. protected function checkString($value, $schema = null, JsonPointer $path = null, $i = null)
  49652. {
  49653. $validator = $this->factory->createInstanceFor('string');
  49654. $validator->check($value, $schema, $path, $i);
  49655. $this->addErrors($validator->getErrors());
  49656. }
  49657. protected function checkNumber($value, $schema = null, JsonPointer $path = null, $i = null)
  49658. {
  49659. $validator = $this->factory->createInstanceFor('number');
  49660. $validator->check($value, $schema, $path, $i);
  49661. $this->addErrors($validator->getErrors());
  49662. }
  49663. protected function checkEnum($value, $schema = null, JsonPointer $path = null, $i = null)
  49664. {
  49665. $validator = $this->factory->createInstanceFor('enum');
  49666. $validator->check($value, $schema, $path, $i);
  49667. $this->addErrors($validator->getErrors());
  49668. }
  49669. protected function checkFormat($value, $schema = null, JsonPointer $path = null, $i = null)
  49670. {
  49671. $validator = $this->factory->createInstanceFor('format');
  49672. $validator->check($value, $schema, $path, $i);
  49673. $this->addErrors($validator->getErrors());
  49674. }
  49675. protected function getTypeCheck()
  49676. {
  49677. return $this->factory->getTypeCheck();
  49678. }
  49679. protected function convertJsonPointerIntoPropertyPath(JsonPointer $pointer)
  49680. {
  49681. $result = array_map(
  49682. function ($path) {
  49683. return sprintf(is_numeric($path) ? '[%d]' : '.%s', $path);
  49684. },
  49685. $pointer->getPropertyPaths()
  49686. );
  49687. return trim(implode('', $result), '.');
  49688. }
  49689. }
  49690. <?php
  49691. namespace JsonSchema\Constraints;
  49692. use JsonSchema\Entity\JsonPointer;
  49693. interface ConstraintInterface
  49694. {
  49695. public function getErrors();
  49696. public function addErrors(array $errors);
  49697. public function addError(JsonPointer $path = null, $message, $constraint='', array $more = null);
  49698. public function isValid();
  49699. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null);
  49700. }
  49701. <?php
  49702. namespace JsonSchema\Constraints;
  49703. use JsonSchema\Entity\JsonPointer;
  49704. class EnumConstraint extends Constraint
  49705. {
  49706. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  49707. {
  49708. if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) {
  49709. return;
  49710. }
  49711. $type = gettype($element);
  49712. foreach ($schema->enum as $enum) {
  49713. $enumType = gettype($enum);
  49714. if ($this->factory->getConfig(self::CHECK_MODE_TYPE_CAST) && $type == 'array' && $enumType == 'object') {
  49715. if ((object) $element == $enum) {
  49716. return;
  49717. }
  49718. }
  49719. if ($type === gettype($enum)) {
  49720. if ($type == 'object') {
  49721. if ($element == $enum) {
  49722. return;
  49723. }
  49724. } elseif ($element === $enum) {
  49725. return;
  49726. }
  49727. }
  49728. }
  49729. $this->addError($path, 'Does not have a value in the enumeration ' . json_encode($schema->enum), 'enum', array('enum' => $schema->enum));
  49730. }
  49731. }
  49732. <?php
  49733. namespace JsonSchema\Constraints;
  49734. use JsonSchema\Exception\InvalidArgumentException;
  49735. use JsonSchema\SchemaStorage;
  49736. use JsonSchema\SchemaStorageInterface;
  49737. use JsonSchema\Uri\UriRetriever;
  49738. use JsonSchema\UriRetrieverInterface;
  49739. use JsonSchema\Validator;
  49740. class Factory
  49741. {
  49742. protected $schemaStorage;
  49743. protected $uriRetriever;
  49744. private $checkMode = Constraint::CHECK_MODE_NORMAL;
  49745. private $typeCheck = array();
  49746. protected $errorContext = Validator::ERROR_DOCUMENT_VALIDATION;
  49747. protected $constraintMap = array(
  49748. 'array' => 'JsonSchema\Constraints\CollectionConstraint',
  49749. 'collection' => 'JsonSchema\Constraints\CollectionConstraint',
  49750. 'object' => 'JsonSchema\Constraints\ObjectConstraint',
  49751. 'type' => 'JsonSchema\Constraints\TypeConstraint',
  49752. 'undefined' => 'JsonSchema\Constraints\UndefinedConstraint',
  49753. 'string' => 'JsonSchema\Constraints\StringConstraint',
  49754. 'number' => 'JsonSchema\Constraints\NumberConstraint',
  49755. 'enum' => 'JsonSchema\Constraints\EnumConstraint',
  49756. 'format' => 'JsonSchema\Constraints\FormatConstraint',
  49757. 'schema' => 'JsonSchema\Constraints\SchemaConstraint',
  49758. 'validator' => 'JsonSchema\Validator'
  49759. );
  49760. private $instanceCache = array();
  49761. public function __construct(
  49762. SchemaStorageInterface $schemaStorage = null,
  49763. UriRetrieverInterface $uriRetriever = null,
  49764. $checkMode = Constraint::CHECK_MODE_NORMAL
  49765. ) {
  49766. $this->setConfig($checkMode);
  49767. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  49768. $this->schemaStorage = $schemaStorage ?: new SchemaStorage($this->uriRetriever);
  49769. }
  49770. public function setConfig($checkMode = Constraint::CHECK_MODE_NORMAL)
  49771. {
  49772. $this->checkMode = $checkMode;
  49773. }
  49774. public function addConfig($options)
  49775. {
  49776. $this->checkMode |= $options;
  49777. }
  49778. public function removeConfig($options)
  49779. {
  49780. $this->checkMode &= ~$options;
  49781. }
  49782. public function getConfig($options = null)
  49783. {
  49784. if ($options === null) {
  49785. return $this->checkMode;
  49786. }
  49787. return $this->checkMode & $options;
  49788. }
  49789. public function getUriRetriever()
  49790. {
  49791. return $this->uriRetriever;
  49792. }
  49793. public function getSchemaStorage()
  49794. {
  49795. return $this->schemaStorage;
  49796. }
  49797. public function getTypeCheck()
  49798. {
  49799. if (!isset($this->typeCheck[$this->checkMode])) {
  49800. $this->typeCheck[$this->checkMode] = ($this->checkMode & Constraint::CHECK_MODE_TYPE_CAST)
  49801. ? new TypeCheck\LooseTypeCheck()
  49802. : new TypeCheck\StrictTypeCheck();
  49803. }
  49804. return $this->typeCheck[$this->checkMode];
  49805. }
  49806. public function setConstraintClass($name, $class)
  49807. {
  49808. if (!class_exists($class)) {
  49809. throw new InvalidArgumentException('Unknown constraint ' . $name);
  49810. }
  49811. if (!in_array('JsonSchema\Constraints\ConstraintInterface', class_implements($class))) {
  49812. throw new InvalidArgumentException('Invalid class ' . $name);
  49813. }
  49814. $this->constraintMap[$name] = $class;
  49815. return $this;
  49816. }
  49817. public function createInstanceFor($constraintName)
  49818. {
  49819. if (!isset($this->constraintMap[$constraintName])) {
  49820. throw new InvalidArgumentException('Unknown constraint ' . $constraintName);
  49821. }
  49822. if (!isset($this->instanceCache[$constraintName])) {
  49823. $this->instanceCache[$constraintName] = new $this->constraintMap[$constraintName]($this);
  49824. }
  49825. return clone $this->instanceCache[$constraintName];
  49826. }
  49827. public function getErrorContext()
  49828. {
  49829. return $this->errorContext;
  49830. }
  49831. public function setErrorContext($errorContext)
  49832. {
  49833. $this->errorContext = $errorContext;
  49834. }
  49835. }
  49836. <?php
  49837. namespace JsonSchema\Constraints;
  49838. use JsonSchema\Entity\JsonPointer;
  49839. use JsonSchema\Rfc3339;
  49840. class FormatConstraint extends Constraint
  49841. {
  49842. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  49843. {
  49844. if (!isset($schema->format) || $this->factory->getConfig(self::CHECK_MODE_DISABLE_FORMAT)) {
  49845. return;
  49846. }
  49847. switch ($schema->format) {
  49848. case 'date':
  49849. if (!$date = $this->validateDateTime($element, 'Y-m-d')) {
  49850. $this->addError($path, sprintf('Invalid date %s, expected format YYYY-MM-DD', json_encode($element)), 'format', array('format' => $schema->format));
  49851. }
  49852. break;
  49853. case 'time':
  49854. if (!$this->validateDateTime($element, 'H:i:s')) {
  49855. $this->addError($path, sprintf('Invalid time %s, expected format hh:mm:ss', json_encode($element)), 'format', array('format' => $schema->format));
  49856. }
  49857. break;
  49858. case 'date-time':
  49859. if (null === Rfc3339::createFromString($element)) {
  49860. $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));
  49861. }
  49862. break;
  49863. case 'utc-millisec':
  49864. if (!$this->validateDateTime($element, 'U')) {
  49865. $this->addError($path, sprintf('Invalid time %s, expected integer of milliseconds since Epoch', json_encode($element)), 'format', array('format' => $schema->format));
  49866. }
  49867. break;
  49868. case 'regex':
  49869. if (!$this->validateRegex($element)) {
  49870. $this->addError($path, 'Invalid regex format ' . $element, 'format', array('format' => $schema->format));
  49871. }
  49872. break;
  49873. case 'color':
  49874. if (!$this->validateColor($element)) {
  49875. $this->addError($path, 'Invalid color', 'format', array('format' => $schema->format));
  49876. }
  49877. break;
  49878. case 'style':
  49879. if (!$this->validateStyle($element)) {
  49880. $this->addError($path, 'Invalid style', 'format', array('format' => $schema->format));
  49881. }
  49882. break;
  49883. case 'phone':
  49884. if (!$this->validatePhone($element)) {
  49885. $this->addError($path, 'Invalid phone number', 'format', array('format' => $schema->format));
  49886. }
  49887. break;
  49888. case 'uri':
  49889. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  49890. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  49891. }
  49892. break;
  49893. case 'uriref':
  49894. case 'uri-reference':
  49895. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  49896. if (substr($element, 0, 2) === '//') {
  49897. $validURL = filter_var('scheme:' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  49898. } elseif (substr($element, 0, 1) === '/') {
  49899. $validURL = filter_var('scheme://host' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  49900. } elseif (strlen($element)) {
  49901. $pathParts = explode('/', $element, 2);
  49902. if (strpos($pathParts[0], ':') !== false) {
  49903. $validURL = null;
  49904. } else {
  49905. $validURL = filter_var('scheme://host/' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  49906. }
  49907. } else {
  49908. $validURL = null;
  49909. }
  49910. if ($validURL === null) {
  49911. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  49912. }
  49913. }
  49914. break;
  49915. case 'email':
  49916. $filterFlags = FILTER_NULL_ON_FAILURE;
  49917. if (defined('FILTER_FLAG_EMAIL_UNICODE')) {
  49918. $filterFlags |= constant('FILTER_FLAG_EMAIL_UNICODE');
  49919. }
  49920. if (null === filter_var($element, FILTER_VALIDATE_EMAIL, $filterFlags)) {
  49921. $this->addError($path, 'Invalid email', 'format', array('format' => $schema->format));
  49922. }
  49923. break;
  49924. case 'ip-address':
  49925. case 'ipv4':
  49926. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV4)) {
  49927. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  49928. }
  49929. break;
  49930. case 'ipv6':
  49931. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV6)) {
  49932. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  49933. }
  49934. break;
  49935. case 'host-name':
  49936. case 'hostname':
  49937. if (!$this->validateHostname($element)) {
  49938. $this->addError($path, 'Invalid hostname', 'format', array('format' => $schema->format));
  49939. }
  49940. break;
  49941. default:
  49942. break;
  49943. }
  49944. }
  49945. protected function validateDateTime($datetime, $format)
  49946. {
  49947. $dt = \DateTime::createFromFormat($format, $datetime);
  49948. if (!$dt) {
  49949. return false;
  49950. }
  49951. if ($datetime === $dt->format($format)) {
  49952. return true;
  49953. }
  49954. if ((strpos('u', $format) !== -1) && (preg_match('/\.\d+Z$/', $datetime))) {
  49955. return true;
  49956. }
  49957. return false;
  49958. }
  49959. protected function validateRegex($regex)
  49960. {
  49961. return false !== @preg_match('/' . $regex . '/u', '');
  49962. }
  49963. protected function validateColor($color)
  49964. {
  49965. if (in_array(strtolower($color), array('aqua', 'black', 'blue', 'fuchsia',
  49966. 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange', 'purple',
  49967. 'red', 'silver', 'teal', 'white', 'yellow'))) {
  49968. return true;
  49969. }
  49970. return preg_match('/^#([a-f0-9]{3}|[a-f0-9]{6})$/i', $color);
  49971. }
  49972. protected function validateStyle($style)
  49973. {
  49974. $properties = explode(';', rtrim($style, ';'));
  49975. $invalidEntries = preg_grep('/^\s*[-a-z]+\s*:\s*.+$/i', $properties, PREG_GREP_INVERT);
  49976. return empty($invalidEntries);
  49977. }
  49978. protected function validatePhone($phone)
  49979. {
  49980. return preg_match('/^\+?(\(\d{3}\)|\d{3}) \d{3} \d{4}$/', $phone);
  49981. }
  49982. protected function validateHostname($host)
  49983. {
  49984. $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';
  49985. return preg_match($hostnameRegex, $host);
  49986. }
  49987. }
  49988. <?php
  49989. namespace JsonSchema\Constraints;
  49990. use JsonSchema\Entity\JsonPointer;
  49991. class NumberConstraint extends Constraint
  49992. {
  49993. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  49994. {
  49995. if (isset($schema->exclusiveMinimum)) {
  49996. if (isset($schema->minimum)) {
  49997. if ($schema->exclusiveMinimum && $element <= $schema->minimum) {
  49998. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'exclusiveMinimum', array('minimum' => $schema->minimum));
  49999. } elseif ($element < $schema->minimum) {
  50000. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  50001. }
  50002. } else {
  50003. $this->addError($path, 'Use of exclusiveMinimum requires presence of minimum', 'missingMinimum');
  50004. }
  50005. } elseif (isset($schema->minimum) && $element < $schema->minimum) {
  50006. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  50007. }
  50008. if (isset($schema->exclusiveMaximum)) {
  50009. if (isset($schema->maximum)) {
  50010. if ($schema->exclusiveMaximum && $element >= $schema->maximum) {
  50011. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'exclusiveMaximum', array('maximum' => $schema->maximum));
  50012. } elseif ($element > $schema->maximum) {
  50013. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  50014. }
  50015. } else {
  50016. $this->addError($path, 'Use of exclusiveMaximum requires presence of maximum', 'missingMaximum');
  50017. }
  50018. } elseif (isset($schema->maximum) && $element > $schema->maximum) {
  50019. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  50020. }
  50021. if (isset($schema->divisibleBy) && $this->fmod($element, $schema->divisibleBy) != 0) {
  50022. $this->addError($path, 'Is not divisible by ' . $schema->divisibleBy, 'divisibleBy', array('divisibleBy' => $schema->divisibleBy));
  50023. }
  50024. if (isset($schema->multipleOf) && $this->fmod($element, $schema->multipleOf) != 0) {
  50025. $this->addError($path, 'Must be a multiple of ' . $schema->multipleOf, 'multipleOf', array('multipleOf' => $schema->multipleOf));
  50026. }
  50027. $this->checkFormat($element, $schema, $path, $i);
  50028. }
  50029. private function fmod($number1, $number2)
  50030. {
  50031. $modulus = ($number1 - round($number1 / $number2) * $number2);
  50032. $precision = 0.0000000001;
  50033. if (-$precision < $modulus && $modulus < $precision) {
  50034. return 0.0;
  50035. }
  50036. return $modulus;
  50037. }
  50038. }
  50039. <?php
  50040. namespace JsonSchema\Constraints;
  50041. use JsonSchema\Entity\JsonPointer;
  50042. class ObjectConstraint extends Constraint
  50043. {
  50044. protected $appliedDefaults = array();
  50045. public function check(&$element, $schema = null, JsonPointer $path = null, $properties = null,
  50046. $additionalProp = null, $patternProperties = null, $appliedDefaults = array())
  50047. {
  50048. if ($element instanceof UndefinedConstraint) {
  50049. return;
  50050. }
  50051. $this->appliedDefaults = $appliedDefaults;
  50052. $matches = array();
  50053. if ($patternProperties) {
  50054. $matches = $this->validatePatternProperties($element, $path, $patternProperties);
  50055. }
  50056. if ($properties) {
  50057. $this->validateProperties($element, $properties, $path);
  50058. }
  50059. $this->validateElement($element, $matches, $schema, $path, $properties, $additionalProp);
  50060. }
  50061. public function validatePatternProperties($element, JsonPointer $path = null, $patternProperties)
  50062. {
  50063. $try = array('/', '#', '+', '~', '%');
  50064. $matches = array();
  50065. foreach ($patternProperties as $pregex => $schema) {
  50066. $delimiter = '/';
  50067. foreach ($try as $delimiter) {
  50068. if (strpos($pregex, $delimiter) === false) {
  50069. break;
  50070. }
  50071. }
  50072. if (@preg_match($delimiter . $pregex . $delimiter . 'u', '') === false) {
  50073. $this->addError($path, 'The pattern "' . $pregex . '" is invalid', 'pregex', array('pregex' => $pregex));
  50074. continue;
  50075. }
  50076. foreach ($element as $i => $value) {
  50077. if (preg_match($delimiter . $pregex . $delimiter . 'u', $i)) {
  50078. $matches[] = $i;
  50079. $this->checkUndefined($value, $schema ?: new \stdClass(), $path, $i, in_array($i, $this->appliedDefaults));
  50080. }
  50081. }
  50082. }
  50083. return $matches;
  50084. }
  50085. public function validateElement($element, $matches, $schema = null, JsonPointer $path = null,
  50086. $properties = null, $additionalProp = null)
  50087. {
  50088. $this->validateMinMaxConstraint($element, $schema, $path);
  50089. foreach ($element as $i => $value) {
  50090. $definition = $this->getProperty($properties, $i);
  50091. if (!in_array($i, $matches) && $additionalProp === false && $this->inlineSchemaProperty !== $i && !$definition) {
  50092. $this->addError($path, 'The property ' . $i . ' is not defined and the definition does not allow additional properties', 'additionalProp');
  50093. }
  50094. if (!in_array($i, $matches) && $additionalProp && !$definition) {
  50095. if ($additionalProp === true) {
  50096. $this->checkUndefined($value, null, $path, $i, in_array($i, $this->appliedDefaults));
  50097. } else {
  50098. $this->checkUndefined($value, $additionalProp, $path, $i, in_array($i, $this->appliedDefaults));
  50099. }
  50100. }
  50101. $require = $this->getProperty($definition, 'requires');
  50102. if ($require && !$this->getProperty($element, $require)) {
  50103. $this->addError($path, 'The presence of the property ' . $i . ' requires that ' . $require . ' also be present', 'requires');
  50104. }
  50105. $property = $this->getProperty($element, $i, $this->factory->createInstanceFor('undefined'));
  50106. if (is_object($property)) {
  50107. $this->validateMinMaxConstraint(!($property instanceof UndefinedConstraint) ? $property : $element, $definition, $path);
  50108. }
  50109. }
  50110. }
  50111. public function validateProperties(&$element, $properties = null, JsonPointer $path = null)
  50112. {
  50113. $undefinedConstraint = $this->factory->createInstanceFor('undefined');
  50114. foreach ($properties as $i => $value) {
  50115. $property = &$this->getProperty($element, $i, $undefinedConstraint);
  50116. $definition = $this->getProperty($properties, $i);
  50117. if (is_object($definition)) {
  50118. $this->checkUndefined($property, $definition, $path, $i, in_array($i, $this->appliedDefaults));
  50119. }
  50120. }
  50121. }
  50122. protected function &getProperty(&$element, $property, $fallback = null)
  50123. {
  50124. if (is_array($element) && (isset($element[$property]) || array_key_exists($property, $element)) ) {
  50125. return $element[$property];
  50126. } elseif (is_object($element) && property_exists($element, $property)) {
  50127. return $element->$property;
  50128. }
  50129. return $fallback;
  50130. }
  50131. protected function validateMinMaxConstraint($element, $objectDefinition, JsonPointer $path = null)
  50132. {
  50133. if (isset($objectDefinition->minProperties) && !is_object($objectDefinition->minProperties)) {
  50134. if ($this->getTypeCheck()->propertyCount($element) < $objectDefinition->minProperties) {
  50135. $this->addError($path, 'Must contain a minimum of ' . $objectDefinition->minProperties . ' properties', 'minProperties', array('minProperties' => $objectDefinition->minProperties));
  50136. }
  50137. }
  50138. if (isset($objectDefinition->maxProperties) && !is_object($objectDefinition->maxProperties)) {
  50139. if ($this->getTypeCheck()->propertyCount($element) > $objectDefinition->maxProperties) {
  50140. $this->addError($path, 'Must contain no more than ' . $objectDefinition->maxProperties . ' properties', 'maxProperties', array('maxProperties' => $objectDefinition->maxProperties));
  50141. }
  50142. }
  50143. }
  50144. }
  50145. <?php
  50146. namespace JsonSchema\Constraints;
  50147. use JsonSchema\Entity\JsonPointer;
  50148. use JsonSchema\Exception\InvalidArgumentException;
  50149. use JsonSchema\Exception\InvalidSchemaException;
  50150. use JsonSchema\Exception\RuntimeException;
  50151. use JsonSchema\Validator;
  50152. class SchemaConstraint extends Constraint
  50153. {
  50154. const DEFAULT_SCHEMA_SPEC = 'http://json-schema.org/draft-04/schema#';
  50155. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  50156. {
  50157. if ($schema !== null) {
  50158. $validationSchema = $schema;
  50159. } elseif ($this->getTypeCheck()->propertyExists($element, $this->inlineSchemaProperty)) {
  50160. $validationSchema = $this->getTypeCheck()->propertyGet($element, $this->inlineSchemaProperty);
  50161. } else {
  50162. throw new InvalidArgumentException('no schema found to verify against');
  50163. }
  50164. if (is_array($validationSchema)) {
  50165. $validationSchema = BaseConstraint::arrayToObjectRecursive($validationSchema);
  50166. }
  50167. if ($this->factory->getConfig(self::CHECK_MODE_VALIDATE_SCHEMA)) {
  50168. if (!$this->getTypeCheck()->isObject($validationSchema)) {
  50169. throw new RuntimeException('Cannot validate the schema of a non-object');
  50170. }
  50171. if ($this->getTypeCheck()->propertyExists($validationSchema, '$schema')) {
  50172. $schemaSpec = $this->getTypeCheck()->propertyGet($validationSchema, '$schema');
  50173. } else {
  50174. $schemaSpec = self::DEFAULT_SCHEMA_SPEC;
  50175. }
  50176. $schemaStorage = $this->factory->getSchemaStorage();
  50177. if (!$this->getTypeCheck()->isObject($schemaSpec)) {
  50178. $schemaSpec = $schemaStorage->getSchema($schemaSpec);
  50179. }
  50180. $initialErrorCount = $this->numErrors();
  50181. $initialConfig = $this->factory->getConfig();
  50182. $initialContext = $this->factory->getErrorContext();
  50183. $this->factory->removeConfig(self::CHECK_MODE_VALIDATE_SCHEMA | self::CHECK_MODE_APPLY_DEFAULTS);
  50184. $this->factory->addConfig(self::CHECK_MODE_TYPE_CAST);
  50185. $this->factory->setErrorContext(Validator::ERROR_SCHEMA_VALIDATION);
  50186. try {
  50187. $this->check($validationSchema, $schemaSpec);
  50188. } catch (\Exception $e) {
  50189. if ($this->factory->getConfig(self::CHECK_MODE_EXCEPTIONS)) {
  50190. throw new InvalidSchemaException('Schema did not pass validation', 0, $e);
  50191. }
  50192. }
  50193. if ($this->numErrors() > $initialErrorCount) {
  50194. $this->addError($path, 'Schema is not valid', 'schema');
  50195. }
  50196. $this->factory->setConfig($initialConfig);
  50197. $this->factory->setErrorContext($initialContext);
  50198. }
  50199. $this->checkUndefined($element, $validationSchema, $path, $i);
  50200. }
  50201. }
  50202. <?php
  50203. namespace JsonSchema\Constraints;
  50204. use JsonSchema\Entity\JsonPointer;
  50205. class StringConstraint extends Constraint
  50206. {
  50207. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  50208. {
  50209. if (isset($schema->maxLength) && $this->strlen($element) > $schema->maxLength) {
  50210. $this->addError($path, 'Must be at most ' . $schema->maxLength . ' characters long', 'maxLength', array(
  50211. 'maxLength' => $schema->maxLength,
  50212. ));
  50213. }
  50214. if (isset($schema->minLength) && $this->strlen($element) < $schema->minLength) {
  50215. $this->addError($path, 'Must be at least ' . $schema->minLength . ' characters long', 'minLength', array(
  50216. 'minLength' => $schema->minLength,
  50217. ));
  50218. }
  50219. if (isset($schema->pattern) && !preg_match('#' . str_replace('#', '\\#', $schema->pattern) . '#u', $element)) {
  50220. $this->addError($path, 'Does not match the regex pattern ' . $schema->pattern, 'pattern', array(
  50221. 'pattern' => $schema->pattern,
  50222. ));
  50223. }
  50224. $this->checkFormat($element, $schema, $path, $i);
  50225. }
  50226. private function strlen($string)
  50227. {
  50228. if (extension_loaded('mbstring')) {
  50229. return mb_strlen($string, mb_detect_encoding($string));
  50230. }
  50231. return strlen($string);
  50232. }
  50233. }
  50234. <?php
  50235. namespace JsonSchema\Constraints\TypeCheck;
  50236. class LooseTypeCheck implements TypeCheckInterface
  50237. {
  50238. public static function isObject($value)
  50239. {
  50240. return
  50241. is_object($value) ||
  50242. (is_array($value) && (count($value) == 0 || self::isAssociativeArray($value)));
  50243. }
  50244. public static function isArray($value)
  50245. {
  50246. return
  50247. is_array($value) &&
  50248. (count($value) == 0 || !self::isAssociativeArray($value));
  50249. }
  50250. public static function propertyGet($value, $property)
  50251. {
  50252. if (is_object($value)) {
  50253. return $value->{$property};
  50254. }
  50255. return $value[$property];
  50256. }
  50257. public static function propertySet(&$value, $property, $data)
  50258. {
  50259. if (is_object($value)) {
  50260. $value->{$property} = $data;
  50261. } else {
  50262. $value[$property] = $data;
  50263. }
  50264. }
  50265. public static function propertyExists($value, $property)
  50266. {
  50267. if (is_object($value)) {
  50268. return property_exists($value, $property);
  50269. }
  50270. return array_key_exists($property, $value);
  50271. }
  50272. public static function propertyCount($value)
  50273. {
  50274. if (is_object($value)) {
  50275. return count(get_object_vars($value));
  50276. }
  50277. return count($value);
  50278. }
  50279. private static function isAssociativeArray($arr)
  50280. {
  50281. return array_keys($arr) !== range(0, count($arr) - 1);
  50282. }
  50283. }
  50284. <?php
  50285. namespace JsonSchema\Constraints\TypeCheck;
  50286. class StrictTypeCheck implements TypeCheckInterface
  50287. {
  50288. public static function isObject($value)
  50289. {
  50290. return is_object($value);
  50291. }
  50292. public static function isArray($value)
  50293. {
  50294. return is_array($value);
  50295. }
  50296. public static function propertyGet($value, $property)
  50297. {
  50298. return $value->{$property};
  50299. }
  50300. public static function propertySet(&$value, $property, $data)
  50301. {
  50302. $value->{$property} = $data;
  50303. }
  50304. public static function propertyExists($value, $property)
  50305. {
  50306. return property_exists($value, $property);
  50307. }
  50308. public static function propertyCount($value)
  50309. {
  50310. if (!is_object($value)) {
  50311. return 0;
  50312. }
  50313. return count(get_object_vars($value));
  50314. }
  50315. }
  50316. <?php
  50317. namespace JsonSchema\Constraints\TypeCheck;
  50318. interface TypeCheckInterface
  50319. {
  50320. public static function isObject($value);
  50321. public static function isArray($value);
  50322. public static function propertyGet($value, $property);
  50323. public static function propertySet(&$value, $property, $data);
  50324. public static function propertyExists($value, $property);
  50325. public static function propertyCount($value);
  50326. }
  50327. <?php
  50328. namespace JsonSchema\Constraints;
  50329. use JsonSchema\Entity\JsonPointer;
  50330. use JsonSchema\Exception\InvalidArgumentException;
  50331. use UnexpectedValueException as StandardUnexpectedValueException;
  50332. class TypeConstraint extends Constraint
  50333. {
  50334. public static $wording = array(
  50335. 'integer' => 'an integer',
  50336. 'number' => 'a number',
  50337. 'boolean' => 'a boolean',
  50338. 'object' => 'an object',
  50339. 'array' => 'an array',
  50340. 'string' => 'a string',
  50341. 'null' => 'a null',
  50342. 'any' => null,
  50343. 0 => null,
  50344. );
  50345. public function check(&$value = null, $schema = null, JsonPointer $path = null, $i = null)
  50346. {
  50347. $type = isset($schema->type) ? $schema->type : null;
  50348. $isValid = false;
  50349. $wording = array();
  50350. if (is_array($type)) {
  50351. $this->validateTypesArray($value, $type, $wording, $isValid, $path);
  50352. } elseif (is_object($type)) {
  50353. $this->checkUndefined($value, $type, $path);
  50354. return;
  50355. } else {
  50356. $isValid = $this->validateType($value, $type);
  50357. }
  50358. if ($isValid === false) {
  50359. if (!is_array($type)) {
  50360. $this->validateTypeNameWording($type);
  50361. $wording[] = self::$wording[$type];
  50362. }
  50363. $this->addError($path, ucwords(gettype($value)) . ' value found, but ' .
  50364. $this->implodeWith($wording, ', ', 'or') . ' is required', 'type');
  50365. }
  50366. }
  50367. protected function validateTypesArray(&$value, array $type, &$validTypesWording, &$isValid, $path)
  50368. {
  50369. foreach ($type as $tp) {
  50370. if (is_object($tp)) {
  50371. if (!$isValid) {
  50372. $validator = $this->factory->createInstanceFor('type');
  50373. $subSchema = new \stdClass();
  50374. $subSchema->type = $tp;
  50375. $validator->check($value, $subSchema, $path, null);
  50376. $error = $validator->getErrors();
  50377. $isValid = !(bool) $error;
  50378. $validTypesWording[] = self::$wording['object'];
  50379. }
  50380. } else {
  50381. $this->validateTypeNameWording($tp);
  50382. $validTypesWording[] = self::$wording[$tp];
  50383. if (!$isValid) {
  50384. $isValid = $this->validateType($value, $tp);
  50385. }
  50386. }
  50387. }
  50388. }
  50389. protected function implodeWith(array $elements, $delimiter = ', ', $listEnd = false)
  50390. {
  50391. if ($listEnd === false || !isset($elements[1])) {
  50392. return implode($delimiter, $elements);
  50393. }
  50394. $lastElement = array_slice($elements, -1);
  50395. $firsElements = join($delimiter, array_slice($elements, 0, -1));
  50396. $implodedElements = array_merge(array($firsElements), $lastElement);
  50397. return join(" $listEnd ", $implodedElements);
  50398. }
  50399. protected function validateTypeNameWording($type)
  50400. {
  50401. if (!isset(self::$wording[$type])) {
  50402. throw new StandardUnexpectedValueException(
  50403. sprintf(
  50404. 'No wording for %s available, expected wordings are: [%s]',
  50405. var_export($type, true),
  50406. implode(', ', array_filter(self::$wording)))
  50407. );
  50408. }
  50409. }
  50410. protected function validateType(&$value, $type)
  50411. {
  50412. if (!$type) {
  50413. return true;
  50414. }
  50415. if ('any' === $type) {
  50416. return true;
  50417. }
  50418. if ('object' === $type) {
  50419. return $this->getTypeCheck()->isObject($value);
  50420. }
  50421. if ('array' === $type) {
  50422. return $this->getTypeCheck()->isArray($value);
  50423. }
  50424. $coerce = $this->factory->getConfig(Constraint::CHECK_MODE_COERCE_TYPES);
  50425. if ('integer' === $type) {
  50426. if ($coerce) {
  50427. $value = $this->toInteger($value);
  50428. }
  50429. return is_int($value);
  50430. }
  50431. if ('number' === $type) {
  50432. if ($coerce) {
  50433. $value = $this->toNumber($value);
  50434. }
  50435. return is_numeric($value) && !is_string($value);
  50436. }
  50437. if ('boolean' === $type) {
  50438. if ($coerce) {
  50439. $value = $this->toBoolean($value);
  50440. }
  50441. return is_bool($value);
  50442. }
  50443. if ('string' === $type) {
  50444. return is_string($value);
  50445. }
  50446. if ('email' === $type) {
  50447. return is_string($value);
  50448. }
  50449. if ('null' === $type) {
  50450. return is_null($value);
  50451. }
  50452. throw new InvalidArgumentException((is_object($value) ? 'object' : $value) . ' is an invalid type for ' . $type);
  50453. }
  50454. protected function toBoolean($value)
  50455. {
  50456. if ($value === 'true') {
  50457. return true;
  50458. }
  50459. if ($value === 'false') {
  50460. return false;
  50461. }
  50462. return $value;
  50463. }
  50464. protected function toNumber($value)
  50465. {
  50466. if (is_numeric($value)) {
  50467. return $value + 0;
  50468. }
  50469. return $value;
  50470. }
  50471. protected function toInteger($value)
  50472. {
  50473. if (is_numeric($value) && (int) $value == $value) {
  50474. return (int) $value;
  50475. }
  50476. return $value;
  50477. }
  50478. }
  50479. <?php
  50480. namespace JsonSchema\Constraints;
  50481. use JsonSchema\Constraints\TypeCheck\LooseTypeCheck;
  50482. use JsonSchema\Entity\JsonPointer;
  50483. use JsonSchema\Exception\ValidationException;
  50484. use JsonSchema\Uri\UriResolver;
  50485. class UndefinedConstraint extends Constraint
  50486. {
  50487. protected $appliedDefaults = array();
  50488. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  50489. {
  50490. if (is_null($schema) || !is_object($schema)) {
  50491. return;
  50492. }
  50493. $path = $this->incrementPath($path ?: new JsonPointer(''), $i);
  50494. if ($fromDefault) {
  50495. $path->setFromDefault();
  50496. }
  50497. $this->validateCommonProperties($value, $schema, $path, $i);
  50498. $this->validateOfProperties($value, $schema, $path, '');
  50499. $this->validateTypes($value, $schema, $path, $i);
  50500. }
  50501. public function validateTypes(&$value, $schema, JsonPointer $path, $i = null)
  50502. {
  50503. if ($this->getTypeCheck()->isArray($value)) {
  50504. $this->checkArray($value, $schema, $path, $i);
  50505. }
  50506. if (LooseTypeCheck::isObject($value)) {
  50507. $this->checkObject(
  50508. $value,
  50509. $schema,
  50510. $path,
  50511. isset($schema->properties) ? $schema->properties : null,
  50512. isset($schema->additionalProperties) ? $schema->additionalProperties : null,
  50513. isset($schema->patternProperties) ? $schema->patternProperties : null,
  50514. $this->appliedDefaults
  50515. );
  50516. }
  50517. if (is_string($value)) {
  50518. $this->checkString($value, $schema, $path, $i);
  50519. }
  50520. if (is_numeric($value)) {
  50521. $this->checkNumber($value, $schema, $path, $i);
  50522. }
  50523. if (isset($schema->enum)) {
  50524. $this->checkEnum($value, $schema, $path, $i);
  50525. }
  50526. }
  50527. protected function validateCommonProperties(&$value, $schema, JsonPointer $path, $i = '')
  50528. {
  50529. if (isset($schema->extends)) {
  50530. if (is_string($schema->extends)) {
  50531. $schema->extends = $this->validateUri($schema, $schema->extends);
  50532. }
  50533. if (is_array($schema->extends)) {
  50534. foreach ($schema->extends as $extends) {
  50535. $this->checkUndefined($value, $extends, $path, $i);
  50536. }
  50537. } else {
  50538. $this->checkUndefined($value, $schema->extends, $path, $i);
  50539. }
  50540. }
  50541. if (!$path->fromDefault()) {
  50542. $this->applyDefaultValues($value, $schema, $path);
  50543. }
  50544. if ($this->getTypeCheck()->isObject($value)) {
  50545. if (!($value instanceof self) && isset($schema->required) && is_array($schema->required)) {
  50546. foreach ($schema->required as $required) {
  50547. if (!$this->getTypeCheck()->propertyExists($value, $required)) {
  50548. $this->addError(
  50549. $this->incrementPath($path ?: new JsonPointer(''), $required),
  50550. 'The property ' . $required . ' is required',
  50551. 'required'
  50552. );
  50553. }
  50554. }
  50555. } elseif (isset($schema->required) && !is_array($schema->required)) {
  50556. if ($schema->required && $value instanceof self) {
  50557. $propertyPaths = $path->getPropertyPaths();
  50558. $propertyName = end($propertyPaths);
  50559. $this->addError(
  50560. $path,
  50561. 'The property ' . $propertyName . ' is required',
  50562. 'required'
  50563. );
  50564. }
  50565. } else {
  50566. if ($value instanceof self) {
  50567. return;
  50568. }
  50569. }
  50570. }
  50571. if (!($value instanceof self)) {
  50572. $this->checkType($value, $schema, $path, $i);
  50573. }
  50574. if (isset($schema->disallow)) {
  50575. $initErrors = $this->getErrors();
  50576. $typeSchema = new \stdClass();
  50577. $typeSchema->type = $schema->disallow;
  50578. $this->checkType($value, $typeSchema, $path);
  50579. if (count($this->getErrors()) == count($initErrors)) {
  50580. $this->addError($path, 'Disallowed value was matched', 'disallow');
  50581. } else {
  50582. $this->errors = $initErrors;
  50583. }
  50584. }
  50585. if (isset($schema->not)) {
  50586. $initErrors = $this->getErrors();
  50587. $this->checkUndefined($value, $schema->not, $path, $i);
  50588. if (count($this->getErrors()) == count($initErrors)) {
  50589. $this->addError($path, 'Matched a schema which it should not', 'not');
  50590. } else {
  50591. $this->errors = $initErrors;
  50592. }
  50593. }
  50594. if (isset($schema->dependencies) && $this->getTypeCheck()->isObject($value)) {
  50595. $this->validateDependencies($value, $schema->dependencies, $path);
  50596. }
  50597. }
  50598. private function shouldApplyDefaultValue($requiredOnly, $schema, $name = null, $parentSchema = null)
  50599. {
  50600. if (!$requiredOnly) {
  50601. return true;
  50602. }
  50603. if (
  50604. $name !== null
  50605. && isset($parentSchema->required)
  50606. && is_array($parentSchema->required)
  50607. && in_array($name, $parentSchema->required)
  50608. ) {
  50609. return true;
  50610. }
  50611. if (isset($schema->required) && !is_array($schema->required) && $schema->required) {
  50612. return true;
  50613. }
  50614. return false;
  50615. }
  50616. protected function applyDefaultValues(&$value, $schema, $path)
  50617. {
  50618. if (!$this->factory->getConfig(self::CHECK_MODE_APPLY_DEFAULTS)) {
  50619. return;
  50620. }
  50621. $requiredOnly = $this->factory->getConfig(self::CHECK_MODE_ONLY_REQUIRED_DEFAULTS);
  50622. if (isset($schema->properties) && LooseTypeCheck::isObject($value)) {
  50623. foreach ($schema->properties as $currentProperty => $propertyDefinition) {
  50624. $propertyDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($propertyDefinition);
  50625. if (
  50626. !LooseTypeCheck::propertyExists($value, $currentProperty)
  50627. && property_exists($propertyDefinition, 'default')
  50628. && $this->shouldApplyDefaultValue($requiredOnly, $propertyDefinition, $currentProperty, $schema)
  50629. ) {
  50630. if (is_object($propertyDefinition->default)) {
  50631. LooseTypeCheck::propertySet($value, $currentProperty, clone $propertyDefinition->default);
  50632. } else {
  50633. LooseTypeCheck::propertySet($value, $currentProperty, $propertyDefinition->default);
  50634. }
  50635. $this->appliedDefaults[] = $currentProperty;
  50636. }
  50637. }
  50638. } elseif (isset($schema->items) && LooseTypeCheck::isArray($value)) {
  50639. $items = array();
  50640. if (LooseTypeCheck::isArray($schema->items)) {
  50641. $items = $schema->items;
  50642. } elseif (isset($schema->minItems) && count($value) < $schema->minItems) {
  50643. $items = array_fill(count($value), $schema->minItems - count($value), $schema->items);
  50644. }
  50645. foreach ($items as $currentItem => $itemDefinition) {
  50646. $itemDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($itemDefinition);
  50647. if (
  50648. !array_key_exists($currentItem, $value)
  50649. && property_exists($itemDefinition, 'default')
  50650. && $this->shouldApplyDefaultValue($requiredOnly, $itemDefinition)) {
  50651. if (is_object($itemDefinition->default)) {
  50652. $value[$currentItem] = clone $itemDefinition->default;
  50653. } else {
  50654. $value[$currentItem] = $itemDefinition->default;
  50655. }
  50656. }
  50657. $path->setFromDefault();
  50658. }
  50659. } elseif (
  50660. $value instanceof self
  50661. && property_exists($schema, 'default')
  50662. && $this->shouldApplyDefaultValue($requiredOnly, $schema)) {
  50663. $value = is_object($schema->default) ? clone $schema->default : $schema->default;
  50664. $path->setFromDefault();
  50665. }
  50666. }
  50667. protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i = '')
  50668. {
  50669. if ($value instanceof self) {
  50670. return;
  50671. }
  50672. if (isset($schema->allOf)) {
  50673. $isValid = true;
  50674. foreach ($schema->allOf as $allOf) {
  50675. $initErrors = $this->getErrors();
  50676. $this->checkUndefined($value, $allOf, $path, $i);
  50677. $isValid = $isValid && (count($this->getErrors()) == count($initErrors));
  50678. }
  50679. if (!$isValid) {
  50680. $this->addError($path, 'Failed to match all schemas', 'allOf');
  50681. }
  50682. }
  50683. if (isset($schema->anyOf)) {
  50684. $isValid = false;
  50685. $startErrors = $this->getErrors();
  50686. $caughtException = null;
  50687. foreach ($schema->anyOf as $anyOf) {
  50688. $initErrors = $this->getErrors();
  50689. try {
  50690. $this->checkUndefined($value, $anyOf, $path, $i);
  50691. if ($isValid = (count($this->getErrors()) == count($initErrors))) {
  50692. break;
  50693. }
  50694. } catch (ValidationException $e) {
  50695. $isValid = false;
  50696. }
  50697. }
  50698. if (!$isValid) {
  50699. $this->addError($path, 'Failed to match at least one schema', 'anyOf');
  50700. } else {
  50701. $this->errors = $startErrors;
  50702. }
  50703. }
  50704. if (isset($schema->oneOf)) {
  50705. $allErrors = array();
  50706. $matchedSchemas = 0;
  50707. $startErrors = $this->getErrors();
  50708. foreach ($schema->oneOf as $oneOf) {
  50709. try {
  50710. $this->errors = array();
  50711. $this->checkUndefined($value, $oneOf, $path, $i);
  50712. if (count($this->getErrors()) == 0) {
  50713. $matchedSchemas++;
  50714. }
  50715. $allErrors = array_merge($allErrors, array_values($this->getErrors()));
  50716. } catch (ValidationException $e) {
  50717. }
  50718. }
  50719. if ($matchedSchemas !== 1) {
  50720. $this->addErrors(array_merge($allErrors, $startErrors));
  50721. $this->addError($path, 'Failed to match exactly one schema', 'oneOf');
  50722. } else {
  50723. $this->errors = $startErrors;
  50724. }
  50725. }
  50726. }
  50727. protected function validateDependencies($value, $dependencies, JsonPointer $path, $i = '')
  50728. {
  50729. foreach ($dependencies as $key => $dependency) {
  50730. if ($this->getTypeCheck()->propertyExists($value, $key)) {
  50731. if (is_string($dependency)) {
  50732. if (!$this->getTypeCheck()->propertyExists($value, $dependency)) {
  50733. $this->addError($path, "$key depends on $dependency and $dependency is missing", 'dependencies');
  50734. }
  50735. } elseif (is_array($dependency)) {
  50736. foreach ($dependency as $d) {
  50737. if (!$this->getTypeCheck()->propertyExists($value, $d)) {
  50738. $this->addError($path, "$key depends on $d and $d is missing", 'dependencies');
  50739. }
  50740. }
  50741. } elseif (is_object($dependency)) {
  50742. $this->checkUndefined($value, $dependency, $path, $i);
  50743. }
  50744. }
  50745. }
  50746. }
  50747. protected function validateUri($schema, $schemaUri = null)
  50748. {
  50749. $resolver = new UriResolver();
  50750. $retriever = $this->factory->getUriRetriever();
  50751. $jsonSchema = null;
  50752. if ($resolver->isValid($schemaUri)) {
  50753. $schemaId = property_exists($schema, 'id') ? $schema->id : null;
  50754. $jsonSchema = $retriever->retrieve($schemaId, $schemaUri);
  50755. }
  50756. return $jsonSchema;
  50757. }
  50758. }
  50759. <?php
  50760. namespace JsonSchema\Entity;
  50761. use JsonSchema\Exception\InvalidArgumentException;
  50762. class JsonPointer
  50763. {
  50764. private $filename;
  50765. private $propertyPaths = array();
  50766. private $fromDefault = false;
  50767. public function __construct($value)
  50768. {
  50769. if (!is_string($value)) {
  50770. throw new InvalidArgumentException('Ref value must be a string');
  50771. }
  50772. $splitRef = explode('#', $value, 2);
  50773. $this->filename = $splitRef[0];
  50774. if (array_key_exists(1, $splitRef)) {
  50775. $this->propertyPaths = $this->decodePropertyPaths($splitRef[1]);
  50776. }
  50777. }
  50778. private function decodePropertyPaths($propertyPathString)
  50779. {
  50780. $paths = array();
  50781. foreach (explode('/', trim($propertyPathString, '/')) as $path) {
  50782. $path = $this->decodePath($path);
  50783. if (is_string($path) && '' !== $path) {
  50784. $paths[] = $path;
  50785. }
  50786. }
  50787. return $paths;
  50788. }
  50789. private function encodePropertyPaths()
  50790. {
  50791. return array_map(
  50792. array($this, 'encodePath'),
  50793. $this->getPropertyPaths()
  50794. );
  50795. }
  50796. private function decodePath($path)
  50797. {
  50798. return strtr($path, array('~1' => '/', '~0' => '~', '%25' => '%'));
  50799. }
  50800. private function encodePath($path)
  50801. {
  50802. return strtr($path, array('/' => '~1', '~' => '~0', '%' => '%25'));
  50803. }
  50804. public function getFilename()
  50805. {
  50806. return $this->filename;
  50807. }
  50808. public function getPropertyPaths()
  50809. {
  50810. return $this->propertyPaths;
  50811. }
  50812. public function withPropertyPaths(array $propertyPaths)
  50813. {
  50814. $new = clone $this;
  50815. $new->propertyPaths = $propertyPaths;
  50816. return $new;
  50817. }
  50818. public function getPropertyPathAsString()
  50819. {
  50820. return rtrim('#/' . implode('/', $this->encodePropertyPaths()), '/');
  50821. }
  50822. public function __toString()
  50823. {
  50824. return $this->getFilename() . $this->getPropertyPathAsString();
  50825. }
  50826. public function setFromDefault()
  50827. {
  50828. $this->fromDefault = true;
  50829. }
  50830. public function fromDefault()
  50831. {
  50832. return $this->fromDefault;
  50833. }
  50834. }
  50835. <?php
  50836. namespace JsonSchema\Exception;
  50837. interface ExceptionInterface
  50838. {
  50839. }
  50840. <?php
  50841. namespace JsonSchema\Exception;
  50842. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  50843. {
  50844. }
  50845. <?php
  50846. namespace JsonSchema\Exception;
  50847. class InvalidConfigException extends RuntimeException
  50848. {
  50849. }
  50850. <?php
  50851. namespace JsonSchema\Exception;
  50852. class InvalidSchemaException extends RuntimeException
  50853. {
  50854. }
  50855. <?php
  50856. namespace JsonSchema\Exception;
  50857. class InvalidSchemaMediaTypeException extends RuntimeException
  50858. {
  50859. }
  50860. <?php
  50861. namespace JsonSchema\Exception;
  50862. class InvalidSourceUriException extends InvalidArgumentException
  50863. {
  50864. }
  50865. <?php
  50866. namespace JsonSchema\Exception;
  50867. class JsonDecodingException extends RuntimeException
  50868. {
  50869. public function __construct($code = JSON_ERROR_NONE, \Exception $previous = null)
  50870. {
  50871. switch ($code) {
  50872. case JSON_ERROR_DEPTH:
  50873. $message = 'The maximum stack depth has been exceeded';
  50874. break;
  50875. case JSON_ERROR_STATE_MISMATCH:
  50876. $message = 'Invalid or malformed JSON';
  50877. break;
  50878. case JSON_ERROR_CTRL_CHAR:
  50879. $message = 'Control character error, possibly incorrectly encoded';
  50880. break;
  50881. case JSON_ERROR_UTF8:
  50882. $message = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  50883. break;
  50884. case JSON_ERROR_SYNTAX:
  50885. $message = 'JSON syntax is malformed';
  50886. break;
  50887. default:
  50888. $message = 'Syntax error';
  50889. }
  50890. parent::__construct($message, $code, $previous);
  50891. }
  50892. }
  50893. <?php
  50894. namespace JsonSchema\Exception;
  50895. class ResourceNotFoundException extends RuntimeException
  50896. {
  50897. }
  50898. <?php
  50899. namespace JsonSchema\Exception;
  50900. class RuntimeException extends \RuntimeException implements ExceptionInterface
  50901. {
  50902. }
  50903. <?php
  50904. namespace JsonSchema\Exception;
  50905. class UnresolvableJsonPointerException extends InvalidArgumentException
  50906. {
  50907. }
  50908. <?php
  50909. namespace JsonSchema\Exception;
  50910. class UriResolverException extends RuntimeException
  50911. {
  50912. }
  50913. <?php
  50914. namespace JsonSchema\Exception;
  50915. class ValidationException extends RuntimeException
  50916. {
  50917. }
  50918. <?php
  50919. namespace JsonSchema\Iterator;
  50920. class ObjectIterator implements \Iterator, \Countable
  50921. {
  50922. private $object;
  50923. private $position = 0;
  50924. private $data = array();
  50925. private $initialized = false;
  50926. public function __construct($object)
  50927. {
  50928. $this->object = $object;
  50929. }
  50930. public function current()
  50931. {
  50932. $this->initialize();
  50933. return $this->data[$this->position];
  50934. }
  50935. public function next()
  50936. {
  50937. $this->initialize();
  50938. $this->position++;
  50939. }
  50940. public function key()
  50941. {
  50942. $this->initialize();
  50943. return $this->position;
  50944. }
  50945. public function valid()
  50946. {
  50947. $this->initialize();
  50948. return isset($this->data[$this->position]);
  50949. }
  50950. public function rewind()
  50951. {
  50952. $this->initialize();
  50953. $this->position = 0;
  50954. }
  50955. public function count()
  50956. {
  50957. $this->initialize();
  50958. return count($this->data);
  50959. }
  50960. private function initialize()
  50961. {
  50962. if (!$this->initialized) {
  50963. $this->data = $this->buildDataFromObject($this->object);
  50964. $this->initialized = true;
  50965. }
  50966. }
  50967. private function buildDataFromObject($object)
  50968. {
  50969. $result = array();
  50970. $stack = new \SplStack();
  50971. $stack->push($object);
  50972. while (!$stack->isEmpty()) {
  50973. $current = $stack->pop();
  50974. if (is_object($current)) {
  50975. array_push($result, $current);
  50976. }
  50977. foreach ($this->getDataFromItem($current) as $propertyName => $propertyValue) {
  50978. if (is_object($propertyValue) || is_array($propertyValue)) {
  50979. $stack->push($propertyValue);
  50980. }
  50981. }
  50982. }
  50983. return $result;
  50984. }
  50985. private function getDataFromItem($item)
  50986. {
  50987. if (!is_object($item) && !is_array($item)) {
  50988. return array();
  50989. }
  50990. return is_object($item) ? get_object_vars($item) : $item;
  50991. }
  50992. }
  50993. <?php
  50994. namespace JsonSchema;
  50995. class Rfc3339
  50996. {
  50997. const REGEX = '/^(\d{4}-\d{2}-\d{2}[T ]{1}\d{2}:\d{2}:\d{2})(\.\d+)?(Z|([+-]\d{2}):?(\d{2}))$/';
  50998. public static function createFromString($string)
  50999. {
  51000. if (!preg_match(self::REGEX, strtoupper($string), $matches)) {
  51001. return null;
  51002. }
  51003. $dateAndTime = $matches[1];
  51004. $microseconds = $matches[2] ?: '.000000';
  51005. $timeZone = 'Z' !== $matches[3] ? $matches[4] . ':' . $matches[5] : '+00:00';
  51006. $dateFormat = strpos($dateAndTime, 'T') === false ? 'Y-m-d H:i:s.uP' : 'Y-m-d\TH:i:s.uP';
  51007. $dateTime = \DateTime::createFromFormat($dateFormat, $dateAndTime . $microseconds . $timeZone, new \DateTimeZone('UTC'));
  51008. return $dateTime ?: null;
  51009. }
  51010. }
  51011. <?php
  51012. namespace JsonSchema;
  51013. use JsonSchema\Constraints\BaseConstraint;
  51014. use JsonSchema\Entity\JsonPointer;
  51015. use JsonSchema\Exception\UnresolvableJsonPointerException;
  51016. use JsonSchema\Uri\UriResolver;
  51017. use JsonSchema\Uri\UriRetriever;
  51018. class SchemaStorage implements SchemaStorageInterface
  51019. {
  51020. const INTERNAL_PROVIDED_SCHEMA_URI = 'internal://provided-schema/';
  51021. protected $uriRetriever;
  51022. protected $uriResolver;
  51023. protected $schemas = array();
  51024. public function __construct(
  51025. UriRetrieverInterface $uriRetriever = null,
  51026. UriResolverInterface $uriResolver = null
  51027. ) {
  51028. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  51029. $this->uriResolver = $uriResolver ?: new UriResolver();
  51030. }
  51031. public function getUriRetriever()
  51032. {
  51033. return $this->uriRetriever;
  51034. }
  51035. public function getUriResolver()
  51036. {
  51037. return $this->uriResolver;
  51038. }
  51039. public function addSchema($id, $schema = null)
  51040. {
  51041. if (is_null($schema) && $id !== self::INTERNAL_PROVIDED_SCHEMA_URI) {
  51042. $schema = $this->uriRetriever->retrieve($id);
  51043. }
  51044. if (is_array($schema)) {
  51045. $schema = BaseConstraint::arrayToObjectRecursive($schema);
  51046. }
  51047. if (is_object($schema) && property_exists($schema, 'id')) {
  51048. if ($schema->id == 'http://json-schema.org/draft-04/schema#') {
  51049. $schema->properties->id->format = 'uri-reference';
  51050. } elseif ($schema->id == 'http://json-schema.org/draft-03/schema#') {
  51051. $schema->properties->id->format = 'uri-reference';
  51052. $schema->properties->{'$ref'}->format = 'uri-reference';
  51053. }
  51054. }
  51055. $this->expandRefs($schema, $id);
  51056. $this->schemas[$id] = $schema;
  51057. }
  51058. private function expandRefs(&$schema, $base = null)
  51059. {
  51060. if (!is_object($schema)) {
  51061. if (is_array($schema)) {
  51062. foreach ($schema as &$member) {
  51063. $this->expandRefs($member, $base);
  51064. }
  51065. }
  51066. return;
  51067. }
  51068. if (property_exists($schema, 'id') && is_string($schema->id) && $base != $schema->id) {
  51069. $base = $this->uriResolver->resolve($schema->id, $base);
  51070. }
  51071. if (property_exists($schema, '$ref') && is_string($schema->{'$ref'})) {
  51072. $refPointer = new JsonPointer($this->uriResolver->resolve($schema->{'$ref'}, $base));
  51073. $schema->{'$ref'} = (string) $refPointer;
  51074. }
  51075. foreach ($schema as &$member) {
  51076. $this->expandRefs($member, $base);
  51077. }
  51078. }
  51079. public function getSchema($id)
  51080. {
  51081. if (!array_key_exists($id, $this->schemas)) {
  51082. $this->addSchema($id);
  51083. }
  51084. return $this->schemas[$id];
  51085. }
  51086. public function resolveRef($ref)
  51087. {
  51088. $jsonPointer = new JsonPointer($ref);
  51089. $fileName = $jsonPointer->getFilename();
  51090. if (!strlen($fileName)) {
  51091. throw new UnresolvableJsonPointerException(sprintf(
  51092. "Could not resolve fragment '%s': no file is defined",
  51093. $jsonPointer->getPropertyPathAsString()
  51094. ));
  51095. }
  51096. $refSchema = $this->getSchema($fileName);
  51097. foreach ($jsonPointer->getPropertyPaths() as $path) {
  51098. if (is_object($refSchema) && property_exists($refSchema, $path)) {
  51099. $refSchema = $this->resolveRefSchema($refSchema->{$path});
  51100. } elseif (is_array($refSchema) && array_key_exists($path, $refSchema)) {
  51101. $refSchema = $this->resolveRefSchema($refSchema[$path]);
  51102. } else {
  51103. throw new UnresolvableJsonPointerException(sprintf(
  51104. 'File: %s is found, but could not resolve fragment: %s',
  51105. $jsonPointer->getFilename(),
  51106. $jsonPointer->getPropertyPathAsString()
  51107. ));
  51108. }
  51109. }
  51110. return $refSchema;
  51111. }
  51112. public function resolveRefSchema($refSchema)
  51113. {
  51114. if (is_object($refSchema) && property_exists($refSchema, '$ref') && is_string($refSchema->{'$ref'})) {
  51115. $newSchema = $this->resolveRef($refSchema->{'$ref'});
  51116. $refSchema = (object) (get_object_vars($refSchema) + get_object_vars($newSchema));
  51117. unset($refSchema->{'$ref'});
  51118. }
  51119. return $refSchema;
  51120. }
  51121. }
  51122. <?php
  51123. namespace JsonSchema;
  51124. interface SchemaStorageInterface
  51125. {
  51126. public function addSchema($id, $schema = null);
  51127. public function getSchema($id);
  51128. public function resolveRef($ref);
  51129. public function resolveRefSchema($refSchema);
  51130. }
  51131. <?php
  51132. namespace JsonSchema\Uri\Retrievers;
  51133. abstract class AbstractRetriever implements UriRetrieverInterface
  51134. {
  51135. protected $contentType;
  51136. public function getContentType()
  51137. {
  51138. return $this->contentType;
  51139. }
  51140. }
  51141. <?php
  51142. namespace JsonSchema\Uri\Retrievers;
  51143. use JsonSchema\Exception\RuntimeException;
  51144. use JsonSchema\Validator;
  51145. class Curl extends AbstractRetriever
  51146. {
  51147. protected $messageBody;
  51148. public function __construct()
  51149. {
  51150. if (!function_exists('curl_init')) {
  51151. throw new RuntimeException('cURL not installed');
  51152. }
  51153. }
  51154. public function retrieve($uri)
  51155. {
  51156. $ch = curl_init();
  51157. curl_setopt($ch, CURLOPT_URL, $uri);
  51158. curl_setopt($ch, CURLOPT_HEADER, true);
  51159. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  51160. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: ' . Validator::SCHEMA_MEDIA_TYPE));
  51161. $response = curl_exec($ch);
  51162. if (false === $response) {
  51163. throw new \JsonSchema\Exception\ResourceNotFoundException('JSON schema not found');
  51164. }
  51165. $this->fetchMessageBody($response);
  51166. $this->fetchContentType($response);
  51167. curl_close($ch);
  51168. return $this->messageBody;
  51169. }
  51170. private function fetchMessageBody($response)
  51171. {
  51172. preg_match("/(?:\r\n){2}(.*)$/ms", $response, $match);
  51173. $this->messageBody = $match[1];
  51174. }
  51175. protected function fetchContentType($response)
  51176. {
  51177. if (0 < preg_match("/Content-Type:(\V*)/ims", $response, $match)) {
  51178. $this->contentType = trim($match[1]);
  51179. return true;
  51180. }
  51181. return false;
  51182. }
  51183. }
  51184. <?php
  51185. namespace JsonSchema\Uri\Retrievers;
  51186. use JsonSchema\Exception\ResourceNotFoundException;
  51187. class FileGetContents extends AbstractRetriever
  51188. {
  51189. protected $messageBody;
  51190. public function retrieve($uri)
  51191. {
  51192. $errorMessage = null;
  51193. set_error_handler(function ($errno, $errstr) use (&$errorMessage) {
  51194. $errorMessage = $errstr;
  51195. });
  51196. $response = file_get_contents($uri);
  51197. restore_error_handler();
  51198. if ($errorMessage) {
  51199. throw new ResourceNotFoundException($errorMessage);
  51200. }
  51201. if (false === $response) {
  51202. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  51203. }
  51204. if ($response == ''
  51205. && substr($uri, 0, 7) == 'file://' && substr($uri, -1) == '/'
  51206. ) {
  51207. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  51208. }
  51209. $this->messageBody = $response;
  51210. if (!empty($http_response_header)) {
  51211. $this->fetchContentType($http_response_header);
  51212. } else {
  51213. $this->contentType = null;
  51214. }
  51215. return $this->messageBody;
  51216. }
  51217. private function fetchContentType(array $headers)
  51218. {
  51219. foreach ($headers as $header) {
  51220. if ($this->contentType = self::getContentTypeMatchInHeader($header)) {
  51221. return true;
  51222. }
  51223. }
  51224. return false;
  51225. }
  51226. protected static function getContentTypeMatchInHeader($header)
  51227. {
  51228. if (0 < preg_match("/Content-Type:(\V*)/ims", $header, $match)) {
  51229. return trim($match[1]);
  51230. }
  51231. return null;
  51232. }
  51233. }
  51234. <?php
  51235. namespace JsonSchema\Uri\Retrievers;
  51236. use JsonSchema\Validator;
  51237. class PredefinedArray extends AbstractRetriever
  51238. {
  51239. private $schemas;
  51240. public function __construct(array $schemas, $contentType = Validator::SCHEMA_MEDIA_TYPE)
  51241. {
  51242. $this->schemas = $schemas;
  51243. $this->contentType = $contentType;
  51244. }
  51245. public function retrieve($uri)
  51246. {
  51247. if (!array_key_exists($uri, $this->schemas)) {
  51248. throw new \JsonSchema\Exception\ResourceNotFoundException(sprintf(
  51249. 'The JSON schema "%s" was not found.',
  51250. $uri
  51251. ));
  51252. }
  51253. return $this->schemas[$uri];
  51254. }
  51255. }
  51256. <?php
  51257. namespace JsonSchema\Uri\Retrievers;
  51258. interface UriRetrieverInterface
  51259. {
  51260. public function retrieve($uri);
  51261. public function getContentType();
  51262. }
  51263. <?php
  51264. namespace JsonSchema\Uri;
  51265. use JsonSchema\Exception\UriResolverException;
  51266. use JsonSchema\UriResolverInterface;
  51267. class UriResolver implements UriResolverInterface
  51268. {
  51269. public function parse($uri)
  51270. {
  51271. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  51272. $components = array();
  51273. if (5 < count($match)) {
  51274. $components = array(
  51275. 'scheme' => $match[2],
  51276. 'authority' => $match[4],
  51277. 'path' => $match[5]
  51278. );
  51279. }
  51280. if (7 < count($match)) {
  51281. $components['query'] = $match[7];
  51282. }
  51283. if (9 < count($match)) {
  51284. $components['fragment'] = $match[9];
  51285. }
  51286. return $components;
  51287. }
  51288. public function generate(array $components)
  51289. {
  51290. $uri = $components['scheme'] . '://'
  51291. . $components['authority']
  51292. . $components['path'];
  51293. if (array_key_exists('query', $components) && strlen($components['query'])) {
  51294. $uri .= '?' . $components['query'];
  51295. }
  51296. if (array_key_exists('fragment', $components)) {
  51297. $uri .= '#' . $components['fragment'];
  51298. }
  51299. return $uri;
  51300. }
  51301. public function resolve($uri, $baseUri = null)
  51302. {
  51303. if (
  51304. !is_null($baseUri) &&
  51305. !filter_var($baseUri, \FILTER_VALIDATE_URL) &&
  51306. !preg_match('|^[^/]+://|u', $baseUri)
  51307. ) {
  51308. if (is_file($baseUri)) {
  51309. $baseUri = 'file://' . realpath($baseUri);
  51310. } elseif (is_dir($baseUri)) {
  51311. $baseUri = 'file://' . realpath($baseUri) . '/';
  51312. } else {
  51313. $baseUri = 'file://' . getcwd() . '/' . $baseUri;
  51314. }
  51315. }
  51316. if ($uri == '') {
  51317. return $baseUri;
  51318. }
  51319. $components = $this->parse($uri);
  51320. $path = $components['path'];
  51321. if (!empty($components['scheme'])) {
  51322. return $uri;
  51323. }
  51324. $baseComponents = $this->parse($baseUri);
  51325. $basePath = $baseComponents['path'];
  51326. $baseComponents['path'] = self::combineRelativePathWithBasePath($path, $basePath);
  51327. if (isset($components['fragment'])) {
  51328. $baseComponents['fragment'] = $components['fragment'];
  51329. }
  51330. return $this->generate($baseComponents);
  51331. }
  51332. public static function combineRelativePathWithBasePath($relativePath, $basePath)
  51333. {
  51334. $relativePath = self::normalizePath($relativePath);
  51335. if ($relativePath == '') {
  51336. return $basePath;
  51337. }
  51338. if ($relativePath[0] == '/') {
  51339. return $relativePath;
  51340. }
  51341. $basePathSegments = explode('/', $basePath);
  51342. preg_match('|^/?(\.\./(?:\./)*)*|', $relativePath, $match);
  51343. $numLevelUp = strlen($match[0]) /3 + 1;
  51344. if ($numLevelUp >= count($basePathSegments)) {
  51345. throw new UriResolverException(sprintf("Unable to resolve URI '%s' from base '%s'", $relativePath, $basePath));
  51346. }
  51347. $basePathSegments = array_slice($basePathSegments, 0, -$numLevelUp);
  51348. $path = preg_replace('|^/?(\.\./(\./)*)*|', '', $relativePath);
  51349. return implode('/', $basePathSegments) . '/' . $path;
  51350. }
  51351. private static function normalizePath($path)
  51352. {
  51353. $path = preg_replace('|((?<!\.)\./)*|', '', $path);
  51354. $path = preg_replace('|//|', '/', $path);
  51355. return $path;
  51356. }
  51357. public function isValid($uri)
  51358. {
  51359. $components = $this->parse($uri);
  51360. return !empty($components);
  51361. }
  51362. }
  51363. <?php
  51364. namespace JsonSchema\Uri;
  51365. use JsonSchema\Exception\InvalidSchemaMediaTypeException;
  51366. use JsonSchema\Exception\JsonDecodingException;
  51367. use JsonSchema\Exception\ResourceNotFoundException;
  51368. use JsonSchema\Uri\Retrievers\FileGetContents;
  51369. use JsonSchema\Uri\Retrievers\UriRetrieverInterface;
  51370. use JsonSchema\UriRetrieverInterface as BaseUriRetrieverInterface;
  51371. use JsonSchema\Validator;
  51372. class UriRetriever implements BaseUriRetrieverInterface
  51373. {
  51374. protected $translationMap = array(
  51375. '|^https?://json-schema.org/draft-(0[34])/schema#?|' => 'package://dist/schema/json-schema-draft-$1.json'
  51376. );
  51377. protected $allowedInvalidContentTypeEndpoints = array(
  51378. 'http://json-schema.org/',
  51379. 'https://json-schema.org/'
  51380. );
  51381. protected $uriRetriever = null;
  51382. private $schemaCache = array();
  51383. public function addInvalidContentTypeEndpoint($endpoint)
  51384. {
  51385. $this->allowedInvalidContentTypeEndpoints[] = $endpoint;
  51386. }
  51387. public function confirmMediaType($uriRetriever, $uri)
  51388. {
  51389. $contentType = $uriRetriever->getContentType();
  51390. if (is_null($contentType)) {
  51391. return;
  51392. }
  51393. if (in_array($contentType, array(Validator::SCHEMA_MEDIA_TYPE, 'application/json'))) {
  51394. return;
  51395. }
  51396. foreach ($this->allowedInvalidContentTypeEndpoints as $endpoint) {
  51397. if (strpos($uri, $endpoint) === 0) {
  51398. return true;
  51399. }
  51400. }
  51401. throw new InvalidSchemaMediaTypeException(sprintf('Media type %s expected', Validator::SCHEMA_MEDIA_TYPE));
  51402. }
  51403. public function getUriRetriever()
  51404. {
  51405. if (is_null($this->uriRetriever)) {
  51406. $this->setUriRetriever(new FileGetContents());
  51407. }
  51408. return $this->uriRetriever;
  51409. }
  51410. public function resolvePointer($jsonSchema, $uri)
  51411. {
  51412. $resolver = new UriResolver();
  51413. $parsed = $resolver->parse($uri);
  51414. if (empty($parsed['fragment'])) {
  51415. return $jsonSchema;
  51416. }
  51417. $path = explode('/', $parsed['fragment']);
  51418. while ($path) {
  51419. $pathElement = array_shift($path);
  51420. if (!empty($pathElement)) {
  51421. $pathElement = str_replace('~1', '/', $pathElement);
  51422. $pathElement = str_replace('~0', '~', $pathElement);
  51423. if (!empty($jsonSchema->$pathElement)) {
  51424. $jsonSchema = $jsonSchema->$pathElement;
  51425. } else {
  51426. throw new ResourceNotFoundException(
  51427. 'Fragment "' . $parsed['fragment'] . '" not found'
  51428. . ' in ' . $uri
  51429. );
  51430. }
  51431. if (!is_object($jsonSchema)) {
  51432. throw new ResourceNotFoundException(
  51433. 'Fragment part "' . $pathElement . '" is no object '
  51434. . ' in ' . $uri
  51435. );
  51436. }
  51437. }
  51438. }
  51439. return $jsonSchema;
  51440. }
  51441. public function retrieve($uri, $baseUri = null, $translate = true)
  51442. {
  51443. $resolver = new UriResolver();
  51444. $resolvedUri = $fetchUri = $resolver->resolve($uri, $baseUri);
  51445. $arParts = $resolver->parse($resolvedUri);
  51446. if (isset($arParts['fragment'])) {
  51447. unset($arParts['fragment']);
  51448. $fetchUri = $resolver->generate($arParts);
  51449. }
  51450. if ($translate) {
  51451. $fetchUri = $this->translate($fetchUri);
  51452. }
  51453. $jsonSchema = $this->loadSchema($fetchUri);
  51454. $jsonSchema = $this->resolvePointer($jsonSchema, $resolvedUri);
  51455. if ($jsonSchema instanceof \stdClass) {
  51456. $jsonSchema->id = $resolvedUri;
  51457. }
  51458. return $jsonSchema;
  51459. }
  51460. protected function loadSchema($fetchUri)
  51461. {
  51462. if (isset($this->schemaCache[$fetchUri])) {
  51463. return $this->schemaCache[$fetchUri];
  51464. }
  51465. $uriRetriever = $this->getUriRetriever();
  51466. $contents = $this->uriRetriever->retrieve($fetchUri);
  51467. $this->confirmMediaType($uriRetriever, $fetchUri);
  51468. $jsonSchema = json_decode($contents);
  51469. if (JSON_ERROR_NONE < $error = json_last_error()) {
  51470. throw new JsonDecodingException($error);
  51471. }
  51472. $this->schemaCache[$fetchUri] = $jsonSchema;
  51473. return $jsonSchema;
  51474. }
  51475. public function setUriRetriever(UriRetrieverInterface $uriRetriever)
  51476. {
  51477. $this->uriRetriever = $uriRetriever;
  51478. return $this;
  51479. }
  51480. public function parse($uri)
  51481. {
  51482. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  51483. $components = array();
  51484. if (5 < count($match)) {
  51485. $components = array(
  51486. 'scheme' => $match[2],
  51487. 'authority' => $match[4],
  51488. 'path' => $match[5]
  51489. );
  51490. }
  51491. if (7 < count($match)) {
  51492. $components['query'] = $match[7];
  51493. }
  51494. if (9 < count($match)) {
  51495. $components['fragment'] = $match[9];
  51496. }
  51497. return $components;
  51498. }
  51499. public function generate(array $components)
  51500. {
  51501. $uri = $components['scheme'] . '://'
  51502. . $components['authority']
  51503. . $components['path'];
  51504. if (array_key_exists('query', $components)) {
  51505. $uri .= $components['query'];
  51506. }
  51507. if (array_key_exists('fragment', $components)) {
  51508. $uri .= $components['fragment'];
  51509. }
  51510. return $uri;
  51511. }
  51512. public function resolve($uri, $baseUri = null)
  51513. {
  51514. $components = $this->parse($uri);
  51515. $path = $components['path'];
  51516. if ((array_key_exists('scheme', $components)) && ('http' === $components['scheme'])) {
  51517. return $uri;
  51518. }
  51519. $baseComponents = $this->parse($baseUri);
  51520. $basePath = $baseComponents['path'];
  51521. $baseComponents['path'] = UriResolver::combineRelativePathWithBasePath($path, $basePath);
  51522. return $this->generate($baseComponents);
  51523. }
  51524. public function isValid($uri)
  51525. {
  51526. $components = $this->parse($uri);
  51527. return !empty($components);
  51528. }
  51529. public function setTranslation($from, $to)
  51530. {
  51531. $this->translationMap[$from] = $to;
  51532. }
  51533. public function translate($uri)
  51534. {
  51535. foreach ($this->translationMap as $from => $to) {
  51536. $uri = preg_replace($from, $to, $uri);
  51537. }
  51538. $uri = preg_replace('|^package://|', sprintf('file://%s/', realpath(__DIR__ . '/../../..')), $uri);
  51539. return $uri;
  51540. }
  51541. }
  51542. <?php
  51543. namespace JsonSchema;
  51544. interface UriResolverInterface
  51545. {
  51546. public function resolve($uri, $baseUri = null);
  51547. }
  51548. <?php
  51549. namespace JsonSchema;
  51550. interface UriRetrieverInterface
  51551. {
  51552. public function retrieve($uri, $baseUri = null);
  51553. }
  51554. <?php
  51555. namespace JsonSchema;
  51556. use JsonSchema\Constraints\BaseConstraint;
  51557. use JsonSchema\Constraints\Constraint;
  51558. class Validator extends BaseConstraint
  51559. {
  51560. const SCHEMA_MEDIA_TYPE = 'application/schema+json';
  51561. const ERROR_NONE = 0x00000000;
  51562. const ERROR_ALL = 0xFFFFFFFF;
  51563. const ERROR_DOCUMENT_VALIDATION = 0x00000001;
  51564. const ERROR_SCHEMA_VALIDATION = 0x00000002;
  51565. public function validate(&$value, $schema = null, $checkMode = null)
  51566. {
  51567. if (is_array($schema)) {
  51568. $schema = self::arrayToObjectRecursive($schema);
  51569. }
  51570. $initialCheckMode = $this->factory->getConfig();
  51571. if ($checkMode !== null) {
  51572. $this->factory->setConfig($checkMode);
  51573. }
  51574. if (is_object($schema) && property_exists($schema, 'id')) {
  51575. $schemaURI = $schema->id;
  51576. } else {
  51577. $schemaURI = SchemaStorage::INTERNAL_PROVIDED_SCHEMA_URI;
  51578. }
  51579. $this->factory->getSchemaStorage()->addSchema($schemaURI, $schema);
  51580. $validator = $this->factory->createInstanceFor('schema');
  51581. $validator->check(
  51582. $value,
  51583. $this->factory->getSchemaStorage()->getSchema($schemaURI)
  51584. );
  51585. $this->factory->setConfig($initialCheckMode);
  51586. $this->addErrors(array_unique($validator->getErrors(), SORT_REGULAR));
  51587. return $validator->getErrorMask();
  51588. }
  51589. public function check($value, $schema)
  51590. {
  51591. return $this->validate($value, $schema);
  51592. }
  51593. public function coerce(&$value, $schema)
  51594. {
  51595. return $this->validate($value, $schema, Constraint::CHECK_MODE_COERCE_TYPES);
  51596. }
  51597. }
  51598. Copyright (C) 2015 Composer
  51599. Permission is hereby granted, free of charge, to any person obtaining a copy of
  51600. this software and associated documentation files (the "Software"), to deal in
  51601. the Software without restriction, including without limitation the rights to
  51602. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  51603. of the Software, and to permit persons to whom the Software is furnished to do
  51604. so, subject to the following conditions:
  51605. The above copyright notice and this permission notice shall be included in all
  51606. copies or substantial portions of the Software.
  51607. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  51608. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  51609. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  51610. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  51611. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  51612. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  51613. SOFTWARE.
  51614. <?php
  51615. namespace Composer\Spdx;
  51616. class SpdxLicenses
  51617. {
  51618. const LICENSES_FILE = 'spdx-licenses.json';
  51619. const EXCEPTIONS_FILE = 'spdx-exceptions.json';
  51620. private $licenses;
  51621. private $licensesExpression;
  51622. private $exceptions;
  51623. private $exceptionsExpression;
  51624. public function __construct()
  51625. {
  51626. $this->loadLicenses();
  51627. $this->loadExceptions();
  51628. }
  51629. public function getLicenseByIdentifier($identifier)
  51630. {
  51631. $key = strtolower($identifier);
  51632. if (!isset($this->licenses[$key])) {
  51633. return;
  51634. }
  51635. list($identifier, $name, $isOsiApproved, $isDeprecatedLicenseId) = $this->licenses[$key];
  51636. return array(
  51637. $name,
  51638. $isOsiApproved,
  51639. 'https://spdx.org/licenses/' . $identifier . '.html#licenseText',
  51640. $isDeprecatedLicenseId,
  51641. );
  51642. }
  51643. public function getLicenses()
  51644. {
  51645. return $this->licenses;
  51646. }
  51647. public function getExceptionByIdentifier($identifier)
  51648. {
  51649. $key = strtolower($identifier);
  51650. if (!isset($this->exceptions[$key])) {
  51651. return;
  51652. }
  51653. list($identifier, $name) = $this->exceptions[$key];
  51654. return array(
  51655. $name,
  51656. 'https://spdx.org/licenses/' . $identifier . '.html#licenseExceptionText',
  51657. );
  51658. }
  51659. public function getIdentifierByName($name)
  51660. {
  51661. foreach ($this->licenses as $licenseData) {
  51662. if ($licenseData[1] === $name) {
  51663. return $licenseData[0];
  51664. }
  51665. }
  51666. foreach ($this->exceptions as $licenseData) {
  51667. if ($licenseData[1] === $name) {
  51668. return $licenseData[0];
  51669. }
  51670. }
  51671. }
  51672. public function isOsiApprovedByIdentifier($identifier)
  51673. {
  51674. return $this->licenses[strtolower($identifier)][2];
  51675. }
  51676. public function isDeprecatedByIdentifier($identifier)
  51677. {
  51678. return $this->licenses[strtolower($identifier)][3];
  51679. }
  51680. public function validate($license)
  51681. {
  51682. if (is_array($license)) {
  51683. $count = count($license);
  51684. if ($count !== count(array_filter($license, 'is_string'))) {
  51685. throw new \InvalidArgumentException('Array of strings expected.');
  51686. }
  51687. $license = $count > 1 ? '(' . implode(' OR ', $license) . ')' : (string) reset($license);
  51688. }
  51689. if (!is_string($license)) {
  51690. throw new \InvalidArgumentException(sprintf(
  51691. 'Array or String expected, %s given.',
  51692. gettype($license)
  51693. ));
  51694. }
  51695. return $this->isValidLicenseString($license);
  51696. }
  51697. public static function getResourcesDir()
  51698. {
  51699. return dirname(__DIR__) . '/res';
  51700. }
  51701. private function loadLicenses()
  51702. {
  51703. if (null !== $this->licenses) {
  51704. return;
  51705. }
  51706. $json = file_get_contents(self::getResourcesDir() . '/' . self::LICENSES_FILE);
  51707. $this->licenses = array();
  51708. foreach (json_decode($json, true) as $identifier => $license) {
  51709. $this->licenses[strtolower($identifier)] = array($identifier, $license[0], $license[1], $license[2]);
  51710. }
  51711. }
  51712. private function loadExceptions()
  51713. {
  51714. if (null !== $this->exceptions) {
  51715. return;
  51716. }
  51717. $json = file_get_contents(self::getResourcesDir() . '/' . self::EXCEPTIONS_FILE);
  51718. $this->exceptions = array();
  51719. foreach (json_decode($json, true) as $identifier => $exception) {
  51720. $this->exceptions[strtolower($identifier)] = array($identifier, $exception[0]);
  51721. }
  51722. }
  51723. private function getLicensesExpression()
  51724. {
  51725. if (null === $this->licensesExpression) {
  51726. $licenses = array_map('preg_quote', array_keys($this->licenses));
  51727. rsort($licenses);
  51728. $licenses = implode('|', $licenses);
  51729. $this->licensesExpression = $licenses;
  51730. }
  51731. return $this->licensesExpression;
  51732. }
  51733. private function getExceptionsExpression()
  51734. {
  51735. if (null === $this->exceptionsExpression) {
  51736. $exceptions = array_map('preg_quote', array_keys($this->exceptions));
  51737. rsort($exceptions);
  51738. $exceptions = implode('|', $exceptions);
  51739. $this->exceptionsExpression = $exceptions;
  51740. }
  51741. return $this->exceptionsExpression;
  51742. }
  51743. private function isValidLicenseString($license)
  51744. {
  51745. if (isset($this->licenses[strtolower($license)])) {
  51746. return true;
  51747. }
  51748. $licenses = $this->getLicensesExpression();
  51749. $exceptions = $this->getExceptionsExpression();
  51750. $regex = <<<REGEX
  51751. {
  51752. (?(DEFINE)
  51753. # idstring: 1*( ALPHA / DIGIT / - / . )
  51754. (?<idstring>[\pL\pN.-]{1,})
  51755. # license-id: taken from list
  51756. (?<licenseid>${licenses})
  51757. # license-exception-id: taken from list
  51758. (?<licenseexceptionid>${exceptions})
  51759. # license-ref: [DocumentRef-1*(idstring):]LicenseRef-1*(idstring)
  51760. (?<licenseref>(?:DocumentRef-(?&idstring):)?LicenseRef-(?&idstring))
  51761. # simple-expresssion: license-id / license-id+ / license-ref
  51762. (?<simple_expression>(?&licenseid)\+? | (?&licenseid) | (?&licenseref))
  51763. # compound-expression: 1*(
  51764. # simple-expression /
  51765. # simple-expression WITH license-exception-id /
  51766. # compound-expression AND compound-expression /
  51767. # compound-expression OR compound-expression
  51768. # ) / ( compound-expression ) )
  51769. (?<compound_head>
  51770. (?&simple_expression) ( \s+ WITH \s+ (?&licenseexceptionid))?
  51771. | \( \s* (?&compound_expression) \s* \)
  51772. )
  51773. (?<compound_expression>
  51774. (?&compound_head) (?: \s+ (?:AND|OR) \s+ (?&compound_expression))?
  51775. )
  51776. # license-expression: 1*1(simple-expression / compound-expression)
  51777. (?<license_expression>(?&compound_expression) | (?&simple_expression))
  51778. ) # end of define
  51779. ^(NONE | NOASSERTION | (?&license_expression))$
  51780. }xi
  51781. REGEX;
  51782. $match = preg_match($regex, $license);
  51783. if (0 === $match) {
  51784. return false;
  51785. }
  51786. if (false === $match) {
  51787. throw new \RuntimeException('Regex failed to compile/run.');
  51788. }
  51789. return true;
  51790. }
  51791. }
  51792. Copyright (C) 2015 Composer
  51793. Permission is hereby granted, free of charge, to any person obtaining a copy of
  51794. this software and associated documentation files (the "Software"), to deal in
  51795. the Software without restriction, including without limitation the rights to
  51796. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  51797. of the Software, and to permit persons to whom the Software is furnished to do
  51798. so, subject to the following conditions:
  51799. The above copyright notice and this permission notice shall be included in all
  51800. copies or substantial portions of the Software.
  51801. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  51802. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  51803. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  51804. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  51805. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  51806. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  51807. SOFTWARE.
  51808. <?php
  51809. namespace Composer\Semver;
  51810. use Composer\Semver\Constraint\Constraint;
  51811. class Comparator
  51812. {
  51813. public static function greaterThan($version1, $version2)
  51814. {
  51815. return self::compare($version1, '>', $version2);
  51816. }
  51817. public static function greaterThanOrEqualTo($version1, $version2)
  51818. {
  51819. return self::compare($version1, '>=', $version2);
  51820. }
  51821. public static function lessThan($version1, $version2)
  51822. {
  51823. return self::compare($version1, '<', $version2);
  51824. }
  51825. public static function lessThanOrEqualTo($version1, $version2)
  51826. {
  51827. return self::compare($version1, '<=', $version2);
  51828. }
  51829. public static function equalTo($version1, $version2)
  51830. {
  51831. return self::compare($version1, '==', $version2);
  51832. }
  51833. public static function notEqualTo($version1, $version2)
  51834. {
  51835. return self::compare($version1, '!=', $version2);
  51836. }
  51837. public static function compare($version1, $operator, $version2)
  51838. {
  51839. $constraint = new Constraint($operator, $version2);
  51840. return $constraint->matches(new Constraint('==', $version1));
  51841. }
  51842. }
  51843. <?php
  51844. namespace Composer\Semver\Constraint;
  51845. trigger_error('The ' . __NAMESPACE__ . '\AbstractConstraint abstract class is deprecated, there is no replacement for it, it will be removed in the next major version.', E_USER_DEPRECATED);
  51846. abstract class AbstractConstraint implements ConstraintInterface
  51847. {
  51848. protected $prettyString;
  51849. public function matches(ConstraintInterface $provider)
  51850. {
  51851. if ($provider instanceof $this) {
  51852. return $this->matchSpecific($provider);
  51853. }
  51854. return $provider->matches($this);
  51855. }
  51856. public function setPrettyString($prettyString)
  51857. {
  51858. $this->prettyString = $prettyString;
  51859. }
  51860. public function getPrettyString()
  51861. {
  51862. if ($this->prettyString) {
  51863. return $this->prettyString;
  51864. }
  51865. return $this->__toString();
  51866. }
  51867. }
  51868. <?php
  51869. namespace Composer\Semver\Constraint;
  51870. class Constraint implements ConstraintInterface
  51871. {
  51872. const OP_EQ = 0;
  51873. const OP_LT = 1;
  51874. const OP_LE = 2;
  51875. const OP_GT = 3;
  51876. const OP_GE = 4;
  51877. const OP_NE = 5;
  51878. private static $transOpStr = array(
  51879. '=' => self::OP_EQ,
  51880. '==' => self::OP_EQ,
  51881. '<' => self::OP_LT,
  51882. '<=' => self::OP_LE,
  51883. '>' => self::OP_GT,
  51884. '>=' => self::OP_GE,
  51885. '<>' => self::OP_NE,
  51886. '!=' => self::OP_NE,
  51887. );
  51888. private static $transOpInt = array(
  51889. self::OP_EQ => '==',
  51890. self::OP_LT => '<',
  51891. self::OP_LE => '<=',
  51892. self::OP_GT => '>',
  51893. self::OP_GE => '>=',
  51894. self::OP_NE => '!=',
  51895. );
  51896. protected $operator;
  51897. protected $version;
  51898. protected $prettyString;
  51899. public function matches(ConstraintInterface $provider)
  51900. {
  51901. if ($provider instanceof $this) {
  51902. return $this->matchSpecific($provider);
  51903. }
  51904. return $provider->matches($this);
  51905. }
  51906. public function setPrettyString($prettyString)
  51907. {
  51908. $this->prettyString = $prettyString;
  51909. }
  51910. public function getPrettyString()
  51911. {
  51912. if ($this->prettyString) {
  51913. return $this->prettyString;
  51914. }
  51915. return $this->__toString();
  51916. }
  51917. public static function getSupportedOperators()
  51918. {
  51919. return array_keys(self::$transOpStr);
  51920. }
  51921. public function __construct($operator, $version)
  51922. {
  51923. if (!isset(self::$transOpStr[$operator])) {
  51924. throw new \InvalidArgumentException(sprintf(
  51925. 'Invalid operator "%s" given, expected one of: %s',
  51926. $operator,
  51927. implode(', ', self::getSupportedOperators())
  51928. ));
  51929. }
  51930. $this->operator = self::$transOpStr[$operator];
  51931. $this->version = $version;
  51932. }
  51933. public function versionCompare($a, $b, $operator, $compareBranches = false)
  51934. {
  51935. if (!isset(self::$transOpStr[$operator])) {
  51936. throw new \InvalidArgumentException(sprintf(
  51937. 'Invalid operator "%s" given, expected one of: %s',
  51938. $operator,
  51939. implode(', ', self::getSupportedOperators())
  51940. ));
  51941. }
  51942. $aIsBranch = 'dev-' === substr($a, 0, 4);
  51943. $bIsBranch = 'dev-' === substr($b, 0, 4);
  51944. if ($aIsBranch && $bIsBranch) {
  51945. return $operator === '==' && $a === $b;
  51946. }
  51947. if (!$compareBranches && ($aIsBranch || $bIsBranch)) {
  51948. return false;
  51949. }
  51950. return version_compare($a, $b, $operator);
  51951. }
  51952. public function matchSpecific(Constraint $provider, $compareBranches = false)
  51953. {
  51954. $noEqualOp = str_replace('=', '', self::$transOpInt[$this->operator]);
  51955. $providerNoEqualOp = str_replace('=', '', self::$transOpInt[$provider->operator]);
  51956. $isEqualOp = self::OP_EQ === $this->operator;
  51957. $isNonEqualOp = self::OP_NE === $this->operator;
  51958. $isProviderEqualOp = self::OP_EQ === $provider->operator;
  51959. $isProviderNonEqualOp = self::OP_NE === $provider->operator;
  51960. if ($isNonEqualOp || $isProviderNonEqualOp) {
  51961. return (!$isEqualOp && !$isProviderEqualOp)
  51962. || $this->versionCompare($provider->version, $this->version, '!=', $compareBranches);
  51963. }
  51964. if ($this->operator !== self::OP_EQ && $noEqualOp === $providerNoEqualOp) {
  51965. return true;
  51966. }
  51967. if ($this->versionCompare($provider->version, $this->version, self::$transOpInt[$this->operator], $compareBranches)) {
  51968. return !($provider->version === $this->version
  51969. && self::$transOpInt[$provider->operator] === $providerNoEqualOp
  51970. && self::$transOpInt[$this->operator] !== $noEqualOp);
  51971. }
  51972. return false;
  51973. }
  51974. public function __toString()
  51975. {
  51976. return self::$transOpInt[$this->operator] . ' ' . $this->version;
  51977. }
  51978. }
  51979. <?php
  51980. namespace Composer\Semver\Constraint;
  51981. interface ConstraintInterface
  51982. {
  51983. public function matches(ConstraintInterface $provider);
  51984. public function getPrettyString();
  51985. public function __toString();
  51986. }
  51987. <?php
  51988. namespace Composer\Semver\Constraint;
  51989. class EmptyConstraint implements ConstraintInterface
  51990. {
  51991. protected $prettyString;
  51992. public function matches(ConstraintInterface $provider)
  51993. {
  51994. return true;
  51995. }
  51996. public function setPrettyString($prettyString)
  51997. {
  51998. $this->prettyString = $prettyString;
  51999. }
  52000. public function getPrettyString()
  52001. {
  52002. if ($this->prettyString) {
  52003. return $this->prettyString;
  52004. }
  52005. return (string) $this;
  52006. }
  52007. public function __toString()
  52008. {
  52009. return '[]';
  52010. }
  52011. }
  52012. <?php
  52013. namespace Composer\Semver\Constraint;
  52014. class MultiConstraint implements ConstraintInterface
  52015. {
  52016. protected $constraints;
  52017. protected $prettyString;
  52018. protected $conjunctive;
  52019. public function __construct(array $constraints, $conjunctive = true)
  52020. {
  52021. $this->constraints = $constraints;
  52022. $this->conjunctive = $conjunctive;
  52023. }
  52024. public function getConstraints()
  52025. {
  52026. return $this->constraints;
  52027. }
  52028. public function isConjunctive()
  52029. {
  52030. return $this->conjunctive;
  52031. }
  52032. public function isDisjunctive()
  52033. {
  52034. return !$this->conjunctive;
  52035. }
  52036. public function matches(ConstraintInterface $provider)
  52037. {
  52038. if (false === $this->conjunctive) {
  52039. foreach ($this->constraints as $constraint) {
  52040. if ($constraint->matches($provider)) {
  52041. return true;
  52042. }
  52043. }
  52044. return false;
  52045. }
  52046. foreach ($this->constraints as $constraint) {
  52047. if (!$constraint->matches($provider)) {
  52048. return false;
  52049. }
  52050. }
  52051. return true;
  52052. }
  52053. public function setPrettyString($prettyString)
  52054. {
  52055. $this->prettyString = $prettyString;
  52056. }
  52057. public function getPrettyString()
  52058. {
  52059. if ($this->prettyString) {
  52060. return $this->prettyString;
  52061. }
  52062. return (string) $this;
  52063. }
  52064. public function __toString()
  52065. {
  52066. $constraints = array();
  52067. foreach ($this->constraints as $constraint) {
  52068. $constraints[] = (string) $constraint;
  52069. }
  52070. return '[' . implode($this->conjunctive ? ' ' : ' || ', $constraints) . ']';
  52071. }
  52072. }
  52073. <?php
  52074. namespace Composer\Semver;
  52075. use Composer\Semver\Constraint\Constraint;
  52076. class Semver
  52077. {
  52078. const SORT_ASC = 1;
  52079. const SORT_DESC = -1;
  52080. private static $versionParser;
  52081. public static function satisfies($version, $constraints)
  52082. {
  52083. if (null === self::$versionParser) {
  52084. self::$versionParser = new VersionParser();
  52085. }
  52086. $versionParser = self::$versionParser;
  52087. $provider = new Constraint('==', $versionParser->normalize($version));
  52088. $parsedConstraints = $versionParser->parseConstraints($constraints);
  52089. return $parsedConstraints->matches($provider);
  52090. }
  52091. public static function satisfiedBy(array $versions, $constraints)
  52092. {
  52093. $versions = array_filter($versions, function ($version) use ($constraints) {
  52094. return Semver::satisfies($version, $constraints);
  52095. });
  52096. return array_values($versions);
  52097. }
  52098. public static function sort(array $versions)
  52099. {
  52100. return self::usort($versions, self::SORT_ASC);
  52101. }
  52102. public static function rsort(array $versions)
  52103. {
  52104. return self::usort($versions, self::SORT_DESC);
  52105. }
  52106. private static function usort(array $versions, $direction)
  52107. {
  52108. if (null === self::$versionParser) {
  52109. self::$versionParser = new VersionParser();
  52110. }
  52111. $versionParser = self::$versionParser;
  52112. $normalized = array();
  52113. foreach ($versions as $key => $version) {
  52114. $normalized[] = array($versionParser->normalize($version), $key);
  52115. }
  52116. usort($normalized, function (array $left, array $right) use ($direction) {
  52117. if ($left[0] === $right[0]) {
  52118. return 0;
  52119. }
  52120. if (Comparator::lessThan($left[0], $right[0])) {
  52121. return -$direction;
  52122. }
  52123. return $direction;
  52124. });
  52125. $sorted = array();
  52126. foreach ($normalized as $item) {
  52127. $sorted[] = $versions[$item[1]];
  52128. }
  52129. return $sorted;
  52130. }
  52131. }
  52132. <?php
  52133. namespace Composer\Semver;
  52134. use Composer\Semver\Constraint\ConstraintInterface;
  52135. use Composer\Semver\Constraint\EmptyConstraint;
  52136. use Composer\Semver\Constraint\MultiConstraint;
  52137. use Composer\Semver\Constraint\Constraint;
  52138. class VersionParser
  52139. {
  52140. private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)((?:[.-]?\d+)*+)?)?([.-]?dev)?';
  52141. private static $stabilities = array('stable', 'RC', 'beta', 'alpha', 'dev');
  52142. public static function parseStability($version)
  52143. {
  52144. $version = preg_replace('{#.+$}i', '', $version);
  52145. if (strpos($version, 'dev-') === 0 || '-dev' === substr($version, -4)) {
  52146. return 'dev';
  52147. }
  52148. preg_match('{' . self::$modifierRegex . '(?:\+.*)?$}i', strtolower($version), $match);
  52149. if (!empty($match[3])) {
  52150. return 'dev';
  52151. }
  52152. if (!empty($match[1])) {
  52153. if ('beta' === $match[1] || 'b' === $match[1]) {
  52154. return 'beta';
  52155. }
  52156. if ('alpha' === $match[1] || 'a' === $match[1]) {
  52157. return 'alpha';
  52158. }
  52159. if ('rc' === $match[1]) {
  52160. return 'RC';
  52161. }
  52162. }
  52163. return 'stable';
  52164. }
  52165. public static function normalizeStability($stability)
  52166. {
  52167. $stability = strtolower($stability);
  52168. return $stability === 'rc' ? 'RC' : $stability;
  52169. }
  52170. public function normalize($version, $fullVersion = null)
  52171. {
  52172. $version = trim($version);
  52173. if (null === $fullVersion) {
  52174. $fullVersion = $version;
  52175. }
  52176. if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $version, $match)) {
  52177. $this->normalize($match[2]);
  52178. $version = $match[1];
  52179. }
  52180. if (preg_match('{^(?:dev-)?(?:master|trunk|default)$}i', $version)) {
  52181. return '9999999-dev';
  52182. }
  52183. if (stripos($version, 'dev-') === 0) {
  52184. return 'dev-' . substr($version, 4);
  52185. }
  52186. if (preg_match('{^([^,\s+]++)\+[^\s]++$}', $version, $match)) {
  52187. $version = $match[1];
  52188. }
  52189. if (preg_match('{^v?(\d{1,5})(\.\d++)?(\.\d++)?(\.\d++)?' . self::$modifierRegex . '$}i', $version, $matches)) {
  52190. $version = $matches[1]
  52191. . (!empty($matches[2]) ? $matches[2] : '.0')
  52192. . (!empty($matches[3]) ? $matches[3] : '.0')
  52193. . (!empty($matches[4]) ? $matches[4] : '.0');
  52194. $index = 5;
  52195. } elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3})?)' . self::$modifierRegex . '$}i', $version, $matches)) {
  52196. $version = preg_replace('{\D}', '.', $matches[1]);
  52197. $index = 2;
  52198. }
  52199. if (isset($index)) {
  52200. if (!empty($matches[$index])) {
  52201. if ('stable' === $matches[$index]) {
  52202. return $version;
  52203. }
  52204. $version .= '-' . $this->expandStability($matches[$index]) . (!empty($matches[$index + 1]) ? ltrim($matches[$index + 1], '.-') : '');
  52205. }
  52206. if (!empty($matches[$index + 2])) {
  52207. $version .= '-dev';
  52208. }
  52209. return $version;
  52210. }
  52211. if (preg_match('{(.*?)[.-]?dev$}i', $version, $match)) {
  52212. try {
  52213. return $this->normalizeBranch($match[1]);
  52214. } catch (\Exception $e) {
  52215. }
  52216. }
  52217. $extraMessage = '';
  52218. if (preg_match('{ +as +' . preg_quote($version) . '$}', $fullVersion)) {
  52219. $extraMessage = ' in "' . $fullVersion . '", the alias must be an exact version';
  52220. } elseif (preg_match('{^' . preg_quote($version) . ' +as +}', $fullVersion)) {
  52221. $extraMessage = ' in "' . $fullVersion . '", the alias source must be an exact version, if it is a branch name you should prefix it with dev-';
  52222. }
  52223. throw new \UnexpectedValueException('Invalid version string "' . $version . '"' . $extraMessage);
  52224. }
  52225. public function parseNumericAliasPrefix($branch)
  52226. {
  52227. if (preg_match('{^(?P<version>(\d++\\.)*\d++)(?:\.x)?-dev$}i', $branch, $matches)) {
  52228. return $matches['version'] . '.';
  52229. }
  52230. return false;
  52231. }
  52232. public function normalizeBranch($name)
  52233. {
  52234. $name = trim($name);
  52235. if (in_array($name, array('master', 'trunk', 'default'))) {
  52236. return $this->normalize($name);
  52237. }
  52238. if (preg_match('{^v?(\d++)(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?$}i', $name, $matches)) {
  52239. $version = '';
  52240. for ($i = 1; $i < 5; ++$i) {
  52241. $version .= isset($matches[$i]) ? str_replace(array('*', 'X'), 'x', $matches[$i]) : '.x';
  52242. }
  52243. return str_replace('x', '9999999', $version) . '-dev';
  52244. }
  52245. return 'dev-' . $name;
  52246. }
  52247. public function parseConstraints($constraints)
  52248. {
  52249. $prettyConstraint = $constraints;
  52250. if (preg_match('{^([^,\s]*?)@(' . implode('|', self::$stabilities) . ')$}i', $constraints, $match)) {
  52251. $constraints = empty($match[1]) ? '*' : $match[1];
  52252. }
  52253. if (preg_match('{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#.+$}i', $constraints, $match)) {
  52254. $constraints = $match[1];
  52255. }
  52256. $orConstraints = preg_split('{\s*\|\|?\s*}', trim($constraints));
  52257. $orGroups = array();
  52258. foreach ($orConstraints as $constraints) {
  52259. $andConstraints = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $constraints);
  52260. if (count($andConstraints) > 1) {
  52261. $constraintObjects = array();
  52262. foreach ($andConstraints as $constraint) {
  52263. foreach ($this->parseConstraint($constraint) as $parsedConstraint) {
  52264. $constraintObjects[] = $parsedConstraint;
  52265. }
  52266. }
  52267. } else {
  52268. $constraintObjects = $this->parseConstraint($andConstraints[0]);
  52269. }
  52270. if (1 === count($constraintObjects)) {
  52271. $constraint = $constraintObjects[0];
  52272. } else {
  52273. $constraint = new MultiConstraint($constraintObjects);
  52274. }
  52275. $orGroups[] = $constraint;
  52276. }
  52277. if (1 === count($orGroups)) {
  52278. $constraint = $orGroups[0];
  52279. } elseif (2 === count($orGroups)
  52280. && $orGroups[0] instanceof MultiConstraint
  52281. && $orGroups[1] instanceof MultiConstraint
  52282. && 2 === count($orGroups[0]->getConstraints())
  52283. && 2 === count($orGroups[1]->getConstraints())
  52284. && ($a = (string) $orGroups[0])
  52285. && strpos($a, '[>=') === 0 && (false !== ($posA = strpos($a, '<', 4)))
  52286. && ($b = (string) $orGroups[1])
  52287. && strpos($b, '[>=') === 0 && (false !== ($posB = strpos($b, '<', 4)))
  52288. && substr($a, $posA + 2, -1) === substr($b, 4, $posB - 5)
  52289. ) {
  52290. $constraint = new MultiConstraint(array(
  52291. new Constraint('>=', substr($a, 4, $posA - 5)),
  52292. new Constraint('<', substr($b, $posB + 2, -1)),
  52293. ));
  52294. } else {
  52295. $constraint = new MultiConstraint($orGroups, false);
  52296. }
  52297. $constraint->setPrettyString($prettyConstraint);
  52298. return $constraint;
  52299. }
  52300. private function parseConstraint($constraint)
  52301. {
  52302. if (preg_match('{^([^,\s]+?)@(' . implode('|', self::$stabilities) . ')$}i', $constraint, $match)) {
  52303. $constraint = $match[1];
  52304. if ($match[2] !== 'stable') {
  52305. $stabilityModifier = $match[2];
  52306. }
  52307. }
  52308. if (preg_match('{^v?[xX*](\.[xX*])*$}i', $constraint)) {
  52309. return array(new EmptyConstraint());
  52310. }
  52311. $versionRegex = 'v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.(\d++))?' . self::$modifierRegex . '(?:\+[^\s]+)?';
  52312. if (preg_match('{^~>?' . $versionRegex . '$}i', $constraint, $matches)) {
  52313. if (strpos($constraint, '~>') === 0) {
  52314. throw new \UnexpectedValueException(
  52315. 'Could not parse version constraint ' . $constraint . ': ' .
  52316. 'Invalid operator "~>", you probably meant to use the "~" operator'
  52317. );
  52318. }
  52319. if (isset($matches[4]) && '' !== $matches[4] && null !== $matches[4]) {
  52320. $position = 4;
  52321. } elseif (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
  52322. $position = 3;
  52323. } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
  52324. $position = 2;
  52325. } else {
  52326. $position = 1;
  52327. }
  52328. $stabilitySuffix = '';
  52329. if (empty($matches[5]) && empty($matches[7])) {
  52330. $stabilitySuffix .= '-dev';
  52331. }
  52332. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  52333. $lowerBound = new Constraint('>=', $lowVersion);
  52334. $highPosition = max(1, $position - 1);
  52335. $highVersion = $this->manipulateVersionString($matches, $highPosition, 1) . '-dev';
  52336. $upperBound = new Constraint('<', $highVersion);
  52337. return array(
  52338. $lowerBound,
  52339. $upperBound,
  52340. );
  52341. }
  52342. if (preg_match('{^\^' . $versionRegex . '($)}i', $constraint, $matches)) {
  52343. if ('0' !== $matches[1] || '' === $matches[2] || null === $matches[2]) {
  52344. $position = 1;
  52345. } elseif ('0' !== $matches[2] || '' === $matches[3] || null === $matches[3]) {
  52346. $position = 2;
  52347. } else {
  52348. $position = 3;
  52349. }
  52350. $stabilitySuffix = '';
  52351. if (empty($matches[5]) && empty($matches[7])) {
  52352. $stabilitySuffix .= '-dev';
  52353. }
  52354. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  52355. $lowerBound = new Constraint('>=', $lowVersion);
  52356. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  52357. $upperBound = new Constraint('<', $highVersion);
  52358. return array(
  52359. $lowerBound,
  52360. $upperBound,
  52361. );
  52362. }
  52363. if (preg_match('{^v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.[xX*])++$}', $constraint, $matches)) {
  52364. if (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
  52365. $position = 3;
  52366. } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
  52367. $position = 2;
  52368. } else {
  52369. $position = 1;
  52370. }
  52371. $lowVersion = $this->manipulateVersionString($matches, $position) . '-dev';
  52372. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  52373. if ($lowVersion === '0.0.0.0-dev') {
  52374. return array(new Constraint('<', $highVersion));
  52375. }
  52376. return array(
  52377. new Constraint('>=', $lowVersion),
  52378. new Constraint('<', $highVersion),
  52379. );
  52380. }
  52381. if (preg_match('{^(?P<from>' . $versionRegex . ') +- +(?P<to>' . $versionRegex . ')($)}i', $constraint, $matches)) {
  52382. $lowStabilitySuffix = '';
  52383. if (empty($matches[6]) && empty($matches[8])) {
  52384. $lowStabilitySuffix = '-dev';
  52385. }
  52386. $lowVersion = $this->normalize($matches['from']);
  52387. $lowerBound = new Constraint('>=', $lowVersion . $lowStabilitySuffix);
  52388. $empty = function ($x) {
  52389. return ($x === 0 || $x === '0') ? false : empty($x);
  52390. };
  52391. if ((!$empty($matches[11]) && !$empty($matches[12])) || !empty($matches[14]) || !empty($matches[16])) {
  52392. $highVersion = $this->normalize($matches['to']);
  52393. $upperBound = new Constraint('<=', $highVersion);
  52394. } else {
  52395. $highMatch = array('', $matches[10], $matches[11], $matches[12], $matches[13]);
  52396. $highVersion = $this->manipulateVersionString($highMatch, $empty($matches[11]) ? 1 : 2, 1) . '-dev';
  52397. $upperBound = new Constraint('<', $highVersion);
  52398. }
  52399. return array(
  52400. $lowerBound,
  52401. $upperBound,
  52402. );
  52403. }
  52404. if (preg_match('{^(<>|!=|>=?|<=?|==?)?\s*(.*)}', $constraint, $matches)) {
  52405. try {
  52406. $version = $this->normalize($matches[2]);
  52407. if (!empty($stabilityModifier) && self::parseStability($version) === 'stable') {
  52408. $version .= '-' . $stabilityModifier;
  52409. } elseif ('<' === $matches[1] || '>=' === $matches[1]) {
  52410. if (!preg_match('/-' . self::$modifierRegex . '$/', strtolower($matches[2]))) {
  52411. if (strpos($matches[2], 'dev-') !== 0) {
  52412. $version .= '-dev';
  52413. }
  52414. }
  52415. }
  52416. return array(new Constraint($matches[1] ?: '=', $version));
  52417. } catch (\Exception $e) {
  52418. }
  52419. }
  52420. $message = 'Could not parse version constraint ' . $constraint;
  52421. if (isset($e)) {
  52422. $message .= ': ' . $e->getMessage();
  52423. }
  52424. throw new \UnexpectedValueException($message);
  52425. }
  52426. private function manipulateVersionString($matches, $position, $increment = 0, $pad = '0')
  52427. {
  52428. for ($i = 4; $i > 0; --$i) {
  52429. if ($i > $position) {
  52430. $matches[$i] = $pad;
  52431. } elseif ($i === $position && $increment) {
  52432. $matches[$i] += $increment;
  52433. if ($matches[$i] < 0) {
  52434. $matches[$i] = $pad;
  52435. --$position;
  52436. if ($i === 1) {
  52437. return null;
  52438. }
  52439. }
  52440. }
  52441. }
  52442. return $matches[1] . '.' . $matches[2] . '.' . $matches[3] . '.' . $matches[4];
  52443. }
  52444. private function expandStability($stability)
  52445. {
  52446. $stability = strtolower($stability);
  52447. switch ($stability) {
  52448. case 'a':
  52449. return 'alpha';
  52450. case 'b':
  52451. return 'beta';
  52452. case 'p':
  52453. case 'pl':
  52454. return 'patch';
  52455. case 'rc':
  52456. return 'RC';
  52457. default:
  52458. return $stability;
  52459. }
  52460. }
  52461. }
  52462. Copyright (C) 2016 Composer
  52463. Permission is hereby granted, free of charge, to any person obtaining a copy of
  52464. this software and associated documentation files (the "Software"), to deal in
  52465. the Software without restriction, including without limitation the rights to
  52466. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  52467. of the Software, and to permit persons to whom the Software is furnished to do
  52468. so, subject to the following conditions:
  52469. The above copyright notice and this permission notice shall be included in all
  52470. copies or substantial portions of the Software.
  52471. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  52472. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  52473. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  52474. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  52475. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  52476. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  52477. SOFTWARE.
  52478. <?php
  52479. namespace Composer\CaBundle;
  52480. use Psr\Log\LoggerInterface;
  52481. use Symfony\Component\Process\PhpProcess;
  52482. class CaBundle
  52483. {
  52484. private static $caPath;
  52485. private static $caFileValidity = array();
  52486. private static $useOpensslParse;
  52487. public static function getSystemCaRootBundlePath(LoggerInterface $logger = null)
  52488. {
  52489. if (self::$caPath !== null) {
  52490. return self::$caPath;
  52491. }
  52492. $caBundlePaths = array();
  52493. $caBundlePaths[] = self::getEnvVariable('SSL_CERT_FILE');
  52494. $caBundlePaths[] = self::getEnvVariable('SSL_CERT_DIR');
  52495. $caBundlePaths[] = ini_get('openssl.cafile');
  52496. $caBundlePaths[] = ini_get('openssl.capath');
  52497. $otherLocations = array(
  52498. '/etc/pki/tls/certs/ca-bundle.crt',
  52499. '/etc/ssl/certs/ca-certificates.crt',
  52500. '/etc/ssl/ca-bundle.pem',
  52501. '/usr/local/share/certs/ca-root-nss.crt',
  52502. '/usr/ssl/certs/ca-bundle.crt',
  52503. '/opt/local/share/curl/curl-ca-bundle.crt',
  52504. '/usr/local/share/curl/curl-ca-bundle.crt',
  52505. '/usr/share/ssl/certs/ca-bundle.crt',
  52506. '/etc/ssl/cert.pem',
  52507. '/usr/local/etc/ssl/cert.pem',
  52508. '/usr/local/etc/openssl/cert.pem',
  52509. '/usr/local/etc/openssl@1.1/cert.pem',
  52510. );
  52511. foreach($otherLocations as $location) {
  52512. $otherLocations[] = dirname($location);
  52513. }
  52514. $caBundlePaths = array_merge($caBundlePaths, $otherLocations);
  52515. foreach ($caBundlePaths as $caBundle) {
  52516. if (self::caFileUsable($caBundle, $logger)) {
  52517. return self::$caPath = $caBundle;
  52518. }
  52519. if (self::caDirUsable($caBundle)) {
  52520. return self::$caPath = $caBundle;
  52521. }
  52522. }
  52523. return self::$caPath = static::getBundledCaBundlePath();
  52524. }
  52525. public static function getBundledCaBundlePath()
  52526. {
  52527. $caBundleFile = __DIR__.'/../res/cacert.pem';
  52528. if (0 === strpos($caBundleFile, 'phar://')) {
  52529. file_put_contents(
  52530. $tempCaBundleFile = tempnam(sys_get_temp_dir(), 'openssl-ca-bundle-'),
  52531. file_get_contents($caBundleFile)
  52532. );
  52533. register_shutdown_function(function() use ($tempCaBundleFile) {
  52534. @unlink($tempCaBundleFile);
  52535. });
  52536. $caBundleFile = $tempCaBundleFile;
  52537. }
  52538. return $caBundleFile;
  52539. }
  52540. public static function validateCaFile($filename, LoggerInterface $logger = null)
  52541. {
  52542. static $warned = false;
  52543. if (isset(self::$caFileValidity[$filename])) {
  52544. return self::$caFileValidity[$filename];
  52545. }
  52546. $contents = file_get_contents($filename);
  52547. if (!static::isOpensslParseSafe()) {
  52548. if (!$warned && $logger) {
  52549. $logger->warning(sprintf(
  52550. 'Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.',
  52551. PHP_VERSION
  52552. ));
  52553. $warned = true;
  52554. }
  52555. $isValid = !empty($contents);
  52556. } else {
  52557. $contents = preg_replace("/^(\\-+(?:BEGIN|END))\\s+TRUSTED\\s+(CERTIFICATE\\-+)\$/m", '$1 $2', $contents);
  52558. $isValid = (bool) openssl_x509_parse($contents);
  52559. }
  52560. if ($logger) {
  52561. $logger->debug('Checked CA file '.realpath($filename).': '.($isValid ? 'valid' : 'invalid'));
  52562. }
  52563. return self::$caFileValidity[$filename] = $isValid;
  52564. }
  52565. public static function isOpensslParseSafe()
  52566. {
  52567. if (null !== self::$useOpensslParse) {
  52568. return self::$useOpensslParse;
  52569. }
  52570. if (PHP_VERSION_ID >= 50600) {
  52571. return self::$useOpensslParse = true;
  52572. }
  52573. if (
  52574. (PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50328)
  52575. || (PHP_VERSION_ID < 50500 && PHP_VERSION_ID >= 50423)
  52576. || (PHP_VERSION_ID < 50600 && PHP_VERSION_ID >= 50507)
  52577. ) {
  52578. return self::$useOpensslParse = true;
  52579. }
  52580. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  52581. return self::$useOpensslParse = false;
  52582. }
  52583. $compareDistroVersionPrefix = function ($prefix, $fixedVersion) {
  52584. $regex = '{^'.preg_quote($prefix).'([0-9]+)$}';
  52585. if (preg_match($regex, PHP_VERSION, $m)) {
  52586. return ((int) $m[1]) >= $fixedVersion;
  52587. }
  52588. return false;
  52589. };
  52590. if (
  52591. $compareDistroVersionPrefix('5.3.3-7+squeeze', 18)
  52592. || $compareDistroVersionPrefix('5.4.4-14+deb7u', 7)
  52593. || $compareDistroVersionPrefix('5.3.10-1ubuntu3.', 9)
  52594. ) {
  52595. return self::$useOpensslParse = true;
  52596. }
  52597. if (!class_exists('Symfony\Component\Process\PhpProcess')) {
  52598. return self::$useOpensslParse = false;
  52599. }
  52600. $cert = 'LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVwRENDQTR5Z0F3SUJBZ0lKQUp6dThyNnU2ZUJjTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUhETVFzd0NRWUQKVlFRR0V3SkVSVEVjTUJvR0ExVUVDQXdUVG05eVpISm9aV2x1TFZkbGMzUm1ZV3hsYmpFUU1BNEdBMVVFQnd3SApTOE9Ed3Jac2JqRVVNQklHQTFVRUNnd0xVMlZyZEdsdmJrVnBibk14SHpBZEJnTlZCQXNNRmsxaGJHbGphVzkxCmN5QkRaWEowSUZObFkzUnBiMjR4SVRBZkJnTlZCQU1NR0cxaGJHbGphVzkxY3k1elpXdDBhVzl1WldsdWN5NWsKWlRFcU1DZ0dDU3FHU0liM0RRRUpBUlliYzNSbFptRnVMbVZ6YzJWeVFITmxhM1JwYjI1bGFXNXpMbVJsTUhVWQpaREU1TnpBd01UQXhNREF3TURBd1dnQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBCkFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUEKQUFBQUFBQVhEVEUwTVRFeU9ERXhNemt6TlZvd2djTXhDekFKQmdOVkJBWVRBa1JGTVJ3d0dnWURWUVFJREJOTwpiM0prY21obGFXNHRWMlZ6ZEdaaGJHVnVNUkF3RGdZRFZRUUhEQWRMdzRQQ3RteHVNUlF3RWdZRFZRUUtEQXRUClpXdDBhVzl1UldsdWN6RWZNQjBHQTFVRUN3d1dUV0ZzYVdOcGIzVnpJRU5sY25RZ1UyVmpkR2x2YmpFaE1COEcKQTFVRUF3d1liV0ZzYVdOcGIzVnpMbk5sYTNScGIyNWxhVzV6TG1SbE1Tb3dLQVlKS29aSWh2Y05BUWtCRmh0egpkR1ZtWVc0dVpYTnpaWEpBYzJWcmRHbHZibVZwYm5NdVpHVXdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCCkR3QXdnZ0VLQW9JQkFRRERBZjNobDdKWTBYY0ZuaXlFSnBTU0RxbjBPcUJyNlFQNjV1c0pQUnQvOFBhRG9xQnUKd0VZVC9OYSs2ZnNnUGpDMHVLOURaZ1dnMnRIV1dvYW5TYmxBTW96NVBINlorUzRTSFJaN2UyZERJalBqZGhqaAowbUxnMlVNTzV5cDBWNzk3R2dzOWxOdDZKUmZIODFNTjJvYlhXczROdHp0TE11RDZlZ3FwcjhkRGJyMzRhT3M4CnBrZHVpNVVhd1Raa3N5NXBMUEhxNWNNaEZHbTA2djY1Q0xvMFYyUGQ5K0tBb2tQclBjTjVLTEtlYno3bUxwazYKU01lRVhPS1A0aWRFcXh5UTdPN2ZCdUhNZWRzUWh1K3ByWTNzaTNCVXlLZlF0UDVDWm5YMmJwMHdLSHhYMTJEWAoxbmZGSXQ5RGJHdkhUY3lPdU4rblpMUEJtM3ZXeG50eUlJdlZBZ01CQUFHalFqQkFNQWtHQTFVZEV3UUNNQUF3CkVRWUpZSVpJQVliNFFnRUJCQVFEQWdlQU1Bc0dBMVVkRHdRRUF3SUZvREFUQmdOVkhTVUVEREFLQmdnckJnRUYKQlFjREFqQU5CZ2txaGtpRzl3MEJBUVVGQUFPQ0FRRUFHMGZaWVlDVGJkajFYWWMrMVNub2FQUit2SThDOENhRAo4KzBVWWhkbnlVNGdnYTBCQWNEclk5ZTk0ZUVBdTZacXljRjZGakxxWFhkQWJvcHBXb2NyNlQ2R0QxeDMzQ2tsClZBcnpHL0t4UW9oR0QySmVxa2hJTWxEb214SE83a2EzOStPYThpMnZXTFZ5alU4QVp2V01BcnVIYTRFRU55RzcKbFcyQWFnYUZLRkNyOVRuWFRmcmR4R1ZFYnY3S1ZRNmJkaGc1cDVTanBXSDErTXEwM3VSM1pYUEJZZHlWODMxOQpvMGxWajFLRkkyRENML2xpV2lzSlJvb2YrMWNSMzVDdGQwd1lCY3BCNlRac2xNY09QbDc2ZHdLd0pnZUpvMlFnClpzZm1jMnZDMS9xT2xOdU5xLzBUenprVkd2OEVUVDNDZ2FVK1VYZTRYT1Z2a2NjZWJKbjJkZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K';
  52601. $script = <<<'EOT'
  52602. error_reporting(-1);
  52603. $info = openssl_x509_parse(base64_decode('%s'));
  52604. var_dump(PHP_VERSION, $info['issuer']['emailAddress'], $info['validFrom_time_t']);
  52605. EOT;
  52606. $script = '<'."?php\n".sprintf($script, $cert);
  52607. try {
  52608. $process = new PhpProcess($script);
  52609. $process->mustRun();
  52610. } catch (\Exception $e) {
  52611. return self::$useOpensslParse = false;
  52612. }
  52613. $output = preg_split('{\r?\n}', trim($process->getOutput()));
  52614. $errorOutput = trim($process->getErrorOutput());
  52615. if (
  52616. count($output) === 3
  52617. && $output[0] === sprintf('string(%d) "%s"', strlen(PHP_VERSION), PHP_VERSION)
  52618. && $output[1] === 'string(27) "stefan.esser@sektioneins.de"'
  52619. && $output[2] === 'int(-1)'
  52620. && preg_match('{openssl_x509_parse\(\): illegal (?:ASN1 data type for|length in) timestamp in - on line \d+}', $errorOutput)
  52621. ) {
  52622. return self::$useOpensslParse = true;
  52623. }
  52624. return self::$useOpensslParse = false;
  52625. }
  52626. public static function reset()
  52627. {
  52628. self::$caFileValidity = array();
  52629. self::$caPath = null;
  52630. self::$useOpensslParse = null;
  52631. }
  52632. private static function getEnvVariable($name)
  52633. {
  52634. if (isset($_SERVER[$name])) {
  52635. return (string) $_SERVER[$name];
  52636. }
  52637. if (PHP_SAPI === 'cli' && ($value = getenv($name)) !== false && $value !== null) {
  52638. return (string) $value;
  52639. }
  52640. return false;
  52641. }
  52642. private static function caFileUsable($certFile, LoggerInterface $logger = null)
  52643. {
  52644. return $certFile && @is_file($certFile) && @is_readable($certFile) && static::validateCaFile($certFile, $logger);
  52645. }
  52646. private static function caDirUsable($certDir)
  52647. {
  52648. return $certDir && @is_dir($certDir) && @is_readable($certDir) && glob($certDir . '/*');
  52649. }
  52650. }
  52651. MIT License
  52652. Copyright (c) 2017 Composer
  52653. Permission is hereby granted, free of charge, to any person obtaining a copy
  52654. of this software and associated documentation files (the "Software"), to deal
  52655. in the Software without restriction, including without limitation the rights
  52656. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  52657. copies of the Software, and to permit persons to whom the Software is
  52658. furnished to do so, subject to the following conditions:
  52659. The above copyright notice and this permission notice shall be included in all
  52660. copies or substantial portions of the Software.
  52661. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  52662. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  52663. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  52664. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  52665. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  52666. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  52667. SOFTWARE.
  52668. <?php
  52669. namespace Composer\XdebugHandler;
  52670. class PhpConfig
  52671. {
  52672. public function useOriginal()
  52673. {
  52674. $this->getDataAndReset();
  52675. return array();
  52676. }
  52677. public function useStandard()
  52678. {
  52679. if ($data = $this->getDataAndReset()) {
  52680. return array('-n', '-c', $data['tmpIni']);
  52681. }
  52682. return array();
  52683. }
  52684. public function usePersistent()
  52685. {
  52686. if ($data = $this->getDataAndReset()) {
  52687. Process::setEnv('PHPRC', $data['tmpIni']);
  52688. Process::setEnv('PHP_INI_SCAN_DIR', '');
  52689. }
  52690. return array();
  52691. }
  52692. private function getDataAndReset()
  52693. {
  52694. if ($data = XdebugHandler::getRestartSettings()) {
  52695. Process::setEnv('PHPRC', $data['phprc']);
  52696. Process::setEnv('PHP_INI_SCAN_DIR', $data['scanDir']);
  52697. }
  52698. return $data;
  52699. }
  52700. }
  52701. <?php
  52702. namespace Composer\XdebugHandler;
  52703. class Process
  52704. {
  52705. public static function addColorOption(array $args, $colorOption)
  52706. {
  52707. if (!$colorOption
  52708. || in_array($colorOption, $args)
  52709. || !preg_match('/^--([a-z]+$)|(^--[a-z]+=)/', $colorOption, $matches)) {
  52710. return $args;
  52711. }
  52712. if (isset($matches[2])) {
  52713. if (false !== ($index = array_search($matches[2].'auto', $args))) {
  52714. $args[$index] = $colorOption;
  52715. return $args;
  52716. } elseif (preg_grep('/^'.$matches[2].'/', $args)) {
  52717. return $args;
  52718. }
  52719. } elseif (in_array('--no-'.$matches[1], $args)) {
  52720. return $args;
  52721. }
  52722. if (false !== getenv('NO_COLOR')) {
  52723. return $args;
  52724. }
  52725. if (false !== ($index = array_search('--', $args))) {
  52726. array_splice($args, $index, 0, $colorOption);
  52727. } else {
  52728. $args[] = $colorOption;
  52729. }
  52730. return $args;
  52731. }
  52732. public static function escape($arg, $meta = true, $module = false)
  52733. {
  52734. if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
  52735. return "'".str_replace("'", "'\\''", $arg)."'";
  52736. }
  52737. $quote = strpbrk($arg, " \t") !== false || $arg === '';
  52738. $arg = preg_replace('/(\\\\*)"/', '$1$1\\"', $arg, -1, $dquotes);
  52739. if ($meta) {
  52740. $meta = $dquotes || preg_match('/%[^%]+%/', $arg);
  52741. if (!$meta) {
  52742. $quote = $quote || strpbrk($arg, '^&|<>()') !== false;
  52743. } elseif ($module && !$dquotes && $quote) {
  52744. $meta = false;
  52745. }
  52746. }
  52747. if ($quote) {
  52748. $arg = '"'.preg_replace('/(\\\\*)$/', '$1$1', $arg).'"';
  52749. }
  52750. if ($meta) {
  52751. $arg = preg_replace('/(["^&|<>()%])/', '^$1', $arg);
  52752. }
  52753. return $arg;
  52754. }
  52755. public static function supportsColor($output)
  52756. {
  52757. if ('Hyper' === getenv('TERM_PROGRAM')) {
  52758. return true;
  52759. }
  52760. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  52761. return (function_exists('sapi_windows_vt100_support')
  52762. && sapi_windows_vt100_support($output))
  52763. || false !== getenv('ANSICON')
  52764. || 'ON' === getenv('ConEmuANSI')
  52765. || 'xterm' === getenv('TERM');
  52766. }
  52767. if (function_exists('stream_isatty')) {
  52768. return stream_isatty($output);
  52769. }
  52770. if (function_exists('posix_isatty')) {
  52771. return posix_isatty($output);
  52772. }
  52773. $stat = fstat($output);
  52774. return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
  52775. }
  52776. public static function setEnv($name, $value = false)
  52777. {
  52778. $unset = false === $value;
  52779. if (!putenv($unset ? $name : $name.'='.$value)) {
  52780. return false;
  52781. }
  52782. if ($unset) {
  52783. unset($_SERVER[$name]);
  52784. } else {
  52785. $_SERVER[$name] = $value;
  52786. }
  52787. if (false !== stripos((string) ini_get('variables_order'), 'E')) {
  52788. if ($unset) {
  52789. unset($_ENV[$name]);
  52790. } else {
  52791. $_ENV[$name] = $value;
  52792. }
  52793. }
  52794. return true;
  52795. }
  52796. }
  52797. <?php
  52798. namespace Composer\XdebugHandler;
  52799. use Psr\Log\LoggerInterface;
  52800. use Psr\Log\LogLevel;
  52801. class Status
  52802. {
  52803. const ENV_RESTART = 'XDEBUG_HANDLER_RESTART';
  52804. const CHECK = 'Check';
  52805. const ERROR = 'Error';
  52806. const INFO = 'Info';
  52807. const NORESTART = 'NoRestart';
  52808. const RESTART = 'Restart';
  52809. const RESTARTING = 'Restarting';
  52810. const RESTARTED = 'Restarted';
  52811. private $debug;
  52812. private $envAllowXdebug;
  52813. private $loaded;
  52814. private $logger;
  52815. private $time;
  52816. public function __construct($envAllowXdebug, $debug)
  52817. {
  52818. $start = getenv(self::ENV_RESTART);
  52819. Process::setEnv(self::ENV_RESTART);
  52820. $this->time = $start ? round((microtime(true) - $start) * 1000) : 0;
  52821. $this->envAllowXdebug = $envAllowXdebug;
  52822. $this->debug = $debug && defined('STDERR');
  52823. }
  52824. public function setLogger(LoggerInterface $logger)
  52825. {
  52826. $this->logger = $logger;
  52827. }
  52828. public function report($op, $data)
  52829. {
  52830. if ($this->logger || $this->debug) {
  52831. call_user_func(array($this, 'report'.$op), $data);
  52832. }
  52833. }
  52834. private function output($text, $level = null)
  52835. {
  52836. if ($this->logger) {
  52837. $this->logger->log($level ?: LogLevel::DEBUG, $text);
  52838. }
  52839. if ($this->debug) {
  52840. fwrite(STDERR, sprintf('xdebug-handler[%d] %s', getmypid(), $text.PHP_EOL));
  52841. }
  52842. }
  52843. private function reportCheck($loaded)
  52844. {
  52845. $this->loaded = $loaded;
  52846. $this->output('Checking '.$this->envAllowXdebug);
  52847. }
  52848. private function reportError($error)
  52849. {
  52850. $this->output(sprintf('No restart (%s)', $error), LogLevel::WARNING);
  52851. }
  52852. private function reportInfo($info)
  52853. {
  52854. $this->output($info);
  52855. }
  52856. private function reportNoRestart()
  52857. {
  52858. $this->output($this->getLoadedMessage());
  52859. if ($this->loaded) {
  52860. $text = sprintf('No restart (%s)', $this->getEnvAllow());
  52861. if (!getenv($this->envAllowXdebug)) {
  52862. $text .= ' Allowed by application';
  52863. }
  52864. $this->output($text);
  52865. }
  52866. }
  52867. private function reportRestart()
  52868. {
  52869. $this->output($this->getLoadedMessage());
  52870. Process::setEnv(self::ENV_RESTART, (string) microtime(true));
  52871. }
  52872. private function reportRestarted()
  52873. {
  52874. $loaded = $this->getLoadedMessage();
  52875. $text = sprintf('Restarted (%d ms). %s', $this->time, $loaded);
  52876. $level = $this->loaded ? LogLevel::WARNING : null;
  52877. $this->output($text, $level);
  52878. }
  52879. private function reportRestarting($command)
  52880. {
  52881. $text = sprintf('Process restarting (%s)', $this->getEnvAllow());
  52882. $this->output($text);
  52883. $text = 'Running '.$command;
  52884. $this->output($text);
  52885. }
  52886. private function getEnvAllow()
  52887. {
  52888. return $this->envAllowXdebug.'='.getenv($this->envAllowXdebug);
  52889. }
  52890. private function getLoadedMessage()
  52891. {
  52892. $loaded = $this->loaded ? sprintf('loaded (%s)', $this->loaded) : 'not loaded';
  52893. return 'The Xdebug extension is '.$loaded;
  52894. }
  52895. }
  52896. <?php
  52897. namespace Composer\XdebugHandler;
  52898. use Psr\Log\LoggerInterface;
  52899. class XdebugHandler
  52900. {
  52901. const SUFFIX_ALLOW = '_ALLOW_XDEBUG';
  52902. const SUFFIX_INIS = '_ORIGINAL_INIS';
  52903. const RESTART_ID = 'internal';
  52904. const RESTART_SETTINGS = 'XDEBUG_HANDLER_SETTINGS';
  52905. const DEBUG = 'XDEBUG_HANDLER_DEBUG';
  52906. protected $tmpIni;
  52907. private static $inRestart;
  52908. private static $name;
  52909. private static $skipped;
  52910. private $cli;
  52911. private $colorOption;
  52912. private $debug;
  52913. private $envAllowXdebug;
  52914. private $envOriginalInis;
  52915. private $loaded;
  52916. private $persistent;
  52917. private $script;
  52918. private $statusWriter;
  52919. public function __construct($envPrefix, $colorOption = '')
  52920. {
  52921. if (!is_string($envPrefix) || empty($envPrefix) || !is_string($colorOption)) {
  52922. throw new \RuntimeException('Invalid constructor parameter');
  52923. }
  52924. self::$name = strtoupper($envPrefix);
  52925. $this->envAllowXdebug = self::$name.self::SUFFIX_ALLOW;
  52926. $this->envOriginalInis = self::$name.self::SUFFIX_INIS;
  52927. $this->colorOption = $colorOption;
  52928. if (extension_loaded('xdebug')) {
  52929. $ext = new \ReflectionExtension('xdebug');
  52930. $this->loaded = $ext->getVersion() ?: 'unknown';
  52931. }
  52932. if ($this->cli = PHP_SAPI === 'cli') {
  52933. $this->debug = getenv(self::DEBUG);
  52934. }
  52935. $this->statusWriter = new Status($this->envAllowXdebug, (bool) $this->debug);
  52936. }
  52937. public function setLogger(LoggerInterface $logger)
  52938. {
  52939. $this->statusWriter->setLogger($logger);
  52940. return $this;
  52941. }
  52942. public function setMainScript($script)
  52943. {
  52944. $this->script = $script;
  52945. return $this;
  52946. }
  52947. public function setPersistent()
  52948. {
  52949. $this->persistent = true;
  52950. return $this;
  52951. }
  52952. public function check()
  52953. {
  52954. $this->notify(Status::CHECK, $this->loaded);
  52955. $envArgs = explode('|', (string) getenv($this->envAllowXdebug));
  52956. if (empty($envArgs[0]) && $this->requiresRestart((bool) $this->loaded)) {
  52957. $this->notify(Status::RESTART);
  52958. if ($this->prepareRestart()) {
  52959. $command = $this->getCommand();
  52960. $this->notify(Status::RESTARTING, $command);
  52961. $this->restart($command);
  52962. }
  52963. return;
  52964. }
  52965. if (self::RESTART_ID === $envArgs[0] && count($envArgs) === 5) {
  52966. $this->notify(Status::RESTARTED);
  52967. Process::setEnv($this->envAllowXdebug);
  52968. self::$inRestart = true;
  52969. if (!$this->loaded) {
  52970. self::$skipped = $envArgs[1];
  52971. }
  52972. $this->setEnvRestartSettings($envArgs);
  52973. return;
  52974. }
  52975. $this->notify(Status::NORESTART);
  52976. if ($settings = self::getRestartSettings()) {
  52977. $this->syncSettings($settings);
  52978. }
  52979. }
  52980. public static function getAllIniFiles()
  52981. {
  52982. if (!empty(self::$name)) {
  52983. $env = getenv(self::$name.self::SUFFIX_INIS);
  52984. if (false !== $env) {
  52985. return explode(PATH_SEPARATOR, $env);
  52986. }
  52987. }
  52988. $paths = array((string) php_ini_loaded_file());
  52989. if ($scanned = php_ini_scanned_files()) {
  52990. $paths = array_merge($paths, array_map('trim', explode(',', $scanned)));
  52991. }
  52992. return $paths;
  52993. }
  52994. public static function getRestartSettings()
  52995. {
  52996. $envArgs = explode('|', (string) getenv(self::RESTART_SETTINGS));
  52997. if (count($envArgs) !== 6
  52998. || (!self::$inRestart && php_ini_loaded_file() !== $envArgs[0])) {
  52999. return;
  53000. }
  53001. return array(
  53002. 'tmpIni' => $envArgs[0],
  53003. 'scannedInis' => (bool) $envArgs[1],
  53004. 'scanDir' => '*' === $envArgs[2] ? false : $envArgs[2],
  53005. 'phprc' => '*' === $envArgs[3] ? false : $envArgs[3],
  53006. 'inis' => explode(PATH_SEPARATOR, $envArgs[4]),
  53007. 'skipped' => $envArgs[5],
  53008. );
  53009. }
  53010. public static function getSkippedVersion()
  53011. {
  53012. return (string) self::$skipped;
  53013. }
  53014. protected function requiresRestart($isLoaded)
  53015. {
  53016. return $isLoaded;
  53017. }
  53018. protected function restart($command)
  53019. {
  53020. $this->doRestart($command);
  53021. }
  53022. private function doRestart($command)
  53023. {
  53024. passthru($command, $exitCode);
  53025. $this->notify(Status::INFO, 'Restarted process exited '.$exitCode);
  53026. if ($this->debug === '2') {
  53027. $this->notify(Status::INFO, 'Temp ini saved: '.$this->tmpIni);
  53028. } else {
  53029. @unlink($this->tmpIni);
  53030. }
  53031. exit($exitCode);
  53032. }
  53033. private function prepareRestart()
  53034. {
  53035. $error = '';
  53036. $iniFiles = self::getAllIniFiles();
  53037. $scannedInis = count($iniFiles) > 1;
  53038. $tmpDir = sys_get_temp_dir();
  53039. if (!$this->cli) {
  53040. $error = 'Unsupported SAPI: '.PHP_SAPI;
  53041. } elseif (!defined('PHP_BINARY')) {
  53042. $error = 'PHP version is too old: '.PHP_VERSION;
  53043. } elseif (!$this->checkConfiguration($info)) {
  53044. $error = $info;
  53045. } elseif (!$this->checkScanDirConfig()) {
  53046. $error = 'PHP version does not report scanned inis: '.PHP_VERSION;
  53047. } elseif (!$this->checkMainScript()) {
  53048. $error = 'Unable to access main script: '.$this->script;
  53049. } elseif (!$this->writeTmpIni($iniFiles, $tmpDir, $error)) {
  53050. $error = $error ?: 'Unable to create temp ini file at: '.$tmpDir;
  53051. } elseif (!$this->setEnvironment($scannedInis, $iniFiles)) {
  53052. $error = 'Unable to set environment variables';
  53053. }
  53054. if ($error) {
  53055. $this->notify(Status::ERROR, $error);
  53056. }
  53057. return empty($error);
  53058. }
  53059. private function writeTmpIni(array $iniFiles, $tmpDir, &$error)
  53060. {
  53061. if (!$this->tmpIni = @tempnam($tmpDir, '')) {
  53062. return false;
  53063. }
  53064. if (empty($iniFiles[0])) {
  53065. array_shift($iniFiles);
  53066. }
  53067. $content = '';
  53068. $regex = '/^\s*(zend_extension\s*=.*xdebug.*)$/mi';
  53069. foreach ($iniFiles as $file) {
  53070. if (($data = @file_get_contents($file)) === false) {
  53071. $error = 'Unable to read ini: '.$file;
  53072. return false;
  53073. }
  53074. $content .= preg_replace($regex, ';$1', $data).PHP_EOL;
  53075. }
  53076. if ($config = parse_ini_string($content)) {
  53077. $loaded = ini_get_all(null, false);
  53078. $content .= $this->mergeLoadedConfig($loaded, $config);
  53079. }
  53080. $content .= 'opcache.enable_cli=0'.PHP_EOL;
  53081. return @file_put_contents($this->tmpIni, $content);
  53082. }
  53083. private function getCommand()
  53084. {
  53085. $php = array(PHP_BINARY);
  53086. $args = array_slice($_SERVER['argv'], 1);
  53087. if (!$this->persistent) {
  53088. array_push($php, '-n', '-c', $this->tmpIni);
  53089. }
  53090. if (defined('STDOUT') && Process::supportsColor(STDOUT)) {
  53091. $args = Process::addColorOption($args, $this->colorOption);
  53092. }
  53093. $args = array_merge($php, array($this->script), $args);
  53094. $cmd = Process::escape(array_shift($args), true, true);
  53095. foreach ($args as $arg) {
  53096. $cmd .= ' '.Process::escape($arg);
  53097. }
  53098. return $cmd;
  53099. }
  53100. private function setEnvironment($scannedInis, array $iniFiles)
  53101. {
  53102. $scanDir = getenv('PHP_INI_SCAN_DIR');
  53103. $phprc = getenv('PHPRC');
  53104. if (!putenv($this->envOriginalInis.'='.implode(PATH_SEPARATOR, $iniFiles))) {
  53105. return false;
  53106. }
  53107. if ($this->persistent) {
  53108. if (!putenv('PHP_INI_SCAN_DIR=') || !putenv('PHPRC='.$this->tmpIni)) {
  53109. return false;
  53110. }
  53111. }
  53112. $envArgs = array(
  53113. self::RESTART_ID,
  53114. $this->loaded,
  53115. (int) $scannedInis,
  53116. false === $scanDir ? '*' : $scanDir,
  53117. false === $phprc ? '*' : $phprc,
  53118. );
  53119. return putenv($this->envAllowXdebug.'='.implode('|', $envArgs));
  53120. }
  53121. private function notify($op, $data = null)
  53122. {
  53123. $this->statusWriter->report($op, $data);
  53124. }
  53125. private function mergeLoadedConfig(array $loadedConfig, array $iniConfig)
  53126. {
  53127. $content = '';
  53128. foreach ($loadedConfig as $name => $value) {
  53129. if (!is_string($value)
  53130. || strpos($name, 'xdebug') === 0
  53131. || $name === 'apc.mmap_file_mask') {
  53132. continue;
  53133. }
  53134. if (!isset($iniConfig[$name]) || $iniConfig[$name] !== $value) {
  53135. $content .= $name.'="'.addcslashes($value, '\\"').'"'.PHP_EOL;
  53136. }
  53137. }
  53138. return $content;
  53139. }
  53140. private function checkMainScript()
  53141. {
  53142. if (null !== $this->script) {
  53143. return file_exists($this->script) || '--' === $this->script;
  53144. }
  53145. if (file_exists($this->script = $_SERVER['argv'][0])) {
  53146. return true;
  53147. }
  53148. $options = PHP_VERSION_ID >= 50306 ? DEBUG_BACKTRACE_IGNORE_ARGS : false;
  53149. $trace = debug_backtrace($options);
  53150. if (($main = end($trace)) && isset($main['file'])) {
  53151. return file_exists($this->script = $main['file']);
  53152. }
  53153. return false;
  53154. }
  53155. private function setEnvRestartSettings($envArgs)
  53156. {
  53157. $settings = array(
  53158. php_ini_loaded_file(),
  53159. $envArgs[2],
  53160. $envArgs[3],
  53161. $envArgs[4],
  53162. getenv($this->envOriginalInis),
  53163. self::$skipped,
  53164. );
  53165. Process::setEnv(self::RESTART_SETTINGS, implode('|', $settings));
  53166. }
  53167. private function syncSettings(array $settings)
  53168. {
  53169. if (false === getenv($this->envOriginalInis)) {
  53170. Process::setEnv($this->envOriginalInis, implode(PATH_SEPARATOR, $settings['inis']));
  53171. }
  53172. self::$skipped = $settings['skipped'];
  53173. $this->notify(Status::INFO, 'Process called with existing restart settings');
  53174. }
  53175. private function checkScanDirConfig()
  53176. {
  53177. return !(getenv('PHP_INI_SCAN_DIR')
  53178. && !PHP_CONFIG_FILE_SCAN_DIR
  53179. && (PHP_VERSION_ID < 70113
  53180. || PHP_VERSION_ID === 70200));
  53181. }
  53182. private function checkConfiguration(&$info)
  53183. {
  53184. if (false !== strpos(ini_get('disable_functions'), 'passthru')) {
  53185. $info = 'passthru function is disabled';
  53186. return false;
  53187. }
  53188. if (extension_loaded('uopz') && !ini_get('uopz.disable')) {
  53189. if (function_exists('uopz_allow_exit')) {
  53190. @uopz_allow_exit(true);
  53191. } else {
  53192. $info = 'uopz extension is not compatible';
  53193. return false;
  53194. }
  53195. }
  53196. return true;
  53197. }
  53198. }
  53199. Copyright (c) 2012 PHP Framework Interoperability Group
  53200. Permission is hereby granted, free of charge, to any person obtaining a copy
  53201. of this software and associated documentation files (the "Software"), to deal
  53202. in the Software without restriction, including without limitation the rights
  53203. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  53204. copies of the Software, and to permit persons to whom the Software is
  53205. furnished to do so, subject to the following conditions:
  53206. The above copyright notice and this permission notice shall be included in
  53207. all copies or substantial portions of the Software.
  53208. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  53209. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  53210. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  53211. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  53212. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  53213. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  53214. THE SOFTWARE.
  53215. <?php
  53216. namespace Psr\Log;
  53217. abstract class AbstractLogger implements LoggerInterface
  53218. {
  53219. public function emergency($message, array $context = array())
  53220. {
  53221. $this->log(LogLevel::EMERGENCY, $message, $context);
  53222. }
  53223. public function alert($message, array $context = array())
  53224. {
  53225. $this->log(LogLevel::ALERT, $message, $context);
  53226. }
  53227. public function critical($message, array $context = array())
  53228. {
  53229. $this->log(LogLevel::CRITICAL, $message, $context);
  53230. }
  53231. public function error($message, array $context = array())
  53232. {
  53233. $this->log(LogLevel::ERROR, $message, $context);
  53234. }
  53235. public function warning($message, array $context = array())
  53236. {
  53237. $this->log(LogLevel::WARNING, $message, $context);
  53238. }
  53239. public function notice($message, array $context = array())
  53240. {
  53241. $this->log(LogLevel::NOTICE, $message, $context);
  53242. }
  53243. public function info($message, array $context = array())
  53244. {
  53245. $this->log(LogLevel::INFO, $message, $context);
  53246. }
  53247. public function debug($message, array $context = array())
  53248. {
  53249. $this->log(LogLevel::DEBUG, $message, $context);
  53250. }
  53251. }
  53252. <?php
  53253. namespace Psr\Log;
  53254. class InvalidArgumentException extends \InvalidArgumentException
  53255. {
  53256. }
  53257. <?php
  53258. namespace Psr\Log;
  53259. class LogLevel
  53260. {
  53261. const EMERGENCY = 'emergency';
  53262. const ALERT = 'alert';
  53263. const CRITICAL = 'critical';
  53264. const ERROR = 'error';
  53265. const WARNING = 'warning';
  53266. const NOTICE = 'notice';
  53267. const INFO = 'info';
  53268. const DEBUG = 'debug';
  53269. }
  53270. <?php
  53271. namespace Psr\Log;
  53272. interface LoggerAwareInterface
  53273. {
  53274. public function setLogger(LoggerInterface $logger);
  53275. }
  53276. <?php
  53277. namespace Psr\Log;
  53278. trait LoggerAwareTrait
  53279. {
  53280. protected $logger;
  53281. public function setLogger(LoggerInterface $logger)
  53282. {
  53283. $this->logger = $logger;
  53284. }
  53285. }
  53286. <?php
  53287. namespace Psr\Log;
  53288. interface LoggerInterface
  53289. {
  53290. public function emergency($message, array $context = array());
  53291. public function alert($message, array $context = array());
  53292. public function critical($message, array $context = array());
  53293. public function error($message, array $context = array());
  53294. public function warning($message, array $context = array());
  53295. public function notice($message, array $context = array());
  53296. public function info($message, array $context = array());
  53297. public function debug($message, array $context = array());
  53298. public function log($level, $message, array $context = array());
  53299. }
  53300. <?php
  53301. namespace Psr\Log;
  53302. trait LoggerTrait
  53303. {
  53304. public function emergency($message, array $context = array())
  53305. {
  53306. $this->log(LogLevel::EMERGENCY, $message, $context);
  53307. }
  53308. public function alert($message, array $context = array())
  53309. {
  53310. $this->log(LogLevel::ALERT, $message, $context);
  53311. }
  53312. public function critical($message, array $context = array())
  53313. {
  53314. $this->log(LogLevel::CRITICAL, $message, $context);
  53315. }
  53316. public function error($message, array $context = array())
  53317. {
  53318. $this->log(LogLevel::ERROR, $message, $context);
  53319. }
  53320. public function warning($message, array $context = array())
  53321. {
  53322. $this->log(LogLevel::WARNING, $message, $context);
  53323. }
  53324. public function notice($message, array $context = array())
  53325. {
  53326. $this->log(LogLevel::NOTICE, $message, $context);
  53327. }
  53328. public function info($message, array $context = array())
  53329. {
  53330. $this->log(LogLevel::INFO, $message, $context);
  53331. }
  53332. public function debug($message, array $context = array())
  53333. {
  53334. $this->log(LogLevel::DEBUG, $message, $context);
  53335. }
  53336. abstract public function log($level, $message, array $context = array());
  53337. }
  53338. <?php
  53339. namespace Psr\Log;
  53340. class NullLogger extends AbstractLogger
  53341. {
  53342. public function log($level, $message, array $context = array())
  53343. {
  53344. }
  53345. }
  53346. <?php
  53347. namespace Psr\Log\Test;
  53348. class DummyTest
  53349. {
  53350. public function __toString()
  53351. {
  53352. return 'DummyTest';
  53353. }
  53354. }
  53355. <?php
  53356. namespace Psr\Log\Test;
  53357. use Psr\Log\LoggerInterface;
  53358. use Psr\Log\LogLevel;
  53359. use PHPUnit\Framework\TestCase;
  53360. abstract class LoggerInterfaceTest extends TestCase
  53361. {
  53362. abstract public function getLogger();
  53363. abstract public function getLogs();
  53364. public function testImplements()
  53365. {
  53366. $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger());
  53367. }
  53368. public function testLogsAtAllLevels($level, $message)
  53369. {
  53370. $logger = $this->getLogger();
  53371. $logger->{$level}($message, array('user' => 'Bob'));
  53372. $logger->log($level, $message, array('user' => 'Bob'));
  53373. $expected = array(
  53374. $level.' message of level '.$level.' with context: Bob',
  53375. $level.' message of level '.$level.' with context: Bob',
  53376. );
  53377. $this->assertEquals($expected, $this->getLogs());
  53378. }
  53379. public function provideLevelsAndMessages()
  53380. {
  53381. return array(
  53382. LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'),
  53383. LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'),
  53384. LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'),
  53385. LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'),
  53386. LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'),
  53387. LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'),
  53388. LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'),
  53389. LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'),
  53390. );
  53391. }
  53392. public function testThrowsOnInvalidLevel()
  53393. {
  53394. $logger = $this->getLogger();
  53395. $logger->log('invalid level', 'Foo');
  53396. }
  53397. public function testContextReplacement()
  53398. {
  53399. $logger = $this->getLogger();
  53400. $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
  53401. $expected = array('info {Message {nothing} Bob Bar a}');
  53402. $this->assertEquals($expected, $this->getLogs());
  53403. }
  53404. public function testObjectCastToString()
  53405. {
  53406. if (method_exists($this, 'createPartialMock')) {
  53407. $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString'));
  53408. } else {
  53409. $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
  53410. }
  53411. $dummy->expects($this->once())
  53412. ->method('__toString')
  53413. ->will($this->returnValue('DUMMY'));
  53414. $this->getLogger()->warning($dummy);
  53415. $expected = array('warning DUMMY');
  53416. $this->assertEquals($expected, $this->getLogs());
  53417. }
  53418. public function testContextCanContainAnything()
  53419. {
  53420. $closed = fopen('php://memory', 'r');
  53421. fclose($closed);
  53422. $context = array(
  53423. 'bool' => true,
  53424. 'null' => null,
  53425. 'string' => 'Foo',
  53426. 'int' => 0,
  53427. 'float' => 0.5,
  53428. 'nested' => array('with object' => new DummyTest),
  53429. 'object' => new \DateTime,
  53430. 'resource' => fopen('php://memory', 'r'),
  53431. 'closed' => $closed,
  53432. );
  53433. $this->getLogger()->warning('Crazy context data', $context);
  53434. $expected = array('warning Crazy context data');
  53435. $this->assertEquals($expected, $this->getLogs());
  53436. }
  53437. public function testContextExceptionKeyCanBeExceptionOrOtherValues()
  53438. {
  53439. $logger = $this->getLogger();
  53440. $logger->warning('Random message', array('exception' => 'oops'));
  53441. $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
  53442. $expected = array(
  53443. 'warning Random message',
  53444. 'critical Uncaught Exception!'
  53445. );
  53446. $this->assertEquals($expected, $this->getLogs());
  53447. }
  53448. }
  53449. <?php
  53450. namespace Psr\Log\Test;
  53451. use Psr\Log\AbstractLogger;
  53452. class TestLogger extends AbstractLogger
  53453. {
  53454. public $records = [];
  53455. public $recordsByLevel = [];
  53456. public function log($level, $message, array $context = [])
  53457. {
  53458. $record = [
  53459. 'level' => $level,
  53460. 'message' => $message,
  53461. 'context' => $context,
  53462. ];
  53463. $this->recordsByLevel[$record['level']][] = $record;
  53464. $this->records[] = $record;
  53465. }
  53466. public function hasRecords($level)
  53467. {
  53468. return isset($this->recordsByLevel[$level]);
  53469. }
  53470. public function hasRecord($record, $level)
  53471. {
  53472. if (is_string($record)) {
  53473. $record = ['message' => $record];
  53474. }
  53475. return $this->hasRecordThatPasses(function ($rec) use ($record) {
  53476. if ($rec['message'] !== $record['message']) {
  53477. return false;
  53478. }
  53479. if (isset($record['context']) && $rec['context'] !== $record['context']) {
  53480. return false;
  53481. }
  53482. return true;
  53483. }, $level);
  53484. }
  53485. public function hasRecordThatContains($message, $level)
  53486. {
  53487. return $this->hasRecordThatPasses(function ($rec) use ($message) {
  53488. return strpos($rec['message'], $message) !== false;
  53489. }, $level);
  53490. }
  53491. public function hasRecordThatMatches($regex, $level)
  53492. {
  53493. return $this->hasRecordThatPasses(function ($rec) use ($regex) {
  53494. return preg_match($regex, $rec['message']) > 0;
  53495. }, $level);
  53496. }
  53497. public function hasRecordThatPasses(callable $predicate, $level)
  53498. {
  53499. if (!isset($this->recordsByLevel[$level])) {
  53500. return false;
  53501. }
  53502. foreach ($this->recordsByLevel[$level] as $i => $rec) {
  53503. if (call_user_func($predicate, $rec, $i)) {
  53504. return true;
  53505. }
  53506. }
  53507. return false;
  53508. }
  53509. public function __call($method, $args)
  53510. {
  53511. if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) {
  53512. $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3];
  53513. $level = strtolower($matches[2]);
  53514. if (method_exists($this, $genericMethod)) {
  53515. $args[] = $level;
  53516. return call_user_func_array([$this, $genericMethod], $args);
  53517. }
  53518. }
  53519. throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()');
  53520. }
  53521. public function reset()
  53522. {
  53523. $this->records = [];
  53524. $this->recordsByLevel = [];
  53525. }
  53526. }
  53527. <?php
  53528. require_once __DIR__ . '/composer/autoload_real.php';
  53529. return ComposerAutoloaderInitComposerPhar1594897020::getLoader();
  53530. <?php
  53531. $vendorDir = dirname(dirname(__FILE__));
  53532. $baseDir = dirname($vendorDir);
  53533. return array(
  53534. );
  53535. <?php
  53536. $vendorDir = dirname(dirname(__FILE__));
  53537. $baseDir = dirname($vendorDir);
  53538. return array(
  53539. 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
  53540. 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
  53541. 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
  53542. 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
  53543. 'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
  53544. 'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'),
  53545. 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
  53546. 'Seld\\PharUtils\\' => array($vendorDir . '/seld/phar-utils/src'),
  53547. 'Seld\\JsonLint\\' => array($vendorDir . '/seld/jsonlint/src/Seld/JsonLint'),
  53548. 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
  53549. 'JsonSchema\\' => array($vendorDir . '/justinrainbow/json-schema/src/JsonSchema'),
  53550. 'Composer\\XdebugHandler\\' => array($vendorDir . '/composer/xdebug-handler/src'),
  53551. 'Composer\\Spdx\\' => array($vendorDir . '/composer/spdx-licenses/src'),
  53552. 'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
  53553. 'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'),
  53554. 'Composer\\' => array($baseDir . '/src/Composer'),
  53555. );
  53556. <?php
  53557. $vendorDir = dirname(dirname(__FILE__));
  53558. $baseDir = dirname($vendorDir);
  53559. return array(
  53560. );
  53561. <?php
  53562. $vendorDir = dirname(dirname(__FILE__));
  53563. $baseDir = dirname($vendorDir);
  53564. return array(
  53565. '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
  53566. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
  53567. );
  53568. <?php
  53569. class ComposerAutoloaderInitComposerPhar1594897020
  53570. {
  53571. private static $loader;
  53572. public static function loadClassLoader($class)
  53573. {
  53574. if ('Composer\Autoload\ClassLoader' === $class) {
  53575. require __DIR__ . '/ClassLoader.php';
  53576. }
  53577. }
  53578. public static function getLoader()
  53579. {
  53580. if (null !== self::$loader) {
  53581. return self::$loader;
  53582. }
  53583. spl_autoload_register(array('ComposerAutoloaderInitComposerPhar1594897020', 'loadClassLoader'), true, true);
  53584. self::$loader = $loader = new \Composer\Autoload\ClassLoader();
  53585. spl_autoload_unregister(array('ComposerAutoloaderInitComposerPhar1594897020', 'loadClassLoader'));
  53586. $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  53587. if ($useStaticLoader) {
  53588. require_once __DIR__ . '/autoload_static.php';
  53589. call_user_func(\Composer\Autoload\ComposerStaticInitComposerPhar1594897020::getInitializer($loader));
  53590. } else {
  53591. $map = require __DIR__ . '/autoload_namespaces.php';
  53592. foreach ($map as $namespace => $path) {
  53593. $loader->set($namespace, $path);
  53594. }
  53595. $map = require __DIR__ . '/autoload_psr4.php';
  53596. foreach ($map as $namespace => $path) {
  53597. $loader->setPsr4($namespace, $path);
  53598. }
  53599. $classMap = require __DIR__ . '/autoload_classmap.php';
  53600. if ($classMap) {
  53601. $loader->addClassMap($classMap);
  53602. }
  53603. }
  53604. $loader->register(true);
  53605. if ($useStaticLoader) {
  53606. $includeFiles = Composer\Autoload\ComposerStaticInitComposerPhar1594897020::$files;
  53607. } else {
  53608. $includeFiles = require __DIR__ . '/autoload_files.php';
  53609. }
  53610. foreach ($includeFiles as $fileIdentifier => $file) {
  53611. composerRequireComposerPhar1594897020($fileIdentifier, $file);
  53612. }
  53613. return $loader;
  53614. }
  53615. }
  53616. function composerRequireComposerPhar1594897020($fileIdentifier, $file)
  53617. {
  53618. if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  53619. require $file;
  53620. $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
  53621. }
  53622. }
  53623. <?php
  53624. namespace Composer\Autoload;
  53625. class ComposerStaticInitComposerPhar1594897020
  53626. {
  53627. public static $files = array (
  53628. '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
  53629. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
  53630. );
  53631. public static $prefixLengthsPsr4 = array (
  53632. 'S' =>
  53633. array (
  53634. 'Symfony\\Polyfill\\Mbstring\\' => 26,
  53635. 'Symfony\\Polyfill\\Ctype\\' => 23,
  53636. 'Symfony\\Component\\Process\\' => 26,
  53637. 'Symfony\\Component\\Finder\\' => 25,
  53638. 'Symfony\\Component\\Filesystem\\' => 29,
  53639. 'Symfony\\Component\\Debug\\' => 24,
  53640. 'Symfony\\Component\\Console\\' => 26,
  53641. 'Seld\\PharUtils\\' => 15,
  53642. 'Seld\\JsonLint\\' => 14,
  53643. ),
  53644. 'P' =>
  53645. array (
  53646. 'Psr\\Log\\' => 8,
  53647. ),
  53648. 'J' =>
  53649. array (
  53650. 'JsonSchema\\' => 11,
  53651. ),
  53652. 'C' =>
  53653. array (
  53654. 'Composer\\XdebugHandler\\' => 23,
  53655. 'Composer\\Spdx\\' => 14,
  53656. 'Composer\\Semver\\' => 16,
  53657. 'Composer\\CaBundle\\' => 18,
  53658. 'Composer\\' => 9,
  53659. ),
  53660. );
  53661. public static $prefixDirsPsr4 = array (
  53662. 'Symfony\\Polyfill\\Mbstring\\' =>
  53663. array (
  53664. 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
  53665. ),
  53666. 'Symfony\\Polyfill\\Ctype\\' =>
  53667. array (
  53668. 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype',
  53669. ),
  53670. 'Symfony\\Component\\Process\\' =>
  53671. array (
  53672. 0 => __DIR__ . '/..' . '/symfony/process',
  53673. ),
  53674. 'Symfony\\Component\\Finder\\' =>
  53675. array (
  53676. 0 => __DIR__ . '/..' . '/symfony/finder',
  53677. ),
  53678. 'Symfony\\Component\\Filesystem\\' =>
  53679. array (
  53680. 0 => __DIR__ . '/..' . '/symfony/filesystem',
  53681. ),
  53682. 'Symfony\\Component\\Debug\\' =>
  53683. array (
  53684. 0 => __DIR__ . '/..' . '/symfony/debug',
  53685. ),
  53686. 'Symfony\\Component\\Console\\' =>
  53687. array (
  53688. 0 => __DIR__ . '/..' . '/symfony/console',
  53689. ),
  53690. 'Seld\\PharUtils\\' =>
  53691. array (
  53692. 0 => __DIR__ . '/..' . '/seld/phar-utils/src',
  53693. ),
  53694. 'Seld\\JsonLint\\' =>
  53695. array (
  53696. 0 => __DIR__ . '/..' . '/seld/jsonlint/src/Seld/JsonLint',
  53697. ),
  53698. 'Psr\\Log\\' =>
  53699. array (
  53700. 0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
  53701. ),
  53702. 'JsonSchema\\' =>
  53703. array (
  53704. 0 => __DIR__ . '/..' . '/justinrainbow/json-schema/src/JsonSchema',
  53705. ),
  53706. 'Composer\\XdebugHandler\\' =>
  53707. array (
  53708. 0 => __DIR__ . '/..' . '/composer/xdebug-handler/src',
  53709. ),
  53710. 'Composer\\Spdx\\' =>
  53711. array (
  53712. 0 => __DIR__ . '/..' . '/composer/spdx-licenses/src',
  53713. ),
  53714. 'Composer\\Semver\\' =>
  53715. array (
  53716. 0 => __DIR__ . '/..' . '/composer/semver/src',
  53717. ),
  53718. 'Composer\\CaBundle\\' =>
  53719. array (
  53720. 0 => __DIR__ . '/..' . '/composer/ca-bundle/src',
  53721. ),
  53722. 'Composer\\' =>
  53723. array (
  53724. 0 => __DIR__ . '/../..' . '/src/Composer',
  53725. ),
  53726. );
  53727. public static function getInitializer(ClassLoader $loader)
  53728. {
  53729. return \Closure::bind(function () use ($loader) {
  53730. $loader->prefixLengthsPsr4 = ComposerStaticInitComposerPhar1594897020::$prefixLengthsPsr4;
  53731. $loader->prefixDirsPsr4 = ComposerStaticInitComposerPhar1594897020::$prefixDirsPsr4;
  53732. }, null, ClassLoader::class);
  53733. }
  53734. }
  53735. <?php
  53736. namespace Composer\Autoload;
  53737. class ClassLoader
  53738. {
  53739. private $prefixLengthsPsr4 = array();
  53740. private $prefixDirsPsr4 = array();
  53741. private $fallbackDirsPsr4 = array();
  53742. private $prefixesPsr0 = array();
  53743. private $fallbackDirsPsr0 = array();
  53744. private $useIncludePath = false;
  53745. private $classMap = array();
  53746. private $classMapAuthoritative = false;
  53747. private $missingClasses = array();
  53748. private $apcuPrefix;
  53749. public function getPrefixes()
  53750. {
  53751. if (!empty($this->prefixesPsr0)) {
  53752. return call_user_func_array('array_merge', $this->prefixesPsr0);
  53753. }
  53754. return array();
  53755. }
  53756. public function getPrefixesPsr4()
  53757. {
  53758. return $this->prefixDirsPsr4;
  53759. }
  53760. public function getFallbackDirs()
  53761. {
  53762. return $this->fallbackDirsPsr0;
  53763. }
  53764. public function getFallbackDirsPsr4()
  53765. {
  53766. return $this->fallbackDirsPsr4;
  53767. }
  53768. public function getClassMap()
  53769. {
  53770. return $this->classMap;
  53771. }
  53772. public function addClassMap(array $classMap)
  53773. {
  53774. if ($this->classMap) {
  53775. $this->classMap = array_merge($this->classMap, $classMap);
  53776. } else {
  53777. $this->classMap = $classMap;
  53778. }
  53779. }
  53780. public function add($prefix, $paths, $prepend = false)
  53781. {
  53782. if (!$prefix) {
  53783. if ($prepend) {
  53784. $this->fallbackDirsPsr0 = array_merge(
  53785. (array) $paths,
  53786. $this->fallbackDirsPsr0
  53787. );
  53788. } else {
  53789. $this->fallbackDirsPsr0 = array_merge(
  53790. $this->fallbackDirsPsr0,
  53791. (array) $paths
  53792. );
  53793. }
  53794. return;
  53795. }
  53796. $first = $prefix[0];
  53797. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  53798. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  53799. return;
  53800. }
  53801. if ($prepend) {
  53802. $this->prefixesPsr0[$first][$prefix] = array_merge(
  53803. (array) $paths,
  53804. $this->prefixesPsr0[$first][$prefix]
  53805. );
  53806. } else {
  53807. $this->prefixesPsr0[$first][$prefix] = array_merge(
  53808. $this->prefixesPsr0[$first][$prefix],
  53809. (array) $paths
  53810. );
  53811. }
  53812. }
  53813. public function addPsr4($prefix, $paths, $prepend = false)
  53814. {
  53815. if (!$prefix) {
  53816. if ($prepend) {
  53817. $this->fallbackDirsPsr4 = array_merge(
  53818. (array) $paths,
  53819. $this->fallbackDirsPsr4
  53820. );
  53821. } else {
  53822. $this->fallbackDirsPsr4 = array_merge(
  53823. $this->fallbackDirsPsr4,
  53824. (array) $paths
  53825. );
  53826. }
  53827. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  53828. $length = strlen($prefix);
  53829. if ('\\' !== $prefix[$length - 1]) {
  53830. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  53831. }
  53832. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  53833. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  53834. } elseif ($prepend) {
  53835. $this->prefixDirsPsr4[$prefix] = array_merge(
  53836. (array) $paths,
  53837. $this->prefixDirsPsr4[$prefix]
  53838. );
  53839. } else {
  53840. $this->prefixDirsPsr4[$prefix] = array_merge(
  53841. $this->prefixDirsPsr4[$prefix],
  53842. (array) $paths
  53843. );
  53844. }
  53845. }
  53846. public function set($prefix, $paths)
  53847. {
  53848. if (!$prefix) {
  53849. $this->fallbackDirsPsr0 = (array) $paths;
  53850. } else {
  53851. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  53852. }
  53853. }
  53854. public function setPsr4($prefix, $paths)
  53855. {
  53856. if (!$prefix) {
  53857. $this->fallbackDirsPsr4 = (array) $paths;
  53858. } else {
  53859. $length = strlen($prefix);
  53860. if ('\\' !== $prefix[$length - 1]) {
  53861. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  53862. }
  53863. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  53864. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  53865. }
  53866. }
  53867. public function setUseIncludePath($useIncludePath)
  53868. {
  53869. $this->useIncludePath = $useIncludePath;
  53870. }
  53871. public function getUseIncludePath()
  53872. {
  53873. return $this->useIncludePath;
  53874. }
  53875. public function setClassMapAuthoritative($classMapAuthoritative)
  53876. {
  53877. $this->classMapAuthoritative = $classMapAuthoritative;
  53878. }
  53879. public function isClassMapAuthoritative()
  53880. {
  53881. return $this->classMapAuthoritative;
  53882. }
  53883. public function setApcuPrefix($apcuPrefix)
  53884. {
  53885. $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
  53886. }
  53887. public function getApcuPrefix()
  53888. {
  53889. return $this->apcuPrefix;
  53890. }
  53891. public function register($prepend = false)
  53892. {
  53893. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  53894. }
  53895. public function unregister()
  53896. {
  53897. spl_autoload_unregister(array($this, 'loadClass'));
  53898. }
  53899. public function loadClass($class)
  53900. {
  53901. if ($file = $this->findFile($class)) {
  53902. includeFile($file);
  53903. return true;
  53904. }
  53905. }
  53906. public function findFile($class)
  53907. {
  53908. if (isset($this->classMap[$class])) {
  53909. return $this->classMap[$class];
  53910. }
  53911. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  53912. return false;
  53913. }
  53914. if (null !== $this->apcuPrefix) {
  53915. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  53916. if ($hit) {
  53917. return $file;
  53918. }
  53919. }
  53920. $file = $this->findFileWithExtension($class, '.php');
  53921. if (false === $file && defined('HHVM_VERSION')) {
  53922. $file = $this->findFileWithExtension($class, '.hh');
  53923. }
  53924. if (null !== $this->apcuPrefix) {
  53925. apcu_add($this->apcuPrefix.$class, $file);
  53926. }
  53927. if (false === $file) {
  53928. $this->missingClasses[$class] = true;
  53929. }
  53930. return $file;
  53931. }
  53932. private function findFileWithExtension($class, $ext)
  53933. {
  53934. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  53935. $first = $class[0];
  53936. if (isset($this->prefixLengthsPsr4[$first])) {
  53937. $subPath = $class;
  53938. while (false !== $lastPos = strrpos($subPath, '\\')) {
  53939. $subPath = substr($subPath, 0, $lastPos);
  53940. $search = $subPath . '\\';
  53941. if (isset($this->prefixDirsPsr4[$search])) {
  53942. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  53943. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  53944. if (file_exists($file = $dir . $pathEnd)) {
  53945. return $file;
  53946. }
  53947. }
  53948. }
  53949. }
  53950. }
  53951. foreach ($this->fallbackDirsPsr4 as $dir) {
  53952. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  53953. return $file;
  53954. }
  53955. }
  53956. if (false !== $pos = strrpos($class, '\\')) {
  53957. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  53958. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  53959. } else {
  53960. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  53961. }
  53962. if (isset($this->prefixesPsr0[$first])) {
  53963. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  53964. if (0 === strpos($class, $prefix)) {
  53965. foreach ($dirs as $dir) {
  53966. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  53967. return $file;
  53968. }
  53969. }
  53970. }
  53971. }
  53972. }
  53973. foreach ($this->fallbackDirsPsr0 as $dir) {
  53974. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  53975. return $file;
  53976. }
  53977. }
  53978. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  53979. return $file;
  53980. }
  53981. return false;
  53982. }
  53983. }
  53984. function includeFile($file)
  53985. {
  53986. include $file;
  53987. }
  53988. ##
  53989. ## Bundle of CA Root Certificates
  53990. ##
  53991. ## Certificate data from Mozilla as of: Wed Jan 1 04:12:10 2020 GMT
  53992. ##
  53993. ## This is a bundle of X.509 certificates of public Certificate Authorities
  53994. ## (CA). These were automatically extracted from Mozilla's root certificates
  53995. ## file (certdata.txt). This file can be found in the mozilla source tree:
  53996. ## https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
  53997. ##
  53998. ## It contains the certificates in PEM format and therefore
  53999. ## can be directly used with curl / libcurl / php_curl, or with
  54000. ## an Apache+mod_ssl webserver for SSL client authentication.
  54001. ## Just configure this file as the SSLCACertificateFile.
  54002. ##
  54003. ## Conversion done with mk-ca-bundle.pl version 1.27.
  54004. ## SHA256: f3bdcd74612952da8476a9d4147f50b29ad0710b7dd95b4c8690500209986d70
  54005. ##
  54006. GlobalSign Root CA
  54007. ==================
  54008. -----BEGIN CERTIFICATE-----
  54009. MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx
  54010. GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds
  54011. b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV
  54012. BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD
  54013. VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa
  54014. DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc
  54015. THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb
  54016. Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP
  54017. c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX
  54018. gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
  54019. HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF
  54020. AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj
  54021. Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG
  54022. j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH
  54023. hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC
  54024. X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
  54025. -----END CERTIFICATE-----
  54026. GlobalSign Root CA - R2
  54027. =======================
  54028. -----BEGIN CERTIFICATE-----
  54029. MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4GA1UECxMXR2xv
  54030. YmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  54031. bFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  54032. aWduIFJvb3QgQ0EgLSBSMjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  54033. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6
  54034. ErPLv4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8eoLrvozp
  54035. s6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklqtTleiDTsvHgMCJiEbKjN
  54036. S7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzdC9XZzPnqJworc5HGnRusyMvo4KD0L5CL
  54037. TfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pazq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6C
  54038. ygPCm48CAwEAAaOBnDCBmTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E
  54039. FgQUm+IHV2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nbG9i
  54040. YWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG3lm0mi3f3BmGLjAN
  54041. BgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4GsJ0/WwbgcQ3izDJr86iw8bmEbTUsp
  54042. 9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu
  54043. 01yiPqFbQfXf5WRDLenVOavSot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG7
  54044. 9G+dwfCMNYxdAfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7
  54045. TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==
  54046. -----END CERTIFICATE-----
  54047. Verisign Class 3 Public Primary Certification Authority - G3
  54048. ============================================================
  54049. -----BEGIN CERTIFICATE-----
  54050. MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV
  54051. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  54052. cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  54053. IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh
  54054. dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw
  54055. CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy
  54056. dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv
  54057. cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkg
  54058. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  54059. ggEBAMu6nFL8eB8aHm8bN3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1
  54060. EUGO+i2tKmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGukxUc
  54061. cLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBmCC+Vk7+qRy+oRpfw
  54062. EuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJXwzw3sJ2zq/3avL6QaaiMxTJ5Xpj
  54063. 055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWuimi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA
  54064. ERSWwauSCPc/L8my/uRan2Te2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5f
  54065. j267Cz3qWhMeDGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC
  54066. /Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565pF4ErWjfJXir0
  54067. xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGtTxzhT5yvDwyd93gN2PQ1VoDa
  54068. t20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ==
  54069. -----END CERTIFICATE-----
  54070. Entrust.net Premium 2048 Secure Server CA
  54071. =========================================
  54072. -----BEGIN CERTIFICATE-----
  54073. MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u
  54074. ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp
  54075. bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV
  54076. BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx
  54077. NzUwNTFaFw0yOTA3MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3
  54078. d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl
  54079. MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u
  54080. ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  54081. MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL
  54082. Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr
  54083. hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW
  54084. nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi
  54085. VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo0IwQDAOBgNVHQ8BAf8E
  54086. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJ
  54087. KoZIhvcNAQEFBQADggEBADubj1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPy
  54088. T/4xmf3IDExoU8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf
  54089. zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5bu/8j72gZyxKT
  54090. J1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+bYQLCIt+jerXmCHG8+c8eS9e
  54091. nNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/ErfF6adulZkMV8gzURZVE=
  54092. -----END CERTIFICATE-----
  54093. Baltimore CyberTrust Root
  54094. =========================
  54095. -----BEGIN CERTIFICATE-----
  54096. MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE
  54097. ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li
  54098. ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC
  54099. SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs
  54100. dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME
  54101. uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB
  54102. UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C
  54103. G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9
  54104. XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr
  54105. l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI
  54106. VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB
  54107. BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh
  54108. cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5
  54109. hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa
  54110. Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
  54111. RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
  54112. -----END CERTIFICATE-----
  54113. AddTrust External Root
  54114. ======================
  54115. -----BEGIN CERTIFICATE-----
  54116. MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
  54117. QWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYD
  54118. VQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEw
  54119. NDgzOFowbzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRU
  54120. cnVzdCBFeHRlcm5hbCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0Eg
  54121. Um9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvtH7xsD821
  54122. +iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9uMq/NzgtHj6RQa1wVsfw
  54123. Tz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzXmk6vBbOmcZSccbNQYArHE504B4YCqOmo
  54124. aSYYkKtMsE8jqzpPhNjfzp/haW+710LXa0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy
  54125. 2xSoRcRdKn23tNbE7qzNE0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv7
  54126. 7+ldU9U0WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYDVR0P
  54127. BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0Jvf6xCZU7wO94CTL
  54128. VBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRk
  54129. VHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB
  54130. IFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZl
  54131. j7DYd7usQWxHYINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
  54132. 6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvCNr4TDea9Y355
  54133. e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEXc4g/VhsxOBi0cQ+azcgOno4u
  54134. G+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5amnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
  54135. -----END CERTIFICATE-----
  54136. Entrust Root Certification Authority
  54137. ====================================
  54138. -----BEGIN CERTIFICATE-----
  54139. MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAUBgNV
  54140. BAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMgaW5jb3Jw
  54141. b3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMWKGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsG
  54142. A1UEAxMkRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0
  54143. MloXDTI2MTEyNzIwNTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMu
  54144. MTkwNwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSByZWZlcmVu
  54145. Y2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNVBAMTJEVudHJ1c3QgUm9v
  54146. dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  54147. ALaVtkNC+sZtKm9I35RMOVcF7sN5EUFoNu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYsz
  54148. A9u3g3s+IIRe7bJWKKf44LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOww
  54149. Cj0Yzfv9KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGIrb68
  54150. j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi94DkZfs0Nw4pgHBN
  54151. rziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOBsDCBrTAOBgNVHQ8BAf8EBAMCAQYw
  54152. DwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAigA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1
  54153. MzQyWjAfBgNVHSMEGDAWgBRokORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DH
  54154. hmak8fdLQ/uEvW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
  54155. A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9tO1KzKtvn1ISM
  54156. Y/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6ZuaAGAT/3B+XxFNSRuzFVJ7yVTa
  54157. v52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTS
  54158. W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0
  54159. tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8
  54160. -----END CERTIFICATE-----
  54161. GeoTrust Global CA
  54162. ==================
  54163. -----BEGIN CERTIFICATE-----
  54164. MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVTMRYwFAYDVQQK
  54165. Ew1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9iYWwgQ0EwHhcNMDIwNTIxMDQw
  54166. MDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j
  54167. LjEbMBkGA1UEAxMSR2VvVHJ1c3QgR2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  54168. CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjo
  54169. BbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDviS2Aelet
  54170. 8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU1XupGc1V3sjs0l44U+Vc
  54171. T4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagU
  54172. vTLrGAMoUgRx5aszPeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTAD
  54173. AQH/MB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVk
  54174. DBF9qn1luMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKInZ57Q
  54175. zxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfStQWVYrmm3ok9Nns4
  54176. d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcFPseKUgzbFbS9bZvlxrFUaKnjaZC2
  54177. mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Unhw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6p
  54178. XE0zX5IJL4hmXXeXxx12E6nV5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvm
  54179. Mw==
  54180. -----END CERTIFICATE-----
  54181. GeoTrust Universal CA
  54182. =====================
  54183. -----BEGIN CERTIFICATE-----
  54184. MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  54185. R2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVyc2FsIENBMB4XDTA0MDMwNDA1
  54186. MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IElu
  54187. Yy4xHjAcBgNVBAMTFUdlb1RydXN0IFVuaXZlcnNhbCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIP
  54188. ADCCAgoCggIBAKYVVaCjxuAfjJ0hUNfBvitbtaSeodlyWL0AG0y/YckUHUWCq8YdgNY96xCcOq9t
  54189. JPi8cQGeBvV8Xx7BDlXKg5pZMK4ZyzBIle0iN430SppyZj6tlcDgFgDgEB8rMQ7XlFTTQjOgNB0e
  54190. RXbdT8oYN+yFFXoZCPzVx5zw8qkuEKmS5j1YPakWaDwvdSEYfyh3peFhF7em6fgemdtzbvQKoiFs
  54191. 7tqqhZJmr/Z6a4LauiIINQ/PQvE1+mrufislzDoR5G2vc7J2Ha3QsnhnGqQ5HFELZ1aD/ThdDc7d
  54192. 8Lsrlh/eezJS/R27tQahsiFepdaVaH/wmZ7cRQg+59IJDTWU3YBOU5fXtQlEIGQWFwMCTFMNaN7V
  54193. qnJNk22CDtucvc+081xdVHppCZbW2xHBjXWotM85yM48vCR85mLK4b19p71XZQvk/iXttmkQ3Cga
  54194. Rr0BHdCXteGYO8A3ZNY9lO4L4fUorgtWv3GLIylBjobFS1J72HGrH4oVpjuDWtdYAVHGTEHZf9hB
  54195. Z3KiKN9gg6meyHv8U3NyWfWTehd2Ds735VzZC1U0oqpbtWpU5xPKV+yXbfReBi9Fi1jUIxaS5BZu
  54196. KGNZMN9QAZxjiRqf2xeUgnA3wySemkfWWspOqGmJch+RbNt+nhutxx9z3SxPGWX9f5NAEC7S8O08
  54197. ni4oPmkmM8V7AgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNq7LqqwDLiIJlF0
  54198. XG0D08DYj3rWMB8GA1UdIwQYMBaAFNq7LqqwDLiIJlF0XG0D08DYj3rWMA4GA1UdDwEB/wQEAwIB
  54199. hjANBgkqhkiG9w0BAQUFAAOCAgEAMXjmx7XfuJRAyXHEqDXsRh3ChfMoWIawC/yOsjmPRFWrZIRc
  54200. aanQmjg8+uUfNeVE44B5lGiku8SfPeE0zTBGi1QrlaXv9z+ZhP015s8xxtxqv6fXIwjhmF7DWgh2
  54201. qaavdy+3YL1ERmrvl/9zlcGO6JP7/TG37FcREUWbMPEaiDnBTzynANXH/KttgCJwpQzgXQQpAvvL
  54202. oJHRfNbDflDVnVi+QTjruXU8FdmbyUqDWcDaU/0zuzYYm4UPFd3uLax2k7nZAY1IEKj79TiG8dsK
  54203. xr2EoyNB3tZ3b4XUhRxQ4K5RirqNPnbiucon8l+f725ZDQbYKxek0nxru18UGkiPGkzns0ccjkxF
  54204. KyDuSN/n3QmOGKjaQI2SJhFTYXNd673nxE0pN2HrrDktZy4W1vUAg4WhzH92xH3kt0tm7wNFYGm2
  54205. DFKWkoRepqO1pD4r2czYG0eq8kTaT/kD6PAUyz/zg97QwVTjt+gKN02LIFkDMBmhLMi9ER/frslK
  54206. xfMnZmaGrGiR/9nmUxwPi1xpZQomyB40w11Re9epnAahNt3ViZS82eQtDF4JbAiXfKM9fJP/P6EU
  54207. p8+1Xevb2xzEdt+Iub1FBZUbrvxGakyvSOPOrg/SfuvmbJxPgWp6ZKy7PtXny3YuxadIwVyQD8vI
  54208. P/rmMuGNG2+k5o7Y+SlIis5z/iw=
  54209. -----END CERTIFICATE-----
  54210. GeoTrust Universal CA 2
  54211. =======================
  54212. -----BEGIN CERTIFICATE-----
  54213. MIIFbDCCA1SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  54214. R2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwHhcNMDQwMzA0
  54215. MDUwMDAwWhcNMjkwMzA0MDUwMDAwWjBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3Qg
  54216. SW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwggIiMA0GCSqGSIb3DQEBAQUA
  54217. A4ICDwAwggIKAoICAQCzVFLByT7y2dyxUxpZKeexw0Uo5dfR7cXFS6GqdHtXr0om/Nj1XqduGdt0
  54218. DE81WzILAePb63p3NeqqWuDW6KFXlPCQo3RWlEQwAx5cTiuFJnSCegx2oG9NzkEtoBUGFF+3Qs17
  54219. j1hhNNwqCPkuwwGmIkQcTAeC5lvO0Ep8BNMZcyfwqph/Lq9O64ceJHdqXbboW0W63MOhBW9Wjo8Q
  54220. JqVJwy7XQYci4E+GymC16qFjwAGXEHm9ADwSbSsVsaxLse4YuU6W3Nx2/zu+z18DwPw76L5GG//a
  54221. QMJS9/7jOvdqdzXQ2o3rXhhqMcceujwbKNZrVMaqW9eiLBsZzKIC9ptZvTdrhrVtgrrY6slWvKk2
  54222. WP0+GfPtDCapkzj4T8FdIgbQl+rhrcZV4IErKIM6+vR7IVEAvlI4zs1meaj0gVbi0IMJR1FbUGrP
  54223. 20gaXT73y/Zl92zxlfgCOzJWgjl6W70viRu/obTo/3+NjN8D8WBOWBFM66M/ECuDmgFz2ZRthAAn
  54224. ZqzwcEAJQpKtT5MNYQlRJNiS1QuUYbKHsu3/mjX/hVTK7URDrBs8FmtISgocQIgfksILAAX/8sgC
  54225. SqSqqcyZlpwvWOB94b67B9xfBHJcMTTD7F8t4D1kkCLm0ey4Lt1ZrtmhN79UNdxzMk+MBB4zsslG
  54226. 8dhcyFVQyWi9qLo2CQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR281Xh+qQ2
  54227. +/CfXGJx7Tz0RzgQKzAfBgNVHSMEGDAWgBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAOBgNVHQ8BAf8E
  54228. BAMCAYYwDQYJKoZIhvcNAQEFBQADggIBAGbBxiPz2eAubl/oz66wsCVNK/g7WJtAJDday6sWSf+z
  54229. dXkzoS9tcBc0kf5nfo/sm+VegqlVHy/c1FEHEv6sFj4sNcZj/NwQ6w2jqtB8zNHQL1EuxBRa3ugZ
  54230. 4T7GzKQp5y6EqgYweHZUcyiYWTjgAA1i00J9IZ+uPTqM1fp3DRgrFg5fNuH8KrUwJM/gYwx7WBr+
  54231. mbpCErGR9Hxo4sjoryzqyX6uuyo9DRXcNJW2GHSoag/HtPQTxORb7QrSpJdMKu0vbBKJPfEncKpq
  54232. A1Ihn0CoZ1Dy81of398j9tx4TuaYT1U6U+Pv8vSfx3zYWK8pIpe44L2RLrB27FcRz+8pRPPphXpg
  54233. Y+RdM4kX2TGq2tbzGDVyz4crL2MjhF2EjD9XoIj8mZEoJmmZ1I+XRL6O1UixpCgp8RW04eWe3fiP
  54234. pm8m1wk8OhwRDqZsN/etRIcsKMfYdIKz0G9KV7s1KSegi+ghp4dkNl3M2Basx7InQJJVOCiNUW7d
  54235. FGdTbHFcJoRNdVq2fmBWqU2t+5sel/MN2dKXVHfaPRK34B7vCAas+YWH6aLcr34YEoP9VhdBLtUp
  54236. gn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwXQMAJKOSLakhT2+zNVVXxxvjpoixMptEm
  54237. X36vWkzaH6byHCx+rgIW0lbQL1dTR+iS
  54238. -----END CERTIFICATE-----
  54239. Comodo AAA Services root
  54240. ========================
  54241. -----BEGIN CERTIFICATE-----
  54242. MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  54243. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  54244. TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw
  54245. MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl
  54246. c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV
  54247. BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  54248. ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG
  54249. C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs
  54250. i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW
  54251. Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH
  54252. Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK
  54253. Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f
  54254. BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl
  54255. cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz
  54256. LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm
  54257. 7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
  54258. Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z
  54259. 8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C
  54260. 12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
  54261. -----END CERTIFICATE-----
  54262. QuoVadis Root CA
  54263. ================
  54264. -----BEGIN CERTIFICATE-----
  54265. MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJCTTEZMBcGA1UE
  54266. ChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
  54267. eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAz
  54268. MTkxODMzMzNaFw0yMTAzMTcxODMzMzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRp
  54269. cyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQD
  54270. EyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF
  54271. AAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Ypli4kVEAkOPcahdxYTMuk
  54272. J0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2DrOpm2RgbaIr1VxqYuvXtdj182d6UajtL
  54273. F8HVj71lODqV0D1VNk7feVcxKh7YWWVJWCCYfqtffp/p1k3sg3Spx2zY7ilKhSoGFPlU5tPaZQeL
  54274. YzcS19Dsw3sgQUSj7cugF+FxZc4dZjH3dgEZyH0DWLaVSR2mEiboxgx24ONmy+pdpibu5cxfvWen
  54275. AScOospUxbF6lR1xHkopigPcakXBpBlebzbNw6Kwt/5cOOJSvPhEQ+aQuwIDAQABo4ICUjCCAk4w
  54276. PQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwczovL29jc3AucXVvdmFkaXNvZmZzaG9y
  54277. ZS5jb20wDwYDVR0TAQH/BAUwAwEB/zCCARoGA1UdIASCAREwggENMIIBCQYJKwYBBAG+WAABMIH7
  54278. MIHUBggrBgEFBQcCAjCBxxqBxFJlbGlhbmNlIG9uIHRoZSBRdW9WYWRpcyBSb290IENlcnRpZmlj
  54279. YXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJs
  54280. ZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh
  54281. Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYIKwYBBQUHAgEW
  54282. Fmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3TKbkGGew5Oanwl4Rqy+/fMIGu
  54283. BgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rqy+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkw
  54284. FwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0
  54285. aG9yaXR5MS4wLAYDVQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6
  54286. tlCLMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSkfnIYj9lo
  54287. fFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf87C9TqnN7Az10buYWnuul
  54288. LsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1RcHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2x
  54289. gI4JVrmcGmD+XcHXetwReNDWXcG31a0ymQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi
  54290. 5upZIof4l/UO/erMkqQWxFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi
  54291. 5nrQNiOKSnQ2+Q==
  54292. -----END CERTIFICATE-----
  54293. QuoVadis Root CA 2
  54294. ==================
  54295. -----BEGIN CERTIFICATE-----
  54296. MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  54297. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMjAeFw0wNjExMjQx
  54298. ODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  54299. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  54300. DwAwggIKAoICAQCaGMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6
  54301. XJxgFyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55JWpzmM+Yk
  54302. lvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bBrrcCaoF6qUWD4gXmuVbB
  54303. lDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp+ARz8un+XJiM9XOva7R+zdRcAitMOeGy
  54304. lZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt
  54305. 66/3FsvbzSUr5R/7mp/iUcw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1Jdxn
  54306. wQ5hYIizPtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og/zOh
  54307. D7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UHoycR7hYQe7xFSkyy
  54308. BNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuIyV77zGHcizN300QyNQliBJIWENie
  54309. J0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1Ud
  54310. DgQWBBQahGK8SEwzJQTU7tD2A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGU
  54311. a6FJpEcwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT
  54312. ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2fBluornFdLwUv
  54313. Z+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzng/iN/Ae42l9NLmeyhP3ZRPx3
  54314. UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2BlfF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodm
  54315. VjB3pjd4M1IQWK4/YY7yarHvGH5KWWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK
  54316. +JDSV6IZUaUtl0HaB0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrW
  54317. IozchLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPRTUIZ3Ph1
  54318. WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWDmbA4CD/pXvk1B+TJYm5X
  54319. f6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0ZohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II
  54320. 4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8
  54321. VCLAAVBpQ570su9t+Oza8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u
  54322. -----END CERTIFICATE-----
  54323. QuoVadis Root CA 3
  54324. ==================
  54325. -----BEGIN CERTIFICATE-----
  54326. MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  54327. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMzAeFw0wNjExMjQx
  54328. OTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  54329. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  54330. DwAwggIKAoICAQDMV0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNgg
  54331. DhoB4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUrH556VOij
  54332. KTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd8lyyBTNvijbO0BNO/79K
  54333. DDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9CabwvvWhDFlaJKjdhkf2mrk7AyxRllDdLkgbv
  54334. BNDInIjbC3uBr7E9KsRlOni27tyAsdLTmZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwp
  54335. p5ijJUMv7/FfJuGITfhebtfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8
  54336. nT8KKdjcT5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDtWAEX
  54337. MJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZc6tsgLjoC2SToJyM
  54338. Gf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A4iLItLRkT9a6fUg+qGkM17uGcclz
  54339. uD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYDVR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHT
  54340. BgkrBgEEAb5YAAMwgcUwgZMGCCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmlj
  54341. YXRlIGNvbnN0aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0
  54342. aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVudC4wLQYIKwYB
  54343. BQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2NwczALBgNVHQ8EBAMCAQYwHQYD
  54344. VR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4GA1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4
  54345. ywLQoUmkRzBFMQswCQYDVQQGEwJCTTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UE
  54346. AxMSUXVvVmFkaXMgUm9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZV
  54347. qyM07ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSemd1o417+s
  54348. hvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd+LJ2w/w4E6oM3kJpK27z
  54349. POuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2
  54350. Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadNt54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp
  54351. 8kokUvd0/bpO5qgdAm6xDYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBC
  54352. bjPsMZ57k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6szHXu
  54353. g/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0jWy10QJLZYxkNc91p
  54354. vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr
  54355. qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
  54356. -----END CERTIFICATE-----
  54357. Security Communication Root CA
  54358. ==============================
  54359. -----BEGIN CERTIFICATE-----
  54360. MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  54361. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  54362. HhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  54363. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  54364. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw
  54365. 8yl89f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJDKaVv0uM
  54366. DPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9Ms+k2Y7CI9eNqPPYJayX
  54367. 5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/NQV3Is00qVUarH9oe4kA92819uZKAnDfd
  54368. DJZkndwi92SL32HeFZRSFaB9UslLqCHJxrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2
  54369. JChzAgMBAAGjPzA9MB0GA1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYw
  54370. DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vGkl3g
  54371. 0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfrUj94nK9NrvjVT8+a
  54372. mCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5Bw+SUEmK3TGXX8npN6o7WWWXlDLJ
  54373. s58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJUJRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ
  54374. 6rBK+1YWc26sTfcioU+tHXotRSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAi
  54375. FL39vmwLAw==
  54376. -----END CERTIFICATE-----
  54377. Sonera Class 2 Root CA
  54378. ======================
  54379. -----BEGIN CERTIFICATE-----
  54380. MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEPMA0GA1UEChMG
  54381. U29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAxMDQwNjA3Mjk0MFoXDTIxMDQw
  54382. NjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNVBAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJh
  54383. IENsYXNzMiBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3
  54384. /Ei9vX+ALTU74W+oZ6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybT
  54385. dXnt5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s3TmVToMG
  54386. f+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2EjvOr7nQKV0ba5cTppCD8P
  54387. tOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu8nYybieDwnPz3BjotJPqdURrBGAgcVeH
  54388. nfO+oJAjPYok4doh28MCAwEAAaMzMDEwDwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITT
  54389. XjwwCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt
  54390. 0jSv9zilzqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/3DEI
  54391. cbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvDFNr450kkkdAdavph
  54392. Oe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6Tk6ezAyNlNzZRZxe7EJQY670XcSx
  54393. EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH
  54394. llpwrN9M
  54395. -----END CERTIFICATE-----
  54396. XRamp Global CA Root
  54397. ====================
  54398. -----BEGIN CERTIFICATE-----
  54399. MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE
  54400. BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj
  54401. dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
  54402. dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx
  54403. HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg
  54404. U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
  54405. dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu
  54406. IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx
  54407. foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE
  54408. zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs
  54409. AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry
  54410. xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  54411. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap
  54412. oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC
  54413. AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc
  54414. /Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
  54415. qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n
  54416. nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz
  54417. 8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw=
  54418. -----END CERTIFICATE-----
  54419. Go Daddy Class 2 CA
  54420. ===================
  54421. -----BEGIN CERTIFICATE-----
  54422. MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY
  54423. VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp
  54424. ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG
  54425. A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
  54426. RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD
  54427. ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv
  54428. 2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32
  54429. qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j
  54430. YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY
  54431. vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O
  54432. BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o
  54433. atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu
  54434. MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG
  54435. A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim
  54436. PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt
  54437. I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
  54438. HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI
  54439. Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b
  54440. vZ8=
  54441. -----END CERTIFICATE-----
  54442. Starfield Class 2 CA
  54443. ====================
  54444. -----BEGIN CERTIFICATE-----
  54445. MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc
  54446. U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg
  54447. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo
  54448. MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG
  54449. A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG
  54450. SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY
  54451. bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ
  54452. JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm
  54453. epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN
  54454. F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF
  54455. MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f
  54456. hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo
  54457. bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g
  54458. QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs
  54459. afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM
  54460. PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
  54461. xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD
  54462. KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3
  54463. QBFGmh95DmK/D5fs4C8fF5Q=
  54464. -----END CERTIFICATE-----
  54465. Taiwan GRCA
  54466. ===========
  54467. -----BEGIN CERTIFICATE-----
  54468. MIIFcjCCA1qgAwIBAgIQH51ZWtcvwgZEpYAIaeNe9jANBgkqhkiG9w0BAQUFADA/MQswCQYDVQQG
  54469. EwJUVzEwMC4GA1UECgwnR292ZXJubWVudCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4X
  54470. DTAyMTIwNTEzMjMzM1oXDTMyMTIwNTEzMjMzM1owPzELMAkGA1UEBhMCVFcxMDAuBgNVBAoMJ0dv
  54471. dmVybm1lbnQgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQAD
  54472. ggIPADCCAgoCggIBAJoluOzMonWoe/fOW1mKydGGEghU7Jzy50b2iPN86aXfTEc2pBsBHH8eV4qN
  54473. w8XRIePaJD9IK/ufLqGU5ywck9G/GwGHU5nOp/UKIXZ3/6m3xnOUT0b3EEk3+qhZSV1qgQdW8or5
  54474. BtD3cCJNtLdBuTK4sfCxw5w/cP1T3YGq2GN49thTbqGsaoQkclSGxtKyyhwOeYHWtXBiCAEuTk8O
  54475. 1RGvqa/lmr/czIdtJuTJV6L7lvnM4T9TjGxMfptTCAtsF/tnyMKtsc2AtJfcdgEWFelq16TheEfO
  54476. htX7MfP6Mb40qij7cEwdScevLJ1tZqa2jWR+tSBqnTuBto9AAGdLiYa4zGX+FVPpBMHWXx1E1wov
  54477. J5pGfaENda1UhhXcSTvxls4Pm6Dso3pdvtUqdULle96ltqqvKKyskKw4t9VoNSZ63Pc78/1Fm9G7
  54478. Q3hub/FCVGqY8A2tl+lSXunVanLeavcbYBT0peS2cWeqH+riTcFCQP5nRhc4L0c/cZyu5SHKYS1t
  54479. B6iEfC3uUSXxY5Ce/eFXiGvviiNtsea9P63RPZYLhY3Naye7twWb7LuRqQoHEgKXTiCQ8P8NHuJB
  54480. O9NAOueNXdpm5AKwB1KYXA6OM5zCppX7VRluTI6uSw+9wThNXo+EHWbNxWCWtFJaBYmOlXqYwZE8
  54481. lSOyDvR5tMl8wUohAgMBAAGjajBoMB0GA1UdDgQWBBTMzO/MKWCkO7GStjz6MmKPrCUVOzAMBgNV
  54482. HRMEBTADAQH/MDkGBGcqBwAEMTAvMC0CAQAwCQYFKw4DAhoFADAHBgVnKgMAAAQUA5vwIhP/lSg2
  54483. 09yewDL7MTqKUWUwDQYJKoZIhvcNAQEFBQADggIBAECASvomyc5eMN1PhnR2WPWus4MzeKR6dBcZ
  54484. TulStbngCnRiqmjKeKBMmo4sIy7VahIkv9Ro04rQ2JyftB8M3jh+Vzj8jeJPXgyfqzvS/3WXy6Tj
  54485. Zwj/5cAWtUgBfen5Cv8b5Wppv3ghqMKnI6mGq3ZW6A4M9hPdKmaKZEk9GhiHkASfQlK3T8v+R0F2
  54486. Ne//AHY2RTKbxkaFXeIksB7jSJaYV0eUVXoPQbFEJPPB/hprv4j9wabak2BegUqZIJxIZhm1AHlU
  54487. D7gsL0u8qV1bYH+Mh6XgUmMqvtg7hUAV/h62ZT/FS9p+tXo1KaMuephgIqP0fSdOLeq0dDzpD6Qz
  54488. DxARvBMB1uUO07+1EqLhRSPAzAhuYbeJq4PjJB7mXQfnHyA+z2fI56wwbSdLaG5LKlwCCDTb+Hbk
  54489. Z6MmnD+iMsJKxYEYMRBWqoTvLQr/uB930r+lWKBi5NdLkXWNiYCYfm3LU05er/ayl4WXudpVBrkk
  54490. 7tfGOB5jGxI7leFYrPLfhNVfmS8NVVvmONsuP3LpSIXLuykTjx44VbnzssQwmSNOXfJIoRIM3BKQ
  54491. CZBUkQM8R+XVyWXgt0t97EfTsws+rZ7QdAAO671RrcDeLMDDav7v3Aun+kbfYNucpllQdSNpc5Oy
  54492. +fwC00fmcc4QAu4njIT/rEUNE1yDMuAlpYYsfPQS
  54493. -----END CERTIFICATE-----
  54494. DigiCert Assured ID Root CA
  54495. ===========================
  54496. -----BEGIN CERTIFICATE-----
  54497. MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG
  54498. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  54499. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx
  54500. MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  54501. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew
  54502. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO
  54503. 9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy
  54504. UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW
  54505. /lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy
  54506. oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf
  54507. GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRF
  54508. 66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzANBgkq
  54509. hkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2Bc
  54510. EkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38Fn
  54511. SbNd67IJKusm7Xi+fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i
  54512. 8b5QZ7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
  54513. +o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
  54514. -----END CERTIFICATE-----
  54515. DigiCert Global Root CA
  54516. =======================
  54517. -----BEGIN CERTIFICATE-----
  54518. MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQG
  54519. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  54520. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAw
  54521. MDAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  54522. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkq
  54523. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn
  54524. TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5
  54525. BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H
  54526. 4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y
  54527. 7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB
  54528. o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm
  54529. 8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF
  54530. BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr
  54531. EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt
  54532. tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886
  54533. UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
  54534. CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
  54535. -----END CERTIFICATE-----
  54536. DigiCert High Assurance EV Root CA
  54537. ==================================
  54538. -----BEGIN CERTIFICATE-----
  54539. MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG
  54540. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSsw
  54541. KQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAw
  54542. MFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZ
  54543. MBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFu
  54544. Y2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm+9S75S0t
  54545. Mqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTWPNt0OKRKzE0lgvdKpVMS
  54546. OO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEMxChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3
  54547. MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFBIk5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQ
  54548. NAQTXKFx01p8VdteZOE3hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUe
  54549. h10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB
  54550. Af8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY
  54551. JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQ
  54552. V8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFp
  54553. myPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK
  54554. mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
  54555. vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K
  54556. -----END CERTIFICATE-----
  54557. DST Root CA X3
  54558. ==============
  54559. -----BEGIN CERTIFICATE-----
  54560. MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/MSQwIgYDVQQK
  54561. ExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4X
  54562. DTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVowPzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1
  54563. cmUgVHJ1c3QgQ28uMRcwFQYDVQQDEw5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQAD
  54564. ggEPADCCAQoCggEBAN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmT
  54565. rE4Orz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEqOLl5CjH9
  54566. UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9bxiqKqy69cK3FCxolkHRy
  54567. xXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40d
  54568. utolucbY38EVAjqr2m7xPi71XAicPNaDaeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0T
  54569. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQ
  54570. MA0GCSqGSIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69ikug
  54571. dB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXrAvHRAosZy5Q6XkjE
  54572. GB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZzR8srzJmwN0jP41ZL9c8PDHIyh8bw
  54573. RLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubS
  54574. fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
  54575. -----END CERTIFICATE-----
  54576. SwissSign Gold CA - G2
  54577. ======================
  54578. -----BEGIN CERTIFICATE-----
  54579. MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw
  54580. EwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2lnbiBHb2xkIENBIC0gRzIwHhcN
  54581. MDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBFMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dp
  54582. c3NTaWduIEFHMR8wHQYDVQQDExZTd2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0B
  54583. AQEFAAOCAg8AMIICCgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUq
  54584. t2/876LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+bbqBHH5C
  54585. jCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c6bM8K8vzARO/Ws/BtQpg
  54586. vd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqEemA8atufK+ze3gE/bk3lUIbLtK/tREDF
  54587. ylqM2tIrfKjuvqblCqoOpd8FUrdVxyJdMmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvR
  54588. AiTysybUa9oEVeXBCsdtMDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuend
  54589. jIj3o02yMszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69yFGkO
  54590. peUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPiaG59je883WX0XaxR
  54591. 7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxMgI93e2CaHt+28kgeDrpOVG2Y4OGi
  54592. GqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw
  54593. AwEB/zAdBgNVHQ4EFgQUWyV7lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64
  54594. OfPAeGZe6Drn8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov
  54595. L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe645R88a7A3hfm
  54596. 5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczOUYrHUDFu4Up+GC9pWbY9ZIEr
  54597. 44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOf
  54598. Mke6UiI0HTJ6CVanfCU2qT1L2sCCbwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6m
  54599. Gu6uLftIdxf+u+yvGPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxp
  54600. mo/a77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCChdiDyyJk
  54601. vC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid392qgQmwLOM7XdVAyksLf
  54602. KzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEppLd6leNcG2mqeSz53OiATIgHQv2ieY2Br
  54603. NU0LbbqhPcCT4H8js1WtciVORvnSFu+wZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6Lqj
  54604. viOvrv1vA+ACOzB2+httQc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ
  54605. -----END CERTIFICATE-----
  54606. SwissSign Silver CA - G2
  54607. ========================
  54608. -----BEGIN CERTIFICATE-----
  54609. MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCQ0gxFTAT
  54610. BgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMB4X
  54611. DTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0NlowRzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3
  54612. aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG
  54613. 9w0BAQEFAAOCAg8AMIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644
  54614. N0MvFz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7brYT7QbNHm
  54615. +/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieFnbAVlDLaYQ1HTWBCrpJH
  54616. 6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH6ATK72oxh9TAtvmUcXtnZLi2kUpCe2Uu
  54617. MGoM9ZDulebyzYLs2aFK7PayS+VFheZteJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5h
  54618. qAaEuSh6XzjZG6k4sIN/c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5
  54619. FZGkECwJMoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRHHTBs
  54620. ROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTfjNFusB3hB48IHpmc
  54621. celM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb65i/4z3GcRm25xBWNOHkDRUjvxF3X
  54622. CO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/
  54623. BAUwAwEB/zAdBgNVHQ4EFgQUF6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRB
  54624. tjpbO8tFnb0cwpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0
  54625. cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBAHPGgeAn0i0P
  54626. 4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShpWJHckRE1qTodvBqlYJ7YH39F
  54627. kWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L
  54628. 3XWgwF15kIwb4FDm3jH+mHtwX6WQ2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx
  54629. /uNncqCxv1yL5PqZIseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFa
  54630. DGi8aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2Xem1ZqSqP
  54631. e97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQRdAtq/gsD/KNVV4n+Ssuu
  54632. WxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJ
  54633. DIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ub
  54634. DgEj8Z+7fNzcbBGXJbLytGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u
  54635. -----END CERTIFICATE-----
  54636. GeoTrust Primary Certification Authority
  54637. ========================================
  54638. -----BEGIN CERTIFICATE-----
  54639. MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQG
  54640. EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMoR2VvVHJ1c3QgUHJpbWFyeSBD
  54641. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgx
  54642. CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQ
  54643. cmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  54644. CgKCAQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9AWbK7hWN
  54645. b6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjAZIVcFU2Ix7e64HXprQU9
  54646. nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE07e9GceBrAqg1cmuXm2bgyxx5X9gaBGge
  54647. RwLmnWDiNpcB3841kt++Z8dtd1k7j53WkBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGt
  54648. tm/81w7a4DSwDRp35+MImO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  54649. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJKoZI
  54650. hvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ16CePbJC/kRYkRj5K
  54651. Ts4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl4b7UVXGYNTq+k+qurUKykG/g/CFN
  54652. NWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6KoKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHa
  54653. Floxt/m0cYASSJlyc1pZU8FjUjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG
  54654. 1riR/aYNKxoUAT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk=
  54655. -----END CERTIFICATE-----
  54656. thawte Primary Root CA
  54657. ======================
  54658. -----BEGIN CERTIFICATE-----
  54659. MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCBqTELMAkGA1UE
  54660. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  54661. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  54662. cml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3
  54663. MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwg
  54664. SW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMv
  54665. KGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMT
  54666. FnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCs
  54667. oPD7gFnUnMekz52hWXMJEEUMDSxuaPFsW0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ
  54668. 1CRfBsDMRJSUjQJib+ta3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGc
  54669. q/gcfomk6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6Sk/K
  54670. aAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94JNqR32HuHUETVPm4p
  54671. afs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYD
  54672. VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XPr87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUF
  54673. AAOCAQEAeRHAS7ORtvzw6WfUDW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeE
  54674. uzLlQRHAd9mzYJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX
  54675. xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2/qxAeeWsEG89
  54676. jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/LHbTY5xZ3Y+m4Q6gLkH3LpVH
  54677. z7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7jVaMaA==
  54678. -----END CERTIFICATE-----
  54679. VeriSign Class 3 Public Primary Certification Authority - G5
  54680. ============================================================
  54681. -----BEGIN CERTIFICATE-----
  54682. MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
  54683. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  54684. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  54685. IHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRp
  54686. ZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCB
  54687. yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2ln
  54688. biBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBh
  54689. dXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmlt
  54690. YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
  54691. ggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKz
  54692. j/i5Vbext0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhD
  54693. Y2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/
  54694. Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNHiDxpg8v+R70r
  54695. fk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/
  54696. BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2Uv
  54697. Z2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy
  54698. aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKvMzEzMA0GCSqG
  54699. SIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzEp6B4Eq1iDkVwZMXnl2YtmAl+
  54700. X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKE
  54701. KQsTb47bDN0lAtukixlE0kF6BWlKWE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiC
  54702. Km0oHw0LxOXnGiYZ4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vE
  54703. ZV8NhnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq
  54704. -----END CERTIFICATE-----
  54705. SecureTrust CA
  54706. ==============
  54707. -----BEGIN CERTIFICATE-----
  54708. MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQG
  54709. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xFzAVBgNVBAMTDlNlY3VyZVRy
  54710. dXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIzMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAe
  54711. BgNVBAoTF1NlY3VyZVRydXN0IENvcnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCC
  54712. ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQX
  54713. OZEzZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO0gMdA+9t
  54714. DWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIaowW8xQmxSPmjL8xk037uH
  54715. GFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b
  54716. 01k/unK8RCSc43Oz969XL0Imnal0ugBS8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmH
  54717. ursCAwEAAaOBnTCBmjATBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/
  54718. BAUwAwEB/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCegJYYj
  54719. aHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  54720. KoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt36Z3q059c4EVlew3KW+JwULKUBRSu
  54721. SceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHf
  54722. mbx8IVQr5Fiiu1cprp6poxkmD5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZ
  54723. nMUFdAvnZyPSCPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
  54724. 3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
  54725. -----END CERTIFICATE-----
  54726. Secure Global CA
  54727. ================
  54728. -----BEGIN CERTIFICATE-----
  54729. MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQG
  54730. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBH
  54731. bG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkxMjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEg
  54732. MB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwg
  54733. Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jx
  54734. YDiJiQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa/FHtaMbQ
  54735. bqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJjnIFHovdRIWCQtBJwB1g
  54736. 8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnIHmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYV
  54737. HDGA76oYa8J719rO+TMg1fW9ajMtgQT7sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi
  54738. 0XPnj3pDAgMBAAGjgZ0wgZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  54739. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCswKaAn
  54740. oCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsGAQQBgjcVAQQDAgEA
  54741. MA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0LURYD7xh8yOOvaliTFGCRsoTciE6+
  54742. OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXOH0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cn
  54743. CDpOGR86p1hcF895P4vkp9MmI50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/5
  54744. 3CYNv6ZHdAbYiNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc
  54745. f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW
  54746. -----END CERTIFICATE-----
  54747. COMODO Certification Authority
  54748. ==============================
  54749. -----BEGIN CERTIFICATE-----
  54750. MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UE
  54751. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  54752. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNVBAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1
  54753. dGhvcml0eTAeFw0wNjEyMDEwMDAwMDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEb
  54754. MBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFD
  54755. T01PRE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  54756. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3UcEbVASY06m/weaKXTuH
  54757. +7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI2GqGd0S7WWaXUF601CxwRM/aN5VCaTww
  54758. xHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV
  54759. 4EajcNxo2f8ESIl33rXp+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA
  54760. 1KGzqSX+DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5OnKVI
  54761. rLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAOBgNVHQ8BAf8E
  54762. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9k
  54763. b2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOC
  54764. AQEAPpiem/Yb6dc5t3iuHXIYSdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CP
  54765. OGEIqB6BCsAvIC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/
  54766. RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4zJVSk/BwJVmc
  54767. IGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5ddBA6+C4OmF4O5MBKgxTMVBbkN
  54768. +8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IBZQ==
  54769. -----END CERTIFICATE-----
  54770. Network Solutions Certificate Authority
  54771. =======================================
  54772. -----BEGIN CERTIFICATE-----
  54773. MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBiMQswCQYDVQQG
  54774. EwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydOZXR3b3Jr
  54775. IFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMx
  54776. MjM1OTU5WjBiMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu
  54777. MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
  54778. CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwzc7MEL7xx
  54779. jOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPPOCwGJgl6cvf6UDL4wpPT
  54780. aaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rlmGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXT
  54781. crA/vGp97Eh/jcOrqnErU2lBUzS1sLnFBgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc
  54782. /Qzpf14Dl847ABSHJ3A4qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMB
  54783. AAGjgZcwgZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIBBjAP
  54784. BgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwubmV0c29sc3NsLmNv
  54785. bS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3JpdHkuY3JsMA0GCSqGSIb3DQEBBQUA
  54786. A4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc86fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q
  54787. 4LqILPxFzBiwmZVRDuwduIj/h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/
  54788. GGUsyfJj4akH/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv
  54789. wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHNpGxlaKFJdlxD
  54790. ydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey
  54791. -----END CERTIFICATE-----
  54792. COMODO ECC Certification Authority
  54793. ==================================
  54794. -----BEGIN CERTIFICATE-----
  54795. MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTELMAkGA1UEBhMC
  54796. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  54797. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBB
  54798. dXRob3JpdHkwHhcNMDgwMzA2MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0Ix
  54799. GzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
  54800. Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRo
  54801. b3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSRFtSrYpn1PlILBs5BAH+X
  54802. 4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0JcfRK9ChQtP6IHG4/bC8vCVlbpVsLM5ni
  54803. wz2J+Wos77LTBumjQjBAMB0GA1UdDgQWBBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8E
  54804. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VG
  54805. FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA
  54806. U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
  54807. -----END CERTIFICATE-----
  54808. OISTE WISeKey Global Root GA CA
  54809. ===============================
  54810. -----BEGIN CERTIFICATE-----
  54811. MIID8TCCAtmgAwIBAgIQQT1yx/RrH4FDffHSKFTfmjANBgkqhkiG9w0BAQUFADCBijELMAkGA1UE
  54812. BhMCQ0gxEDAOBgNVBAoTB1dJU2VLZXkxGzAZBgNVBAsTEkNvcHlyaWdodCAoYykgMjAwNTEiMCAG
  54813. A1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBH
  54814. bG9iYWwgUm9vdCBHQSBDQTAeFw0wNTEyMTExNjAzNDRaFw0zNzEyMTExNjA5NTFaMIGKMQswCQYD
  54815. VQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEbMBkGA1UECxMSQ29weXJpZ2h0IChjKSAyMDA1MSIw
  54816. IAYDVQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5
  54817. IEdsb2JhbCBSb290IEdBIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy0+zAJs9
  54818. Nt350UlqaxBJH+zYK7LG+DKBKUOVTJoZIyEVRd7jyBxRVVuuk+g3/ytr6dTqvirdqFEr12bDYVxg
  54819. Asj1znJ7O7jyTmUIms2kahnBAbtzptf2w93NvKSLtZlhuAGio9RN1AU9ka34tAhxZK9w8RxrfvbD
  54820. d50kc3vkDIzh2TbhmYsFmQvtRTEJysIA2/dyoJaqlYfQjse2YXMNdmaM3Bu0Y6Kff5MTMPGhJ9vZ
  54821. /yxViJGg4E8HsChWjBgbl0SOid3gF27nKu+POQoxhILYQBRJLnpB5Kf+42TMwVlxSywhp1t94B3R
  54822. LoGbw9ho972WG6xwsRYUC9tguSYBBQIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw
  54823. AwEB/zAdBgNVHQ4EFgQUswN+rja8sHnR3JQmthG+IbJphpQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  54824. KoZIhvcNAQEFBQADggEBAEuh/wuHbrP5wUOxSPMowB0uyQlB+pQAHKSkq0lPjz0e701vvbyk9vIm
  54825. MMkQyh2I+3QZH4VFvbBsUfk2ftv1TDI6QU9bR8/oCy22xBmddMVHxjtqD6wU2zz0c5ypBd8A3HR4
  54826. +vg1YFkCExh8vPtNsCBtQ7tgMHpnM1zFmdH4LTlSc/uMqpclXHLZCB6rTjzjgTGfA6b7wP4piFXa
  54827. hNVQA7bihKOmNqoROgHhGEvWRGizPflTdISzRpFGlgC3gCy24eMQ4tui5yiPAZZiFj4A4xylNoEY
  54828. okxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ/L7fCg0=
  54829. -----END CERTIFICATE-----
  54830. Certigna
  54831. ========
  54832. -----BEGIN CERTIFICATE-----
  54833. MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNVBAYTAkZSMRIw
  54834. EAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4XDTA3MDYyOTE1MTMwNVoXDTI3
  54835. MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwI
  54836. Q2VydGlnbmEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7q
  54837. XOEm7RFHYeGifBZ4QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyH
  54838. GxnygQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbwzBfsV1/p
  54839. ogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q130yGLMLLGq/jj8UEYkg
  54840. DncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKf
  54841. Irjxwo1p3Po6WAbfAgMBAAGjgbwwgbkwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQ
  54842. tCRZvgHyUtVF9lo53BEwZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJ
  54843. BgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzjAQ/J
  54844. SP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG9w0BAQUFAAOCAQEA
  54845. hQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8hbV6lUmPOEvjvKtpv6zf+EwLHyzs+
  54846. ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFncfca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1klu
  54847. PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY
  54848. 1gkIl2PlwS6wt0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw
  54849. WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg==
  54850. -----END CERTIFICATE-----
  54851. Cybertrust Global Root
  54852. ======================
  54853. -----BEGIN CERTIFICATE-----
  54854. MIIDoTCCAomgAwIBAgILBAAAAAABD4WqLUgwDQYJKoZIhvcNAQEFBQAwOzEYMBYGA1UEChMPQ3li
  54855. ZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2JhbCBSb290MB4XDTA2MTIxNTA4
  54856. MDAwMFoXDTIxMTIxNTA4MDAwMFowOzEYMBYGA1UEChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQD
  54857. ExZDeWJlcnRydXN0IEdsb2JhbCBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
  54858. +Mi8vRRQZhP/8NN57CPytxrHjoXxEnOmGaoQ25yiZXRadz5RfVb23CO21O1fWLE3TdVJDm71aofW
  54859. 0ozSJ8bi/zafmGWgE07GKmSb1ZASzxQG9Dvj1Ci+6A74q05IlG2OlTEQXO2iLb3VOm2yHLtgwEZL
  54860. AfVJrn5GitB0jaEMAs7u/OePuGtm839EAL9mJRQr3RAwHQeWP032a7iPt3sMpTjr3kfb1V05/Iin
  54861. 89cqdPHoWqI7n1C6poxFNcJQZZXcY4Lv3b93TZxiyWNzFtApD0mpSPCzqrdsxacwOUBdrsTiXSZT
  54862. 8M4cIwhhqJQZugRiQOwfOHB3EgZxpzAYXSUnpQIDAQABo4GlMIGiMA4GA1UdDwEB/wQEAwIBBjAP
  54863. BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBS2CHsNesysIEyGVjJez6tuhS1wVzA/BgNVHR8EODA2
  54864. MDSgMqAwhi5odHRwOi8vd3d3Mi5wdWJsaWMtdHJ1c3QuY29tL2NybC9jdC9jdHJvb3QuY3JsMB8G
  54865. A1UdIwQYMBaAFLYIew16zKwgTIZWMl7Pq26FLXBXMA0GCSqGSIb3DQEBBQUAA4IBAQBW7wojoFRO
  54866. lZfJ+InaRcHUowAl9B8Tq7ejhVhpwjCt2BWKLePJzYFa+HMjWqd8BfP9IjsO0QbE2zZMcwSO5bAi
  54867. 5MXzLqXZI+O4Tkogp24CJJ8iYGd7ix1yCcUxXOl5n4BHPa2hCwcUPUf/A2kaDAtE52Mlp3+yybh2
  54868. hO0j9n0Hq0V+09+zv+mKts2oomcrUtW3ZfA5TGOgkXmTUg9U3YO7n9GPp1Nzw8v/MOx8BLjYRB+T
  54869. X3EJIrduPuocA06dGiBh+4E37F78CkWr1+cXVdCg6mCbpvbjjFspwgZgFJ0tl0ypkxWdYcQBX0jW
  54870. WL1WMRJOEcgh4LMRkWXbtKaIOM5V
  54871. -----END CERTIFICATE-----
  54872. ePKI Root Certification Authority
  54873. =================================
  54874. -----BEGIN CERTIFICATE-----
  54875. MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQG
  54876. EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xKjAoBgNVBAsMIWVQS0kg
  54877. Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMx
  54878. MjdaMF4xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEq
  54879. MCgGA1UECwwhZVBLSSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0B
  54880. AQEFAAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAHSyZbCUNs
  54881. IZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAhijHyl3SJCRImHJ7K2RKi
  54882. lTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3XDZoTM1PRYfl61dd4s5oz9wCGzh1NlDiv
  54883. qOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX
  54884. 12ruOzjjK9SXDrkb5wdJfzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0O
  54885. WQqraffAsgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uUWH1+
  54886. ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLSnT0IFaUQAS2zMnao
  54887. lQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pHdmX2Os+PYhcZewoozRrSgx4hxyy/
  54888. vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJipNiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXi
  54889. Zo1jDiVN1Rmy5nk3pyKdVDECAwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/Qkqi
  54890. MAwGA1UdEwQFMAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH
  54891. ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGBuvl2ICO1J2B0
  54892. 1GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6YlPwZpVnPDimZI+ymBV3QGypzq
  54893. KOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkPJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdV
  54894. xrsStZf0X4OFunHB2WyBEXYKCrC/gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEP
  54895. NXubrjlpC2JgQCA2j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+r
  54896. GNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxE
  54897. xJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS/jQ6fbjpKdx2qcgw+BRx
  54898. gMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2zGp1iro2C6pSe3VkQw63d4k3jMdXH7Ojy
  54899. sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD
  54900. BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw=
  54901. -----END CERTIFICATE-----
  54902. certSIGN ROOT CA
  54903. ================
  54904. -----BEGIN CERTIFICATE-----
  54905. MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYTAlJPMREwDwYD
  54906. VQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTAeFw0wNjA3MDQxNzIwMDRa
  54907. Fw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UE
  54908. CxMQY2VydFNJR04gUk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7I
  54909. JUqOtdu0KBuqV5Do0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHH
  54910. rfAQUySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5dRdY4zTW2
  54911. ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQOA7+j0xbm0bqQfWwCHTD
  54912. 0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwvJoIQ4uNllAoEwF73XVv4EOLQunpL+943
  54913. AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B
  54914. Af8EBAMCAcYwHQYDVR0OBBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IB
  54915. AQA+0hyJLjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecYMnQ8
  54916. SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ44gx+FkagQnIl6Z0
  54917. x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6IJd1hJyMctTEHBDa0GpC9oHRxUIlt
  54918. vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7Nz
  54919. TogVZ96edhBiIL5VaZVDADlN9u6wWk5JRFRYX0KD
  54920. -----END CERTIFICATE-----
  54921. GeoTrust Primary Certification Authority - G3
  54922. =============================================
  54923. -----BEGIN CERTIFICATE-----
  54924. MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UE
  54925. BhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA4IEdlb1RydXN0
  54926. IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFy
  54927. eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIz
  54928. NTk1OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAo
  54929. YykgMjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMT
  54930. LUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZI
  54931. hvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz+uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5j
  54932. K/BGvESyiaHAKAxJcCGVn2TAppMSAmUmhsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdE
  54933. c5IiaacDiGydY8hS2pgn5whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3C
  54934. IShwiP/WJmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exALDmKu
  54935. dlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZChuOl1UcCAwEAAaNC
  54936. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMR5yo6hTgMdHNxr
  54937. 2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IBAQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9
  54938. cr5HqQ6XErhK8WTTOd8lNNTBzU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbE
  54939. Ap7aDHdlDkQNkv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD
  54940. AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUHSJsMC8tJP33s
  54941. t/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2Gspki4cErx5z481+oghLrGREt
  54942. -----END CERTIFICATE-----
  54943. thawte Primary Root CA - G2
  54944. ===========================
  54945. -----BEGIN CERTIFICATE-----
  54946. MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDELMAkGA1UEBhMC
  54947. VVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMpIDIwMDcgdGhhd3RlLCBJbmMu
  54948. IC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3Qg
  54949. Q0EgLSBHMjAeFw0wNzExMDUwMDAwMDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEV
  54950. MBMGA1UEChMMdGhhd3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBG
  54951. b3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAt
  54952. IEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/BebfowJPDQfGAFG6DAJS
  54953. LSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6papu+7qzcMBniKI11KOasf2twu8x+qi5
  54954. 8/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU
  54955. mtgAMADna3+FGO6Lts6KDPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUN
  54956. G4k8VIZ3KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41oxXZ3K
  54957. rr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg==
  54958. -----END CERTIFICATE-----
  54959. thawte Primary Root CA - G3
  54960. ===========================
  54961. -----BEGIN CERTIFICATE-----
  54962. MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCBrjELMAkGA1UE
  54963. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  54964. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  54965. cml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0w
  54966. ODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh
  54967. d3RlLCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMTgwNgYD
  54968. VQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIG
  54969. A1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  54970. MIIBCgKCAQEAsr8nLPvb2FvdeHsbnndmgcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2At
  54971. P0LMqmsywCPLLEHd5N/8YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC
  54972. +BsUa0Lfb1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS99irY
  54973. 7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2SzhkGcuYMXDhpxwTW
  54974. vGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUkOQIDAQABo0IwQDAPBgNVHRMBAf8E
  54975. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJ
  54976. KoZIhvcNAQELBQADggEBABpA2JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweK
  54977. A3rD6z8KLFIWoCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu
  54978. t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7cKUGRIjxpp7sC
  54979. 8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fMm7v/OeZWYdMKp8RcTGB7BXcm
  54980. er/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZuMdRAGmI0Nj81Aa6sY6A=
  54981. -----END CERTIFICATE-----
  54982. GeoTrust Primary Certification Authority - G2
  54983. =============================================
  54984. -----BEGIN CERTIFICATE-----
  54985. MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDELMAkGA1UEBhMC
  54986. VVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA3IEdlb1RydXN0IElu
  54987. Yy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBD
  54988. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1
  54989. OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg
  54990. MjAwNyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMTLUdl
  54991. b1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjB2MBAGByqGSM49AgEG
  54992. BSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcLSo17VDs6bl8VAsBQps8lL33KSLjHUGMc
  54993. KiEIfJo22Av+0SbFWDEwKCXzXV2juLaltJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYD
  54994. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+
  54995. EVXVMAoGCCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGTqQ7m
  54996. ndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBuczrD6ogRLQy7rQkgu2
  54997. npaqBA+K
  54998. -----END CERTIFICATE-----
  54999. VeriSign Universal Root Certification Authority
  55000. ===============================================
  55001. -----BEGIN CERTIFICATE-----
  55002. MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCBvTELMAkGA1UE
  55003. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  55004. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  55005. IHVzZSBvbmx5MTgwNgYDVQQDEy9WZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9u
  55006. IEF1dGhvcml0eTAeFw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJV
  55007. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  55008. cmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  55009. IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmljYXRpb24gQXV0
  55010. aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj
  55011. 1mCOkdeQmIN65lgZOIzF9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGP
  55012. MiJhgsWHH26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+HLL72
  55013. 9fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN/BMReYTtXlT2NJ8I
  55014. AfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPTrJ9VAMf2CGqUuV/c4DPxhGD5WycR
  55015. tPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0G
  55016. CCsGAQUFBwEMBGEwX6FdoFswWTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2O
  55017. a8PPgGrUSBgsexkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud
  55018. DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4sAPmLGd75JR3
  55019. Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+seQxIcaBlVZaDrHC1LGmWazx
  55020. Y8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTx
  55021. P/jgdFcrGJ2BtMQo2pSXpXDrrB2+BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+P
  55022. wGZsY6rp2aQW9IHRlRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4
  55023. mJO37M2CYfE45k+XmCpajQ==
  55024. -----END CERTIFICATE-----
  55025. VeriSign Class 3 Public Primary Certification Authority - G4
  55026. ============================================================
  55027. -----BEGIN CERTIFICATE-----
  55028. MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjELMAkGA1UEBhMC
  55029. VVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3
  55030. b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVz
  55031. ZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmlj
  55032. YXRpb24gQXV0aG9yaXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjEL
  55033. MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBU
  55034. cnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRo
  55035. b3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5
  55036. IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8
  55037. Utpkmw4tXNherJI9/gHmGUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGz
  55038. rl0Bp3vefLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUwAwEB
  55039. /zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEw
  55040. HzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVyaXNpZ24u
  55041. Y29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMWkf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMD
  55042. A2gAMGUCMGYhDBgmYFo4e1ZC4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIx
  55043. AJw9SDkjOVgaFRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA==
  55044. -----END CERTIFICATE-----
  55045. NetLock Arany (Class Gold) Főtanúsítvány
  55046. ========================================
  55047. -----BEGIN CERTIFICATE-----
  55048. MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G
  55049. A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610
  55050. dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBB
  55051. cmFueSAoQ2xhc3MgR29sZCkgRsWRdGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgx
  55052. MjA2MTUwODIxWjCBpzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxO
  55053. ZXRMb2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlmaWNhdGlv
  55054. biBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNzIEdvbGQpIEbFkXRhbsO6
  55055. c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCRec75LbRTDofTjl5Bu
  55056. 0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrTlF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw
  55057. /HpYzY6b7cNGbIRwXdrzAZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAk
  55058. H3B5r9s5VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRGILdw
  55059. fzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2BJtr+UBdADTHLpl1
  55060. neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIB
  55061. BjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2MU9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwW
  55062. qZw8UQCgwBEIBaeZ5m8BiFRhbvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTta
  55063. YtOUZcTh5m2C+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC
  55064. bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2FuLjbvrW5Kfna
  55065. NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu
  55066. dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=
  55067. -----END CERTIFICATE-----
  55068. Staat der Nederlanden Root CA - G2
  55069. ==================================
  55070. -----BEGIN CERTIFICATE-----
  55071. MIIFyjCCA7KgAwIBAgIEAJiWjDANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  55072. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  55073. Um9vdCBDQSAtIEcyMB4XDTA4MDMyNjExMTgxN1oXDTIwMDMyNTExMDMxMFowWjELMAkGA1UEBhMC
  55074. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  55075. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMVZ
  55076. 5291qj5LnLW4rJ4L5PnZyqtdj7U5EILXr1HgO+EASGrP2uEGQxGZqhQlEq0i6ABtQ8SpuOUfiUtn
  55077. vWFI7/3S4GCI5bkYYCjDdyutsDeqN95kWSpGV+RLufg3fNU254DBtvPUZ5uW6M7XxgpT0GtJlvOj
  55078. CwV3SPcl5XCsMBQgJeN/dVrlSPhOewMHBPqCYYdu8DvEpMfQ9XQ+pV0aCPKbJdL2rAQmPlU6Yiil
  55079. e7Iwr/g3wtG61jj99O9JMDeZJiFIhQGp5Rbn3JBV3w/oOM2ZNyFPXfUib2rFEhZgF1XyZWampzCR
  55080. OME4HYYEhLoaJXhena/MUGDWE4dS7WMfbWV9whUYdMrhfmQpjHLYFhN9C0lK8SgbIHRrxT3dsKpI
  55081. CT0ugpTNGmXZK4iambwYfp/ufWZ8Pr2UuIHOzZgweMFvZ9C+X+Bo7d7iscksWXiSqt8rYGPy5V65
  55082. 48r6f1CGPqI0GAwJaCgRHOThuVw+R7oyPxjMW4T182t0xHJ04eOLoEq9jWYv6q012iDTiIJh8BIi
  55083. trzQ1aTsr1SIJSQ8p22xcik/Plemf1WvbibG/ufMQFxRRIEKeN5KzlW/HdXZt1bv8Hb/C3m1r737
  55084. qWmRRpdogBQ2HbN/uymYNqUg+oJgYjOk7Na6B6duxc8UpufWkjTYgfX8HV2qXB72o007uPc5AgMB
  55085. AAGjgZcwgZQwDwYDVR0TAQH/BAUwAwEB/zBSBgNVHSAESzBJMEcGBFUdIAAwPzA9BggrBgEFBQcC
  55086. ARYxaHR0cDovL3d3dy5wa2lvdmVyaGVpZC5ubC9wb2xpY2llcy9yb290LXBvbGljeS1HMjAOBgNV
  55087. HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJFoMocVHYnitfGsNig0jQt8YojrMA0GCSqGSIb3DQEBCwUA
  55088. A4ICAQCoQUpnKpKBglBu4dfYszk78wIVCVBR7y29JHuIhjv5tLySCZa59sCrI2AGeYwRTlHSeYAz
  55089. +51IvuxBQ4EffkdAHOV6CMqqi3WtFMTC6GY8ggen5ieCWxjmD27ZUD6KQhgpxrRW/FYQoAUXvQwj
  55090. f/ST7ZwaUb7dRUG/kSS0H4zpX897IZmflZ85OkYcbPnNe5yQzSipx6lVu6xiNGI1E0sUOlWDuYaN
  55091. kqbG9AclVMwWVxJKgnjIFNkXgiYtXSAfea7+1HAWFpWD2DU5/1JddRwWxRNVz0fMdWVSSt7wsKfk
  55092. CpYL+63C4iWEst3kvX5ZbJvw8NjnyvLplzh+ib7M+zkXYT9y2zqR2GUBGR2tUKRXCnxLvJxxcypF
  55093. URmFzI79R6d0lR2o0a9OF7FpJsKqeFdbxU2n5Z4FF5TKsl+gSRiNNOkmbEgeqmiSBeGCc1qb3Adb
  55094. CG19ndeNIdn8FCCqwkXfP+cAslHkwvgFuXkajDTznlvkN1trSt8sV4pAWja63XVECDdCcAz+3F4h
  55095. oKOKwJCcaNpQ5kUQR3i2TtJlycM33+FCY7BXN0Ute4qcvwXqZVUz9zkQxSgqIXobisQk+T8VyJoV
  55096. IPVVYpbtbZNQvOSqeK3Zywplh6ZmwcSBo3c6WB4L7oOLnR7SUqTMHW+wmG2UMbX4cQrcufx9MmDm
  55097. 66+KAQ==
  55098. -----END CERTIFICATE-----
  55099. Hongkong Post Root CA 1
  55100. =======================
  55101. -----BEGIN CERTIFICATE-----
  55102. MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoT
  55103. DUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMB4XDTAzMDUx
  55104. NTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25n
  55105. IFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEF
  55106. AAOCAQ8AMIIBCgKCAQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1
  55107. ApzQjVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEnPzlTCeqr
  55108. auh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjhZY4bXSNmO7ilMlHIhqqh
  55109. qZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9nnV0ttgCXjqQesBCNnLsak3c78QA3xMY
  55110. V18meMjWCnl3v/evt3a5pQuEF10Q6m/hq5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNV
  55111. HRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7i
  55112. h9legYsCmEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI37pio
  55113. l7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clBoiMBdDhViw+5Lmei
  55114. IAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJsEhTkYY2sEJCehFC78JZvRZ+K88ps
  55115. T/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpOfMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilT
  55116. c4afU9hDDl3WY4JxHYB0yvbiAmvZWg==
  55117. -----END CERTIFICATE-----
  55118. SecureSign RootCA11
  55119. ===================
  55120. -----BEGIN CERTIFICATE-----
  55121. MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi
  55122. SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS
  55123. b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw
  55124. KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1
  55125. cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL
  55126. TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO
  55127. wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq
  55128. g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP
  55129. O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA
  55130. bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX
  55131. t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh
  55132. OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r
  55133. bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ
  55134. Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01
  55135. y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061
  55136. lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I=
  55137. -----END CERTIFICATE-----
  55138. Microsec e-Szigno Root CA 2009
  55139. ==============================
  55140. -----BEGIN CERTIFICATE-----
  55141. MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJIVTER
  55142. MA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jv
  55143. c2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o
  55144. dTAeFw0wOTA2MTYxMTMwMThaFw0yOTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UE
  55145. BwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUt
  55146. U3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTCCASIw
  55147. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvPkd6mJviZpWNwrZuuyjNA
  55148. fW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tccbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG
  55149. 0IMZfcChEhyVbUr02MelTTMuhTlAdX4UfIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKA
  55150. pxn1ntxVUwOXewdI/5n7N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm
  55151. 1HxdrtbCxkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1+rUC
  55152. AwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTLD8bf
  55153. QkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAbBgNVHREE
  55154. FDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqGSIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0o
  55155. lZMEyL/azXm4Q5DwpL7v8u8hmLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfX
  55156. I/OMn74dseGkddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775
  55157. tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c2Pm2G2JwCz02
  55158. yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi
  55159. LXpUq3DDfSJlgnCW
  55160. -----END CERTIFICATE-----
  55161. GlobalSign Root CA - R3
  55162. =======================
  55163. -----BEGIN CERTIFICATE-----
  55164. MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xv
  55165. YmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  55166. bFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  55167. aWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  55168. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWt
  55169. iHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsTgHeMCOFJ
  55170. 0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmmKPZpO/bLyCiR5Z2KYVc3
  55171. rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zdQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjl
  55172. OCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2
  55173. xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  55174. FI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7
  55175. lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8
  55176. EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1E
  55177. bddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18
  55178. YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r
  55179. kpeDMdmztcpHWD9f
  55180. -----END CERTIFICATE-----
  55181. Autoridad de Certificacion Firmaprofesional CIF A62634068
  55182. =========================================================
  55183. -----BEGIN CERTIFICATE-----
  55184. MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UEBhMCRVMxQjBA
  55185. BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2
  55186. MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEyMzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIw
  55187. QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB
  55188. NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD
  55189. Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P
  55190. B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY
  55191. 7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH
  55192. ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI
  55193. plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX
  55194. MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX
  55195. LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK
  55196. bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU
  55197. vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1Ud
  55198. EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNH
  55199. DhpkLzCBpgYDVR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp
  55200. cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBvACAAZABlACAA
  55201. bABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBlAGwAbwBuAGEAIAAwADgAMAAx
  55202. ADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx
  55203. 51tkljYyGOylMnfX40S2wBEqgLk9am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qk
  55204. R71kMrv2JYSiJ0L1ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaP
  55205. T481PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS3a/DTg4f
  55206. Jl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5kSeTy36LssUzAKh3ntLFl
  55207. osS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF3dvd6qJ2gHN99ZwExEWN57kci57q13XR
  55208. crHedUTnQn3iV2t93Jm8PYMo6oCTjcVMZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoR
  55209. saS8I8nkvof/uZS2+F0gStRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTD
  55210. KCOM/iczQ0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQBjLMi
  55211. 6Et8Vcad+qMUu2WFbm5PEn4KPJ2V
  55212. -----END CERTIFICATE-----
  55213. Izenpe.com
  55214. ==========
  55215. -----BEGIN CERTIFICATE-----
  55216. MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQG
  55217. EwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wHhcNMDcxMjEz
  55218. MTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMu
  55219. QS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ
  55220. 03rKDx6sp4boFmVqscIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAK
  55221. ClaOxdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6HLmYRY2xU
  55222. +zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFXuaOKmMPsOzTFlUFpfnXC
  55223. PCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQDyCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxT
  55224. OTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbK
  55225. F7jJeodWLBoBHmy+E60QrLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK
  55226. 0GqfvEyNBjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8Lhij+
  55227. 0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIBQFqNeb+Lz0vPqhbB
  55228. leStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+HMh3/1uaD7euBUbl8agW7EekFwID
  55229. AQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2luZm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+
  55230. SVpFTlBFIFMuQS4gLSBDSUYgQTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBG
  55231. NjIgUzgxQzBBBgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx
  55232. MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  55233. BBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUAA4ICAQB4pgwWSp9MiDrAyw6l
  55234. Fn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWblaQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbga
  55235. kEyrkgPH7UIBzg/YsfqikuFgba56awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8q
  55236. hT/AQKM6WfxZSzwoJNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Cs
  55237. g1lwLDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCTVyvehQP5
  55238. aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGkLhObNA5me0mrZJfQRsN5
  55239. nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJbUjWumDqtujWTI6cfSN01RpiyEGjkpTHC
  55240. ClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZo
  55241. Q0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1Z
  55242. WrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw==
  55243. -----END CERTIFICATE-----
  55244. Chambers of Commerce Root - 2008
  55245. ================================
  55246. -----BEGIN CERTIFICATE-----
  55247. MIIHTzCCBTegAwIBAgIJAKPaQn6ksa7aMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYDVQQGEwJFVTFD
  55248. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  55249. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  55250. QS4xKTAnBgNVBAMTIENoYW1iZXJzIG9mIENvbW1lcmNlIFJvb3QgLSAyMDA4MB4XDTA4MDgwMTEy
  55251. Mjk1MFoXDTM4MDczMTEyMjk1MFowga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNl
  55252. ZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQF
  55253. EwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJl
  55254. cnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
  55255. AQCvAMtwNyuAWko6bHiUfaN/Gh/2NdW928sNRHI+JrKQUrpjOyhYb6WzbZSm891kDFX29ufyIiKA
  55256. XuFixrYp4YFs8r/lfTJqVKAyGVn+H4vXPWCGhSRv4xGzdz4gljUha7MI2XAuZPeEklPWDrCQiorj
  55257. h40G072QDuKZoRuGDtqaCrsLYVAGUvGef3bsyw/QHg3PmTA9HMRFEFis1tPo1+XqxQEHd9ZR5gN/
  55258. ikilTWh1uem8nk4ZcfUyS5xtYBkL+8ydddy/Js2Pk3g5eXNeJQ7KXOt3EgfLZEFHcpOrUMPrCXZk
  55259. NNI5t3YRCQ12RcSprj1qr7V9ZS+UWBDsXHyvfuK2GNnQm05aSd+pZgvMPMZ4fKecHePOjlO+Bd5g
  55260. D2vlGts/4+EhySnB8esHnFIbAURRPHsl18TlUlRdJQfKFiC4reRB7noI/plvg6aRArBsNlVq5331
  55261. lubKgdaX8ZSD6e2wsWsSaR6s+12pxZjptFtYer49okQ6Y1nUCyXeG0+95QGezdIp1Z8XGQpvvwyQ
  55262. 0wlf2eOKNcx5Wk0ZN5K3xMGtr/R5JJqyAQuxr1yW84Ay+1w9mPGgP0revq+ULtlVmhduYJ1jbLhj
  55263. ya6BXBg14JC7vjxPNyK5fuvPnnchpj04gftI2jE9K+OJ9dC1vX7gUMQSibMjmhAxhduub+84Mxh2
  55264. EQIDAQABo4IBbDCCAWgwEgYDVR0TAQH/BAgwBgEB/wIBDDAdBgNVHQ4EFgQU+SSsD7K1+HnA+mCI
  55265. G8TZTQKeFxkwgeMGA1UdIwSB2zCB2IAU+SSsD7K1+HnA+mCIG8TZTQKeFxmhgbSkgbEwga4xCzAJ
  55266. BgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNh
  55267. bWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENh
  55268. bWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDiC
  55269. CQCj2kJ+pLGu2jAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUH
  55270. AgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAJASryI1
  55271. wqM58C7e6bXpeHxIvj99RZJe6dqxGfwWPJ+0W2aeaufDuV2I6A+tzyMP3iU6XsxPpcG1Lawk0lgH
  55272. 3qLPaYRgM+gQDROpI9CF5Y57pp49chNyM/WqfcZjHwj0/gF/JM8rLFQJ3uIrbZLGOU8W6jx+ekbU
  55273. RWpGqOt1glanq6B8aBMz9p0w8G8nOSQjKpD9kCk18pPfNKXG9/jvjA9iSnyu0/VU+I22mlaHFoI6
  55274. M6taIgj3grrqLuBHmrS1RaMFO9ncLkVAO+rcf+g769HsJtg1pDDFOqxXnrN2pSB7+R5KBWIBpih1
  55275. YJeSDW4+TTdDDZIVnBgizVGZoCkaPF+KMjNbMMeJL0eYD6MDxvbxrN8y8NmBGuScvfaAFPDRLLmF
  55276. 9dijscilIeUcE5fuDr3fKanvNFNb0+RqE4QGtjICxFKuItLcsiFCGtpA8CnJ7AoMXOLQusxI0zcK
  55277. zBIKinmwPQN/aUv0NCB9szTqjktk9T79syNnFQ0EuPAtwQlRPLJsFfClI9eDdOTlLsn+mCdCxqvG
  55278. nrDQWzilm1DefhiYtUU79nm06PcaewaD+9CL2rvHvRirCG88gGtAPxkZumWK5r7VXNM21+9AUiRg
  55279. OGcEMeyP84LG3rlV8zsxkVrctQgVrXYlCg17LofiDKYGvCYQbTed7N14jHyAxfDZd0jQ
  55280. -----END CERTIFICATE-----
  55281. Global Chambersign Root - 2008
  55282. ==============================
  55283. -----BEGIN CERTIFICATE-----
  55284. MIIHSTCCBTGgAwIBAgIJAMnN0+nVfSPOMA0GCSqGSIb3DQEBBQUAMIGsMQswCQYDVQQGEwJFVTFD
  55285. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  55286. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  55287. QS4xJzAlBgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwODAeFw0wODA4MDExMjMx
  55288. NDBaFw0zODA3MzExMjMxNDBaMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUg
  55289. Y3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJ
  55290. QTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAlBgNVBAMTHkdsb2JhbCBD
  55291. aGFtYmVyc2lnbiBSb290IC0gMjAwODCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDf
  55292. VtPkOpt2RbQT2//BthmLN0EYlVJH6xedKYiONWwGMi5HYvNJBL99RDaxccy9Wglz1dmFRP+RVyXf
  55293. XjaOcNFccUMd2drvXNL7G706tcuto8xEpw2uIRU/uXpbknXYpBI4iRmKt4DS4jJvVpyR1ogQC7N0
  55294. ZJJ0YPP2zxhPYLIj0Mc7zmFLmY/CDNBAspjcDahOo7kKrmCgrUVSY7pmvWjg+b4aqIG7HkF4ddPB
  55295. /gBVsIdU6CeQNR1MM62X/JcumIS/LMmjv9GYERTtY/jKmIhYF5ntRQOXfjyGHoiMvvKRhI9lNNgA
  55296. TH23MRdaKXoKGCQwoze1eqkBfSbW+Q6OWfH9GzO1KTsXO0G2Id3UwD2ln58fQ1DJu7xsepeY7s2M
  55297. H/ucUa6LcL0nn3HAa6x9kGbo1106DbDVwo3VyJ2dwW3Q0L9R5OP4wzg2rtandeavhENdk5IMagfe
  55298. Ox2YItaswTXbo6Al/3K1dh3ebeksZixShNBFks4c5eUzHdwHU1SjqoI7mjcv3N2gZOnm3b2u/GSF
  55299. HTynyQbehP9r6GsaPMWis0L7iwk+XwhSx2LE1AVxv8Rk5Pihg+g+EpuoHtQ2TS9x9o0o9oOpE9Jh
  55300. wZG7SMA0j0GMS0zbaRL/UJScIINZc+18ofLx/d33SdNDWKBWY8o9PeU1VlnpDsogzCtLkykPAgMB
  55301. AAGjggFqMIIBZjASBgNVHRMBAf8ECDAGAQH/AgEMMB0GA1UdDgQWBBS5CcqcHtvTbDprru1U8VuT
  55302. BjUuXjCB4QYDVR0jBIHZMIHWgBS5CcqcHtvTbDprru1U8VuTBjUuXqGBsqSBrzCBrDELMAkGA1UE
  55303. BhMCRVUxQzBBBgNVBAcTOk1hZHJpZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2FtZXJm
  55304. aXJtYS5jb20vYWRkcmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UEChMSQUMgQ2FtZXJm
  55305. aXJtYSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNpZ24gUm9vdCAtIDIwMDiCCQDJzdPp
  55306. 1X0jzjAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUHAgEWHGh0
  55307. dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAICIf3DekijZBZRG
  55308. /5BXqfEv3xoNa/p8DhxJJHkn2EaqbylZUohwEurdPfWbU1Rv4WCiqAm57OtZfMY18dwY6fFn5a+6
  55309. ReAJ3spED8IXDneRRXozX1+WLGiLwUePmJs9wOzL9dWCkoQ10b42OFZyMVtHLaoXpGNR6woBrX/s
  55310. dZ7LoR/xfxKxueRkf2fWIyr0uDldmOghp+G9PUIadJpwr2hsUF1Jz//7Dl3mLEfXgTpZALVza2Mg
  55311. 9jFFCDkO9HB+QHBaP9BrQql0PSgvAm11cpUJjUhjxsYjV5KTXjXBjfkK9yydYhz2rXzdpjEetrHH
  55312. foUm+qRqtdpjMNHvkzeyZi99Bffnt0uYlDXA2TopwZ2yUDMdSqlapskD7+3056huirRXhOukP9Du
  55313. qqqHW2Pok+JrqNS4cnhrG+055F3Lm6qH1U9OAP7Zap88MQ8oAgF9mOinsKJknnn4SPIVqczmyETr
  55314. P3iZ8ntxPjzxmKfFGBI/5rsoM0LpRQp8bfKGeS/Fghl9CYl8slR2iK7ewfPM4W7bMdaTrpmg7yVq
  55315. c5iJWzouE4gev8CSlDQb4ye3ix5vQv/n6TebUB0tovkC7stYWDpxvGjjqsGvHCgfotwjZT+B6q6Z
  55316. 09gwzxMNTxXJhLynSC34MCN32EZLeW32jO06f2ARePTpm67VVMB0gNELQp/B
  55317. -----END CERTIFICATE-----
  55318. Go Daddy Root Certificate Authority - G2
  55319. ========================================
  55320. -----BEGIN CERTIFICATE-----
  55321. MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  55322. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMu
  55323. MTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5
  55324. MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
  55325. b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8G
  55326. A1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI
  55327. hvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKDE6bFIEMBO4Tx5oVJnyfq
  55328. 9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD
  55329. +qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutd
  55330. fMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMl
  55331. NAJWJwGRtDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNC
  55332. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9
  55333. BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096ac
  55334. vNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r
  55335. 5N9ss4UXnT3ZJE95kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYV
  55336. N8Gb5DKj7Tjo2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
  55337. LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1
  55338. -----END CERTIFICATE-----
  55339. Starfield Root Certificate Authority - G2
  55340. =========================================
  55341. -----BEGIN CERTIFICATE-----
  55342. MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  55343. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  55344. b2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0
  55345. eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAw
  55346. DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQg
  55347. VGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZpY2F0ZSBB
  55348. dXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3twQP89o/8ArFv
  55349. W59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMgnLRJdzIpVv257IzdIvpy3Cdhl+72WoTs
  55350. bhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNk
  55351. N3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7Nf
  55352. ZTD4p7dNdloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbU
  55353. JtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  55354. AQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfol
  55355. TwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx
  55356. 4mcujJUDJi5DnUox9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUw
  55357. F5okxBDgBPfg8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K
  55358. pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZ
  55359. c2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0
  55360. -----END CERTIFICATE-----
  55361. Starfield Services Root Certificate Authority - G2
  55362. ==================================================
  55363. -----BEGIN CERTIFICATE-----
  55364. MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  55365. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  55366. b2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVsZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRl
  55367. IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNV
  55368. BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxT
  55369. dGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2VydmljZXMg
  55370. Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
  55371. AQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20pOsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2
  55372. h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm28xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4Pa
  55373. hHQUw2eeBGg6345AWh1KTs9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLP
  55374. LJGmpufehRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk6mFB
  55375. rMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAwDwYDVR0TAQH/BAUw
  55376. AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+qAdcwKziIorhtSpzyEZGDMA0GCSqG
  55377. SIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMIbw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPP
  55378. E95Dz+I0swSdHynVv/heyNXBve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTy
  55379. xQGjhdByPq1zqwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd
  55380. iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn0q23KXB56jza
  55381. YyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCNsSi6
  55382. -----END CERTIFICATE-----
  55383. AffirmTrust Commercial
  55384. ======================
  55385. -----BEGIN CERTIFICATE-----
  55386. MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCVVMxFDAS
  55387. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMB4XDTEw
  55388. MDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  55389. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEF
  55390. AAOCAQ8AMIIBCgKCAQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6Eqdb
  55391. DuKPHx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yrba0F8PrV
  55392. C8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPALMeIrJmqbTFeurCA+ukV6
  55393. BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1yHp52UKqK39c/s4mT6NmgTWvRLpUHhww
  55394. MmWd5jyTXlBOeuM61G7MGvv50jeuJCqrVwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNV
  55395. HQ4EFgQUnZPGU4teyq8/nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  55396. AQYwDQYJKoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYGXUPG
  55397. hi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNjvbz4YYCanrHOQnDi
  55398. qX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivtZ8SOyUOyXGsViQK8YvxO8rUzqrJv
  55399. 0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9gN53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0kh
  55400. sUlHRUe072o0EclNmsxZt9YCnlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8=
  55401. -----END CERTIFICATE-----
  55402. AffirmTrust Networking
  55403. ======================
  55404. -----BEGIN CERTIFICATE-----
  55405. MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UEBhMCVVMxFDAS
  55406. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMB4XDTEw
  55407. MDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  55408. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEF
  55409. AAOCAQ8AMIIBCgKCAQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SE
  55410. Hi3yYJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbuakCNrmreI
  55411. dIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRLQESxG9fhwoXA3hA/Pe24
  55412. /PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gb
  55413. h+0t+nvujArjqWaJGctB+d1ENmHP4ndGyH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNV
  55414. HQ4EFgQUBx/S55zawm6iQLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  55415. AQYwDQYJKoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfOtDIu
  55416. UFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzuQY0x2+c06lkh1QF6
  55417. 12S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZLgo/bNjR9eUJtGxUAArgFU2HdW23
  55418. WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4uolu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9
  55419. /ZFvgrG+CJPbFEfxojfHRZ48x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s=
  55420. -----END CERTIFICATE-----
  55421. AffirmTrust Premium
  55422. ===================
  55423. -----BEGIN CERTIFICATE-----
  55424. MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UEBhMCVVMxFDAS
  55425. BgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMB4XDTEwMDEy
  55426. OTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRy
  55427. dXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  55428. MIICCgKCAgEAxBLfqV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtn
  55429. BKAQJG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ+jjeRFcV
  55430. 5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrSs8PhaJyJ+HoAVt70VZVs
  55431. +7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmd
  55432. GPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d770O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5R
  55433. p9EixAqnOEhss/n/fauGV+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NI
  55434. S+LI+H+SqHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S5u04
  55435. 6uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4IaC1nEWTJ3s7xgaVY5
  55436. /bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TXOwF0lkLgAOIua+rF7nKsu7/+6qqo
  55437. +Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYEFJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB
  55438. /wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByv
  55439. MiPIs0laUZx2KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg
  55440. Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B8OWycvpEgjNC
  55441. 6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQMKSOyARiqcTtNd56l+0OOF6S
  55442. L5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK
  55443. +4w1IX2COPKpVJEZNZOUbWo6xbLQu4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmV
  55444. BtWVyuEklut89pMFu+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFg
  55445. IxpHYoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8GKa1qF60
  55446. g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaORtGdFNrHF+QFlozEJLUb
  55447. zxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6eKeC2uAloGRwYQw==
  55448. -----END CERTIFICATE-----
  55449. AffirmTrust Premium ECC
  55450. =======================
  55451. -----BEGIN CERTIFICATE-----
  55452. MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMCVVMxFDASBgNV
  55453. BAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQcmVtaXVtIEVDQzAeFw0xMDAx
  55454. MjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJBgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1U
  55455. cnVzdDEgMB4GA1UEAwwXQWZmaXJtVHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQA
  55456. IgNiAAQNMF4bFZ0D0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQ
  55457. N8O9ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0GA1UdDgQW
  55458. BBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAK
  55459. BggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/VsaobgxCd05DhT1wV/GzTjxi+zygk8N53X
  55460. 57hG8f2h4nECMEJZh0PUUd+60wkyWs6Iflc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKM
  55461. eQ==
  55462. -----END CERTIFICATE-----
  55463. Certum Trusted Network CA
  55464. =========================
  55465. -----BEGIN CERTIFICATE-----
  55466. MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK
  55467. ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlv
  55468. biBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIy
  55469. MTIwNzM3WhcNMjkxMjMxMTIwNzM3WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBU
  55470. ZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  55471. MSIwIAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
  55472. AQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rHUV+rpDKmYYe2bg+G0jAC
  55473. l/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LMTXPb865Px1bVWqeWifrzq2jUI4ZZJ88J
  55474. J7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVUBBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4
  55475. fOQtf/WsX+sWn7Et0brMkUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0
  55476. cvW0QM8xAcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNVHRMB
  55477. Af8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNVHQ8BAf8EBAMCAQYw
  55478. DQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15ysHhE49wcrwn9I0j6vSrEuVUEtRCj
  55479. jSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfLI9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1
  55480. mS1FhIrlQgnXdAIv94nYmem8J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5aj
  55481. Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI
  55482. 03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw=
  55483. -----END CERTIFICATE-----
  55484. TWCA Root Certification Authority
  55485. =================================
  55486. -----BEGIN CERTIFICATE-----
  55487. MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ
  55488. VEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNh
  55489. dGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMzWhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQG
  55490. EwJUVzESMBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NB
  55491. IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
  55492. AoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFEAcK0HMMx
  55493. QhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HHK3XLfJ+utdGdIzdjp9xC
  55494. oi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeXRfwZVzsrb+RH9JlF/h3x+JejiB03HFyP
  55495. 4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1r
  55496. y+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIB
  55497. BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG
  55498. 9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lC
  55499. mtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlW
  55500. QtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVY
  55501. T0bf+215WfKEIlKuD8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocny
  55502. Yh0igzyXxfkZYiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==
  55503. -----END CERTIFICATE-----
  55504. Security Communication RootCA2
  55505. ==============================
  55506. -----BEGIN CERTIFICATE-----
  55507. MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
  55508. U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMeU2VjdXJpdHkgQ29tbXVuaWNh
  55509. dGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoXDTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMC
  55510. SlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3Vy
  55511. aXR5IENvbW11bmljYXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  55512. ANAVOVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGrzbl+dp++
  55513. +T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVMVAX3NuRFg3sUZdbcDE3R
  55514. 3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQhNBqyjoGADdH5H5XTz+L62e4iKrFvlNV
  55515. spHEfbmwhRkGeC7bYRr6hfVKkaHnFtWOojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1K
  55516. EOtOghY6rCcMU/Gt1SSwawNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8
  55517. QIH4D5csOPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEB
  55518. CwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpFcoJxDjrSzG+ntKEj
  55519. u/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXcokgfGT+Ok+vx+hfuzU7jBBJV1uXk
  55520. 3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6q
  55521. tnRGEmyR7jTV7JqR50S+kDFy1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29
  55522. mvVXIwAHIRc/SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03
  55523. -----END CERTIFICATE-----
  55524. EC-ACC
  55525. ======
  55526. -----BEGIN CERTIFICATE-----
  55527. MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB8zELMAkGA1UE
  55528. BhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2VydGlmaWNhY2lvIChOSUYgUS0w
  55529. ODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYD
  55530. VQQLEyxWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UE
  55531. CxMsSmVyYXJxdWlhIEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMT
  55532. BkVDLUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQGEwJFUzE7
  55533. MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8gKE5JRiBRLTA4MDExNzYt
  55534. SSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZl
  55535. Z2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQubmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJh
  55536. cnF1aWEgRW50aXRhdHMgZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUND
  55537. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R85iK
  55538. w5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm4CgPukLjbo73FCeT
  55539. ae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaVHMf5NLWUhdWZXqBIoH7nF2W4onW4
  55540. HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNdQlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0a
  55541. E9jD2z3Il3rucO2n5nzbcc8tlGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw
  55542. 0JDnJwIDAQABo4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E
  55543. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4opvpXY0wfwYD
  55544. VR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBodHRwczovL3d3dy5jYXRjZXJ0
  55545. Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5l
  55546. dC92ZXJhcnJlbCAwDQYJKoZIhvcNAQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJ
  55547. lF7W2u++AVtd0x7Y/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNa
  55548. Al6kSBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhyRp/7SNVe
  55549. l+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOSAgu+TGbrIP65y7WZf+a2
  55550. E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xlnJ2lYJU6Un/10asIbvPuW/mIPX64b24D
  55551. 5EI=
  55552. -----END CERTIFICATE-----
  55553. Hellenic Academic and Research Institutions RootCA 2011
  55554. =======================================================
  55555. -----BEGIN CERTIFICATE-----
  55556. MIIEMTCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCR1IxRDBCBgNVBAoT
  55557. O0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9y
  55558. aXR5MUAwPgYDVQQDEzdIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  55559. IFJvb3RDQSAyMDExMB4XDTExMTIwNjEzNDk1MloXDTMxMTIwMTEzNDk1MlowgZUxCzAJBgNVBAYT
  55560. AkdSMUQwQgYDVQQKEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  55561. IENlcnQuIEF1dGhvcml0eTFAMD4GA1UEAxM3SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNo
  55562. IEluc3RpdHV0aW9ucyBSb290Q0EgMjAxMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  55563. AKlTAOMupvaO+mDYLZU++CwqVE7NuYRhlFhPjz2L5EPzdYmNUeTDN9KKiE15HrcS3UN4SoqS5tdI
  55564. 1Q+kOilENbgH9mgdVc04UfCMJDGFr4PJfel3r+0ae50X+bOdOFAPplp5kYCvN66m0zH7tSYJnTxa
  55565. 71HFK9+WXesyHgLacEnsbgzImjeN9/E2YEsmLIKe0HjzDQ9jpFEw4fkrJxIH2Oq9GGKYsFk3fb7u
  55566. 8yBRQlqD75O6aRXxYp2fmTmCobd0LovUxQt7L/DICto9eQqakxylKHJzkUOap9FNhYS5qXSPFEDH
  55567. 3N6sQWRstBmbAmNtJGSPRLIl6s5ddAxjMlyNh+UCAwEAAaOBiTCBhjAPBgNVHRMBAf8EBTADAQH/
  55568. MAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQUppFC/RNhSiOeCKQp5dgTBCPuQSUwRwYDVR0eBEAwPqA8
  55569. MAWCAy5ncjAFggMuZXUwBoIELmVkdTAGggQub3JnMAWBAy5ncjAFgQMuZXUwBoEELmVkdTAGgQQu
  55570. b3JnMA0GCSqGSIb3DQEBBQUAA4IBAQAf73lB4XtuP7KMhjdCSk4cNx6NZrokgclPEg8hwAOXhiVt
  55571. XdMiKahsog2p6z0GW5k6x8zDmjR/qw7IThzh+uTczQ2+vyT+bOdrwg3IBp5OjWEopmr95fZi6hg8
  55572. TqBTnbI6nOulnJEWtk2C4AwFSKls9cz4y51JtPACpf1wA+2KIaWuE4ZJwzNzvoc7dIsXRSZMFpGD
  55573. /md9zU1jZ/rzAxKWeAaNsWftjj++n08C9bMJL/NMh98qy5V8AcysNnq/onN694/BtZqhFLKPM58N
  55574. 7yLcZnuEvUUXBj08yrl3NI/K6s8/MT7jiOOASSXIl7WdmplNsDz4SgCbZN2fOUvRJ9e4
  55575. -----END CERTIFICATE-----
  55576. Actalis Authentication Root CA
  55577. ==============================
  55578. -----BEGIN CERTIFICATE-----
  55579. MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UEBhMCSVQxDjAM
  55580. BgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UE
  55581. AwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDky
  55582. MjExMjIwMlowazELMAkGA1UEBhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlz
  55583. IFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290
  55584. IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNvUTufClrJ
  55585. wkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX4ay8IMKx4INRimlNAJZa
  55586. by/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9KK3giq0itFZljoZUj5NDKd45RnijMCO6
  55587. zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1f
  55588. YVEiVRvjRuPjPdA1YprbrxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2
  55589. oxgkg4YQ51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2Fbe8l
  55590. EfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxeKF+w6D9Fz8+vm2/7
  55591. hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4Fv6MGn8i1zeQf1xcGDXqVdFUNaBr8
  55592. EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbnfpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5
  55593. jF66CyCU3nuDuP/jVo23Eek7jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLY
  55594. iDrIn3hm7YnzezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt
  55595. ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQALe3KHwGCmSUyI
  55596. WOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70jsNjLiNmsGe+b7bAEzlgqqI0
  55597. JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDzWochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKx
  55598. K3JCaKygvU5a2hi/a5iB0P2avl4VSM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+
  55599. Xlff1ANATIGk0k9jpwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC
  55600. 4yyXX04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+OkfcvHlXHo
  55601. 2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7RK4X9p2jIugErsWx0Hbhz
  55602. lefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btUZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXem
  55603. OR/qnuOf0GZvBeyqdn6/axag67XH/JJULysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9
  55604. vwGYT7JZVEc+NHt4bVaTLnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg==
  55605. -----END CERTIFICATE-----
  55606. Trustis FPS Root CA
  55607. ===================
  55608. -----BEGIN CERTIFICATE-----
  55609. MIIDZzCCAk+gAwIBAgIQGx+ttiD5JNM2a/fH8YygWTANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQG
  55610. EwJHQjEYMBYGA1UEChMPVHJ1c3RpcyBMaW1pdGVkMRwwGgYDVQQLExNUcnVzdGlzIEZQUyBSb290
  55611. IENBMB4XDTAzMTIyMzEyMTQwNloXDTI0MDEyMTExMzY1NFowRTELMAkGA1UEBhMCR0IxGDAWBgNV
  55612. BAoTD1RydXN0aXMgTGltaXRlZDEcMBoGA1UECxMTVHJ1c3RpcyBGUFMgUm9vdCBDQTCCASIwDQYJ
  55613. KoZIhvcNAQEBBQADggEPADCCAQoCggEBAMVQe547NdDfxIzNjpvto8A2mfRC6qc+gIMPpqdZh8mQ
  55614. RUN+AOqGeSoDvT03mYlmt+WKVoaTnGhLaASMk5MCPjDSNzoiYYkchU59j9WvezX2fihHiTHcDnlk
  55615. H5nSW7r+f2C/revnPDgpai/lkQtV/+xvWNUtyd5MZnGPDNcE2gfmHhjjvSkCqPoc4Vu5g6hBSLwa
  55616. cY3nYuUtsuvffM/bq1rKMfFMIvMFE/eC+XN5DL7XSxzA0RU8k0Fk0ea+IxciAIleH2ulrG6nS4zt
  55617. o3Lmr2NNL4XSFDWaLk6M6jKYKIahkQlBOrTh4/L68MkKokHdqeMDx4gVOxzUGpTXn2RZEm0CAwEA
  55618. AaNTMFEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBS6+nEleYtXQSUhhgtx67JkDoshZzAd
  55619. BgNVHQ4EFgQUuvpxJXmLV0ElIYYLceuyZA6LIWcwDQYJKoZIhvcNAQEFBQADggEBAH5Y//01GX2c
  55620. GE+esCu8jowU/yyg2kdbw++BLa8F6nRIW/M+TgfHbcWzk88iNVy2P3UnXwmWzaD+vkAMXBJV+JOC
  55621. yinpXj9WV4s4NvdFGkwozZ5BuO1WTISkQMi4sKUraXAEasP41BIy+Q7DsdwyhEQsb8tGD+pmQQ9P
  55622. 8Vilpg0ND2HepZ5dfWWhPBfnqFVO76DH7cZEf1T1o+CP8HxVIo8ptoGj4W1OLBuAZ+ytIJ8MYmHV
  55623. l/9D7S3B2l0pKoU/rGXuhg8FjZBf3+6f9L/uHfuY5H+QK4R4EA5sSVPvFVtlRkpdr7r7OnIdzfYl
  55624. iB6XzCGcKQENZetX2fNXlrtIzYE=
  55625. -----END CERTIFICATE-----
  55626. Buypass Class 2 Root CA
  55627. =======================
  55628. -----BEGIN CERTIFICATE-----
  55629. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  55630. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMiBSb290IENBMB4X
  55631. DTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1owTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  55632. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIw
  55633. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1
  55634. g1Lr6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPVL4O2fuPn
  55635. 9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC911K2GScuVr1QGbNgGE41b
  55636. /+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHxMlAQTn/0hpPshNOOvEu/XAFOBz3cFIqU
  55637. CqTqc/sLUegTBxj6DvEr0VQVfTzh97QZQmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeff
  55638. awrbD02TTqigzXsu8lkBarcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgI
  55639. zRFo1clrUs3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLiFRhn
  55640. Bkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRSP/TizPJhk9H9Z2vX
  55641. Uq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN9SG9dKpN6nIDSdvHXx1iY8f93ZHs
  55642. M+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxPAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  55643. VR0OBBYEFMmAd+BikoL1RpzzuvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  55644. AAOCAgEAU18h9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s
  55645. A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3tOluwlN5E40EI
  55646. osHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo+fsicdl9sz1Gv7SEr5AcD48S
  55647. aq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYd
  55648. DnkM/crqJIByw5c/8nerQyIKx+u2DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWD
  55649. LfJ6v9r9jv6ly0UsH8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0
  55650. oyLQI+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK75t98biGC
  55651. wWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h3PFaTWwyI0PurKju7koS
  55652. CTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPzY11aWOIv4x3kqdbQCtCev9eBCfHJxyYN
  55653. rJgWVqA=
  55654. -----END CERTIFICATE-----
  55655. Buypass Class 3 Root CA
  55656. =======================
  55657. -----BEGIN CERTIFICATE-----
  55658. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  55659. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMyBSb290IENBMB4X
  55660. DTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFowTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  55661. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIw
  55662. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRH
  55663. sJ8YZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3EN3coTRiR
  55664. 5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9tznDDgFHmV0ST9tD+leh
  55665. 7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX0DJq1l1sDPGzbjniazEuOQAnFN44wOwZ
  55666. ZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH
  55667. 2xc519woe2v1n/MuwU8XKhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV
  55668. /afmiSTYzIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvSO1UQ
  55669. RwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D34xFMFbG02SrZvPA
  55670. Xpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgPK9Dx2hzLabjKSWJtyNBjYt1gD1iq
  55671. j6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  55672. VR0OBBYEFEe4zf/lb+74suwvTg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  55673. AAOCAgEAACAjQTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV
  55674. cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXSIGrs/CIBKM+G
  55675. uIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2HJLw5QY33KbmkJs4j1xrG0aG
  55676. Q0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsaO5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8
  55677. ZORK15FTAaggiG6cX0S5y2CBNOxv033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2
  55678. KSb12tjE8nVhz36udmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz
  55679. 6MkEkbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg413OEMXbug
  55680. UZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvDu79leNKGef9JOxqDDPDe
  55681. eOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq4/g7u9xN12TyUb7mqqta6THuBrxzvxNi
  55682. Cp/HuZc=
  55683. -----END CERTIFICATE-----
  55684. T-TeleSec GlobalRoot Class 3
  55685. ============================
  55686. -----BEGIN CERTIFICATE-----
  55687. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  55688. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  55689. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgx
  55690. MDAxMTAyOTU2WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  55691. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  55692. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0GCSqGSIb3
  55693. DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN8ELg63iIVl6bmlQdTQyK
  55694. 9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/RLyTPWGrTs0NvvAgJ1gORH8EGoel15YU
  55695. NpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZF
  55696. iP0Zf3WHHx+xGwpzJFu5ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W
  55697. 0eDrXltMEnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGjQjBA
  55698. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1A/d2O2GCahKqGFPr
  55699. AyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOyWL6ukK2YJ5f+AbGwUgC4TeQbIXQb
  55700. fsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzT
  55701. ucpH9sry9uetuUg/vBa3wW306gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7h
  55702. P0HHRwA11fXT91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml
  55703. e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4pTpPDpFQUWw==
  55704. -----END CERTIFICATE-----
  55705. EE Certification Centre Root CA
  55706. ===============================
  55707. -----BEGIN CERTIFICATE-----
  55708. MIIEAzCCAuugAwIBAgIQVID5oHPtPwBMyonY43HmSjANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG
  55709. EwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czEoMCYGA1UEAwwfRUUgQ2Vy
  55710. dGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYGCSqGSIb3DQEJARYJcGtpQHNrLmVlMCIYDzIw
  55711. MTAxMDMwMTAxMDMwWhgPMjAzMDEyMTcyMzU5NTlaMHUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKDBlB
  55712. UyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMSgwJgYDVQQDDB9FRSBDZXJ0aWZpY2F0aW9uIENlbnRy
  55713. ZSBSb290IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwggEiMA0GCSqGSIb3DQEBAQUAA4IB
  55714. DwAwggEKAoIBAQDIIMDs4MVLqwd4lfNE7vsLDP90jmG7sWLqI9iroWUyeuuOF0+W2Ap7kaJjbMeM
  55715. TC55v6kF/GlclY1i+blw7cNRfdCT5mzrMEvhvH2/UpvObntl8jixwKIy72KyaOBhU8E2lf/slLo2
  55716. rpwcpzIP5Xy0xm90/XsY6KxX7QYgSzIwWFv9zajmofxwvI6Sc9uXp3whrj3B9UiHbCe9nyV0gVWw
  55717. 93X2PaRka9ZP585ArQ/dMtO8ihJTmMmJ+xAdTX7Nfh9WDSFwhfYggx/2uh8Ej+p3iDXE/+pOoYtN
  55718. P2MbRMNE1CV2yreN1x5KZmTNXMWcg+HCCIia7E6j8T4cLNlsHaFLAgMBAAGjgYowgYcwDwYDVR0T
  55719. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBLyWj7qVhy/zQas8fElyalL1BSZ
  55720. MEUGA1UdJQQ+MDwGCCsGAQUFBwMCBggrBgEFBQcDAQYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEF
  55721. BQcDCAYIKwYBBQUHAwkwDQYJKoZIhvcNAQEFBQADggEBAHv25MANqhlHt01Xo/6tu7Fq1Q+e2+Rj
  55722. xY6hUFaTlrg4wCQiZrxTFGGVv9DHKpY5P30osxBAIWrEr7BSdxjhlthWXePdNl4dp1BUoMUq5KqM
  55723. lIpPnTX/dqQGE5Gion0ARD9V04I8GtVbvFZMIi5GQ4okQC3zErg7cBqklrkar4dBGmoYDQZPxz5u
  55724. uSlNDUmJEYcyW+ZLBMjkXOZ0c5RdFpgTlf7727FE5TpwrDdr5rMzcijJs1eg9gIWiAYLtqZLICjU
  55725. 3j2LrTcFU3T+bsy8QxdxXvnFzBqpYe73dgzzcvRyrc9yAjYHR8/vGVCJYMzpJJUPwssd8m92kMfM
  55726. dcGWxZ0=
  55727. -----END CERTIFICATE-----
  55728. D-TRUST Root Class 3 CA 2 2009
  55729. ==============================
  55730. -----BEGIN CERTIFICATE-----
  55731. MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  55732. DAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTAe
  55733. Fw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NThaME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxE
  55734. LVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIw
  55735. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOAD
  55736. ER03UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42tSHKXzlA
  55737. BF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9RySPocq60vFYJfxLLHLGv
  55738. KZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsMlFqVlNpQmvH/pStmMaTJOKDfHR+4CS7z
  55739. p+hnUquVH+BGPtikw8paxTGA6Eian5Rp/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUC
  55740. AwEAAaOCARowggEWMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ
  55741. 4PGEMA4GA1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVjdG9y
  55742. eS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUyMENBJTIwMiUyMDIw
  55743. MDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRlcmV2b2NhdGlvbmxpc3QwQ6BBoD+G
  55744. PWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAw
  55745. OS5jcmwwDQYJKoZIhvcNAQELBQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm
  55746. 2H6NMLVwMeniacfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0
  55747. o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4KzCUqNQT4YJEV
  55748. dT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8PIWmawomDeCTmGCufsYkl4ph
  55749. X5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3YJohw1+qRzT65ysCQblrGXnRl11z+o+I=
  55750. -----END CERTIFICATE-----
  55751. D-TRUST Root Class 3 CA 2 EV 2009
  55752. =================================
  55753. -----BEGIN CERTIFICATE-----
  55754. MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  55755. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  55756. OTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUwNDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  55757. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  55758. OTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfS
  55759. egpnljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM03TP1YtHh
  55760. zRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6ZqQTMFexgaDbtCHu39b+T
  55761. 7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lRp75mpoo6Kr3HGrHhFPC+Oh25z1uxav60
  55762. sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure35
  55763. 11H3a6UCAwEAAaOCASQwggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyv
  55764. cop9NteaHNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFwOi8v
  55765. ZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xhc3MlMjAzJTIwQ0El
  55766. MjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1ERT9jZXJ0aWZpY2F0ZXJldm9jYXRp
  55767. b25saXN0MEagRKBChkBodHRwOi8vd3d3LmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xh
  55768. c3NfM19jYV8yX2V2XzIwMDkuY3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+
  55769. PPoeUSbrh/Yp3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05
  55770. nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNFCSuGdXzfX2lX
  55771. ANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7naxpeG0ILD5EJt/rDiZE4OJudA
  55772. NCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqXKVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVv
  55773. w9y4AyHqnxbxLFS1
  55774. -----END CERTIFICATE-----
  55775. CA Disig Root R2
  55776. ================
  55777. -----BEGIN CERTIFICATE-----
  55778. MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNVBAYTAlNLMRMw
  55779. EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
  55780. ZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQyMDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sx
  55781. EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
  55782. c2lnIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbC
  55783. w3OeNcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNHPWSb6Wia
  55784. xswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3Ix2ymrdMxp7zo5eFm1tL7
  55785. A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbeQTg06ov80egEFGEtQX6sx3dOy1FU+16S
  55786. GBsEWmjGycT6txOgmLcRK7fWV8x8nhfRyyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqV
  55787. g8NTEQxzHQuyRpDRQjrOQG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa
  55788. 5Beny912H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJQfYE
  55789. koopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUDi/ZnWejBBhG93c+A
  55790. Ak9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORsnLMOPReisjQS1n6yqEm70XooQL6i
  55791. Fh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNV
  55792. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5u
  55793. Qu0wDQYJKoZIhvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM
  55794. tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqfGopTpti72TVV
  55795. sRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkblvdhuDvEK7Z4bLQjb/D907Je
  55796. dR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W8
  55797. 1k/BfDxujRNt+3vrMNDcTa/F1balTFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjx
  55798. mHHEt38OFdAlab0inSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01
  55799. utI3gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18DrG5gPcFw0
  55800. sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3OszMOl6W8KjptlwlCFtaOg
  55801. UxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8xL4ysEr3vQCj8KWefshNPZiTEUxnpHikV
  55802. 7+ZtsH8tZ/3zbBt1RqPlShfppNcL
  55803. -----END CERTIFICATE-----
  55804. ACCVRAIZ1
  55805. =========
  55806. -----BEGIN CERTIFICATE-----
  55807. MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UEAwwJQUNDVlJB
  55808. SVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQswCQYDVQQGEwJFUzAeFw0xMTA1
  55809. MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQBgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwH
  55810. UEtJQUNDVjENMAsGA1UECgwEQUNDVjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  55811. DwAwggIKAoICAQCbqau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gM
  55812. jmoYHtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWoG2ioPej0
  55813. RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpAlHPrzg5XPAOBOp0KoVdD
  55814. aaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhrIA8wKFSVf+DuzgpmndFALW4ir50awQUZ
  55815. 0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDG
  55816. WuzndN9wrqODJerWx5eHk6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs7
  55817. 8yM2x/474KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMOm3WR
  55818. 5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpacXpkatcnYGMN285J
  55819. 9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPluUsXQA+xtrn13k/c4LOsOxFwYIRK
  55820. Q26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYIKwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRw
  55821. Oi8vd3d3LmFjY3YuZXMvZmlsZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEu
  55822. Y3J0MB8GCCsGAQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2
  55823. VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeTVfZW6oHlNsyM
  55824. Hj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIGCCsGAQUFBwICMIIBFB6CARAA
  55825. QQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUAcgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBh
  55826. AO0AegAgAGQAZQAgAGwAYQAgAEEAQwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUA
  55827. YwBuAG8AbABvAGcA7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBj
  55828. AHQAcgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAAQwBQAFMA
  55829. IABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUAczAwBggrBgEFBQcCARYk
  55830. aHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2MuaHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0
  55831. dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRtaW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2
  55832. MV9kZXIuY3JsMA4GA1UdDwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZI
  55833. hvcNAQEFBQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdpD70E
  55834. R9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gUJyCpZET/LtZ1qmxN
  55835. YEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+mAM/EKXMRNt6GGT6d7hmKG9Ww7Y49
  55836. nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepDvV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJ
  55837. TS+xJlsndQAJxGJ3KQhfnlmstn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3
  55838. sCPdK6jT2iWH7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h
  55839. I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szAh1xA2syVP1Xg
  55840. Nce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xFd3+YJ5oyXSrjhO7FmGYvliAd
  55841. 3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2HpPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3p
  55842. EfbRD0tVNEYqi4Y7
  55843. -----END CERTIFICATE-----
  55844. TWCA Global Root CA
  55845. ===================
  55846. -----BEGIN CERTIFICATE-----
  55847. MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcxEjAQBgNVBAoT
  55848. CVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMTVFdDQSBHbG9iYWwgUm9vdCBD
  55849. QTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQK
  55850. EwlUQUlXQU4tQ0ExEDAOBgNVBAsTB1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3Qg
  55851. Q0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2C
  55852. nJfF10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz0ALfUPZV
  55853. r2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfChMBwqoJimFb3u/Rk28OKR
  55854. Q4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbHzIh1HrtsBv+baz4X7GGqcXzGHaL3SekV
  55855. tTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1W
  55856. KKD+u4ZqyPpcC1jcxkt2yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99
  55857. sy2sbZCilaLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYPoA/p
  55858. yJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQABDzfuBSO6N+pjWxn
  55859. kjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcEqYSjMq+u7msXi7Kx/mzhkIyIqJdI
  55860. zshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMC
  55861. AQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6g
  55862. cFGn90xHNcgL1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn
  55863. LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WFH6vPNOw/KP4M
  55864. 8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNoRI2T9GRwoD2dKAXDOXC4Ynsg
  55865. /eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlg
  55866. lPx4mI88k1HtQJAH32RjJMtOcQWh15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryP
  55867. A9gK8kxkRr05YuWW6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3m
  55868. i4TWnsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5jwa19hAM8
  55869. EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWzaGHQRiapIVJpLesux+t3
  55870. zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmyKwbQBM0=
  55871. -----END CERTIFICATE-----
  55872. TeliaSonera Root CA v1
  55873. ======================
  55874. -----BEGIN CERTIFICATE-----
  55875. MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAwNzEUMBIGA1UE
  55876. CgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJvb3QgQ0EgdjEwHhcNMDcxMDE4
  55877. MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwW
  55878. VGVsaWFTb25lcmEgUm9vdCBDQSB2MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+
  55879. 6yfwIaPzaSZVfp3FVRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA
  55880. 3GV17CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+XZ75Ljo1k
  55881. B1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+/jXh7VB7qTCNGdMJjmhn
  55882. Xb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxH
  55883. oLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkmdtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3
  55884. F0fUTPHSiXk+TT2YqGHeOh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJ
  55885. oWjiUIMusDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4pgd7
  55886. gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fsslESl1MpWtTwEhDc
  55887. TwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQarMCpgKIv7NHfirZ1fpoeDVNAgMB
  55888. AAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qW
  55889. DNXr+nuqF+gTEjANBgkqhkiG9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNm
  55890. zqjMDfz1mgbldxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx
  55891. 0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1TjTQpgcmLNkQfW
  55892. pb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBedY2gea+zDTYa4EzAvXUYNR0PV
  55893. G6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpc
  55894. c41teyWRyu5FrgZLAMzTsVlQ2jqIOylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOT
  55895. JsjrDNYmiLbAJM+7vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2
  55896. qReWt88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcnHL/EVlP6
  55897. Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVxSK236thZiNSQvxaz2ems
  55898. WWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY=
  55899. -----END CERTIFICATE-----
  55900. E-Tugra Certification Authority
  55901. ===============================
  55902. -----BEGIN CERTIFICATE-----
  55903. MIIGSzCCBDOgAwIBAgIIamg+nFGby1MwDQYJKoZIhvcNAQELBQAwgbIxCzAJBgNVBAYTAlRSMQ8w
  55904. DQYDVQQHDAZBbmthcmExQDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamls
  55905. ZXJpIHZlIEhpem1ldGxlcmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBN
  55906. ZXJrZXppMSgwJgYDVQQDDB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTEzMDMw
  55907. NTEyMDk0OFoXDTIzMDMwMzEyMDk0OFowgbIxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmEx
  55908. QDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamlsZXJpIHZlIEhpem1ldGxl
  55909. cmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBNZXJrZXppMSgwJgYDVQQD
  55910. DB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  55911. MIICCgKCAgEA4vU/kwVRHoViVF56C/UYB4Oufq9899SKa6VjQzm5S/fDxmSJPZQuVIBSOTkHS0vd
  55912. hQd2h8y/L5VMzH2nPbxHD5hw+IyFHnSOkm0bQNGZDbt1bsipa5rAhDGvykPL6ys06I+XawGb1Q5K
  55913. CKpbknSFQ9OArqGIW66z6l7LFpp3RMih9lRozt6Plyu6W0ACDGQXwLWTzeHxE2bODHnv0ZEoq1+g
  55914. ElIwcxmOj+GMB6LDu0rw6h8VqO4lzKRG+Bsi77MOQ7osJLjFLFzUHPhdZL3Dk14opz8n8Y4e0ypQ
  55915. BaNV2cvnOVPAmJ6MVGKLJrD3fY185MaeZkJVgkfnsliNZvcHfC425lAcP9tDJMW/hkd5s3kc91r0
  55916. E+xs+D/iWR+V7kI+ua2oMoVJl0b+SzGPWsutdEcf6ZG33ygEIqDUD13ieU/qbIWGvaimzuT6w+Gz
  55917. rt48Ue7LE3wBf4QOXVGUnhMMti6lTPk5cDZvlsouDERVxcr6XQKj39ZkjFqzAQqptQpHF//vkUAq
  55918. jqFGOjGY5RH8zLtJVor8udBhmm9lbObDyz51Sf6Pp+KJxWfXnUYTTjF2OySznhFlhqt/7x3U+Lzn
  55919. rFpct1pHXFXOVbQicVtbC/DP3KBhZOqp12gKY6fgDT+gr9Oq0n7vUaDmUStVkhUXU8u3Zg5mTPj5
  55920. dUyQ5xJwx0UCAwEAAaNjMGEwHQYDVR0OBBYEFC7j27JJ0JxUeVz6Jyr+zE7S6E5UMA8GA1UdEwEB
  55921. /wQFMAMBAf8wHwYDVR0jBBgwFoAULuPbsknQnFR5XPonKv7MTtLoTlQwDgYDVR0PAQH/BAQDAgEG
  55922. MA0GCSqGSIb3DQEBCwUAA4ICAQAFNzr0TbdF4kV1JI+2d1LoHNgQk2Xz8lkGpD4eKexd0dCrfOAK
  55923. kEh47U6YA5n+KGCRHTAduGN8qOY1tfrTYXbm1gdLymmasoR6d5NFFxWfJNCYExL/u6Au/U5Mh/jO
  55924. XKqYGwXgAEZKgoClM4so3O0409/lPun++1ndYYRP0lSWE2ETPo+Aab6TR7U1Q9Jauz1c77NCR807
  55925. VRMGsAnb/WP2OogKmW9+4c4bU2pEZiNRCHu8W1Ki/QY3OEBhj0qWuJA3+GbHeJAAFS6LrVE1Uweo
  55926. a2iu+U48BybNCAVwzDk/dr2l02cmAYamU9JgO3xDf1WKvJUawSg5TB9D0pH0clmKuVb8P7Sd2nCc
  55927. dlqMQ1DujjByTd//SffGqWfZbawCEeI6FiWnWAjLb1NBnEg4R2gz0dfHj9R0IdTDBZB6/86WiLEV
  55928. KV0jq9BgoRJP3vQXzTLlyb/IQ639Lo7xr+L0mPoSHyDYwKcMhcWQ9DstliaxLL5Mq+ux0orJ23gT
  55929. Dx4JnW2PAJ8C2sH6H3p6CcRK5ogql5+Ji/03X186zjhZhkuvcQu02PJwT58yE+Owp1fl2tpDy4Q0
  55930. 8ijE6m30Ku/Ba3ba+367hTzSU8JNvnHhRdH9I2cNE3X7z2VnIp2usAnRCf8dNL/+I5c30jn6PQ0G
  55931. C7TbO6Orb1wdtn7os4I07QZcJA==
  55932. -----END CERTIFICATE-----
  55933. T-TeleSec GlobalRoot Class 2
  55934. ============================
  55935. -----BEGIN CERTIFICATE-----
  55936. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  55937. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  55938. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgx
  55939. MDAxMTA0MDE0WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  55940. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  55941. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0GCSqGSIb3
  55942. DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUdAqSzm1nzHoqvNK38DcLZ
  55943. SBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiCFoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/F
  55944. vudocP05l03Sx5iRUKrERLMjfTlH6VJi1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx970
  55945. 2cu+fjOlbpSD8DT6IavqjnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGV
  55946. WOHAD3bZwI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGjQjBA
  55947. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/WSA2AHmgoCJrjNXy
  55948. YdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhyNsZt+U2e+iKo4YFWz827n+qrkRk4
  55949. r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPACuvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNf
  55950. vNoBYimipidx5joifsFvHZVwIEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR
  55951. 3p1m0IvVVGb6g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN
  55952. 9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlPBSeOE6Fuwg==
  55953. -----END CERTIFICATE-----
  55954. Atos TrustedRoot 2011
  55955. =====================
  55956. -----BEGIN CERTIFICATE-----
  55957. MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UEAwwVQXRvcyBU
  55958. cnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0xMTA3MDcxNDU4
  55959. MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMMFUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsG
  55960. A1UECgwEQXRvczELMAkGA1UEBhMCREUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCV
  55961. hTuXbyo7LjvPpvMpNb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr
  55962. 54rMVD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+SZFhyBH+
  55963. DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ4J7sVaE3IqKHBAUsR320
  55964. HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0Lcp2AMBYHlT8oDv3FdU9T1nSatCQujgKR
  55965. z3bFmx5VdJx4IbHwLfELn8LVlhgf8FQieowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7R
  55966. l+lwrrw7GWzbITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZ
  55967. bNshMBgGA1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB
  55968. CwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8jvZfza1zv7v1Apt+h
  55969. k6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kPDpFrdRbhIfzYJsdHt6bPWHJxfrrh
  55970. TZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pcmaHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a9
  55971. 61qn8FYiqTxlVMYVqL2Gns2Dlmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G
  55972. 3mB/ufNPRJLvKrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed
  55973. -----END CERTIFICATE-----
  55974. QuoVadis Root CA 1 G3
  55975. =====================
  55976. -----BEGIN CERTIFICATE-----
  55977. MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQELBQAwSDELMAkG
  55978. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  55979. b3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJN
  55980. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEg
  55981. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakE
  55982. PBtVwedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWerNrwU8lm
  55983. PNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF34168Xfuw6cwI2H44g4hWf6
  55984. Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh4Pw5qlPafX7PGglTvF0FBM+hSo+LdoIN
  55985. ofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXpUhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/l
  55986. g6AnhF4EwfWQvTA9xO+oabw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV
  55987. 7qJZjqlc3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/GKubX
  55988. 9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSthfbZxbGL0eUQMk1f
  55989. iyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KOTk0k+17kBL5yG6YnLUlamXrXXAkg
  55990. t3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOtzCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  55991. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZI
  55992. hvcNAQELBQADggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC
  55993. MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2cDMT/uFPpiN3
  55994. GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUNqXsCHKnQO18LwIE6PWThv6ct
  55995. Tr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP
  55996. +V04ikkwj+3x6xn0dxoxGE1nVGwvb2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh
  55997. 3jRJjehZrJ3ydlo28hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fa
  55998. wx/kNSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNjZgKAvQU6
  55999. O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhpq1467HxpvMc7hU6eFbm0
  56000. FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFtnh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOV
  56001. hMJKzRwuJIczYOXD
  56002. -----END CERTIFICATE-----
  56003. QuoVadis Root CA 2 G3
  56004. =====================
  56005. -----BEGIN CERTIFICATE-----
  56006. MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQELBQAwSDELMAkG
  56007. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  56008. b3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJN
  56009. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIg
  56010. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFh
  56011. ZiFfqq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMWn4rjyduY
  56012. NM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ymc5GQYaYDFCDy54ejiK2t
  56013. oIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+O7q414AB+6XrW7PFXmAqMaCvN+ggOp+o
  56014. MiwMzAkd056OXbxMmO7FGmh77FOm6RQ1o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+l
  56015. V0POKa2Mq1W/xPtbAd0jIaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZo
  56016. L1NesNKqIcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz8eQQ
  56017. sSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43ehvNURG3YBZwjgQQvD
  56018. 6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l7ZizlWNof/k19N+IxWA1ksB8aRxh
  56019. lRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALGcC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  56020. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZI
  56021. hvcNAQELBQADggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66
  56022. AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RCroijQ1h5fq7K
  56023. pVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0GaW/ZZGYjeVYg3UQt4XAoeo0L9
  56024. x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4nlv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgz
  56025. dWqTHBLmYF5vHX/JHyPLhGGfHoJE+V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6X
  56026. U/IyAgkwo1jwDQHVcsaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+Nw
  56027. mNtddbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNgKCLjsZWD
  56028. zYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeMHVOyToV7BjjHLPj4sHKN
  56029. JeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4WSr2Rz0ZiC3oheGe7IUIarFsNMkd7Egr
  56030. O3jtZsSOeWmD3n+M
  56031. -----END CERTIFICATE-----
  56032. QuoVadis Root CA 3 G3
  56033. =====================
  56034. -----BEGIN CERTIFICATE-----
  56035. MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQELBQAwSDELMAkG
  56036. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  56037. b3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJN
  56038. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMg
  56039. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286
  56040. IxSR/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNuFoM7pmRL
  56041. Mon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXRU7Ox7sWTaYI+FrUoRqHe
  56042. 6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+cra1AdHkrAj80//ogaX3T7mH1urPnMNA3
  56043. I4ZyYUUpSFlob3emLoG+B01vr87ERRORFHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3U
  56044. VDmrJqMz6nWB2i3ND0/kA9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f7
  56045. 5li59wzweyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634RylsSqi
  56046. Md5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBpVzgeAVuNVejH38DM
  56047. dyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0QA4XN8f+MFrXBsj6IbGB/kE+V9/Yt
  56048. rQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  56049. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZI
  56050. hvcNAQELBQADggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px
  56051. KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnIFUBhynLWcKzS
  56052. t/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5WvvoxXqA/4Ti2Tk08HS6IT7SdEQ
  56053. TXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFgu/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9Du
  56054. DcpmvJRPpq3t/O5jrFc/ZSXPsoaP0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGib
  56055. Ih6BJpsQBJFxwAYf3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmD
  56056. hPbl8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+DhcI00iX
  56057. 0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HNPlopNLk9hM6xZdRZkZFW
  56058. dSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ywaZWWDYWGWVjUTR939+J399roD1B0y2
  56059. PpxxVJkES/1Y+Zj0
  56060. -----END CERTIFICATE-----
  56061. DigiCert Assured ID Root G2
  56062. ===========================
  56063. -----BEGIN CERTIFICATE-----
  56064. MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQG
  56065. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  56066. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgw
  56067. MTE1MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  56068. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIw
  56069. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSAn61UQbVH
  56070. 35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4HteccbiJVMWWXvdMX0h5i89vq
  56071. bFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9HpEgjAALAcKxHad3A2m67OeYfcgnDmCXRw
  56072. VWmvo2ifv922ebPynXApVfSr/5Vh88lAbx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OP
  56073. YLfykqGxvYmJHzDNw6YuYjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+Rn
  56074. lTGNAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTO
  56075. w0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPIQW5pJ6d1Ee88hjZv
  56076. 0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I0jJmwYrA8y8678Dj1JGG0VDjA9tz
  56077. d29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4GnilmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAW
  56078. hsI6yLETcDbYz+70CjTVW0z9B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0M
  56079. jomZmWzwPDCvON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo
  56080. IhNzbM8m9Yop5w==
  56081. -----END CERTIFICATE-----
  56082. DigiCert Assured ID Root G3
  56083. ===========================
  56084. -----BEGIN CERTIFICATE-----
  56085. MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV
  56086. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYD
  56087. VQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  56088. MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  56089. d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQ
  56090. BgcqhkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJfZn4f5dwb
  56091. RXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17QRSAPWXYQ1qAk8C3eNvJs
  56092. KTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgF
  56093. UaFNN6KDec6NHSrkhDAKBggqhkjOPQQDAwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5Fy
  56094. YZ5eEJJZVrmDxxDnOOlYJjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy
  56095. 1vUhZscv6pZjamVFkpUBtA==
  56096. -----END CERTIFICATE-----
  56097. DigiCert Global Root G2
  56098. =======================
  56099. -----BEGIN CERTIFICATE-----
  56100. MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQG
  56101. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  56102. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUx
  56103. MjAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  56104. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkq
  56105. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI2/Ou8jqJ
  56106. kTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx1x7e/dfgy5SDN67sH0NO
  56107. 3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQq2EGnI/yuum06ZIya7XzV+hdG82MHauV
  56108. BJVJ8zUtluNJbd134/tJS7SsVQepj5WztCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyM
  56109. UNGPHgm+F6HmIcr9g+UQvIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQAB
  56110. o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV5uNu
  56111. 5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY1Yl9PMWLSn/pvtsr
  56112. F9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4NeF22d+mQrvHRAiGfzZ0JFrabA0U
  56113. WTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NGFdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBH
  56114. QRFXGU7Aj64GxJUTFy8bJZ918rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/
  56115. iyK5S9kJRaTepLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl
  56116. MrY=
  56117. -----END CERTIFICATE-----
  56118. DigiCert Global Root G3
  56119. =======================
  56120. -----BEGIN CERTIFICATE-----
  56121. MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQswCQYDVQQGEwJV
  56122. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAwHgYD
  56123. VQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAw
  56124. MDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5k
  56125. aWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0C
  56126. AQYFK4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FGfp4tn+6O
  56127. YwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPOZ9wj/wMco+I+o0IwQDAP
  56128. BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNp
  56129. Yim8S8YwCgYIKoZIzj0EAwMDaAAwZQIxAK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y
  56130. 3maTD/HMsQmP3Wyr+mt/oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34
  56131. VOKa5Vt8sycX
  56132. -----END CERTIFICATE-----
  56133. DigiCert Trusted Root G4
  56134. ========================
  56135. -----BEGIN CERTIFICATE-----
  56136. MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBiMQswCQYDVQQG
  56137. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSEw
  56138. HwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  56139. MTIwMDAwWjBiMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  56140. d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0G
  56141. CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3yithZwuEp
  56142. pz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1Ifxp4VpX6+n6lXFllVcq9o
  56143. k3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDVySAdYyktzuxeTsiT+CFhmzTrBcZe7Fsa
  56144. vOvJz82sNEBfsXpm7nfISKhmV1efVFiODCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGY
  56145. QJB5w3jHtrHEtWoYOAMQjdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6
  56146. MUSaM0C/CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCiEhtm
  56147. mnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADMfRyVw4/3IbKyEbe7
  56148. f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QYuKZ3AeEPlAwhHbJUKSWJbOUOUlFH
  56149. dL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXKchYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8
  56150. oR7FwI+isX4KJpn15GkvmB0t9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud
  56151. DwEB/wQEAwIBhjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD
  56152. ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2SV1EY+CtnJYY
  56153. ZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd+SeuMIW59mdNOj6PWTkiU0Tr
  56154. yF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWcfFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy
  56155. 7zBZLq7gcfJW5GqXb5JQbZaNaHqasjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iah
  56156. ixTXTBmyUEFxPT9NcCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN
  56157. 5r5N0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie4u1Ki7wb
  56158. /UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mIr/OSmbaz5mEP0oUA51Aa
  56159. 5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tK
  56160. G48BtieVU+i2iW1bvGjUI+iLUaJW+fCmgKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP
  56161. 82Z+
  56162. -----END CERTIFICATE-----
  56163. COMODO RSA Certification Authority
  56164. ==================================
  56165. -----BEGIN CERTIFICATE-----
  56166. MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCBhTELMAkGA1UE
  56167. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  56168. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlv
  56169. biBBdXRob3JpdHkwHhcNMTAwMTE5MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMC
  56170. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  56171. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBB
  56172. dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR6FSS0gpWsawNJN3Fz0Rn
  56173. dJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8Xpz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZ
  56174. FGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+
  56175. 5eNu/Nio5JIk2kNrYrhV/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pG
  56176. x8cgoLEfZd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z+pUX
  56177. 2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7wqP/0uK3pN/u6uPQL
  56178. OvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZahSL0896+1DSJMwBGB7FY79tOi4lu3
  56179. sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVICu9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+C
  56180. GCe01a60y1Dma/RMhnEw6abfFobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5
  56181. WdYgGq/yapiqcrxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E
  56182. FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
  56183. DQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvlwFTPoCWOAvn9sKIN9SCYPBMt
  56184. rFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+
  56185. nq6PK7o9mfjYcwlYRm6mnPTXJ9OV2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSg
  56186. tZx8jb8uk2IntznaFxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwW
  56187. sRqZCuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiKboHGhfKp
  56188. pC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmckejkk9u+UJueBPSZI9FoJA
  56189. zMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yLS0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHq
  56190. ZJx64SIDqZxubw5lT2yHh17zbqD5daWbQOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk52
  56191. 7RH89elWsn2/x20Kk4yl0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7I
  56192. LaZRfyHBNVOFBkpdn627G190
  56193. -----END CERTIFICATE-----
  56194. USERTrust RSA Certification Authority
  56195. =====================================
  56196. -----BEGIN CERTIFICATE-----
  56197. MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCBiDELMAkGA1UE
  56198. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  56199. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  56200. dGlvbiBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UE
  56201. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  56202. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  56203. dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCAEmUXNg7D2wiz
  56204. 0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2j
  56205. Y0K2dvKpOyuR+OJv0OwWIJAJPuLodMkYtJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFn
  56206. RghRy4YUVD+8M/5+bJz/Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O
  56207. +T23LLb2VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT79uq
  56208. /nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6c0Plfg6lZrEpfDKE
  56209. Y1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmTYo61Zs8liM2EuLE/pDkP2QKe6xJM
  56210. lXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97lc6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8
  56211. yexDJtC/QV9AqURE9JnnV4eeUB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+
  56212. eLf8ZxXhyVeEHg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd
  56213. BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
  56214. MAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPFUp/L+M+ZBn8b2kMVn54CVVeW
  56215. FPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KOVWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ
  56216. 7l8wXEskEVX/JJpuXior7gtNn3/3ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQ
  56217. Eg9zKC7F4iRO/Fjs8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM
  56218. 8WcRiQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYzeSf7dNXGi
  56219. FSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZXHlKYC6SQK5MNyosycdi
  56220. yA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9c
  56221. J2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRBVXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGw
  56222. sAvgnEzDHNb842m1R0aBL6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gx
  56223. Q+6IHdfGjjxDah2nGN59PRbxYvnKkKj9
  56224. -----END CERTIFICATE-----
  56225. USERTrust ECC Certification Authority
  56226. =====================================
  56227. -----BEGIN CERTIFICATE-----
  56228. MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDELMAkGA1UEBhMC
  56229. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  56230. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  56231. biBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMC
  56232. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  56233. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  56234. biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqfloI+d61SRvU8Za2EurxtW2
  56235. 0eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinngo4N+LZfQYcTxmdwlkWOrfzCjtHDix6Ez
  56236. nPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0GA1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNV
  56237. HQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBB
  56238. HU6+4WMBzzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbWRNZu
  56239. 9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg=
  56240. -----END CERTIFICATE-----
  56241. GlobalSign ECC Root CA - R4
  56242. ===========================
  56243. -----BEGIN CERTIFICATE-----
  56244. MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEkMCIGA1UECxMb
  56245. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  56246. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  56247. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  56248. EwpHbG9iYWxTaWduMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuMZ5049sJQ6fLjkZHAOkrprl
  56249. OQcJFspjsbmG+IpXwVfOQvpzofdlQv8ewQCybnMO/8ch5RikqtlxP6jUuc6MHaNCMEAwDgYDVR0P
  56250. AQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFFSwe61FuOJAf/sKbvu+M8k8o4TV
  56251. MAoGCCqGSM49BAMCA0gAMEUCIQDckqGgE6bPA7DmxCGXkPoUVy0D7O48027KqGx2vKLeuwIgJ6iF
  56252. JzWbVsaj8kfSt24bAgAXqmemFZHe+pTsewv4n4Q=
  56253. -----END CERTIFICATE-----
  56254. GlobalSign ECC Root CA - R5
  56255. ===========================
  56256. -----BEGIN CERTIFICATE-----
  56257. MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEkMCIGA1UECxMb
  56258. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  56259. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  56260. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  56261. EwpHbG9iYWxTaWduMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6
  56262. SFkc8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8kehOvRnkmS
  56263. h5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  56264. BgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYIKoZIzj0EAwMDaAAwZQIxAOVpEslu28Yx
  56265. uglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7
  56266. yFz9SO8NdCKoCOJuxUnOxwy8p2Fp8fc74SrL+SvzZpA3
  56267. -----END CERTIFICATE-----
  56268. Staat der Nederlanden Root CA - G3
  56269. ==================================
  56270. -----BEGIN CERTIFICATE-----
  56271. MIIFdDCCA1ygAwIBAgIEAJiiOTANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  56272. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  56273. Um9vdCBDQSAtIEczMB4XDTEzMTExNDExMjg0MloXDTI4MTExMzIzMDAwMFowWjELMAkGA1UEBhMC
  56274. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  56275. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAL4y
  56276. olQPcPssXFnrbMSkUeiFKrPMSjTysF/zDsccPVMeiAho2G89rcKezIJnByeHaHE6n3WWIkYFsO2t
  56277. x1ueKt6c/DrGlaf1F2cY5y9JCAxcz+bMNO14+1Cx3Gsy8KL+tjzk7FqXxz8ecAgwoNzFs21v0IJy
  56278. EavSgWhZghe3eJJg+szeP4TrjTgzkApyI/o1zCZxMdFyKJLZWyNtZrVtB0LrpjPOktvA9mxjeM3K
  56279. Tj215VKb8b475lRgsGYeCasH/lSJEULR9yS6YHgamPfJEf0WwTUaVHXvQ9Plrk7O53vDxk5hUUur
  56280. mkVLoR9BvUhTFXFkC4az5S6+zqQbwSmEorXLCCN2QyIkHxcE1G6cxvx/K2Ya7Irl1s9N9WMJtxU5
  56281. 1nus6+N86U78dULI7ViVDAZCopz35HCz33JvWjdAidiFpNfxC95DGdRKWCyMijmev4SH8RY7Ngzp
  56282. 07TKbBlBUgmhHbBqv4LvcFEhMtwFdozL92TkA1CvjJFnq8Xy7ljY3r735zHPbMk7ccHViLVlvMDo
  56283. FxcHErVc0qsgk7TmgoNwNsXNo42ti+yjwUOH5kPiNL6VizXtBznaqB16nzaeErAMZRKQFWDZJkBE
  56284. 41ZgpRDUajz9QdwOWke275dhdU/Z/seyHdTtXUmzqWrLZoQT1Vyg3N9udwbRcXXIV2+vD3dbAgMB
  56285. AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRUrfrHkleu
  56286. yjWcLhL75LpdINyUVzANBgkqhkiG9w0BAQsFAAOCAgEAMJmdBTLIXg47mAE6iqTnB/d6+Oea31BD
  56287. U5cqPco8R5gu4RV78ZLzYdqQJRZlwJ9UXQ4DO1t3ApyEtg2YXzTdO2PCwyiBwpwpLiniyMMB8jPq
  56288. KqrMCQj3ZWfGzd/TtiunvczRDnBfuCPRy5FOCvTIeuXZYzbB1N/8Ipf3YF3qKS9Ysr1YvY2WTxB1
  56289. v0h7PVGHoTx0IsL8B3+A3MSs/mrBcDCw6Y5p4ixpgZQJut3+TcCDjJRYwEYgr5wfAvg1VUkvRtTA
  56290. 8KCWAg8zxXHzniN9lLf9OtMJgwYh/WA9rjLA0u6NpvDntIJ8CsxwyXmA+P5M9zWEGYox+wrZ13+b
  56291. 8KKaa8MFSu1BYBQw0aoRQm7TIwIEC8Zl3d1Sd9qBa7Ko+gE4uZbqKmxnl4mUnrzhVNXkanjvSr0r
  56292. mj1AfsbAddJu+2gw7OyLnflJNZoaLNmzlTnVHpL3prllL+U9bTpITAjc5CgSKL59NVzq4BZ+Extq
  56293. 1z7XnvwtdbLBFNUjA9tbbws+eC8N3jONFrdI54OagQ97wUNNVQQXOEpR1VmiiXTTn74eS9fGbbeI
  56294. JG9gkaSChVtWQbzQRKtqE77RLFi3EjNYsjdj3BP1lB0/QFH1T/U67cjF68IeHRaVesd+QnGTbksV
  56295. tzDfqu1XhUisHWrdOWnk4Xl4vs4Fv6EM94B7IWcnMFk=
  56296. -----END CERTIFICATE-----
  56297. Staat der Nederlanden EV Root CA
  56298. ================================
  56299. -----BEGIN CERTIFICATE-----
  56300. MIIFcDCCA1igAwIBAgIEAJiWjTANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQGEwJOTDEeMBwGA1UE
  56301. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSkwJwYDVQQDDCBTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  56302. RVYgUm9vdCBDQTAeFw0xMDEyMDgxMTE5MjlaFw0yMjEyMDgxMTEwMjhaMFgxCzAJBgNVBAYTAk5M
  56303. MR4wHAYDVQQKDBVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xKTAnBgNVBAMMIFN0YWF0IGRlciBOZWRl
  56304. cmxhbmRlbiBFViBSb290IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA48d+ifkk
  56305. SzrSM4M1LGns3Amk41GoJSt5uAg94JG6hIXGhaTK5skuU6TJJB79VWZxXSzFYGgEt9nCUiY4iKTW
  56306. O0Cmws0/zZiTs1QUWJZV1VD+hq2kY39ch/aO5ieSZxeSAgMs3NZmdO3dZ//BYY1jTw+bbRcwJu+r
  56307. 0h8QoPnFfxZpgQNH7R5ojXKhTbImxrpsX23Wr9GxE46prfNeaXUmGD5BKyF/7otdBwadQ8QpCiv8
  56308. Kj6GyzyDOvnJDdrFmeK8eEEzduG/L13lpJhQDBXd4Pqcfzho0LKmeqfRMb1+ilgnQ7O6M5HTp5gV
  56309. XJrm0w912fxBmJc+qiXbj5IusHsMX/FjqTf5m3VpTCgmJdrV8hJwRVXj33NeN/UhbJCONVrJ0yPr
  56310. 08C+eKxCKFhmpUZtcALXEPlLVPxdhkqHz3/KRawRWrUgUY0viEeXOcDPusBCAUCZSCELa6fS/ZbV
  56311. 0b5GnUngC6agIk440ME8MLxwjyx1zNDFjFE7PZQIZCZhfbnDZY8UnCHQqv0XcgOPvZuM5l5Tnrmd
  56312. 74K74bzickFbIZTTRTeU0d8JOV3nI6qaHcptqAqGhYqCvkIH1vI4gnPah1vlPNOePqc7nvQDs/nx
  56313. fRN0Av+7oeX6AHkcpmZBiFxgV6YuCcS6/ZrPpx9Aw7vMWgpVSzs4dlG4Y4uElBbmVvMCAwEAAaNC
  56314. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFP6rAJCYniT8qcwa
  56315. ivsnuL8wbqg7MA0GCSqGSIb3DQEBCwUAA4ICAQDPdyxuVr5Os7aEAJSrR8kN0nbHhp8dB9O2tLsI
  56316. eK9p0gtJ3jPFrK3CiAJ9Brc1AsFgyb/E6JTe1NOpEyVa/m6irn0F3H3zbPB+po3u2dfOWBfoqSmu
  56317. c0iH55vKbimhZF8ZE/euBhD/UcabTVUlT5OZEAFTdfETzsemQUHSv4ilf0X8rLiltTMMgsT7B/Zq
  56318. 5SWEXwbKwYY5EdtYzXc7LMJMD16a4/CrPmEbUCTCwPTxGfARKbalGAKb12NMcIxHowNDXLldRqAN
  56319. b/9Zjr7dn3LDWyvfjFvO5QxGbJKyCqNMVEIYFRIYvdr8unRu/8G2oGTYqV9Vrp9canaW2HNnh/tN
  56320. f1zuacpzEPuKqf2evTY4SUmH9A4U8OmHuD+nT3pajnnUk+S7aFKErGzp85hwVXIy+TSrK0m1zSBi
  56321. 5Dp6Z2Orltxtrpfs/J92VoguZs9btsmksNcFuuEnL5O7Jiqik7Ab846+HUCjuTaPPoIaGl6I6lD4
  56322. WeKDRikL40Rc4ZW2aZCaFG+XroHPaO+Zmr615+F/+PoTRxZMzG0IQOeLeG9QgkRQP2YGiqtDhFZK
  56323. DyAthg710tvSeopLzaXoTvFeJiUBWSOgftL2fiFX1ye8FVdMpEbB4IMeDExNH08GGeL5qPQ6gqGy
  56324. eUN51q1veieQA6TqJIc/2b3Z6fJfUEkc7uzXLg==
  56325. -----END CERTIFICATE-----
  56326. IdenTrust Commercial Root CA 1
  56327. ==============================
  56328. -----BEGIN CERTIFICATE-----
  56329. MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBKMQswCQYDVQQG
  56330. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBS
  56331. b290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQwMTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzES
  56332. MBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENB
  56333. IDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ld
  56334. hNlT3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU+ehcCuz/
  56335. mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gpS0l4PJNgiCL8mdo2yMKi
  56336. 1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1bVoE/c40yiTcdCMbXTMTEl3EASX2MN0C
  56337. XZ/g1Ue9tOsbobtJSdifWwLziuQkkORiT0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl
  56338. 3ZBWzvurpWCdxJ35UrCLvYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzy
  56339. NeVJSQjKVsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZKdHzV
  56340. WYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHTc+XvvqDtMwt0viAg
  56341. xGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hvl7yTmvmcEpB4eoCHFddydJxVdHix
  56342. uuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5NiGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC
  56343. AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZI
  56344. hvcNAQELBQADggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH
  56345. 6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwtLRvM7Kqas6pg
  56346. ghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93nAbowacYXVKV7cndJZ5t+qnt
  56347. ozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3+wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmV
  56348. YjzlVYA211QC//G5Xc7UI2/YRYRKW2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUX
  56349. feu+h1sXIFRRk0pTAwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/ro
  56350. kTLql1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG4iZZRHUe
  56351. 2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZmUlO+KWA2yUPHGNiiskz
  56352. Z2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7R
  56353. cGzM7vRX+Bi6hG6H
  56354. -----END CERTIFICATE-----
  56355. IdenTrust Public Sector Root CA 1
  56356. =================================
  56357. -----BEGIN CERTIFICATE-----
  56358. MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQG
  56359. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3Rv
  56360. ciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcNMzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJV
  56361. UzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBS
  56362. b290IENBIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTy
  56363. P4o7ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGyRBb06tD6
  56364. Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlSbdsHyo+1W/CD80/HLaXI
  56365. rcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF/YTLNiCBWS2ab21ISGHKTN9T0a9SvESf
  56366. qy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoS
  56367. mJxZZoY+rfGwyj4GD3vwEUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFn
  56368. ol57plzy9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9VGxyh
  56369. LrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ2fjXctscvG29ZV/v
  56370. iDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsVWaFHVCkugyhfHMKiq3IXAAaOReyL
  56371. 4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gDW/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8B
  56372. Af8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMw
  56373. DQYJKoZIhvcNAQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj
  56374. t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHVDRDtfULAj+7A
  56375. mgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9TaDKQGXSc3z1i9kKlT/YPyNt
  56376. GtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8GlwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFt
  56377. m6/n6J91eEyrRjuazr8FGF1NFTwWmhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMx
  56378. NRF4eKLg6TCMf4DfWN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4
  56379. Mhn5+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJtshquDDI
  56380. ajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhAGaQdp/lLQzfcaFpPz+vC
  56381. ZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ
  56382. 3Wl9af0AVqW3rLatt8o+Ae+c
  56383. -----END CERTIFICATE-----
  56384. Entrust Root Certification Authority - G2
  56385. =========================================
  56386. -----BEGIN CERTIFICATE-----
  56387. MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMCVVMxFjAUBgNV
  56388. BAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVy
  56389. bXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ug
  56390. b25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIw
  56391. HhcNMDkwNzA3MTcyNTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoT
  56392. DUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMx
  56393. OTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25s
  56394. eTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwggEi
  56395. MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP
  56396. /vaCeb9zYQYKpSfYs1/TRU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXz
  56397. HHfV1IWNcCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hWwcKU
  56398. s/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1U1+cPvQXLOZprE4y
  56399. TGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0jaWvYkxN4FisZDQSA/i2jZRjJKRx
  56400. AgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ6
  56401. 0B7vfec7aVHUbI2fkBJmqzANBgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5Z
  56402. iXMRrEPR9RP/jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ
  56403. Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v1fN2D807iDgi
  56404. nWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4RnAuknZoh8/CbCzB428Hch0P+
  56405. vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmHVHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xO
  56406. e4pIb4tF9g==
  56407. -----END CERTIFICATE-----
  56408. Entrust Root Certification Authority - EC1
  56409. ==========================================
  56410. -----BEGIN CERTIFICATE-----
  56411. MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkGA1UEBhMCVVMx
  56412. FjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVn
  56413. YWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXpl
  56414. ZCB1c2Ugb25seTEzMDEGA1UEAxMqRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  56415. IC0gRUMxMB4XDTEyMTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYw
  56416. FAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2Fs
  56417. LXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQg
  56418. dXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAt
  56419. IEVDMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHy
  56420. AsWfoPZb1YsGGYZPUxBtByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef
  56421. 9eNi1KlHBz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  56422. FLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVCR98crlOZF7ZvHH3h
  56423. vxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nXhTcGtXsI/esni0qU+eH6p44mCOh8
  56424. kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G
  56425. -----END CERTIFICATE-----
  56426. CFCA EV ROOT
  56427. ============
  56428. -----BEGIN CERTIFICATE-----
  56429. MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJDTjEwMC4GA1UE
  56430. CgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNB
  56431. IEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkxMjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEw
  56432. MC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQD
  56433. DAxDRkNBIEVWIFJPT1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnV
  56434. BU03sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpLTIpTUnrD
  56435. 7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5/ZOkVIBMUtRSqy5J35DN
  56436. uF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp7hZZLDRJGqgG16iI0gNyejLi6mhNbiyW
  56437. ZXvKWfry4t3uMCz7zEasxGPrb382KzRzEpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7
  56438. xzbh72fROdOXW3NiGUgthxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9f
  56439. py25IGvPa931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqotaK8K
  56440. gWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNgTnYGmE69g60dWIol
  56441. hdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfVPKPtl8MeNPo4+QgO48BdK4PRVmrJ
  56442. tqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hvcWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAf
  56443. BgNVHSMEGDAWgBTj/i39KNALtbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
  56444. /wQEAwIBBjAdBgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB
  56445. ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObTej/tUxPQ4i9q
  56446. ecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdLjOztUmCypAbqTuv0axn96/Ua
  56447. 4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBSESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sG
  56448. E5uPhnEFtC+NiWYzKXZUmhH4J/qyP5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfX
  56449. BDrDMlI1Dlb4pd19xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjn
  56450. aH9dCi77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN5mydLIhy
  56451. PDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe/v5WOaHIz16eGWRGENoX
  56452. kbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+ZAAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3C
  56453. ekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su
  56454. -----END CERTIFICATE-----
  56455. OISTE WISeKey Global Root GB CA
  56456. ===============================
  56457. -----BEGIN CERTIFICATE-----
  56458. MIIDtTCCAp2gAwIBAgIQdrEgUnTwhYdGs/gjGvbCwDANBgkqhkiG9w0BAQsFADBtMQswCQYDVQQG
  56459. EwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNl
  56460. ZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQiBDQTAeFw0xNDEyMDExNTAw
  56461. MzJaFw0zOTEyMDExNTEwMzFaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYD
  56462. VQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEds
  56463. b2JhbCBSb290IEdCIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Be3HEokKtaX
  56464. scriHvt9OO+Y9bI5mE4nuBFde9IllIiCFSZqGzG7qFshISvYD06fWvGxWuR51jIjK+FTzJlFXHtP
  56465. rby/h0oLS5daqPZI7H17Dc0hBt+eFf1Biki3IPShehtX1F1Q/7pn2COZH8g/497/b1t3sWtuuMlk
  56466. 9+HKQUYOKXHQuSP8yYFfTvdv37+ErXNku7dCjmn21HYdfp2nuFeKUWdy19SouJVUQHMD9ur06/4o
  56467. Qnc/nSMbsrY9gBQHTC5P99UKFg29ZkM3fiNDecNAhvVMKdqOmq0NpQSHiB6F4+lT1ZvIiwNjeOvg
  56468. GUpuuy9rM2RYk61pv48b74JIxwIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB
  56469. /zAdBgNVHQ4EFgQUNQ/INmNe4qPs+TtmFc5RUuORmj0wEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZI
  56470. hvcNAQELBQADggEBAEBM+4eymYGQfp3FsLAmzYh7KzKNbrghcViXfa43FK8+5/ea4n32cZiZBKpD
  56471. dHij40lhPnOMTZTg+XHEthYOU3gf1qKHLwI5gSk8rxWYITD+KJAAjNHhy/peyP34EEY7onhCkRd0
  56472. VQreUGdNZtGn//3ZwLWoo4rOZvUPQ82nK1d7Y0Zqqi5S2PTt4W2tKZB4SLrhI6qjiey1q5bAtEui
  56473. HZeeevJuQHHfaPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic
  56474. Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM=
  56475. -----END CERTIFICATE-----
  56476. SZAFIR ROOT CA2
  56477. ===============
  56478. -----BEGIN CERTIFICATE-----
  56479. MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQELBQAwUTELMAkG
  56480. A1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6ZW5pb3dhIFMuQS4xGDAWBgNV
  56481. BAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkwNzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJ
  56482. BgNVBAYTAlBMMSgwJgYDVQQKDB9LcmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYD
  56483. VQQDDA9TWkFGSVIgUk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5Q
  56484. qEvNQLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT3PSQ1hNK
  56485. DJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw3gAeqDRHu5rr/gsUvTaE
  56486. 2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr63fE9biCloBK0TXC5ztdyO4mTp4CEHCdJ
  56487. ckm1/zuVnsHMyAHs6A6KCpbns6aH5db5BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwi
  56488. ieDhZNRnvDF5YTy7ykHNXGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0P
  56489. AQH/BAQDAgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsFAAOC
  56490. AQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw8PRBEew/R40/cof5
  56491. O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOGnXkZ7/e7DDWQw4rtTw/1zBLZpD67
  56492. oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCPoky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul
  56493. 4+vJhaAlIDf7js4MNIThPIGyd05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6
  56494. +/NNIxuZMzSgLvWpCz/UXeHPhJ/iGcJfitYgHuNztw==
  56495. -----END CERTIFICATE-----
  56496. Certum Trusted Network CA 2
  56497. ===========================
  56498. -----BEGIN CERTIFICATE-----
  56499. MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCBgDELMAkGA1UE
  56500. BhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMuQS4xJzAlBgNVBAsTHkNlcnR1
  56501. bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIGA1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29y
  56502. ayBDQSAyMCIYDzIwMTExMDA2MDgzOTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQ
  56503. TDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENl
  56504. cnRpZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENB
  56505. IDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWADGSdhhuWZGc/IjoedQF9
  56506. 7/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+o
  56507. CgCXhVqqndwpyeI1B+twTUrWwbNWuKFBOJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40b
  56508. Rr5HMNUuctHFY9rnY3lEfktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2p
  56509. uTRZCr+ESv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1mo130
  56510. GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02isx7QBlrd9pPPV3WZ
  56511. 9fqGGmd4s7+W/jTcvedSVuWz5XV710GRBdxdaeOVDUO5/IOWOZV7bIBaTxNyxtd9KXpEulKkKtVB
  56512. Rgkg/iKgtlswjbyJDNXXcPiHUv3a76xRLgezTv7QCdpw75j6VuZt27VXS9zlLCUVyJ4ueE742pye
  56513. hizKV/Ma5ciSixqClnrDvFASadgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vM
  56514. BhBgu4M1t15n3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  56515. AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZI
  56516. hvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQF/xlhMcQSZDe28cmk4gmb3DW
  56517. Al45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTfCVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuA
  56518. L55MYIR4PSFk1vtBHxgP58l1cb29XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMo
  56519. clm2q8KMZiYcdywmdjWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tM
  56520. pkT/WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jbAoJnwTnb
  56521. w3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksqP/ujmv5zMnHCnsZy4Ypo
  56522. J/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Kob7a6bINDd82Kkhehnlt4Fj1F4jNy3eFm
  56523. ypnTycUm/Q1oBEauttmbjL4ZvrHG8hnjXALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLX
  56524. is7VmFxWlgPF7ncGNf/P5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7
  56525. zAYspsbiDrW5viSP
  56526. -----END CERTIFICATE-----
  56527. Hellenic Academic and Research Institutions RootCA 2015
  56528. =======================================================
  56529. -----BEGIN CERTIFICATE-----
  56530. MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcT
  56531. BkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0
  56532. aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNVBAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNl
  56533. YXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIwMTUwHhcNMTUwNzA3MTAxMTIxWhcNNDAwNjMwMTAx
  56534. MTIxWjCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMg
  56535. QWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNV
  56536. BAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIw
  56537. MTUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDC+Kk/G4n8PDwEXT2QNrCROnk8Zlrv
  56538. bTkBSRq0t89/TSNTt5AA4xMqKKYx8ZEA4yjsriFBzh/a/X0SWwGDD7mwX5nh8hKDgE0GPt+sr+eh
  56539. iGsxr/CL0BgzuNtFajT0AoAkKAoCFZVedioNmToUW/bLy1O8E00BiDeUJRtCvCLYjqOWXjrZMts+
  56540. 6PAQZe104S+nfK8nNLspfZu2zwnI5dMK/IhlZXQK3HMcXM1AsRzUtoSMTFDPaI6oWa7CJ06CojXd
  56541. FPQf/7J31Ycvqm59JCfnxssm5uX+Zwdj2EUN3TpZZTlYepKZcj2chF6IIbjV9Cz82XBST3i4vTwr
  56542. i5WY9bPRaM8gFH5MXF/ni+X1NYEZN9cRCLdmvtNKzoNXADrDgfgXy5I2XdGj2HUb4Ysn6npIQf1F
  56543. GQatJ5lOwXBH3bWfgVMS5bGMSF0xQxfjjMZ6Y5ZLKTBOhE5iGV48zpeQpX8B653g+IuJ3SWYPZK2
  56544. fu/Z8VFRfS0myGlZYeCsargqNhEEelC9MoS+L9xy1dcdFkfkR2YgP/SWxa+OAXqlD3pk9Q0Yh9mu
  56545. iNX6hME6wGkoLfINaFGq46V3xqSQDqE3izEjR8EJCOtu93ib14L8hCCZSRm2Ekax+0VVFqmjZayc
  56546. Bw/qa9wfLgZy7IaIEuQt218FL+TwA9MmM+eAws1CoRc0CwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  56547. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUcRVnyMjJvXVdctA4GGqd83EkVAswDQYJKoZI
  56548. hvcNAQELBQADggIBAHW7bVRLqhBYRjTyYtcWNl0IXtVsyIe9tC5G8jH4fOpCtZMWVdyhDBKg2mF+
  56549. D1hYc2Ryx+hFjtyp8iY/xnmMsVMIM4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6HwbISHTGzrM
  56550. d/K4kPFox/la/vot9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkNaeJK9E10A/+y
  56551. d+2VZ5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRGar9KC/eaj8GsGsVn
  56552. 82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnhX9izjFk0WaSrT2y7Hxjb
  56553. davYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQl033DlZdwJVqwjbDG2jJ9SrcR5q+ss7F
  56554. Jej6A7na+RZukYT1HCjI/CbM1xyQVqdfbzoEvM14iQuODy+jqk+iGxI9FghAD/FGTNeqewjBCvVt
  56555. J94Cj8rDtSvK6evIIVM4pcw72Hc3MKJP2W/R8kCtQXoXxdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGa
  56556. JI7ZjnHKe7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODfqiAeW2GFZECpkJcNrVPSWh2HagCXZWK0vm9q
  56557. p/UsQu0yrbYhnr68
  56558. -----END CERTIFICATE-----
  56559. Hellenic Academic and Research Institutions ECC RootCA 2015
  56560. ===========================================================
  56561. -----BEGIN CERTIFICATE-----
  56562. MIICwzCCAkqgAwIBAgIBADAKBggqhkjOPQQDAjCBqjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0
  56563. aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9u
  56564. cyBDZXJ0LiBBdXRob3JpdHkxRDBCBgNVBAMTO0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJj
  56565. aCBJbnN0aXR1dGlvbnMgRUNDIFJvb3RDQSAyMDE1MB4XDTE1MDcwNzEwMzcxMloXDTQwMDYzMDEw
  56566. MzcxMlowgaoxCzAJBgNVBAYTAkdSMQ8wDQYDVQQHEwZBdGhlbnMxRDBCBgNVBAoTO0hlbGxlbmlj
  56567. IEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9yaXR5MUQwQgYD
  56568. VQQDEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIEVDQyBSb290
  56569. Q0EgMjAxNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABJKgQehLgoRc4vgxEZmGZE4JJS+dQS8KrjVP
  56570. dJWyUWRrjWvmP3CV8AVER6ZyOFB2lQJajq4onvktTpnvLEhvTCUp6NFxW98dwXU3tNf6e3pCnGoK
  56571. Vlp8aQuqgAkkbH7BRqNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  56572. BBYEFLQiC4KZJAEOnLvkDv2/+5cgk5kqMAoGCCqGSM49BAMCA2cAMGQCMGfOFmI4oqxiRaeplSTA
  56573. GiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7SofTUwJCA3sS61kFyjn
  56574. dc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR
  56575. -----END CERTIFICATE-----
  56576. ISRG Root X1
  56577. ============
  56578. -----BEGIN CERTIFICATE-----
  56579. MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAwTzELMAkGA1UE
  56580. BhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNoIEdyb3VwMRUwEwYDVQQD
  56581. EwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQG
  56582. EwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMT
  56583. DElTUkcgUm9vdCBYMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54r
  56584. Vygch77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+0TM8ukj1
  56585. 3Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6UA5/TR5d8mUgjU+g4rk8K
  56586. b4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sWT8KOEUt+zwvo/7V3LvSye0rgTBIlDHCN
  56587. Aymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyHB5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ
  56588. 4Q7e2RCOFvu396j3x+UCB5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf
  56589. 1b0SHzUvKBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWnOlFu
  56590. hjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTnjh8BCNAw1FtxNrQH
  56591. usEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbwqHyGO0aoSCqI3Haadr8faqU9GY/r
  56592. OPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CIrU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4G
  56593. A1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY
  56594. 9umbbjANBgkqhkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
  56595. ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ3BebYhtF8GaV
  56596. 0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KKNFtY2PwByVS5uCbMiogziUwt
  56597. hDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJw
  56598. TdwJx4nLCgdNbOhdjsnvzqvHu7UrTkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nx
  56599. e5AW0wdeRlN8NwdCjNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZA
  56600. JzVcoyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq4RgqsahD
  56601. YVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPAmRGunUHBcnWEvgJBQl9n
  56602. JEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57demyPxgcYxn/eR44/KJ4EBs+lVDR3veyJ
  56603. m+kXQ99b21/+jh5Xos1AnX5iItreGCc=
  56604. -----END CERTIFICATE-----
  56605. AC RAIZ FNMT-RCM
  56606. ================
  56607. -----BEGIN CERTIFICATE-----
  56608. MIIFgzCCA2ugAwIBAgIPXZONMGc2yAYdGsdUhGkHMA0GCSqGSIb3DQEBCwUAMDsxCzAJBgNVBAYT
  56609. AkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTAeFw0wODEw
  56610. MjkxNTU5NTZaFw0zMDAxMDEwMDAwMDBaMDsxCzAJBgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJD
  56611. TTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  56612. ggIBALpxgHpMhm5/yBNtwMZ9HACXjywMI7sQmkCpGreHiPibVmr75nuOi5KOpyVdWRHbNi63URcf
  56613. qQgfBBckWKo3Shjf5TnUV/3XwSyRAZHiItQDwFj8d0fsjz50Q7qsNI1NOHZnjrDIbzAzWHFctPVr
  56614. btQBULgTfmxKo0nRIBnuvMApGGWn3v7v3QqQIecaZ5JCEJhfTzC8PhxFtBDXaEAUwED653cXeuYL
  56615. j2VbPNmaUtu1vZ5Gzz3rkQUCwJaydkxNEJY7kvqcfw+Z374jNUUeAlz+taibmSXaXvMiwzn15Cou
  56616. 08YfxGyqxRxqAQVKL9LFwag0Jl1mpdICIfkYtwb1TplvqKtMUejPUBjFd8g5CSxJkjKZqLsXF3mw
  56617. WsXmo8RZZUc1g16p6DULmbvkzSDGm0oGObVo/CK67lWMK07q87Hj/LaZmtVC+nFNCM+HHmpxffnT
  56618. tOmlcYF7wk5HlqX2doWjKI/pgG6BU6VtX7hI+cL5NqYuSf+4lsKMB7ObiFj86xsc3i1w4peSMKGJ
  56619. 47xVqCfWS+2QrYv6YyVZLag13cqXM7zlzced0ezvXg5KkAYmY6252TUtB7p2ZSysV4999AeU14EC
  56620. ll2jB0nVetBX+RvnU0Z1qrB5QstocQjpYL05ac70r8NWQMetUqIJ5G+GR4of6ygnXYMgrwTJbFaa
  56621. i0b1AgMBAAGjgYMwgYAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE
  56622. FPd9xf3E6Jobd2Sn9R2gzL+HYJptMD4GA1UdIAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1o
  56623. dHRwOi8vd3d3LmNlcnQuZm5tdC5lcy9kcGNzLzANBgkqhkiG9w0BAQsFAAOCAgEAB5BK3/MjTvDD
  56624. nFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1RXxlDPiyN8+s
  56625. D8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYMLVN0V2Ue1bLdI4E7pWYjJ2cJ
  56626. j+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrT
  56627. Qfv6MooqtyuGC2mDOL7Nii4LcK2NJpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW
  56628. +YJF1DngoABd15jmfZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7
  56629. Ixjp6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp1txyM/1d
  56630. 8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B9kiABdcPUXmsEKvU7ANm
  56631. 5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wokRqEIr9baRRmW1FMdW4R58MD3R++Lj8UG
  56632. rp1MYp3/RgT408m2ECVAdf4WqslKYIYvuu8wd+RU4riEmViAqhOLUTpPSPaLtrM=
  56633. -----END CERTIFICATE-----
  56634. Amazon Root CA 1
  56635. ================
  56636. -----BEGIN CERTIFICATE-----
  56637. MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsFADA5MQswCQYD
  56638. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAxMB4XDTE1
  56639. MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  56640. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  56641. ggEBALJ4gHHKeNXjca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgH
  56642. FzZM9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qwIFAGbHrQ
  56643. gLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6VOujw5H5SNz/0egwLX0t
  56644. dHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L93FcXmn/6pUCyziKrlA4b9v7LWIbxcce
  56645. VOF34GfID5yHI9Y/QCB/IIDEgEw+OyQmjgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB
  56646. /zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3
  56647. DQEBCwUAA4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDIU5PM
  56648. CCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUsN+gDS63pYaACbvXy
  56649. 8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vvo/ufQJVtMVT8QtPHRh8jrdkPSHCa
  56650. 2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2
  56651. xJNDd2ZhwLnoQdeXeGADbkpyrqXRfboQnoZsG4q5WTP468SQvvG5
  56652. -----END CERTIFICATE-----
  56653. Amazon Root CA 2
  56654. ================
  56655. -----BEGIN CERTIFICATE-----
  56656. MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwFADA5MQswCQYD
  56657. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAyMB4XDTE1
  56658. MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  56659. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  56660. ggIBAK2Wny2cSkxKgXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4
  56661. kHbZW0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg1dKmSYXp
  56662. N+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K8nu+NQWpEjTj82R0Yiw9
  56663. AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvd
  56664. fLC6HM783k81ds8P+HgfajZRRidhW+mez/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAEx
  56665. kv8LV/SasrlX6avvDXbR8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSS
  56666. btqDT6ZjmUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz7Mt0
  56667. Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6+XUyo05f7O0oYtlN
  56668. c/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI0u1ufm8/0i2BWSlmy5A5lREedCf+
  56669. 3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSw
  56670. DPBMMPQFWAJI/TPlUq9LhONmUjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oA
  56671. A7CXDpO8Wqj2LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY
  56672. +gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kSk5Nrp+gvU5LE
  56673. YFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl7uxMMne0nxrpS10gxdr9HIcW
  56674. xkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygmbtmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQ
  56675. gj9sAq+uEjonljYE1x2igGOpm/HlurR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbW
  56676. aQbLU8uz/mtBzUF+fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoV
  56677. Yh63n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE76KlXIx3
  56678. KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H9jVlpNMKVv/1F2Rs76gi
  56679. JUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT4PsJYGw=
  56680. -----END CERTIFICATE-----
  56681. Amazon Root CA 3
  56682. ================
  56683. -----BEGIN CERTIFICATE-----
  56684. MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5MQswCQYDVQQG
  56685. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAzMB4XDTE1MDUy
  56686. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  56687. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZB
  56688. f8ANm+gBG1bG8lKlui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjr
  56689. Zt6jQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSrttvXBp43
  56690. rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkrBqWTrBqYaGFy+uGh0Psc
  56691. eGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteMYyRIHN8wfdVoOw==
  56692. -----END CERTIFICATE-----
  56693. Amazon Root CA 4
  56694. ================
  56695. -----BEGIN CERTIFICATE-----
  56696. MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5MQswCQYDVQQG
  56697. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSA0MB4XDTE1MDUy
  56698. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  56699. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN
  56700. /sGKe0uoe0ZLY7Bi9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri
  56701. 83BkM6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
  56702. HQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WBMAoGCCqGSM49BAMDA2gA
  56703. MGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlwCkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1
  56704. AE47xDqUEpHJWEadIRNyp4iciuRMStuW1KyLa2tJElMzrdfkviT8tQp21KW8EA==
  56705. -----END CERTIFICATE-----
  56706. LuxTrust Global Root 2
  56707. ======================
  56708. -----BEGIN CERTIFICATE-----
  56709. MIIFwzCCA6ugAwIBAgIUCn6m30tEntpqJIWe5rgV0xZ/u7EwDQYJKoZIhvcNAQELBQAwRjELMAkG
  56710. A1UEBhMCTFUxFjAUBgNVBAoMDUx1eFRydXN0IFMuQS4xHzAdBgNVBAMMFkx1eFRydXN0IEdsb2Jh
  56711. bCBSb290IDIwHhcNMTUwMzA1MTMyMTU3WhcNMzUwMzA1MTMyMTU3WjBGMQswCQYDVQQGEwJMVTEW
  56712. MBQGA1UECgwNTHV4VHJ1c3QgUy5BLjEfMB0GA1UEAwwWTHV4VHJ1c3QgR2xvYmFsIFJvb3QgMjCC
  56713. AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANeFl78RmOnwYoNMPIf5U2o3C/IPPIfOb9wm
  56714. Kb3FibrJgz337spbxm1Jc7TJRqMbNBM/wYlFV/TZsfs2ZUv7COJIcRHIbjuend+JZTemhfY7RBi2
  56715. xjcwYkSSl2l9QjAk5A0MiWtj3sXh306pFGxT4GHO9hcvHTy95iJMHZP1EMShduxq3sVs35a0VkBC
  56716. wGKSMKEtFZSg0iAGCW5qbeXrt77U8PEVfIvmTroTzEsnXpk8F12PgX8zPU/TPxvsXD/wPEx1bvKm
  56717. 1Z3aLQdjAsZy6ZS8TEmVT4hSyNvoaYL4zDRbIvCGp4m9SAptZoFtyMhk+wHh9OHe2Z7d21vUKpkm
  56718. FRseTJIpgp7VkoGSQXAZ96Tlk0u8d2cx3Rz9MXANF5kM+Qw5GSoXtTBxVdUPrljhPS80m8+f9niF
  56719. wpN6cj5mj5wWEWCPnolvZ77gR1o7DJpni89Gxq44o/KnvObWhWszJHAiS8sIm7vI+AIpHb4gDEa/
  56720. a4ebsypmQjVGbKq6rfmYe+lQVRQxv7HaLe2ArWgk+2mr2HETMOZns4dA/Yl+8kPREd8vZS9kzl8U
  56721. ubG/Mb2HeFpZZYiq/FkySIbWTLkpS5XTdvN3JW1CHDiDTf2jX5t/Lax5Gw5CMZdjpPuKadUiDTSQ
  56722. MC6otOBttpSsvItO13D8xTiOZCXhTTmQzsmHhFhxAgMBAAGjgagwgaUwDwYDVR0TAQH/BAUwAwEB
  56723. /zBCBgNVHSAEOzA5MDcGByuBKwEBAQowLDAqBggrBgEFBQcCARYeaHR0cHM6Ly9yZXBvc2l0b3J5
  56724. Lmx1eHRydXN0Lmx1MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBT/GCh2+UgFLKGu8SsbK7JT
  56725. +Et8szAdBgNVHQ4EFgQU/xgodvlIBSyhrvErGyuyU/hLfLMwDQYJKoZIhvcNAQELBQADggIBAGoZ
  56726. FO1uecEsh9QNcH7X9njJCwROxLHOk3D+sFTAMs2ZMGQXvw/l4jP9BzZAcg4atmpZ1gDlaCDdLnIN
  56727. H2pkMSCEfUmmWjfrRcmF9dTHF5kH5ptV5AzoqbTOjFu1EVzPig4N1qx3gf4ynCSecs5U89BvolbW
  56728. 7MM3LGVYvlcAGvI1+ut7MV3CwRI9loGIlonBWVx65n9wNOeD4rHh4bhY79SV5GCc8JaXcozrhAIu
  56729. ZY+kt9J/Z93I055cqqmkoCUUBpvsT34tC38ddfEz2O3OuHVtPlu5mB0xDVbYQw8wkbIEa91WvpWA
  56730. VWe+2M2D2RjuLg+GLZKecBPs3lHJQ3gCpU3I+V/EkVhGFndadKpAvAefMLmx9xIX3eP/JEAdemrR
  56731. TxgKqpAd60Ae36EeRJIQmvKN4dFLRp7oRUKX6kWZ8+xm1QL68qZKJKrezrnK+T+Tb/mjuuqlPpmt
  56732. /f97mfVl7vBZKGfXkJWkE4SphMHozs51k2MavDzq1WQfLSoSOcbDWjLtR5EWDrw4wVDej8oqkDQc
  56733. 7kGUnF4ZLvhFSZl0kbAEb+MEWrGrKqv+x9CWttrhSmQGbmBNvUJO/3jaJMobtNeWOWyu8Q6qp31I
  56734. iyBMz2TWuJdGsE7RKlY6oJO9r4Ak4Ap+58rVyuiFVdw2KuGUaJPHZnJED4AhMmwlxyOAgwrr
  56735. -----END CERTIFICATE-----
  56736. TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1
  56737. =============================================
  56738. -----BEGIN CERTIFICATE-----
  56739. MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIxGDAWBgNVBAcT
  56740. D0dlYnplIC0gS29jYWVsaTFCMEAGA1UEChM5VHVya2l5ZSBCaWxpbXNlbCB2ZSBUZWtub2xvamlr
  56741. IEFyYXN0aXJtYSBLdXJ1bXUgLSBUVUJJVEFLMS0wKwYDVQQLEyRLYW11IFNlcnRpZmlrYXN5b24g
  56742. TWVya2V6aSAtIEthbXUgU00xNjA0BgNVBAMTLVRVQklUQUsgS2FtdSBTTSBTU0wgS29rIFNlcnRp
  56743. ZmlrYXNpIC0gU3VydW0gMTAeFw0xMzExMjUwODI1NTVaFw00MzEwMjUwODI1NTVaMIHSMQswCQYD
  56744. VQQGEwJUUjEYMBYGA1UEBxMPR2ViemUgLSBLb2NhZWxpMUIwQAYDVQQKEzlUdXJraXllIEJpbGlt
  56745. c2VsIHZlIFRla25vbG9qaWsgQXJhc3Rpcm1hIEt1cnVtdSAtIFRVQklUQUsxLTArBgNVBAsTJEth
  56746. bXUgU2VydGlmaWthc3lvbiBNZXJrZXppIC0gS2FtdSBTTTE2MDQGA1UEAxMtVFVCSVRBSyBLYW11
  56747. IFNNIFNTTCBLb2sgU2VydGlmaWthc2kgLSBTdXJ1bSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  56748. MIIBCgKCAQEAr3UwM6q7a9OZLBI3hNmNe5eA027n/5tQlT6QlVZC1xl8JoSNkvoBHToP4mQ4t4y8
  56749. 6Ij5iySrLqP1N+RAjhgleYN1Hzv/bKjFxlb4tO2KRKOrbEz8HdDc72i9z+SqzvBV96I01INrN3wc
  56750. wv61A+xXzry0tcXtAA9TNypN9E8Mg/uGz8v+jE69h/mniyFXnHrfA2eJLJ2XYacQuFWQfw4tJzh0
  56751. 3+f92k4S400VIgLI4OD8D62K18lUUMw7D8oWgITQUVbDjlZ/iSIzL+aFCr2lqBs23tPcLG07xxO9
  56752. WSMs5uWk99gL7eqQQESolbuT1dCANLZGeA4fAJNG4e7p+exPFwIDAQABo0IwQDAdBgNVHQ4EFgQU
  56753. ZT/HiobGPN08VFw1+DrtUgxHV8gwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJ
  56754. KoZIhvcNAQELBQADggEBACo/4fEyjq7hmFxLXs9rHmoJ0iKpEsdeV31zVmSAhHqT5Am5EM2fKifh
  56755. AHe+SMg1qIGf5LgsyX8OsNJLN13qudULXjS99HMpw+0mFZx+CFOKWI3QSyjfwbPfIPP54+M638yc
  56756. lNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4lzwDGrpDxpa5RXI4s6ehlj2R
  56757. e37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0j
  56758. q5Rm+K37DwhuJi1/FwcJsoz7UMCflo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM=
  56759. -----END CERTIFICATE-----
  56760. GDCA TrustAUTH R5 ROOT
  56761. ======================
  56762. -----BEGIN CERTIFICATE-----
  56763. MIIFiDCCA3CgAwIBAgIIfQmX/vBH6nowDQYJKoZIhvcNAQELBQAwYjELMAkGA1UEBhMCQ04xMjAw
  56764. BgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZIENPLixMVEQuMR8wHQYDVQQD
  56765. DBZHRENBIFRydXN0QVVUSCBSNSBST09UMB4XDTE0MTEyNjA1MTMxNVoXDTQwMTIzMTE1NTk1OVow
  56766. YjELMAkGA1UEBhMCQ04xMjAwBgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZ
  56767. IENPLixMVEQuMR8wHQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMIICIjANBgkqhkiG9w0B
  56768. AQEFAAOCAg8AMIICCgKCAgEA2aMW8Mh0dHeb7zMNOwZ+Vfy1YI92hhJCfVZmPoiC7XJjDp6L3TQs
  56769. AlFRwxn9WVSEyfFrs0yw6ehGXTjGoqcuEVe6ghWinI9tsJlKCvLriXBjTnnEt1u9ol2x8kECK62p
  56770. OqPseQrsXzrj/e+APK00mxqriCZ7VqKChh/rNYmDf1+uKU49tm7srsHwJ5uu4/Ts765/94Y9cnrr
  56771. pftZTqfrlYwiOXnhLQiPzLyRuEH3FMEjqcOtmkVEs7LXLM3GKeJQEK5cy4KOFxg2fZfmiJqwTTQJ
  56772. 9Cy5WmYqsBebnh52nUpmMUHfP/vFBu8btn4aRjb3ZGM74zkYI+dndRTVdVeSN72+ahsmUPI2JgaQ
  56773. xXABZG12ZuGR224HwGGALrIuL4xwp9E7PLOR5G62xDtw8mySlwnNR30YwPO7ng/Wi64HtloPzgsM
  56774. R6flPri9fcebNaBhlzpBdRfMK5Z3KpIhHtmVdiBnaM8Nvd/WHwlqmuLMc3GkL30SgLdTMEZeS1SZ
  56775. D2fJpcjyIMGC7J0R38IC+xo70e0gmu9lZJIQDSri3nDxGGeCjGHeuLzRL5z7D9Ar7Rt2ueQ5Vfj4
  56776. oR24qoAATILnsn8JuLwwoC8N9VKejveSswoAHQBUlwbgsQfZxw9cZX08bVlX5O2ljelAU58VS6Bx
  56777. 9hoh49pwBiFYFIeFd3mqgnkCAwEAAaNCMEAwHQYDVR0OBBYEFOLJQJ9NzuiaoXzPDj9lxSmIahlR
  56778. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQDRSVfg
  56779. p8xoWLoBDysZzY2wYUWsEe1jUGn4H3++Fo/9nesLqjJHdtJnJO29fDMylyrHBYZmDRd9FBUb1Ov9
  56780. H5r2XpdptxolpAqzkT9fNqyL7FeoPueBihhXOYV0GkLH6VsTX4/5COmSdI31R9KrO9b7eGZONn35
  56781. 6ZLpBN79SWP8bfsUcZNnL0dKt7n/HipzcEYwv1ryL3ml4Y0M2fmyYzeMN2WFcGpcWwlyua1jPLHd
  56782. +PwyvzeG5LuOmCd+uh8W4XAR8gPfJWIyJyYYMoSf/wA6E7qaTfRPuBRwIrHKK5DOKcFw9C+df/KQ
  56783. HtZa37dG/OaG+svgIHZ6uqbL9XzeYqWxi+7egmaKTjowHz+Ay60nugxe19CxVsp3cbK1daFQqUBD
  56784. F8Io2c9Si1vIY9RCPqAzekYu9wogRlR+ak8x8YF+QnQ4ZXMn7sZ8uI7XpTrXmKGcjBBV09tL7ECQ
  56785. 8s1uV9JiDnxXk7Gnbc2dg7sq5+W2O3FYrf3RRbxake5TFW/TRQl1brqQXR4EzzffHqhmsYzmIGrv
  56786. /EhOdJhCrylvLmrH+33RZjEizIYAfmaDDEL0vTSSwxrqT8p+ck0LcIymSLumoRT2+1hEmRSuqguT
  56787. aaApJUqlyyvdimYHFngVV3Eb7PVHhPOeMTd61X8kreS8/f3MboPoDKi3QWwH3b08hpcv0g==
  56788. -----END CERTIFICATE-----
  56789. TrustCor RootCert CA-1
  56790. ======================
  56791. -----BEGIN CERTIFICATE-----
  56792. MIIEMDCCAxigAwIBAgIJANqb7HHzA7AZMA0GCSqGSIb3DQEBCwUAMIGkMQswCQYDVQQGEwJQQTEP
  56793. MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
  56794. U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
  56795. dHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0IENBLTEwHhcNMTYwMjA0MTIzMjE2WhcNMjkx
  56796. MjMxMTcyMzE2WjCBpDELMAkGA1UEBhMCUEExDzANBgNVBAgMBlBhbmFtYTEUMBIGA1UEBwwLUGFu
  56797. YW1hIENpdHkxJDAiBgNVBAoMG1RydXN0Q29yIFN5c3RlbXMgUy4gZGUgUi5MLjEnMCUGA1UECwwe
  56798. VHJ1c3RDb3IgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MR8wHQYDVQQDDBZUcnVzdENvciBSb290Q2Vy
  56799. dCBDQS0xMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv463leLCJhJrMxnHQFgKq1mq
  56800. jQCj/IDHUHuO1CAmujIS2CNUSSUQIpidRtLByZ5OGy4sDjjzGiVoHKZaBeYei0i/mJZ0PmnK6bV4
  56801. pQa81QBeCQryJ3pS/C3Vseq0iWEk8xoT26nPUu0MJLq5nux+AHT6k61sKZKuUbS701e/s/OojZz0
  56802. JEsq1pme9J7+wH5COucLlVPat2gOkEz7cD+PSiyU8ybdY2mplNgQTsVHCJCZGxdNuWxu72CVEY4h
  56803. gLW9oHPY0LJ3xEXqWib7ZnZ2+AYfYW0PVcWDtxBWcgYHpfOxGgMFZA6dWorWhnAbJN7+KIor0Gqw
  56804. /Hqi3LJ5DotlDwIDAQABo2MwYTAdBgNVHQ4EFgQU7mtJPHo/DeOxCbeKyKsZn3MzUOcwHwYDVR0j
  56805. BBgwFoAU7mtJPHo/DeOxCbeKyKsZn3MzUOcwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  56806. AYYwDQYJKoZIhvcNAQELBQADggEBACUY1JGPE+6PHh0RU9otRCkZoB5rMZ5NDp6tPVxBb5UrJKF5
  56807. mDo4Nvu7Zp5I/5CQ7z3UuJu0h3U/IJvOcs+hVcFNZKIZBqEHMwwLKeXx6quj7LUKdJDHfXLy11yf
  56808. ke+Ri7fc7Waiz45mO7yfOgLgJ90WmMCV1Aqk5IGadZQ1nJBfiDcGrVmVCrDRZ9MZyonnMlo2HD6C
  56809. qFqTvsbQZJG2z9m2GM/bftJlo6bEjhcxwft+dtvTheNYsnd6djtsL1Ac59v2Z3kf9YKVmgenFK+P
  56810. 3CghZwnS1k1aHBkcjndcw5QkPTJrS37UeJSDvjdNzl/HHk484IkzlQsPpTLWPFp5LBk=
  56811. -----END CERTIFICATE-----
  56812. TrustCor RootCert CA-2
  56813. ======================
  56814. -----BEGIN CERTIFICATE-----
  56815. MIIGLzCCBBegAwIBAgIIJaHfyjPLWQIwDQYJKoZIhvcNAQELBQAwgaQxCzAJBgNVBAYTAlBBMQ8w
  56816. DQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5MSQwIgYDVQQKDBtUcnVzdENvciBT
  56817. eXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29yIENlcnRpZmljYXRlIEF1dGhvcml0
  56818. eTEfMB0GA1UEAwwWVHJ1c3RDb3IgUm9vdENlcnQgQ0EtMjAeFw0xNjAyMDQxMjMyMjNaFw0zNDEy
  56819. MzExNzI2MzlaMIGkMQswCQYDVQQGEwJQQTEPMA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5h
  56820. bWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3IgU3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5U
  56821. cnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0
  56822. IENBLTIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnIG7CKqJiJJWQdsg4foDSq8Gb
  56823. ZQWU9MEKENUCrO2fk8eHyLAnK0IMPQo+QVqedd2NyuCb7GgypGmSaIwLgQ5WoD4a3SwlFIIvl9Nk
  56824. RvRUqdw6VC0xK5mC8tkq1+9xALgxpL56JAfDQiDyitSSBBtlVkxs1Pu2YVpHI7TYabS3OtB0PAx1
  56825. oYxOdqHp2yqlO/rOsP9+aij9JxzIsekp8VduZLTQwRVtDr4uDkbIXvRR/u8OYzo7cbrPb1nKDOOb
  56826. XUm4TOJXsZiKQlecdu/vvdFoqNL0Cbt3Nb4lggjEFixEIFapRBF37120Hapeaz6LMvYHL1cEksr1
  56827. /p3C6eizjkxLAjHZ5DxIgif3GIJ2SDpxsROhOdUuxTTCHWKF3wP+TfSvPd9cW436cOGlfifHhi5q
  56828. jxLGhF5DUVCcGZt45vz27Ud+ez1m7xMTiF88oWP7+ayHNZ/zgp6kPwqcMWmLmaSISo5uZk3vFsQP
  56829. eSghYA2FFn3XVDjxklb9tTNMg9zXEJ9L/cb4Qr26fHMC4P99zVvh1Kxhe1fVSntb1IVYJ12/+Ctg
  56830. rKAmrhQhJ8Z3mjOAPF5GP/fDsaOGM8boXg25NSyqRsGFAnWAoOsk+xWq5Gd/bnc/9ASKL3x74xdh
  56831. 8N0JqSDIvgmk0H5Ew7IwSjiqqewYmgeCK9u4nBit2uBGF6zPXQIDAQABo2MwYTAdBgNVHQ4EFgQU
  56832. 2f4hQG6UnrybPZx9mCAZ5YwwYrIwHwYDVR0jBBgwFoAU2f4hQG6UnrybPZx9mCAZ5YwwYrIwDwYD
  56833. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQELBQADggIBAJ5Fngw7tu/h
  56834. Osh80QA9z+LqBrWyOrsGS2h60COXdKcs8AjYeVrXWoSK2BKaG9l9XE1wxaX5q+WjiYndAfrs3fnp
  56835. kpfbsEZC89NiqpX+MWcUaViQCqoL7jcjx1BRtPV+nuN79+TMQjItSQzL/0kMmx40/W5ulop5A7Zv
  56836. 2wnL/V9lFDfhOPXzYRZY5LVtDQsEGz9QLX+zx3oaFoBg+Iof6Rsqxvm6ARppv9JYx1RXCI/hOWB3
  56837. S6xZhBqI8d3LT3jX5+EzLfzuQfogsL7L9ziUwOHQhQ+77Sxzq+3+knYaZH9bDTMJBzN7Bj8RpFxw
  56838. PIXAz+OQqIN3+tvmxYxoZxBnpVIt8MSZj3+/0WvitUfW2dCFmU2Umw9Lje4AWkcdEQOsQRivh7dv
  56839. DDqPys/cA8GiCcjl/YBeyGBCARsaU1q7N6a3vLqE6R5sGtRk2tRD/pOLS/IseRYQ1JMLiI+h2IYU
  56840. RpFHmygk71dSTlxCnKr3Sewn6EAes6aJInKc9Q0ztFijMDvd1GpUk74aTfOTlPf8hAs/hCBcNANE
  56841. xdqtvArBAs8e5ZTZ845b2EzwnexhF7sUMlQMAimTHpKG9n/v55IFDlndmQguLvqcAFLTxWYp5KeX
  56842. RKQOKIETNcX2b2TmQcTVL8w0RSXPQQCWPUouwpaYT05KnJe32x+SMsj/D1Fu1uwJ
  56843. -----END CERTIFICATE-----
  56844. TrustCor ECA-1
  56845. ==============
  56846. -----BEGIN CERTIFICATE-----
  56847. MIIEIDCCAwigAwIBAgIJAISCLF8cYtBAMA0GCSqGSIb3DQEBCwUAMIGcMQswCQYDVQQGEwJQQTEP
  56848. MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
  56849. U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
  56850. dHkxFzAVBgNVBAMMDlRydXN0Q29yIEVDQS0xMB4XDTE2MDIwNDEyMzIzM1oXDTI5MTIzMTE3Mjgw
  56851. N1owgZwxCzAJBgNVBAYTAlBBMQ8wDQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5
  56852. MSQwIgYDVQQKDBtUcnVzdENvciBTeXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29y
  56853. IENlcnRpZmljYXRlIEF1dGhvcml0eTEXMBUGA1UEAwwOVHJ1c3RDb3IgRUNBLTEwggEiMA0GCSqG
  56854. SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDPj+ARtZ+odnbb3w9U73NjKYKtR8aja+3+XzP4Q1HpGjOR
  56855. MRegdMTUpwHmspI+ap3tDvl0mEDTPwOABoJA6LHip1GnHYMma6ve+heRK9jGrB6xnhkB1Zem6g23
  56856. xFUfJ3zSCNV2HykVh0A53ThFEXXQmqc04L/NyFIduUd+Dbi7xgz2c1cWWn5DkR9VOsZtRASqnKmc
  56857. p0yJF4OuowReUoCLHhIlERnXDH19MURB6tuvsBzvgdAsxZohmz3tQjtQJvLsznFhBmIhVE5/wZ0+
  56858. fyCMgMsq2JdiyIMzkX2woloPV+g7zPIlstR8L+xNxqE6FXrntl019fZISjZFZtS6mFjBAgMBAAGj
  56859. YzBhMB0GA1UdDgQWBBREnkj1zG1I1KBLf/5ZJC+Dl5mahjAfBgNVHSMEGDAWgBREnkj1zG1I1KBL
  56860. f/5ZJC+Dl5mahjAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsF
  56861. AAOCAQEABT41XBVwm8nHc2FvcivUwo/yQ10CzsSUuZQRg2dd4mdsdXa/uwyqNsatR5Nj3B5+1t4u
  56862. /ukZMjgDfxT2AHMsWbEhBuH7rBiVDKP/mZb3Kyeb1STMHd3BOuCYRLDE5D53sXOpZCz2HAF8P11F
  56863. hcCF5yWPldwX8zyfGm6wyuMdKulMY/okYWLW2n62HGz1Ah3UKt1VkOsqEUc8Ll50soIipX1TH0Xs
  56864. J5F95yIW6MBoNtjG8U+ARDL54dHRHareqKucBK+tIA5kmE2la8BIWJZpTdwHjFGTot+fDz2LYLSC
  56865. jaoITmJF4PkL0uDgPFveXHEnJcLmA4GLEFPjx1WitJ/X5g==
  56866. -----END CERTIFICATE-----
  56867. SSL.com Root Certification Authority RSA
  56868. ========================================
  56869. -----BEGIN CERTIFICATE-----
  56870. MIIF3TCCA8WgAwIBAgIIeyyb0xaAMpkwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UEBhMCVVMxDjAM
  56871. BgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24x
  56872. MTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBSU0EwHhcNMTYw
  56873. MjEyMTczOTM5WhcNNDEwMjEyMTczOTM5WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  56874. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NM
  56875. LmNvbSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTCCAiIwDQYJKoZIhvcNAQEBBQAD
  56876. ggIPADCCAgoCggIBAPkP3aMrfcvQKv7sZ4Wm5y4bunfh4/WvpOz6Sl2RxFdHaxh3a3by/ZPkPQ/C
  56877. Fp4LZsNWlJ4Xg4XOVu/yFv0AYvUiCVToZRdOQbngT0aXqhvIuG5iXmmxX9sqAn78bMrzQdjt0Oj8
  56878. P2FI7bADFB0QDksZ4LtO7IZl/zbzXmcCC52GVWH9ejjt/uIZALdvoVBidXQ8oPrIJZK0bnoix/ge
  56879. oeOy3ZExqysdBP+lSgQ36YWkMyv94tZVNHwZpEpox7Ko07fKoZOI68GXvIz5HdkihCR0xwQ9aqkp
  56880. k8zruFvh/l8lqjRYyMEjVJ0bmBHDOJx+PYZspQ9AhnwC9FwCTyjLrnGfDzrIM/4RJTXq/LrFYD3Z
  56881. fBjVsqnTdXgDciLKOsMf7yzlLqn6niy2UUb9rwPW6mBo6oUWNmuF6R7As93EJNyAKoFBbZQ+yODJ
  56882. gUEAnl6/f8UImKIYLEJAs/lvOCdLToD0PYFH4Ih86hzOtXVcUS4cK38acijnALXRdMbX5J+tB5O2
  56883. UzU1/Dfkw/ZdFr4hc96SCvigY2q8lpJqPvi8ZVWb3vUNiSYE/CUapiVpy8JtynziWV+XrOvvLsi8
  56884. 1xtZPCvM8hnIk2snYxnP/Okm+Mpxm3+T/jRnhE6Z6/yzeAkzcLpmpnbtG3PrGqUNxCITIJRWCk4s
  56885. bE6x/c+cCbqiM+2HAgMBAAGjYzBhMB0GA1UdDgQWBBTdBAkHovV6fVJTEpKV7jiAJQ2mWTAPBgNV
  56886. HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFN0ECQei9Xp9UlMSkpXuOIAlDaZZMA4GA1UdDwEB/wQE
  56887. AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAIBgRlCn7Jp0cHh5wYfGVcpNxJK1ok1iOMq8bs3AD/CUr
  56888. dIWQPXhq9LmLpZc7tRiRux6n+UBbkflVma8eEdBcHadm47GUBwwyOabqG7B52B2ccETjit3E+ZUf
  56889. ijhDPwGFpUenPUayvOUiaPd7nNgsPgohyC0zrL/FgZkxdMF1ccW+sfAjRfSda/wZY52jvATGGAsl
  56890. u1OJD7OAUN5F7kR/q5R4ZJjT9ijdh9hwZXT7DrkT66cPYakylszeu+1jTBi7qUD3oFRuIIhxdRjq
  56891. erQ0cuAjJ3dctpDqhiVAq+8zD8ufgr6iIPv2tS0a5sKFsXQP+8hlAqRSAUfdSSLBv9jra6x+3uxj
  56892. MxW3IwiPxg+NQVrdjsW5j+VFP3jbutIbQLH+cU0/4IGiul607BXgk90IH37hVZkLId6Tngr75qNJ
  56893. vTYw/ud3sqB1l7UtgYgXZSD32pAAn8lSzDLKNXz1PQ/YK9f1JmzJBjSWFupwWRoyeXkLtoh/D1JI
  56894. Pb9s2KJELtFOt3JY04kTlf5Eq/jXixtunLwsoFvVagCvXzfh1foQC5ichucmj87w7G6KVwuA406y
  56895. wKBjYZC6VWg3dGq2ktufoYYitmUnDuy2n0Jg5GfCtdpBC8TTi2EbvPofkSvXRAdeuims2cXp71NI
  56896. WuuA8ShYIc2wBlX7Jz9TkHCpBB5XJ7k=
  56897. -----END CERTIFICATE-----
  56898. SSL.com Root Certification Authority ECC
  56899. ========================================
  56900. -----BEGIN CERTIFICATE-----
  56901. MIICjTCCAhSgAwIBAgIIdebfy8FoW6gwCgYIKoZIzj0EAwIwfDELMAkGA1UEBhMCVVMxDjAMBgNV
  56902. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xMTAv
  56903. BgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEy
  56904. MTgxNDAzWhcNNDEwMjEyMTgxNDAzWjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAO
  56905. BgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNv
  56906. bSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuBBAAiA2IA
  56907. BEVuqVDEpiM2nl8ojRfLliJkP9x6jh3MCLOicSS6jkm5BBtHllirLZXI7Z4INcgn64mMU1jrYor+
  56908. 8FsPazFSY0E7ic3s7LaNGdM0B9y7xgZ/wkWV7Mt/qCPgCemB+vNH06NjMGEwHQYDVR0OBBYEFILR
  56909. hXMw5zUE044CkvvlpNHEIejNMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUgtGFczDnNQTT
  56910. jgKS++Wk0cQh6M0wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2cAMGQCMG/n61kRpGDPYbCW
  56911. e+0F+S8Tkdzt5fxQaxFGRrMcIQBiu77D5+jNB5n5DQtdcj7EqgIwH7y6C+IwJPt8bYBVCpk+gA0z
  56912. 5Wajs6O7pdWLjwkspl1+4vAHCGht0nxpbl/f5Wpl
  56913. -----END CERTIFICATE-----
  56914. SSL.com EV Root Certification Authority RSA R2
  56915. ==============================================
  56916. -----BEGIN CERTIFICATE-----
  56917. MIIF6zCCA9OgAwIBAgIIVrYpzTS8ePYwDQYJKoZIhvcNAQELBQAwgYIxCzAJBgNVBAYTAlVTMQ4w
  56918. DAYDVQQIDAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9u
  56919. MTcwNQYDVQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIy
  56920. MB4XDTE3MDUzMTE4MTQzN1oXDTQyMDUzMDE4MTQzN1owgYIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQI
  56921. DAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMTcwNQYD
  56922. VQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIyMIICIjAN
  56923. BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAjzZlQOHWTcDXtOlG2mvqM0fNTPl9fb69LT3w23jh
  56924. hqXZuglXaO1XPqDQCEGD5yhBJB/jchXQARr7XnAjssufOePPxU7Gkm0mxnu7s9onnQqG6YE3Bf7w
  56925. cXHswxzpY6IXFJ3vG2fThVUCAtZJycxa4bH3bzKfydQ7iEGonL3Lq9ttewkfokxykNorCPzPPFTO
  56926. Zw+oz12WGQvE43LrrdF9HSfvkusQv1vrO6/PgN3B0pYEW3p+pKk8OHakYo6gOV7qd89dAFmPZiw+
  56927. B6KjBSYRaZfqhbcPlgtLyEDhULouisv3D5oi53+aNxPN8k0TayHRwMwi8qFG9kRpnMphNQcAb9Zh
  56928. CBHqurj26bNg5U257J8UZslXWNvNh2n4ioYSA0e/ZhN2rHd9NCSFg83XqpyQGp8hLH94t2S42Oim
  56929. 9HizVcuE0jLEeK6jj2HdzghTreyI/BXkmg3mnxp3zkyPuBQVPWKchjgGAGYS5Fl2WlPAApiiECto
  56930. RHuOec4zSnaqW4EWG7WK2NAAe15itAnWhmMOpgWVSbooi4iTsjQc2KRVbrcc0N6ZVTsj9CLg+Slm
  56931. JuwgUHfbSguPvuUCYHBBXtSuUDkiFCbLsjtzdFVHB3mBOagwE0TlBIqulhMlQg+5U8Sb/M3kHN48
  56932. +qvWBkofZ6aYMBzdLNvcGJVXZsb/XItW9XcCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNV
  56933. HSMEGDAWgBT5YLvU49U09rj1BoAlp3PbRmmonjAdBgNVHQ4EFgQU+WC71OPVNPa49QaAJadz20Zp
  56934. qJ4wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBWs47LCp1Jjr+kxJG7ZhcFUZh1
  56935. ++VQLHqe8RT6q9OKPv+RKY9ji9i0qVQBDb6Thi/5Sm3HXvVX+cpVHBK+Rw82xd9qt9t1wkclf7nx
  56936. Y/hoLVUE0fKNsKTPvDxeH3jnpaAgcLAExbf3cqfeIg29MyVGjGSSJuM+LmOW2puMPfgYCdcDzH2G
  56937. guDKBAdRUNf/ktUM79qGn5nX67evaOI5JpS6aLe/g9Pqemc9YmeuJeVy6OLk7K4S9ksrPJ/psEDz
  56938. OFSz/bdoyNrGj1E8svuR3Bznm53htw1yj+KkxKl4+esUrMZDBcJlOSgYAsOCsp0FvmXtll9ldDz7
  56939. CTUue5wT/RsPXcdtgTpWD8w74a8CLyKsRspGPKAcTNZEtF4uXBVmCeEmKf7GUmG6sXP/wwyc5Wxq
  56940. lD8UykAWlYTzWamsX0xhk23RO8yilQwipmdnRC652dKKQbNmC1r7fSOl8hqw/96bg5Qu0T/fkreR
  56941. rwU7ZcegbLHNYhLDkBvjJc40vG93drEQw/cFGsDWr3RiSBd3kmmQYRzelYB0VI8YHMPzA9C/pEN1
  56942. hlMYegouCRw2n5H9gooiS9EOUCXdywMMF8mDAAhONU2Ki+3wApRmLER/y5UnlhetCTCstnEXbosX
  56943. 9hwJ1C07mKVx01QT2WDz9UtmT/rx7iASjbSsV7FFY6GsdqnC+w==
  56944. -----END CERTIFICATE-----
  56945. SSL.com EV Root Certification Authority ECC
  56946. ===========================================
  56947. -----BEGIN CERTIFICATE-----
  56948. MIIClDCCAhqgAwIBAgIILCmcWxbtBZUwCgYIKoZIzj0EAwIwfzELMAkGA1UEBhMCVVMxDjAMBgNV
  56949. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xNDAy
  56950. BgNVBAMMK1NTTC5jb20gRVYgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYw
  56951. MjEyMTgxNTIzWhcNNDEwMjEyMTgxNTIzWjB/MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  56952. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjE0MDIGA1UEAwwrU1NM
  56953. LmNvbSBFViBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuB
  56954. BAAiA2IABKoSR5CYG/vvw0AHgyBO8TCCogbR8pKGYfL2IWjKAMTH6kMAVIbc/R/fALhBYlzccBYy
  56955. 3h+Z1MzFB8gIH2EWB1E9fVwHU+M1OIzfzZ/ZLg1KthkuWnBaBu2+8KGwytAJKaNjMGEwHQYDVR0O
  56956. BBYEFFvKXuXe0oGqzagtZFG22XKbl+ZPMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUW8pe
  56957. 5d7SgarNqC1kUbbZcpuX5k8wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2gAMGUCMQCK5kCJ
  56958. N+vp1RPZytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZgh5Mm
  56959. m7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg==
  56960. -----END CERTIFICATE-----
  56961. GlobalSign Root CA - R6
  56962. =======================
  56963. -----BEGIN CERTIFICATE-----
  56964. MIIFgzCCA2ugAwIBAgIORea7A4Mzw4VlSOb/RVEwDQYJKoZIhvcNAQEMBQAwTDEgMB4GA1UECxMX
  56965. R2xvYmFsU2lnbiBSb290IENBIC0gUjYxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkds
  56966. b2JhbFNpZ24wHhcNMTQxMjEwMDAwMDAwWhcNMzQxMjEwMDAwMDAwWjBMMSAwHgYDVQQLExdHbG9i
  56967. YWxTaWduIFJvb3QgQ0EgLSBSNjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFs
  56968. U2lnbjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAJUH6HPKZvnsFMp7PPcNCPG0RQss
  56969. grRIxutbPK6DuEGSMxSkb3/pKszGsIhrxbaJ0cay/xTOURQh7ErdG1rG1ofuTToVBu1kZguSgMpE
  56970. 3nOUTvOniX9PeGMIyBJQbUJmL025eShNUhqKGoC3GYEOfsSKvGRMIRxDaNc9PIrFsmbVkJq3MQbF
  56971. vuJtMgamHvm566qjuL++gmNQ0PAYid/kD3n16qIfKtJwLnvnvJO7bVPiSHyMEAc4/2ayd2F+4OqM
  56972. PKq0pPbzlUoSB239jLKJz9CgYXfIWHSw1CM69106yqLbnQneXUQtkPGBzVeS+n68UARjNN9rkxi+
  56973. azayOeSsJDa38O+2HBNXk7besvjihbdzorg1qkXy4J02oW9UivFyVm4uiMVRQkQVlO6jxTiWm05O
  56974. WgtH8wY2SXcwvHE35absIQh1/OZhFj931dmRl4QKbNQCTXTAFO39OfuD8l4UoQSwC+n+7o/hbguy
  56975. CLNhZglqsQY6ZZZZwPA1/cnaKI0aEYdwgQqomnUdnjqGBQCe24DWJfncBZ4nWUx2OVvq+aWh2IMP
  56976. 0f/fMBH5hc8zSPXKbWQULHpYT9NLCEnFlWQaYw55PfWzjMpYrZxCRXluDocZXFSxZba/jJvcE+kN
  56977. b7gu3GduyYsRtYQUigAZcIN5kZeR1BonvzceMgfYFGM8KEyvAgMBAAGjYzBhMA4GA1UdDwEB/wQE
  56978. AwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSubAWjkxPioufi1xzWx/B/yGdToDAfBgNV
  56979. HSMEGDAWgBSubAWjkxPioufi1xzWx/B/yGdToDANBgkqhkiG9w0BAQwFAAOCAgEAgyXt6NH9lVLN
  56980. nsAEoJFp5lzQhN7craJP6Ed41mWYqVuoPId8AorRbrcWc+ZfwFSY1XS+wc3iEZGtIxg93eFyRJa0
  56981. lV7Ae46ZeBZDE1ZXs6KzO7V33EByrKPrmzU+sQghoefEQzd5Mr6155wsTLxDKZmOMNOsIeDjHfrY
  56982. BzN2VAAiKrlNIC5waNrlU/yDXNOd8v9EDERm8tLjvUYAGm0CuiVdjaExUd1URhxN25mW7xocBFym
  56983. Fe944Hn+Xds+qkxV/ZoVqW/hpvvfcDDpw+5CRu3CkwWJ+n1jez/QcYF8AOiYrg54NMMl+68KnyBr
  56984. 3TsTjxKM4kEaSHpzoHdpx7Zcf4LIHv5YGygrqGytXm3ABdJ7t+uA/iU3/gKbaKxCXcPu9czc8FB1
  56985. 0jZpnOZ7BN9uBmm23goJSFmH63sUYHpkqmlD75HHTOwY3WzvUy2MmeFe8nI+z1TIvWfspA9MRf/T
  56986. uTAjB0yPEL+GltmZWrSZVxykzLsViVO6LAUP5MSeGbEYNNVMnbrt9x+vJJUEeKgDu+6B5dpffItK
  56987. oZB0JaezPkvILFa9x8jvOOJckvB595yEunQtYQEgfn7R8k8HWV+LLUNS60YMlOH1Zkd5d9VUWx+t
  56988. JDfLRVpOoERIyNiwmcUVhAn21klJwGW45hpxbqCo8YLoRT5s1gLXCmeDBVrJpBA=
  56989. -----END CERTIFICATE-----
  56990. OISTE WISeKey Global Root GC CA
  56991. ===============================
  56992. -----BEGIN CERTIFICATE-----
  56993. MIICaTCCAe+gAwIBAgIQISpWDK7aDKtARb8roi066jAKBggqhkjOPQQDAzBtMQswCQYDVQQGEwJD
  56994. SDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEo
  56995. MCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQyBDQTAeFw0xNzA1MDkwOTQ4MzRa
  56996. Fw00MjA1MDkwOTU4MzNaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQL
  56997. ExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2Jh
  56998. bCBSb290IEdDIENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAETOlQwMYPchi82PG6s4nieUqjFqdr
  56999. VCTbUf/q9Akkwwsin8tqJ4KBDdLArzHkdIJuyiXZjHWd8dvQmqJLIX4Wp2OQ0jnUsYd4XxiWD1Ab
  57000. NTcPasbc2RNNpI6QN+a9WzGRo1QwUjAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  57001. BgNVHQ4EFgQUSIcUrOPDnpBgOtfKie7TrYy0UGYwEAYJKwYBBAGCNxUBBAMCAQAwCgYIKoZIzj0E
  57002. AwMDaAAwZQIwJsdpW9zV57LnyAyMjMPdeYwbY9XJUpROTYJKcx6ygISpJcBMWm1JKWB4E+J+SOtk
  57003. AjEA2zQgMgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9
  57004. -----END CERTIFICATE-----
  57005. GTS Root R1
  57006. ===========
  57007. -----BEGIN CERTIFICATE-----
  57008. MIIFWjCCA0KgAwIBAgIQbkepxUtHDA3sM9CJuRz04TANBgkqhkiG9w0BAQwFADBHMQswCQYDVQQG
  57009. EwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJv
  57010. b3QgUjEwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAG
  57011. A1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjEwggIi
  57012. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2EQKLHuOhd5s73L+UPreVp0A8of2C+X0yBoJx
  57013. 9vaMf/vo27xqLpeXo4xL+Sv2sfnOhB2x+cWX3u+58qPpvBKJXqeqUqv4IyfLpLGcY9vXmX7wCl7r
  57014. aKb0xlpHDU0QM+NOsROjyBhsS+z8CZDfnWQpJSMHobTSPS5g4M/SCYe7zUjwTcLCeoiKu7rPWRnW
  57015. r4+wB7CeMfGCwcDfLqZtbBkOtdh+JhpFAz2weaSUKK0PfyblqAj+lug8aJRT7oM6iCsVlgmy4HqM
  57016. LnXWnOunVmSPlk9orj2XwoSPwLxAwAtcvfaHszVsrBhQf4TgTM2S0yDpM7xSma8ytSmzJSq0SPly
  57017. 4cpk9+aCEI3oncKKiPo4Zor8Y/kB+Xj9e1x3+naH+uzfsQ55lVe0vSbv1gHR6xYKu44LtcXFilWr
  57018. 06zqkUspzBmkMiVOKvFlRNACzqrOSbTqn3yDsEB750Orp2yjj32JgfpMpf/VjsPOS+C12LOORc92
  57019. wO1AK/1TD7Cn1TsNsYqiA94xrcx36m97PtbfkSIS5r762DL8EGMUUXLeXdYWk70paDPvOmbsB4om
  57020. 3xPXV2V4J95eSRQAogB/mqghtqmxlbCluQ0WEdrHbEg8QOB+DVrNVjzRlwW5y0vtOUucxD/SVRNu
  57021. JLDWcfr0wbrM7Rv1/oFB2ACYPTrIrnqYNxgFlQIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD
  57022. VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU5K8rJnEaK0gnhS9SZizv8IkTcT4wDQYJKoZIhvcNAQEM
  57023. BQADggIBADiWCu49tJYeX++dnAsznyvgyv3SjgofQXSlfKqE1OXyHuY3UjKcC9FhHb8owbZEKTV1
  57024. d5iyfNm9dKyKaOOpMQkpAWBz40d8U6iQSifvS9efk+eCNs6aaAyC58/UEBZvXw6ZXPYfcX3v73sv
  57025. fuo21pdwCxXu11xWajOl40k4DLh9+42FpLFZXvRq4d2h9mREruZRgyFmxhE+885H7pwoHyXa/6xm
  57026. ld01D1zvICxi/ZG6qcz8WpyTgYMpl0p8WnK0OdC3d8t5/Wk6kjftbjhlRn7pYL15iJdfOBL07q9b
  57027. gsiG1eGZbYwE8na6SfZu6W0eX6DvJ4J2QPim01hcDyxC2kLGe4g0x8HYRZvBPsVhHdljUEn2NIVq
  57028. 4BjFbkerQUIpm/ZgDdIx02OYI5NaAIFItO/Nis3Jz5nu2Z6qNuFoS3FJFDYoOj0dzpqPJeaAcWEr
  57029. tXvM+SUWgeExX6GjfhaknBZqlxi9dnKlC54dNuYvoS++cJEPqOba+MSSQGwlfnuzCdyyF62ARPBo
  57030. pY+Udf90WuioAnwMCeKpSwughQtiue+hMZL77/ZRBIls6Kl0obsXs7X9SQ98POyDGCBDTtWTurQ0
  57031. sR8WNh8M5mQ5Fkzc4P4dyKliPUDqysU0ArSuiYgzNdwsE3PYJ/HQcu51OyLemGhmW/HGY0dVHLql
  57032. CFF1pkgl
  57033. -----END CERTIFICATE-----
  57034. GTS Root R2
  57035. ===========
  57036. -----BEGIN CERTIFICATE-----
  57037. MIIFWjCCA0KgAwIBAgIQbkepxlqz5yDFMJo/aFLybzANBgkqhkiG9w0BAQwFADBHMQswCQYDVQQG
  57038. EwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJv
  57039. b3QgUjIwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAG
  57040. A1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwggIi
  57041. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDO3v2m++zsFDQ8BwZabFn3GTXd98GdVarTzTuk
  57042. k3LvCvptnfbwhYBboUhSnznFt+4orO/LdmgUud+tAWyZH8QiHZ/+cnfgLFuv5AS/T3KgGjSY6Dlo
  57043. 7JUle3ah5mm5hRm9iYz+re026nO8/4Piy33B0s5Ks40FnotJk9/BW9BuXvAuMC6C/Pq8tBcKSOWI
  57044. m8Wba96wyrQD8Nr0kLhlZPdcTK3ofmZemde4wj7I0BOdre7kRXuJVfeKH2JShBKzwkCX44ofR5Gm
  57045. dFrS+LFjKBC4swm4VndAoiaYecb+3yXuPuWgf9RhD1FLPD+M2uFwdNjCaKH5wQzpoeJ/u1U8dgbu
  57046. ak7MkogwTZq9TwtImoS1mKPV+3PBV2HdKFZ1E66HjucMUQkQdYhMvI35ezzUIkgfKtzra7tEscsz
  57047. cTJGr61K8YzodDqs5xoic4DSMPclQsciOzsSrZYuxsN2B6ogtzVJV+mSSeh2FnIxZyuWfoqjx5RW
  57048. Ir9qS34BIbIjMt/kmkRtWVtd9QCgHJvGeJeNkP+byKq0rxFROV7Z+2et1VsRnTKaG73Vululycsl
  57049. aVNVJ1zgyjbLiGH7HrfQy+4W+9OmTN6SpdTi3/UGVN4unUu0kzCqgc7dGtxRcw1PcOnlthYhGXmy
  57050. 5okLdWTK1au8CcEYof/UVKGFPP0UJAOyh9OktwIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD
  57051. VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUu//KjiOfT5nK2+JopqUVJxce2Q4wDQYJKoZIhvcNAQEM
  57052. BQADggIBALZp8KZ3/p7uC4Gt4cCpx/k1HUCCq+YEtN/L9x0Pg/B+E02NjO7jMyLDOfxA325BS0JT
  57053. vhaI8dI4XsRomRyYUpOM52jtG2pzegVATX9lO9ZY8c6DR2Dj/5epnGB3GFW1fgiTz9D2PGcDFWEJ
  57054. +YF59exTpJ/JjwGLc8R3dtyDovUMSRqodt6Sm2T4syzFJ9MHwAiApJiS4wGWAqoC7o87xdFtCjMw
  57055. c3i5T1QWvwsHoaRc5svJXISPD+AVdyx+Jn7axEvbpxZ3B7DNdehyQtaVhJ2Gg/LkkM0JR9SLA3Da
  57056. WsYDQvTtN6LwG1BUSw7YhN4ZKJmBR64JGz9I0cNv4rBgF/XuIwKl2gBbbZCr7qLpGzvpx0QnRY5r
  57057. n/WkhLx3+WuXrD5RRaIRpsyF7gpo8j5QOHokYh4XIDdtak23CZvJ/KRY9bb7nE4Yu5UC56Gtmwfu
  57058. Nmsk0jmGwZODUNKBRqhfYlcsu2xkiAhu7xNUX90txGdj08+JN7+dIPT7eoOboB6BAFDC5AwiWVIQ
  57059. 7UNWhwD4FFKnHYuTjKJNRn8nxnGbJN7k2oaLDX5rIMHAnuFl2GqjpuiFizoHCBy69Y9Vmhh1fuXs
  57060. gWbRIXOhNUQLgD1bnF5vKheW0YMjiGZt5obicDIvUiLnyOd/xCxgXS/Dr55FBcOEArf9LAhST4Ld
  57061. o/DUhgkC
  57062. -----END CERTIFICATE-----
  57063. GTS Root R3
  57064. ===========
  57065. -----BEGIN CERTIFICATE-----
  57066. MIICDDCCAZGgAwIBAgIQbkepx2ypcyRAiQ8DVd2NHTAKBggqhkjOPQQDAzBHMQswCQYDVQQGEwJV
  57067. UzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3Qg
  57068. UjMwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UE
  57069. ChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjMwdjAQBgcq
  57070. hkjOPQIBBgUrgQQAIgNiAAQfTzOHMymKoYTey8chWEGJ6ladK0uFxh1MJ7x/JlFyb+Kf1qPKzEUU
  57071. Rout736GjOyxfi//qXGdGIRFBEFVbivqJn+7kAHjSxm65FSWRQmx1WyRRK2EE46ajA2ADDL24Cej
  57072. QjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTB8Sa6oC2uhYHP
  57073. 0/EqEr24Cmf9vDAKBggqhkjOPQQDAwNpADBmAjEAgFukfCPAlaUs3L6JbyO5o91lAFJekazInXJ0
  57074. glMLfalAvWhgxeG4VDvBNhcl2MG9AjEAnjWSdIUlUfUk7GRSJFClH9voy8l27OyCbvWFGFPouOOa
  57075. KaqW04MjyaR7YbPMAuhd
  57076. -----END CERTIFICATE-----
  57077. GTS Root R4
  57078. ===========
  57079. -----BEGIN CERTIFICATE-----
  57080. MIICCjCCAZGgAwIBAgIQbkepyIuUtui7OyrYorLBmTAKBggqhkjOPQQDAzBHMQswCQYDVQQGEwJV
  57081. UzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3Qg
  57082. UjQwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UE
  57083. ChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQwdjAQBgcq
  57084. hkjOPQIBBgUrgQQAIgNiAATzdHOnaItgrkO4NcWBMHtLSZ37wWHO5t5GvWvVYRg1rkDdc/eJkTBa
  57085. 6zzuhXyiQHY7qca4R9gq55KRanPpsXI5nymfopjTX15YhmUPoYRlBtHci8nHc8iMai/lxKvRHYqj
  57086. QjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSATNbrdP9JNqPV
  57087. 2Py1PsVq8JQdjDAKBggqhkjOPQQDAwNnADBkAjBqUFJ0CMRw3J5QdCHojXohw0+WbhXRIjVhLfoI
  57088. N+4Zba3bssx9BzT1YBkstTTZbyACMANxsbqjYAuG7ZoIapVon+Kz4ZNkfF6Tpt95LY2F45TPI11x
  57089. zPKwTdb+mciUqXWi4w==
  57090. -----END CERTIFICATE-----
  57091. UCA Global G2 Root
  57092. ==================
  57093. -----BEGIN CERTIFICATE-----
  57094. MIIFRjCCAy6gAwIBAgIQXd+x2lqj7V2+WmUgZQOQ7zANBgkqhkiG9w0BAQsFADA9MQswCQYDVQQG
  57095. EwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxGzAZBgNVBAMMElVDQSBHbG9iYWwgRzIgUm9vdDAeFw0x
  57096. NjAzMTEwMDAwMDBaFw00MDEyMzEwMDAwMDBaMD0xCzAJBgNVBAYTAkNOMREwDwYDVQQKDAhVbmlU
  57097. cnVzdDEbMBkGA1UEAwwSVUNBIEdsb2JhbCBHMiBSb290MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  57098. MIICCgKCAgEAxeYrb3zvJgUno4Ek2m/LAfmZmqkywiKHYUGRO8vDaBsGxUypK8FnFyIdK+35KYmT
  57099. oni9kmugow2ifsqTs6bRjDXVdfkX9s9FxeV67HeToI8jrg4aA3++1NDtLnurRiNb/yzmVHqUwCoV
  57100. 8MmNsHo7JOHXaOIxPAYzRrZUEaalLyJUKlgNAQLx+hVRZ2zA+te2G3/RVogvGjqNO7uCEeBHANBS
  57101. h6v7hn4PJGtAnTRnvI3HLYZveT6OqTwXS3+wmeOwcWDcC/Vkw85DvG1xudLeJ1uK6NjGruFZfc8o
  57102. LTW4lVYa8bJYS7cSN8h8s+1LgOGN+jIjtm+3SJUIsUROhYw6AlQgL9+/V087OpAh18EmNVQg7Mc/
  57103. R+zvWr9LesGtOxdQXGLYD0tK3Cv6brxzks3sx1DoQZbXqX5t2Okdj4q1uViSukqSKwxW/YDrCPBe
  57104. KW4bHAyvj5OJrdu9o54hyokZ7N+1wxrrFv54NkzWbtA+FxyQF2smuvt6L78RHBgOLXMDj6DlNaBa
  57105. 4kx1HXHhOThTeEDMg5PXCp6dW4+K5OXgSORIskfNTip1KnvyIvbJvgmRlld6iIis7nCs+dwp4wwc
  57106. OxJORNanTrAmyPPZGpeRaOrvjUYG0lZFWJo8DA+DuAUlwznPO6Q0ibd5Ei9Hxeepl2n8pndntd97
  57107. 8XplFeRhVmUCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O
  57108. BBYEFIHEjMz15DD/pQwIX4wVZyF0Ad/fMA0GCSqGSIb3DQEBCwUAA4ICAQATZSL1jiutROTL/7lo
  57109. 5sOASD0Ee/ojL3rtNtqyzm325p7lX1iPyzcyochltq44PTUbPrw7tgTQvPlJ9Zv3hcU2tsu8+Mg5
  57110. 1eRfB70VVJd0ysrtT7q6ZHafgbiERUlMjW+i67HM0cOU2kTC5uLqGOiiHycFutfl1qnN3e92mI0A
  57111. Ds0b+gO3joBYDic/UvuUospeZcnWhNq5NXHzJsBPd+aBJ9J3O5oUb3n09tDh05S60FdRvScFDcH9
  57112. yBIw7m+NESsIndTUv4BFFJqIRNow6rSn4+7vW4LVPtateJLbXDzz2K36uGt/xDYotgIVilQsnLAX
  57113. c47QN6MUPJiVAAwpBVueSUmxX8fjy88nZY41F7dXyDDZQVu5FLbowg+UMaeUmMxq67XhJ/UQqAHo
  57114. jhJi6IjMtX9Gl8CbEGY4GjZGXyJoPd/JxhMnq1MGrKI8hgZlb7F+sSlEmqO6SWkoaY/X5V+tBIZk
  57115. bxqgDMUIYs6Ao9Dz7GjevjPHF1t/gMRMTLGmhIrDO7gJzRSBuhjjVFc2/tsvfEehOjPI+Vg7RE+x
  57116. ygKJBJYoaMVLuCaJu9YzL1DV/pqJuhgyklTGW+Cd+V7lDSKb9triyCGyYiGqhkCyLmTTX8jjfhFn
  57117. RR8F/uOi77Oos/N9j/gMHyIfLXC0uAE0djAA5SN4p1bXUB+K+wb1whnw0A==
  57118. -----END CERTIFICATE-----
  57119. UCA Extended Validation Root
  57120. ============================
  57121. -----BEGIN CERTIFICATE-----
  57122. MIIFWjCCA0KgAwIBAgIQT9Irj/VkyDOeTzRYZiNwYDANBgkqhkiG9w0BAQsFADBHMQswCQYDVQQG
  57123. EwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9u
  57124. IFJvb3QwHhcNMTUwMzEzMDAwMDAwWhcNMzgxMjMxMDAwMDAwWjBHMQswCQYDVQQGEwJDTjERMA8G
  57125. A1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9uIFJvb3QwggIi
  57126. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCpCQcoEwKwmeBkqh5DFnpzsZGgdT6o+uM4AHrs
  57127. iWogD4vFsJszA1qGxliG1cGFu0/GnEBNyr7uaZa4rYEwmnySBesFK5pI0Lh2PpbIILvSsPGP2KxF
  57128. Rv+qZ2C0d35qHzwaUnoEPQc8hQ2E0B92CvdqFN9y4zR8V05WAT558aopO2z6+I9tTcg1367r3CTu
  57129. eUWnhbYFiN6IXSV8l2RnCdm/WhUFhvMJHuxYMjMR83dksHYf5BA1FxvyDrFspCqjc/wJHx4yGVMR
  57130. 59mzLC52LqGj3n5qiAno8geK+LLNEOfic0CTuwjRP+H8C5SzJe98ptfRr5//lpr1kXuYC3fUfugH
  57131. 0mK1lTnj8/FtDw5lhIpjVMWAtuCeS31HJqcBCF3RiJ7XwzJE+oJKCmhUfzhTA8ykADNkUVkLo4KR
  57132. el7sFsLzKuZi2irbWWIQJUoqgQtHB0MGcIfS+pMRKXpITeuUx3BNr2fVUbGAIAEBtHoIppB/TuDv
  57133. B0GHr2qlXov7z1CymlSvw4m6WC31MJixNnI5fkkE/SmnTHnkBVfblLkWU41Gsx2VYVdWf6/wFlth
  57134. WG82UBEL2KwrlRYaDh8IzTY0ZRBiZtWAXxQgXy0MoHgKaNYs1+lvK9JKBZP8nm9rZ/+I8U6laUpS
  57135. NwXqxhaN0sSZ0YIrO7o1dfdRUVjzyAfd5LQDfwIDAQABo0IwQDAdBgNVHQ4EFgQU2XQ65DA9DfcS
  57136. 3H5aBZ8eNJr34RQwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQEL
  57137. BQADggIBADaNl8xCFWQpN5smLNb7rhVpLGsaGvdftvkHTFnq88nIua7Mui563MD1sC3AO6+fcAUR
  57138. ap8lTwEpcOPlDOHqWnzcSbvBHiqB9RZLcpHIojG5qtr8nR/zXUACE/xOHAbKsxSQVBcZEhrxH9cM
  57139. aVr2cXj0lH2RC47skFSOvG+hTKv8dGT9cZr4QQehzZHkPJrgmzI5c6sq1WnIeJEmMX3ixzDx/BR4
  57140. dxIOE/TdFpS/S2d7cFOFyrC78zhNLJA5wA3CXWvp4uXViI3WLL+rG761KIcSF3Ru/H38j9CHJrAb
  57141. +7lsq+KePRXBOy5nAliRn+/4Qh8st2j1da3Ptfb/EX3C8CSlrdP6oDyp+l3cpaDvRKS+1ujl5BOW
  57142. F3sGPjLtx7dCvHaj2GU4Kzg1USEODm8uNBNA4StnDG1KQTAYI1oyVZnJF+A83vbsea0rWBmirSwi
  57143. GpWOvpaQXUJXxPkUAzUrHC1RVwinOt4/5Mi0A3PCwSaAuwtCH60NryZy2sy+s6ODWA2CxR9GUeOc
  57144. GMyNm43sSet1UNWMKFnKdDTajAshqx7qG+XH/RU+wBeq+yNuJkbL+vmxcmtpzyKEC2IPrNkZAJSi
  57145. djzULZrtBJ4tBmIQN1IchXIbJ+XMxjHsN+xjWZsLHXbMfjKaiJUINlK73nZfdklJrX+9ZSCyycEr
  57146. dhh2n1ax
  57147. -----END CERTIFICATE-----
  57148. Certigna Root CA
  57149. ================
  57150. -----BEGIN CERTIFICATE-----
  57151. MIIGWzCCBEOgAwIBAgIRAMrpG4nxVQMNo+ZBbcTjpuEwDQYJKoZIhvcNAQELBQAwWjELMAkGA1UE
  57152. BhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczEcMBoGA1UECwwTMDAwMiA0ODE0NjMwODEwMDAzNjEZ
  57153. MBcGA1UEAwwQQ2VydGlnbmEgUm9vdCBDQTAeFw0xMzEwMDEwODMyMjdaFw0zMzEwMDEwODMyMjda
  57154. MFoxCzAJBgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxHDAaBgNVBAsMEzAwMDIgNDgxNDYz
  57155. MDgxMDAwMzYxGTAXBgNVBAMMEENlcnRpZ25hIFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  57156. DwAwggIKAoICAQDNGDllGlmx6mQWDoyUJJV8g9PFOSbcDO8WV43X2KyjQn+Cyu3NW9sOty3tRQgX
  57157. stmzy9YXUnIo245Onoq2C/mehJpNdt4iKVzSs9IGPjA5qXSjklYcoW9MCiBtnyN6tMbaLOQdLNyz
  57158. KNAT8kxOAkmhVECe5uUFoC2EyP+YbNDrihqECB63aCPuI9Vwzm1RaRDuoXrC0SIxwoKF0vJVdlB8
  57159. JXrJhFwLrN1CTivngqIkicuQstDuI7pmTLtipPlTWmR7fJj6o0ieD5Wupxj0auwuA0Wv8HT4Ks16
  57160. XdG+RCYyKfHx9WzMfgIhC59vpD++nVPiz32pLHxYGpfhPTc3GGYo0kDFUYqMwy3OU4gkWGQwFsWq
  57161. 4NYKpkDfePb1BHxpE4S80dGnBs8B92jAqFe7OmGtBIyT46388NtEbVncSVmurJqZNjBBe3YzIoej
  57162. wpKGbvlw7q6Hh5UbxHq9MfPU0uWZ/75I7HX1eBYdpnDBfzwboZL7z8g81sWTCo/1VTp2lc5ZmIoJ
  57163. lXcymoO6LAQ6l73UL77XbJuiyn1tJslV1c/DeVIICZkHJC1kJWumIWmbat10TWuXekG9qxf5kBdI
  57164. jzb5LdXF2+6qhUVB+s06RbFo5jZMm5BX7CO5hwjCxAnxl4YqKE3idMDaxIzb3+KhF1nOJFl0Mdp/
  57165. /TBt2dzhauH8XwIDAQABo4IBGjCCARYwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYw
  57166. HQYDVR0OBBYEFBiHVuBud+4kNTxOc5of1uHieX4rMB8GA1UdIwQYMBaAFBiHVuBud+4kNTxOc5of
  57167. 1uHieX4rMEQGA1UdIAQ9MDswOQYEVR0gADAxMC8GCCsGAQUFBwIBFiNodHRwczovL3d3d3cuY2Vy
  57168. dGlnbmEuZnIvYXV0b3JpdGVzLzBtBgNVHR8EZjBkMC+gLaArhilodHRwOi8vY3JsLmNlcnRpZ25h
  57169. LmZyL2NlcnRpZ25hcm9vdGNhLmNybDAxoC+gLYYraHR0cDovL2NybC5kaGlteW90aXMuY29tL2Nl
  57170. cnRpZ25hcm9vdGNhLmNybDANBgkqhkiG9w0BAQsFAAOCAgEAlLieT/DjlQgi581oQfccVdV8AOIt
  57171. OoldaDgvUSILSo3L6btdPrtcPbEo/uRTVRPPoZAbAh1fZkYJMyjhDSSXcNMQH+pkV5a7XdrnxIxP
  57172. TGRGHVyH41neQtGbqH6mid2PHMkwgu07nM3A6RngatgCdTer9zQoKJHyBApPNeNgJgH60BGM+RFq
  57173. 7q89w1DTj18zeTyGqHNFkIwgtnJzFyO+B2XleJINugHA64wcZr+shncBlA2c5uk5jR+mUYyZDDl3
  57174. 4bSb+hxnV29qao6pK0xXeXpXIs/NX2NGjVxZOob4Mkdio2cNGJHc+6Zr9UhhcyNZjgKnvETq9Emd
  57175. 8VRY+WCv2hikLyhF3HqgiIZd8zvn/yk1gPxkQ5Tm4xxvvq0OKmOZK8l+hfZx6AYDlf7ej0gcWtSS
  57176. 6Cvu5zHbugRqh5jnxV/vfaci9wHYTfmJ0A6aBVmknpjZbyvKcL5kwlWj9Omvw5Ip3IgWJJk8jSaY
  57177. tlu3zM63Nwf9JtmYhST/WSMDmu2dnajkXjjO11INb9I/bbEFa0nOipFGc/T2L/Coc3cOZayhjWZS
  57178. aX5LaAzHHjcng6WMxwLkFM1JAbBzs/3GkDpv0mztO+7skb6iQ12LAEpmJURw3kAP+HwV96LOPNde
  57179. E4yBFxgX0b3xdxA61GU5wSesVywlVP+i2k+KYTlerj1KjL0=
  57180. -----END CERTIFICATE-----
  57181. emSign Root CA - G1
  57182. ===================
  57183. -----BEGIN CERTIFICATE-----
  57184. MIIDlDCCAnygAwIBAgIKMfXkYgxsWO3W2DANBgkqhkiG9w0BAQsFADBnMQswCQYDVQQGEwJJTjET
  57185. MBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRl
  57186. ZDEcMBoGA1UEAxMTZW1TaWduIFJvb3QgQ0EgLSBHMTAeFw0xODAyMTgxODMwMDBaFw00MzAyMTgx
  57187. ODMwMDBaMGcxCzAJBgNVBAYTAklOMRMwEQYDVQQLEwplbVNpZ24gUEtJMSUwIwYDVQQKExxlTXVk
  57188. aHJhIFRlY2hub2xvZ2llcyBMaW1pdGVkMRwwGgYDVQQDExNlbVNpZ24gUm9vdCBDQSAtIEcxMIIB
  57189. IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk0u76WaK7p1b1TST0Bsew+eeuGQzf2N4aLTN
  57190. LnF115sgxk0pvLZoYIr3IZpWNVrzdr3YzZr/k1ZLpVkGoZM0Kd0WNHVO8oG0x5ZOrRkVUkr+PHB1
  57191. cM2vK6sVmjM8qrOLqs1D/fXqcP/tzxE7lM5OMhbTI0Aqd7OvPAEsbO2ZLIvZTmmYsvePQbAyeGHW
  57192. DV/D+qJAkh1cF+ZwPjXnorfCYuKrpDhMtTk1b+oDafo6VGiFbdbyL0NVHpENDtjVaqSW0RM8LHhQ
  57193. 6DqS0hdW5TUaQBw+jSztOd9C4INBdN+jzcKGYEho42kLVACL5HZpIQ15TjQIXhTCzLG3rdd8cIrH
  57194. hQIDAQABo0IwQDAdBgNVHQ4EFgQU++8Nhp6w492pufEhF38+/PB3KxowDgYDVR0PAQH/BAQDAgEG
  57195. MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAFn/8oz1h31xPaOfG1vR2vjTnGs2
  57196. vZupYeveFix0PZ7mddrXuqe8QhfnPZHr5X3dPpzxz5KsbEjMwiI/aTvFthUvozXGaCocV685743Q
  57197. NcMYDHsAVhzNixl03r4PEuDQqqE/AjSxcM6dGNYIAwlG7mDgfrbESQRRfXBgvKqy/3lyeqYdPV8q
  57198. +Mri/Tm3R7nrft8EI6/6nAYH6ftjk4BAtcZsCjEozgyfz7MjNYBBjWzEN3uBL4ChQEKF6dk4jeih
  57199. U80Bv2noWgbyRQuQ+q7hv53yrlc8pa6yVvSLZUDp/TGBLPQ5Cdjua6e0ph0VpZj3AYHYhX3zUVxx
  57200. iN66zB+Afko=
  57201. -----END CERTIFICATE-----
  57202. emSign ECC Root CA - G3
  57203. =======================
  57204. -----BEGIN CERTIFICATE-----
  57205. MIICTjCCAdOgAwIBAgIKPPYHqWhwDtqLhDAKBggqhkjOPQQDAzBrMQswCQYDVQQGEwJJTjETMBEG
  57206. A1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRlZDEg
  57207. MB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0gRzMwHhcNMTgwMjE4MTgzMDAwWhcNNDMwMjE4
  57208. MTgzMDAwWjBrMQswCQYDVQQGEwJJTjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11
  57209. ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0g
  57210. RzMwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQjpQy4LRL1KPOxst3iAhKAnjlfSU2fySU0WXTsuwYc
  57211. 58Byr+iuL+FBVIcUqEqy6HyC5ltqtdyzdc6LBtCGI79G1Y4PPwT01xySfvalY8L1X44uT6EYGQIr
  57212. MgqCZH0Wk9GjQjBAMB0GA1UdDgQWBBR8XQKEE9TMipuBzhccLikenEhjQjAOBgNVHQ8BAf8EBAMC
  57213. AQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNpADBmAjEAvvNhzwIQHWSVB7gYboiFBS+D
  57214. CBeQyh+KTOgNG3qxrdWBCUfvO6wIBHxcmbHtRwfSAjEAnbpV/KlK6O3t5nYBQnvI+GDZjVGLVTv7
  57215. jHvrZQnD+JbNR6iC8hZVdyR+EhCVBCyj
  57216. -----END CERTIFICATE-----
  57217. emSign Root CA - C1
  57218. ===================
  57219. -----BEGIN CERTIFICATE-----
  57220. MIIDczCCAlugAwIBAgILAK7PALrEzzL4Q7IwDQYJKoZIhvcNAQELBQAwVjELMAkGA1UEBhMCVVMx
  57221. EzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQDExNlbVNp
  57222. Z24gUm9vdCBDQSAtIEMxMB4XDTE4MDIxODE4MzAwMFoXDTQzMDIxODE4MzAwMFowVjELMAkGA1UE
  57223. BhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQD
  57224. ExNlbVNpZ24gUm9vdCBDQSAtIEMxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz+up
  57225. ufGZBczYKCFK83M0UYRWEPWgTywS4/oTmifQz/l5GnRfHXk5/Fv4cI7gklL35CX5VIPZHdPIWoU/
  57226. Xse2B+4+wM6ar6xWQio5JXDWv7V7Nq2s9nPczdcdioOl+yuQFTdrHCZH3DspVpNqs8FqOp099cGX
  57227. OFgFixwR4+S0uF2FHYP+eF8LRWgYSKVGczQ7/g/IdrvHGPMF0Ybzhe3nudkyrVWIzqa2kbBPrH4V
  57228. I5b2P/AgNBbeCsbEBEV5f6f9vtKppa+cxSMq9zwhbL2vj07FOrLzNBL834AaSaTUqZX3noleooms
  57229. lMuoaJuvimUnzYnu3Yy1aylwQ6BpC+S5DwIDAQABo0IwQDAdBgNVHQ4EFgQU/qHgcB4qAzlSWkK+
  57230. XJGFehiqTbUwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQAD
  57231. ggEBAMJKVvoVIXsoounlHfv4LcQ5lkFMOycsxGwYFYDGrK9HWS8mC+M2sO87/kOXSTKZEhVb3xEp
  57232. /6tT+LvBeA+snFOvV71ojD1pM/CjoCNjO2RnIkSt1XHLVip4kqNPEjE2NuLe/gDEo2APJ62gsIq1
  57233. NnpSob0n9CAnYuhNlCQT5AoE6TyrLshDCUrGYQTlSTR+08TI9Q/Aqum6VF7zYytPT1DU/rl7mYw9
  57234. wC68AivTxEDkigcxHpvOJpkT+xHqmiIMERnHXhuBUDDIlhJu58tBf5E7oke3VIAb3ADMmpDqw8NQ
  57235. BmIMMMAVSKeoWXzhriKi4gp6D/piq1JM4fHfyr6DDUI=
  57236. -----END CERTIFICATE-----
  57237. emSign ECC Root CA - C3
  57238. =======================
  57239. -----BEGIN CERTIFICATE-----
  57240. MIICKzCCAbGgAwIBAgIKe3G2gla4EnycqDAKBggqhkjOPQQDAzBaMQswCQYDVQQGEwJVUzETMBEG
  57241. A1UECxMKZW1TaWduIFBLSTEUMBIGA1UEChMLZU11ZGhyYSBJbmMxIDAeBgNVBAMTF2VtU2lnbiBF
  57242. Q0MgUm9vdCBDQSAtIEMzMB4XDTE4MDIxODE4MzAwMFoXDTQzMDIxODE4MzAwMFowWjELMAkGA1UE
  57243. BhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMSAwHgYDVQQD
  57244. ExdlbVNpZ24gRUNDIFJvb3QgQ0EgLSBDMzB2MBAGByqGSM49AgEGBSuBBAAiA2IABP2lYa57JhAd
  57245. 6bciMK4G9IGzsUJxlTm801Ljr6/58pc1kjZGDoeVjbk5Wum739D+yAdBPLtVb4OjavtisIGJAnB9
  57246. SMVK4+kiVCJNk7tCDK93nCOmfddhEc5lx/h//vXyqaNCMEAwHQYDVR0OBBYEFPtaSNCAIEDyqOkA
  57247. B2kZd6fmw/TPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MAoGCCqGSM49BAMDA2gA
  57248. MGUCMQC02C8Cif22TGK6Q04ThHK1rt0c3ta13FaPWEBaLd4gTCKDypOofu4SQMfWh0/434UCMBwU
  57249. ZOR8loMRnLDRWmFLpg9J0wD8ofzkpf9/rdcw0Md3f76BB1UwUCAU9Vc4CqgxUQ==
  57250. -----END CERTIFICATE-----
  57251. Hongkong Post Root CA 3
  57252. =======================
  57253. -----BEGIN CERTIFICATE-----
  57254. MIIFzzCCA7egAwIBAgIUCBZfikyl7ADJk0DfxMauI7gcWqQwDQYJKoZIhvcNAQELBQAwbzELMAkG
  57255. A1UEBhMCSEsxEjAQBgNVBAgTCUhvbmcgS29uZzESMBAGA1UEBxMJSG9uZyBLb25nMRYwFAYDVQQK
  57256. Ew1Ib25na29uZyBQb3N0MSAwHgYDVQQDExdIb25na29uZyBQb3N0IFJvb3QgQ0EgMzAeFw0xNzA2
  57257. MDMwMjI5NDZaFw00MjA2MDMwMjI5NDZaMG8xCzAJBgNVBAYTAkhLMRIwEAYDVQQIEwlIb25nIEtv
  57258. bmcxEjAQBgNVBAcTCUhvbmcgS29uZzEWMBQGA1UEChMNSG9uZ2tvbmcgUG9zdDEgMB4GA1UEAxMX
  57259. SG9uZ2tvbmcgUG9zdCBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCz
  57260. iNfqzg8gTr7m1gNt7ln8wlffKWihgw4+aMdoWJwcYEuJQwy51BWy7sFOdem1p+/l6TWZ5Mwc50tf
  57261. jTMwIDNT2aa71T4Tjukfh0mtUC1Qyhi+AViiE3CWu4mIVoBc+L0sPOFMV4i707mV78vH9toxdCim
  57262. 5lSJ9UExyuUmGs2C4HDaOym71QP1mbpV9WTRYA6ziUm4ii8F0oRFKHyPaFASePwLtVPLwpgchKOe
  57263. sL4jpNrcyCse2m5FHomY2vkALgbpDDtw1VAliJnLzXNg99X/NWfFobxeq81KuEXryGgeDQ0URhLj
  57264. 0mRiikKYvLTGCAj4/ahMZJx2Ab0vqWwzD9g/KLg8aQFChn5pwckGyuV6RmXpwtZQQS4/t+TtbNe/
  57265. JgERohYpSms0BpDsE9K2+2p20jzt8NYt3eEV7KObLyzJPivkaTv/ciWxNoZbx39ri1UbSsUgYT2u
  57266. y1DhCDq+sI9jQVMwCFk8mB13umOResoQUGC/8Ne8lYePl8X+l2oBlKN8W4UdKjk60FSh0Tlxnf0h
  57267. +bV78OLgAo9uliQlLKAeLKjEiafv7ZkGL7YKTE/bosw3Gq9HhS2KX8Q0NEwA/RiTZxPRN+ZItIsG
  57268. xVd7GYYKecsAyVKvQv83j+GjHno9UKtjBucVtT+2RTeUN7F+8kjDf8V1/peNRY8apxpyKBpADwID
  57269. AQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQXnc0e
  57270. i9Y5K3DTXNSguB+wAPzFYTAdBgNVHQ4EFgQUF53NHovWOStw01zUoLgfsAD8xWEwDQYJKoZIhvcN
  57271. AQELBQADggIBAFbVe27mIgHSQpsY1Q7XZiNc4/6gx5LS6ZStS6LG7BJ8dNVI0lkUmcDrudHr9Egw
  57272. W62nV3OZqdPlt9EuWSRY3GguLmLYauRwCy0gUCCkMpXRAJi70/33MvJJrsZ64Ee+bs7Lo3I6LWld
  57273. y8joRTnU+kLBEUx3XZL7av9YROXrgZ6voJmtvqkBZss4HTzfQx/0TW60uhdG/H39h4F5ag0zD/ov
  57274. +BS5gLNdTaqX4fnkGMX41TiMJjz98iji7lpJiCzfeT2OnpA8vUFKOt1b9pq0zj8lMH8yfaIDlNDc
  57275. eqFS3m6TjRgm/VWsvY+b0s+v54Ysyx8Jb6NvqYTUc79NoXQbTiNg8swOqn+knEwlqLJmOzj/2ZQw
  57276. 9nKEvmhVEA/GcywWaZMH/rFF7buiVWqw2rVKAiUnhde3t4ZEFolsgCs+l6mc1X5VTMbeRRAc6uk7
  57277. nwNT7u56AQIWeNTowr5GdogTPyK7SBIdUgC0An4hGh6cJfTzPV4e0hz5sy229zdcxsshTrD3mUcY
  57278. hcErulWuBurQB7Lcq9CClnXO0lD+mefPL5/ndtFhKvshuzHQqp9HpLIiyhY6UFfEW0NnxWViA0kB
  57279. 60PZ2Pierc+xYw5F9KBaLJstxabArahH9CdMOA0uG0k7UvToiIMrVCjU8jVStDKDYmlkDJGcn5fq
  57280. dBb9HxEGmpv0
  57281. -----END CERTIFICATE-----
  57282. Entrust Root Certification Authority - G4
  57283. =========================================
  57284. -----BEGIN CERTIFICATE-----
  57285. MIIGSzCCBDOgAwIBAgIRANm1Q3+vqTkPAAAAAFVlrVgwDQYJKoZIhvcNAQELBQAwgb4xCzAJBgNV
  57286. BAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3Qu
  57287. bmV0L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxNSBFbnRydXN0LCBJbmMuIC0gZm9yIGF1
  57288. dGhvcml6ZWQgdXNlIG9ubHkxMjAwBgNVBAMTKUVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1
  57289. dGhvcml0eSAtIEc0MB4XDTE1MDUyNzExMTExNloXDTM3MTIyNzExNDExNlowgb4xCzAJBgNVBAYT
  57290. AlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0
  57291. L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxNSBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhv
  57292. cml6ZWQgdXNlIG9ubHkxMjAwBgNVBAMTKUVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhv
  57293. cml0eSAtIEc0MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAsewsQu7i0TD/pZJH4i3D
  57294. umSXbcr3DbVZwbPLqGgZ2K+EbTBwXX7zLtJTmeH+H17ZSK9dE43b/2MzTdMAArzE+NEGCJR5WIoV
  57295. 3imz/f3ET+iq4qA7ec2/a0My3dl0ELn39GjUu9CH1apLiipvKgS1sqbHoHrmSKvS0VnM1n4j5pds
  57296. 8ELl3FFLFUHtSUrJ3hCX1nbB76W1NhSXNdh4IjVS70O92yfbYVaCNNzLiGAMC1rlLAHGVK/XqsEQ
  57297. e9IFWrhAnoanw5CGAlZSCXqc0ieCU0plUmr1POeo8pyvi73TDtTUXm6Hnmo9RR3RXRv06QqsYJn7
  57298. ibT/mCzPfB3pAqoEmh643IhuJbNsZvc8kPNXwbMv9W3y+8qh+CmdRouzavbmZwe+LGcKKh9asj5X
  57299. xNMhIWNlUpEbsZmOeX7m640A2Vqq6nPopIICR5b+W45UYaPrL0swsIsjdXJ8ITzI9vF01Bx7owVV
  57300. 7rtNOzK+mndmnqxpkCIHH2E6lr7lmk/MBTwoWdPBDFSoWWG9yHJM6Nyfh3+9nEg2XpWjDrk4JFX8
  57301. dWbrAuMINClKxuMrLzOg2qOGpRKX/YAr2hRC45K9PvJdXmd0LhyIRyk0X+IyqJwlN4y6mACXi0mW
  57302. Hv0liqzc2thddG5msP9E36EYxr5ILzeUePiVSj9/E15dWf10hkNjc0kCAwEAAaNCMEAwDwYDVR0T
  57303. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJ84xFYjwznooHFs6FRM5Og6sb9n
  57304. MA0GCSqGSIb3DQEBCwUAA4ICAQAS5UKme4sPDORGpbZgQIeMJX6tuGguW8ZAdjwD+MlZ9POrYs4Q
  57305. jbRaZIxowLByQzTSGwv2LFPSypBLhmb8qoMi9IsabyZIrHZ3CL/FmFz0Jomee8O5ZDIBf9PD3Vht
  57306. 7LGrhFV0d4QEJ1JrhkzO3bll/9bGXp+aEJlLdWr+aumXIOTkdnrG0CSqkM0gkLpHZPt/B7NTeLUK
  57307. YvJzQ85BK4FqLoUWlFPUa19yIqtRLULVAJyZv967lDtX/Zr1hstWO1uIAeV8KEsD+UmDfLJ/fOPt
  57308. jqF/YFOOVZ1QNBIPt5d7bIdKROf1beyAN/BYGW5KaHbwH5Lk6rWS02FREAutp9lfx1/cH6NcjKF+
  57309. m7ee01ZvZl4HliDtC3T7Zk6LERXpgUl+b7DUUH8i119lAg2m9IUe2K4GS0qn0jFmwvjO5QimpAKW
  57310. RGhXxNUzzxkvFMSUHHuk2fCfDrGA4tGeEWSpiBE6doLlYsKA2KSD7ZPvfC+QsDJMlhVoSFLUmQjA
  57311. JOgc47OlIQ6SwJAfzyBfyjs4x7dtOvPmRLgOMWuIjnDrnBdSqEGULoe256YSxXXfW8AKbnuk5F6G
  57312. +TaU33fD6Q3AOfF5u0aOq0NZJ7cguyPpVkAh7DE9ZapD8j3fcEThuk0mEDuYn/PIjhs4ViFqUZPT
  57313. kcpG2om3PVODLAgfi49T3f+sHw==
  57314. -----END CERTIFICATE-----
  57315. <?php
  57316. if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') {
  57317. echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
  57318. }
  57319. setlocale(LC_ALL, 'C');
  57320. require __DIR__.'/../src/bootstrap.php';
  57321. use Composer\Console\Application;
  57322. use Composer\XdebugHandler\XdebugHandler;
  57323. error_reporting(-1);
  57324. // Restart without Xdebug
  57325. $xdebug = new XdebugHandler('Composer', '--ansi');
  57326. $xdebug->check();
  57327. unset($xdebug);
  57328. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '4.0', '>=')) {
  57329. echo 'HHVM 4.0 has dropped support for Composer, please use PHP instead. Aborting.'.PHP_EOL;
  57330. exit(1);
  57331. }
  57332. if (function_exists('ini_set')) {
  57333. @ini_set('display_errors', 1);
  57334. $memoryInBytes = function ($value) {
  57335. $unit = strtolower(substr($value, -1, 1));
  57336. $value = (int) $value;
  57337. switch($unit) {
  57338. case 'g':
  57339. $value *= 1024;
  57340. // no break (cumulative multiplier)
  57341. case 'm':
  57342. $value *= 1024;
  57343. // no break (cumulative multiplier)
  57344. case 'k':
  57345. $value *= 1024;
  57346. }
  57347. return $value;
  57348. };
  57349. $memoryLimit = trim(ini_get('memory_limit'));
  57350. // Increase memory_limit if it is lower than 1.5GB
  57351. if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1536) {
  57352. @ini_set('memory_limit', '1536M');
  57353. }
  57354. // Set user defined memory limit
  57355. if ($memoryLimit = getenv('COMPOSER_MEMORY_LIMIT')) {
  57356. @ini_set('memory_limit', $memoryLimit);
  57357. }
  57358. unset($memoryInBytes, $memoryLimit);
  57359. }
  57360. putenv('COMPOSER_BINARY='.realpath($_SERVER['argv'][0]));
  57361. // run the command application
  57362. $application = new Application();
  57363. $application->run();
  57364. Copyright (c) Nils Adermann, Jordi Boggiano
  57365. Permission is hereby granted, free of charge, to any person obtaining a copy
  57366. of this software and associated documentation files (the "Software"), to deal
  57367. in the Software without restriction, including without limitation the rights
  57368. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  57369. copies of the Software, and to permit persons to whom the Software is furnished
  57370. to do so, subject to the following conditions:
  57371. The above copyright notice and this permission notice shall be included in all
  57372. copies or substantial portions of the Software.
  57373. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  57374. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  57375. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  57376. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  57377. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  57378. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  57379. THE SOFTWARE.
  57380. lšî„vOHK£mE΢—™þƒ���GBMB